:root {
    --primary-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --accent-color: #ffe66d;
    --bg-color: #f7f9fc;
    --text-color: #2d3436;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poor Story', system-ui;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
}

body {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Start from top for scrolling */
    color: var(--text-color);
}

#app {
    width: 100%;
    max-width: 500px;
    min-height: 100vh;
    margin: 0 auto;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    /* Prevent horizontal overflow within the app box */
}

@media (max-width: 480px) {
    #app {
        border-radius: 0;
        border: none;
    }

    header {
        padding: 20px 10px 15px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    header p {
        font-size: 0.9rem;
    }

    #game-container {
        padding: 15px;
    }

    .menu-grid {
        gap: 10px;
    }

    .menu-item {
        padding: 15px;
        border-radius: 15px;
    }

    .menu-item .icon {
        font-size: 2.2rem;
    }

    .menu-item .label {
        font-size: 1rem;
    }
}

header {
    padding: 30px 20px 25px;
    text-align: center;
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
    color: var(--primary-color);
    text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

header h1.breadcrumb-mode {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 1.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
    margin-bottom: 0;
}

.breadcrumb-prefix {
    font-size: 0.65em;
    opacity: 0.8;
    font-weight: normal;
}

@media (max-width: 480px) {
    header h1.breadcrumb-mode {
        font-size: 1.4rem;
        gap: 5px;
    }
}

@media (max-width: 360px) {
    header h1.breadcrumb-mode {
        font-size: 1.15rem;
    }

    .breadcrumb-prefix {
        font-size: 0.6em;
    }
}

header p {
    font-size: 1.1rem;
    color: #636e72;
}

#game-container {
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.menu-item {
    background: white;
    border: none;
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.menu-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.menu-item .icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.menu-item .label {
    font-size: 1.2rem;
    font-weight: bold;
}

.hidden {
    display: none !important;
}

#game-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

.screen-header {
    display: flex;
    flex-direction: column;
    /* Stack vertically */
    align-items: center;
    margin-bottom: 30px;
    gap: 15px;
}

#back-to-menu,
#retry-game {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    padding: 8px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-family: 'Poor Story', cursive;
    transition: all 0.2s;
    font-weight: bold;
}

#retry-game {
    background: var(--secondary-color);
    color: white;
}

#back-to-menu:hover,
#retry-game:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.header-actions {
    display: flex;
    gap: 10px;
}

#game-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-color);
    text-align: center;
}

@media (max-width: 480px) {
    .screen-header {
        margin-bottom: 10px;
        gap: 5px;
    }

    #game-title {
        font-size: 1.5rem;
    }

    #game-content {
        justify-content: flex-start;
        padding-top: 10px;
    }
}

#game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

footer {
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
}

.donation-box {
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 20px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 25px;
    border: none;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    color: #444;
    position: relative;
    overflow: hidden;
}

.donation-box strong {
    color: var(--primary-color);
    font-size: 1.1rem;
    display: inline-block;
    padding: 0 5px;
}

.account-info {
    margin-top: 10px;
    color: var(--primary-color);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Common Game UI Elements */
.game-btn {
    padding: 12px 30px;
    font-size: 1.2rem;
    border: none;
    border-radius: 15px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 0 #d63031;
    transition: all 0.1s;
}

.game-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #d63031;
}

.game-result {
    margin-top: 20px;
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    min-height: 2.5rem;
    /* Space for result text to prevent layout shift */
    display: flex;
    align-items: center;
    justify-content: center;
}