/* Local Outfit Font */
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('fonts/Outfit.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
        U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('fonts/Outfit-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
        U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
        U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #22d3ee;
    --accent: #f472b6;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-elevated: #252542;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(255, 255, 255, 0.1);
}

html,
body {
    height: 100%;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
}

.game-wrapper {
    width: 100%;
    height: 100%;
    max-width: 600px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #0f0f1a 0%, #1a1a2e 100%);
}

.game-wrapper.shake {
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translateX(-1px);
    }

    20%,
    80% {
        transform: translateX(2px);
    }

    30%,
    50%,
    70% {
        transform: translateX(-3px);
    }

    40%,
    60% {
        transform: translateX(3px);
    }
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: clamp(16px, 4vw, 32px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.hidden {
    opacity: 0;
    transform: scale(0.95);
    visibility: hidden;
    pointer-events: none;
}

/* ===== START SCREEN ===== */
.start-screen {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
    justify-content: center;
    padding-top: clamp(20px, 4vh, 40px);
    padding-bottom: clamp(20px, 4vh, 40px);
    gap: clamp(12px, 2.5vh, 20px);
}

/* Menu Header */
.menu-header {
    text-align: center;
    animation: fadeUp 0.4s ease-out backwards;
}

.logo-container {
    text-align: center;
    margin-bottom: 12px;
}

.logo-blocks {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 3px;
    margin-bottom: 16px;
}

.logo-block {
    height: 14px;
    border-radius: 3px;
    animation: stackDrop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards,
        stackFloat 3s ease-in-out infinite;
    animation-delay: calc(var(--delay) * 0.1s), calc(0.4s + var(--delay) * 0.1s);
}

.logo-block:nth-child(1) {
    background: linear-gradient(180deg, #34d399 0%, #22c55e 100%);
    width: 50px;
    box-shadow: 0 3px 10px rgba(52, 211, 153, 0.35);
}

.logo-block:nth-child(2) {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
    width: 62px;
    box-shadow: 0 3px 10px rgba(251, 191, 36, 0.35);
}

.logo-block:nth-child(3) {
    background: linear-gradient(180deg, #f87171 0%, #ef4444 100%);
    width: 75px;
    box-shadow: 0 3px 10px rgba(248, 113, 113, 0.35);
}

@keyframes stackDrop {
    0% {
        opacity: 0;
        transform: translateY(-40px) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes stackFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

.title-wrapper {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}

.start-screen h1 {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: 2px;
    line-height: 1;
    animation: titleReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.35s backwards;
}

@keyframes titleReveal {
    0% {
        opacity: 0;
        transform: translateY(20px);
        letter-spacing: 12px;
    }

    100% {
        opacity: 1;
        transform: translateY(0);
        letter-spacing: 2px;
    }
}

.tagline {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    animation: taglineReveal 0.3s ease-out 0.5s backwards;
}

@keyframes taglineReveal {
    0% {
        opacity: 0;
        transform: translateX(-10px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    margin: 0;
}

/* Player Card */
.player-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 320px;
    animation: fadeUp 0.4s ease-out 0.3s backwards;
}

.player-avatar {
    width: 44px;
    height: 44px;
    background: var(--bg-elevated);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.player-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.player-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-icon-action {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-icon-action:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Stats Container */
.stats-container {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 320px;
    animation: fadeUp 0.4s ease-out 0.4s backwards;
}

.stat-card {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
}

.stat-card.online {
    border-color: rgba(52, 211, 153, 0.3);
}

.stat-card .stat-icon {
    font-size: 1.4rem;
}

.stat-card .pulse-dot {
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
    animation: pulse 2s ease-in-out infinite;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-info .stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-info .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Action Groups */
.action-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 320px;
}

.primary-actions {
    animation: fadeUp 0.4s ease-out 0.5s backwards;
}

.secondary-actions {
    display: flex;
    flex-direction: row;
    gap: 12px;
    animation: fadeUp 0.4s ease-out 0.6s backwards;
}

/* Play Button - Main CTA */
.btn-play {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
    color: var(--text-primary);
    border: none;
    padding: 20px 48px;
    font-size: 1.3rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 3px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.btn-play::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.btn-play:hover::before {
    left: 100%;
}

.btn-play:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.5),
        0 6px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-play:active {
    transform: translateY(-1px);
}

.btn-play-icon {
    font-size: 1.1rem;
}

.btn-play-text {
    letter-spacing: 3px;
}

/* Secondary Action Buttons */
.btn-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 16px 20px;
    font-family: 'Outfit', sans-serif;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.btn-action:active {
    transform: translateY(0);
}

.btn-action-icon {
    font-size: 1.4rem;
}

.btn-action-text {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.9);
    }
}

.instructions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 28px;
    width: 100%;
    max-width: 280px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: transform 0.2s ease, background 0.2s ease;
    animation: slideInLeft 0.4s ease-out backwards;
}

.instruction-item:nth-child(1) {
    animation-delay: 0.7s;
}

.instruction-item:nth-child(2) {
    animation-delay: 0.8s;
}

@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.instruction-item:hover {
    transform: translateX(4px);
    background: var(--bg-elevated);
}

.instruction-icon {
    font-size: 1.2rem;
}

.instruction-item span:last-child {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.instruction-item kbd {
    background: var(--bg-elevated);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Outfit', monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

/* Primary Button */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--primary);
    color: var(--text-primary);
    border: none;
    padding: 16px 48px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 1px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Animation only for start screen button */
.start-screen>.btn-primary {
    animation: buttonPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.9s backwards;
}

@keyframes buttonPop {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5), 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 12px 32px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-secondary:active {
    transform: translateY(1px);
}

.btn-view-tower {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    color: #a78bfa;
    border: 1px solid rgba(168, 85, 247, 0.4);
    padding: 12px 28px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-view-tower:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(168, 85, 247, 0.25) 100%);
    border-color: rgba(168, 85, 247, 0.6);
    color: #c4b5fd;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.2);
}

.btn-view-tower:active {
    transform: translateY(1px);
    box-shadow: none;
}

.btn-view-tower .btn-icon {
    font-size: 1.1rem;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Home Footer - Stats & Actions */
.home-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
    width: 100%;
    max-width: 300px;
    animation: fadeUp 0.4s ease-out 1s backwards;
}

.stats-row {
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    flex: 1;
    max-width: 140px;
}

.stat-badge .stat-icon {
    font-size: 1.2rem;
}

.stat-badge .stat-content {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.stat-badge .stat-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-badge .stat-value {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
}

/* Online Badge with Pulse */
.online-badge {
    border-color: rgba(52, 211, 153, 0.3);
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.9);
    }
}

/* Legacy stat-item support */
.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 12px 20px;
    border-radius: 50px;
    border: 1px solid var(--border);
}

.stat-icon {
    font-size: 1.1rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.stat-value {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
}

/* ===== GAME SCREEN ===== */
.game-screen {
    padding: 0;
}

.game-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    pointer-events: none;
}

.hud-left,
.hud-right {
    flex: 1;
    display: flex;
    min-width: 90px;
    max-width: 90px;
}

.hud-center {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
}

.hud-right {
    justify-content: flex-end;
}

/* Shared HUD element style */
.hud-element {
    background: var(--bg-card);
    padding: 10px 20px;
    border-radius: 50px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    gap: 2px;
}

.hud-element-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.hud-element-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.score-display {
    background: var(--bg-card);
    padding: 10px 24px;
    border-radius: 50px;
    border: 1px solid var(--border);
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-display .score-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.combo-display {
    background: var(--bg-card);
    padding: 10px 0;
    border-radius: 50px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 52px;
    width: 90px;
    gap: 2px;
    animation: comboPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.combo-display.hidden {
    display: none;
}

@keyframes comboPopIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.combo-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.combo-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--warning);
    line-height: 1;
}

.speed-indicator {
    background: var(--bg-card);
    padding: 10px 0;
    border-radius: 50px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 52px;
    width: 90px;
    gap: 4px;
}

.speed-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.speed-bar {
    width: 60px;
    height: 5px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
}

.speed-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
    background-size: 60px 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 20%;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.tap-hint {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: tapPulse 1.5s ease-in-out infinite;
}

.tap-hint .tap-icon {
    font-size: 2rem;
    animation: tapBounce 1s ease-in-out infinite;
}

.tap-hint span:last-child {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 2px;
}

@keyframes tapPulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

@keyframes tapBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ===== GAME OVER SCREEN ===== */
.gameover-screen {
    background: rgba(15, 15, 26, 0.97);
    backdrop-filter: blur(20px);
}

.gameover-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    max-width: 340px;
    animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Result Header */
.result-header {
    text-align: center;
}

.gameover-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--danger);
    letter-spacing: 4px;
    margin-bottom: 12px;
}

.new-record {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--warning) 0%, #f59e0b 100%);
    border-radius: 50px;
    animation: recordPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s backwards,
        recordGlow 2s ease-in-out infinite;
}

.new-record.hidden {
    display: none;
}

.record-icon {
    font-size: 1rem;
}

.record-text {
    font-size: 0.9rem;
    font-weight: 800;
    color: #1a1a2e;
    letter-spacing: 1px;
}

@keyframes recordPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes recordGlow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
    }

    50% {
        box-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
    }
}

/* Score Card */
.score-card {
    width: 100%;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.score-card .score-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.score-card .score-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.score-card .score-number {
    font-size: 4.5rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
    background: linear-gradient(180deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-divider {
    width: 80%;
    height: 1px;
    background: var(--border);
}

.score-card .score-best {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-elevated);
    padding: 12px 20px;
    border-radius: 12px;
}

.score-card .best-icon {
    font-size: 1.3rem;
}

.best-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.score-card .best-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-card .best-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--warning);
    line-height: 1;
}

/* Game Over Actions */
.gameover-actions {
    width: 100%;
}

.gameover-actions .btn-play {
    width: 100%;
}

.gameover-secondary-actions {
    display: flex;
    gap: 12px;
    width: 100%;
}

.btn-gameover-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 16px 12px;
    font-family: 'Outfit', sans-serif;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-gameover-action:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.btn-gameover-action:active {
    transform: translateY(0);
}

.btn-gameover-action .btn-action-icon {
    font-size: 1.4rem;
}

.btn-gameover-action .btn-action-text {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== RESPONSIVE ===== */

/* Large Desktop optimizations */
@media (min-width: 769px) {
    .game-wrapper {
        box-shadow: 0 0 60px rgba(99, 102, 241, 0.25);
        overflow: hidden;
    }

    .start-screen h1 {
        font-size: 3rem;
    }

    .tagline {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .score-card .score-number {
        font-size: 5.5rem;
    }

    .btn-play {
        padding: 22px 56px;
        font-size: 1.4rem;
    }

    .player-card,
    .stats-container,
    .action-group {
        max-width: 360px;
    }
}

/* Desktop optimizations */
@media (min-width: 601px) and (max-width: 768px) {
    .game-wrapper {
        box-shadow: 0 0 50px rgba(99, 102, 241, 0.2);
    }

    .start-screen h1 {
        font-size: 2.8rem;
    }

    .score-card .score-number {
        font-size: 5rem;
    }
}

/* Tablet/Medium screens */
@media (max-width: 600px) and (min-width: 451px) {
    .start-screen h1 {
        font-size: 2.2rem;
    }

    .game-hud {
        padding: 14px;
    }
}

/* Mobile screens */
@media (max-width: 450px) {
    .start-screen h1 {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }

    .tagline {
        font-size: 1.1rem;
    }

    .btn-play {
        padding: 16px 32px;
        font-size: 1.1rem;
    }

    .btn-action {
        padding: 14px 16px;
    }

    .btn-action-icon {
        font-size: 1.2rem;
    }

    .gameover-title {
        font-size: 1.6rem;
        letter-spacing: 3px;
    }

    .score-card .score-number {
        font-size: 3.5rem;
    }

    .score-card {
        padding: 20px;
    }

    .game-hud {
        padding: 12px;
    }

    .hud-left,
    .hud-right {
        min-width: 80px;
        max-width: 80px;
    }

    .combo-display,
    .speed-indicator {
        width: 80px;
        height: 48px;
        padding: 8px 0;
    }

    .score-display {
        padding: 8px 20px;
        height: 48px;
    }

    .score-display .score-value {
        font-size: 1.3rem;
    }
}

/* Very small mobile */
@media (max-width: 380px) {
    .start-screen h1 {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }

    .logo-block {
        height: 12px;
    }

    .logo-block:nth-child(1) {
        width: 45px;
    }

    .logo-block:nth-child(2) {
        width: 58px;
    }

    .logo-block:nth-child(3) {
        width: 70px;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .player-card {
        padding: 10px 14px;
    }

    .player-avatar {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
    }

    .stats-container {
        gap: 8px;
    }

    .stat-card {
        padding: 12px 14px;
    }

    .btn-play {
        padding: 14px 24px;
        font-size: 1rem;
    }

    .score-card .score-number {
        font-size: 3rem;
    }

    .btn-gameover-action {
        padding: 12px 10px;
    }
}

/* Short screens (landscape phones, small tablets) */
@media (max-height: 650px) {
    .start-screen {
        padding-top: 16px;
        padding-bottom: 16px;
    }

    .logo-blocks {
        margin-bottom: 8px;
    }

    .logo-block {
        height: 10px;
    }

    .start-screen h1 {
        font-size: 1.4rem;
        letter-spacing: 1px;
    }

    .tagline {
        font-size: 1rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .player-card {
        padding: 8px 12px;
    }

    .player-avatar {
        width: 36px;
        height: 36px;
    }

    .stats-container {
        gap: 8px;
    }

    .stat-card {
        padding: 10px 12px;
    }

    .btn-play {
        padding: 14px 32px;
        font-size: 1rem;
    }

    .btn-action {
        padding: 12px 14px;
    }

    .gameover-content {
        gap: 16px;
    }

    .gameover-title {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .score-card {
        padding: 16px;
        gap: 12px;
    }

    .score-card .score-number {
        font-size: 3rem;
    }
}

/* Very short screens */
@media (max-height: 550px) {
    .start-screen {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .logo-container {
        margin-bottom: 8px;
    }

    .logo-blocks {
        gap: 2px;
        margin-bottom: 4px;
    }

    .logo-block {
        height: 8px;
    }

    .start-screen h1 {
        font-size: 1.2rem;
        letter-spacing: 1px;
    }

    .tagline {
        font-size: 0.9rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .player-card {
        padding: 6px 10px;
    }

    .player-avatar {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .player-name {
        font-size: 0.95rem;
    }

    .stat-card {
        padding: 8px 10px;
    }

    .stat-info .stat-value {
        font-size: 1.1rem;
    }

    .btn-play {
        padding: 12px 24px;
        font-size: 0.95rem;
        gap: 10px;
    }

    .btn-action {
        padding: 10px 12px;
        gap: 4px;
    }

    .btn-action-icon {
        font-size: 1.1rem;
    }

    .btn-action-text {
        font-size: 0.7rem;
    }

    .gameover-content {
        gap: 12px;
    }

    .score-card {
        padding: 12px;
        gap: 10px;
    }

    .score-card .score-number {
        font-size: 2.5rem;
    }

    .gameover-secondary-actions {
        gap: 8px;
    }

    .btn-gameover-action {
        padding: 10px 8px;
    }
}

/* ===== PLAYER SECTION ===== */
.player-section {
    margin-bottom: 20px;
    animation: fadeUp 0.4s ease-out 0.85s backwards;
}

/* ===== PLAYER INFO ===== */
.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.player-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.player-name {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.btn-edit {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 6px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.btn-edit:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.1);
}

.btn-leaderboard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 12px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.5px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-leaderboard:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-leaderboard:active {
    transform: translateY(1px);
}

.btn-leaderboard .btn-icon {
    font-size: 1rem;
}

.btn-leaderboard .btn-text {
    flex: 1;
}

.btn-leaderboard .btn-arrow {
    font-size: 0.9rem;
    opacity: 0.5;
}

/* ===== LEADERBOARD MODAL ===== */
.modal-leaderboard {
    max-width: 380px;
}

.modal-leaderboard .leaderboard-list {
    max-height: 400px;
    margin-bottom: 16px;
}

.leaderboard-list {
    background: var(--bg-elevated);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    overflow-y: auto;
}

.leaderboard-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.leaderboard-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item:hover {
    background: var(--bg-elevated);
}

.leaderboard-item.current-player {
    background: rgba(99, 102, 241, 0.15);
}

.leaderboard-rank {
    width: 28px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.leaderboard-rank.gold {
    color: #fbbf24;
}

.leaderboard-rank.silver {
    color: #94a3b8;
}

.leaderboard-rank.bronze {
    color: #cd7c32;
}

.leaderboard-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-score {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--warning);
    margin-left: 12px;
}

/* ===== ONLINE INDICATOR ===== */
.online-indicator .stat-icon {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ===== USERNAME MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    width: 100%;
    max-width: 340px;
    border: 1px solid var(--border);
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
}

.modal-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

.modal-input:focus {
    border-color: var(--primary);
}

.modal-input::placeholder {
    color: var(--text-muted);
}

.modal-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions .btn-secondary,
.modal-actions .btn-primary {
    flex: 1;
    padding: 12px 16px;
}

.modal-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 12px;
    text-align: center;
}

.modal-error.hidden {
    display: none;
}

/* ===== HELP MODAL ===== */
.modal-help {
    max-width: 360px;
}

.help-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.help-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-elevated);
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.help-icon-large {
    font-size: 1.6rem;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.help-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.help-text strong {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
}

.help-text span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== TOWER MODAL ===== */
.modal-tower {
    max-width: 400px;
}

.tower-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-elevated);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 20px;
    overflow: hidden;
    max-height: 60vh;
}

.tower-preview canvas {
    max-width: 100%;
    max-height: 55vh;
    border-radius: 8px;
    object-fit: contain;
}

.modal-tower .modal-actions {
    display: flex;
    gap: 12px;
}

.modal-tower .btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}