* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Noto Sans', sans-serif;
    background-color: #000;
    color: #fff;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -webkit-app-region: no-drag;
}

#game-container {
    width: 100%;
    height: calc(100% - 40px);
    display: flex;
    flex-direction: column;
    position: relative;
}

#app-header {
    padding: 12px 16px;
    background: linear-gradient(to bottom, #1a1a1a, #0a0a0a);
    border-bottom: 2px solid #222;
    display: flex;
    align-items: center;
    justify-content: center;
}

#app-header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin: 0;
}

.header-letter {
    text-shadow: 0 0 10px currentColor;
    display: inline-block;
}

.header-space {
    display: inline-block;
    width: 0.3em;
}

#hud {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr auto;
    align-items: center;
    justify-items: center;
    gap: 8px;
    padding: 12px;
    background-color: #111;
    border-bottom: 1px solid #222;
}

#score-display, #combo-display, #level-display, #lives-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.6;
    text-transform: uppercase;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
}

.menu-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}

.menu-btn span {
    width: 20px;
    height: 2px;
    background-color: #fff;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.menu-btn:active {
    opacity: 0.7;
}

#target-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 12px;
    background-color: #0a0a0a;
    border-bottom: 1px solid #222;
}

.target-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.6;
    text-transform: uppercase;
}

#target-tile {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

#game-board {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px;
    overflow-y: auto;
    align-content: start;
}

.tile {
    aspect-ratio: 1;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    background-size: 100% 100%;
    background-position: 0 0;
    transform: scale(1);
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 0 20px rgba(0, 0, 0, 0.5),
        inset 0 -2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.1) 30%, transparent 70%);
    pointer-events: none;
    animation: shimmer 3s infinite;
}

.tile::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

@keyframes shimmer {
    0%, 100% {
        transform: translateX(-100%);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

.tile:active {
    transform: scale(0.95);
    box-shadow: 
        0 0 30px rgba(0, 0, 0, 0.6),
        inset 0 -2px 8px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tile.correct {
    animation: popOut 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.tile.wrong {
    animation: shake 0.3s ease;
}

@keyframes popOut {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

#game-over-screen.hidden {
    display: none;
}

.game-over-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    text-align: center;
}

.game-over-content h1 {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: 2px;
}

.final-score {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.final-score > div:first-child {
    font-size: 12px;
    letter-spacing: 1px;
    opacity: 0.6;
    text-transform: uppercase;
}

#final-score-value {
    font-size: 36px;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
}

#restart-btn {
    padding: 14px 32px;
    background-color: #fff;
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

#restart-btn:active {
    opacity: 0.8;
    transform: scale(0.98);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#options-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    animation: fadeIn 0.3s ease;
}

#options-modal.hidden {
    display: none;
}

.modal-content {
    background-color: #111;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 90%;
    width: 280px;
}

.modal-content h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    text-align: center;
    text-transform: uppercase;
}

.modal-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.7;
    text-transform: uppercase;
}

.toggle-btn {
    padding: 10px 16px;
    background-color: #1a1a1a;
    color: #fff;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.toggle-btn.on {
    border-color: #4ECDC4;
    color: #4ECDC4;
}

.toggle-btn.off {
    border-color: #666;
    color: #666;
}

.toggle-btn:active {
    opacity: 0.8;
}

.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.language-buttons {
    display: flex;
    gap: 8px;
}

.language-btn {
    flex: 1;
    padding: 10px 16px;
    background-color: #1a1a1a;
    color: #fff;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.language-btn.active {
    border-color: #69F0AE;
    color: #69F0AE;
    background-color: rgba(105, 240, 174, 0.1);
}

.language-btn:active {
    opacity: 0.8;
}

.difficulty-btn {
    padding: 10px 16px;
    background-color: #1a1a1a;
    color: #fff;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.difficulty-btn.active {
    border-color: #FF6B6B;
    color: #FF6B6B;
    background-color: rgba(255, 107, 107, 0.1);
}

.difficulty-btn:active {
    opacity: 0.8;
}

.close-btn {
    padding: 12px 24px;
    background-color: #fff;
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    margin-top: 8px;
}

.close-btn:active {
    opacity: 0.8;
    transform: scale(0.98);
}

.hidden {
    display: none !important;
}

#footer {
    height: 40px;
    background-color: #111;
    border-top: 1px solid #222;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    padding: 0 12px;
}

#footer p {
    margin: 0;
    text-align: center;
}

#footer a {
    color: #fff;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

#footer a:active {
    opacity: 0.7;
}

.install-btn {
    padding: 10px 16px;
    background-color: #1a1a1a;
    color: #fff;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    border-color: #FFD740;
    color: #FFD740;
    background-color: rgba(255, 215, 64, 0.1);
}

.install-btn:active {
    opacity: 0.8;
}

.install-btn.hidden {
    display: none !important;
}

/* Mobile specific adjustments */
@media (max-width: 600px) {
    #game-board {
        gap: 10px;
        padding: 12px;
    }

    .tile {
        border-radius: 10px;
    }

    .stat-value {
        font-size: 16px;
    }

    #footer {
        font-size: 10px;
        height: 35px;
    }

    #game-container {
        height: calc(100% - 35px);
    }
}