/* ==========================================================================
   NEON SWING GLOBAL STYLESHEET
   ========================================================================== */

:root {
    --bg-dark: #0a0a0f;
    --primary: #00ffff;
    --secondary: #ff2d78;
    --warning: #ffff00;
    --danger: #ff4444;
    --success: #39ff14;
    --glass-bg: rgba(15, 15, 25, 0.90);
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: #ffffff;
    font-family: var(--font-primary);
    overflow: hidden;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    touch-action: none;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Canvas */
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: radial-gradient(circle at center, #141424 0%, var(--bg-dark) 100%);
}

/* Tap/Click overlay */
.interaction-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    background: transparent;
    cursor: pointer;
}

/* ==========================================================================
   HUD HEADER — 3 COLUMN GRID
   ========================================================================== */
.hud-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 16px 24px;
    display: none;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    z-index: 100;
    pointer-events: none;
}

.hud-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

.hud-right {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.hud-center {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* HUD Buttons */
.hud-btn {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-primary);
}

.hud-btn:hover {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.35);
    transform: translateY(-2px);
    color: var(--primary);
}

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

.hud-btn.icon-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
    font-size: 1.1rem;
    border-radius: 10px;
}

/* Score boxes */
.hud-score-box {
    background: rgba(15, 15, 25, 0.75);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 8px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    min-width: 70px;
}

.hud-score-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--primary);
    text-transform: uppercase;
}

.hud-score-value {
    font-size: 1.3rem;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.best-score-box .hud-score-label {
    color: var(--secondary);
}

.best-score-box .hud-score-value {
    text-shadow: 0 0 10px rgba(255, 45, 120, 0.5);
}

/* ==========================================================================
   GAME SCREEN OVERLAYS
   ========================================================================== */
.game-screen {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.80);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 80;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    padding: 20px;
    overflow-y: auto;
}

/* FIX: Help screen must be above all other screens */
#help-screen {
    z-index: 150;
}

.game-screen.active {
    opacity: 1;
    visibility: visible;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px 36px;
    width: 100%;
    max-width: 460px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform: scale(0.92);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.game-screen.active .glass-card {
    transform: scale(1);
}

/* Typography */
.game-title {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -1px;
    text-transform: uppercase;
    line-height: 1.1;
}

.screen-title {
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.game-subtitle {
    font-size: 1rem;
    color: #a0a0c0;
    font-weight: 400;
    line-height: 1.5;
}

/* Neon text colors */
.neon-text-blue {
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.6), 0 0 30px rgba(0, 255, 255, 0.2);
}

.neon-text-pink {
    color: var(--secondary);
    text-shadow: 0 0 10px rgba(255, 45, 120, 0.6), 0 0 30px rgba(255, 45, 120, 0.2);
}

.neon-text-yellow {
    color: var(--warning);
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.6), 0 0 30px rgba(255, 255, 0, 0.2);
}

.neon-text-red {
    color: var(--danger);
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.6), 0 0 30px rgba(255, 68, 68, 0.2);
}

/* Score display */
.score-display {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.score-display span:first-child {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--warning);
}

.score-display span:last-child {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffffff;
}

/* Controls guide */
.controls-guide {
    background: rgba(0, 255, 255, 0.03);
    border: 1px dashed rgba(0, 255, 255, 0.2);
    border-radius: 16px;
    padding: 16px;
    font-size: 0.82rem;
    color: #b0b0d0;
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.controls-guide p strong {
    color: #ffffff;
}

.guide-note {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 8px;
    margin-top: 4px;
    font-size: 0.78rem;
    text-align: center;
    color: #888;
}

/* Final stats */
.final-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 14px 22px;
    border-radius: 14px;
    font-weight: 600;
}

.stat-row span:first-child {
    color: #a0a0c0;
    font-size: 0.82rem;
    letter-spacing: 1px;
}

.stat-row span:last-child {
    font-size: 1.5rem;
    font-weight: 900;
}

.highlight-cyan {
    color: var(--primary) !important;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.highlight-pink {
    color: var(--secondary) !important;
    text-shadow: 0 0 10px rgba(255, 45, 120, 0.5);
}

/* Menu buttons */
.menu-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    padding: 15px 22px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-family: var(--font-primary);
}

.menu-btn.primary-glow {
    background: var(--primary);
    color: var(--bg-dark);
    border-color: transparent;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
}

.menu-btn.primary-glow:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 35px rgba(0, 255, 255, 0.65);
    background: #33ffff;
}

.menu-btn.secondary-glow:hover {
    border-color: var(--secondary);
    box-shadow: 0 0 20px rgba(255, 45, 120, 0.4);
    color: var(--secondary);
    transform: translateY(-3px);
}

.menu-btn.danger-glow:hover {
    border-color: var(--danger);
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.4);
    color: var(--danger);
    transform: translateY(-3px);
}

.menu-btn:active {
    transform: translateY(0) !important;
}

/* ==========================================================================
   HOW TO PLAY — INSTRUCTION LIST
   ========================================================================== */
.instruction-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 12px 16px;
}

.inst-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.instruction-item p {
    font-size: 0.85rem;
    color: #c0c0d8;
    line-height: 1.6;
}

.instruction-item p strong {
    color: #ffffff;
}

/* ==========================================================================
   SOCIAL SHARE SECTION — GAME OVER
   ========================================================================== */
.share-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.share-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #666;
    text-transform: uppercase;
}

.share-row {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.share-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 16px;
    border-radius: 14px;
    border: none;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: var(--font-primary);
    letter-spacing: 0.5px;
}

/* WhatsApp */
.wa-btn {
    background: #25D366;
    color: #ffffff;
    box-shadow: 0 0 16px rgba(37, 211, 102, 0.35);
}

.wa-btn:hover {
    background: #20ba59;
    transform: translateY(-2px);
    box-shadow: 0 0 24px rgba(37, 211, 102, 0.55);
}

/* X (Twitter) */
.x-btn {
    background: #000000;
    color: #ffffff;
    border: 1px solid #333;
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.08);
}

.x-btn:hover {
    background: #111;
    transform: translateY(-2px);
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.15);
    border-color: #555;
}

.share-btn:active {
    transform: translateY(0) !important;
}

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

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
    .hud-header {
        padding: 12px 16px;
    }

    .hud-btn {
        padding: 8px 12px;
        font-size: 0.82rem;
    }

    .hud-btn.icon-btn {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .hud-score-box {
        padding: 6px 12px;
        min-width: 58px;
    }

    .hud-score-value {
        font-size: 1.1rem;
    }

    .glass-card {
        padding: 30px 22px;
        gap: 16px;
        border-radius: 20px;
    }

    .game-title {
        font-size: 2.4rem;
    }

    .screen-title {
        font-size: 1.6rem;
    }
}

@media (max-width: 480px) {
    .hud-center {
        gap: 8px;
    }

    .hud-score-box {
        padding: 5px 10px;
        min-width: 52px;
    }

    .hud-score-value {
        font-size: 1rem;
    }

    .share-row {
        flex-direction: column;
        gap: 10px;
    }

    .game-title {
        font-size: 2rem;
    }
}

/* Safe area for iPhone notch/home bar */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .glass-card {
        padding-bottom: max(36px, calc(20px + env(safe-area-inset-bottom)));
    }
}
