/* ============================================
   VOID RUNNER - Neon Synthwave Game Styles
   ============================================ */

:root {
    --primary: #ff69b4;
    --secondary: #00ffff;
    --accent: #ffff00;
    --danger: #ff4500;
    --collectible: #ffcc00;
    --powerup: #9400d3;
    --bg-dark: #0a0a1a;
    --bg-card: rgba(10, 10, 30, 0.85);
    --text-primary: #ffffff;
    --text-secondary: #88aacc;
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    font-family: var(--font-body);
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
}

/* ---- Layout ---- */
#game-container {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen:not(.hidden) button,
.screen:not(.hidden) .neon-btn,
.screen:not(.hidden) .text-btn,
.screen:not(.hidden) .menu-icon-btn,
.screen:not(.hidden) .shop-item {
    pointer-events: auto;
}

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

/* ---- Loading Screen ---- */
#loading-screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    z-index: 100;
    transition: opacity 0.6s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#loading-content {
    text-align: center;
}

#loading-title {
    font-family: var(--font-display);
    font-size: clamp(28px, 8vw, 48px);
    font-weight: 900;
    color: var(--secondary);
    text-shadow: 0 0 20px var(--secondary), 0 0 40px var(--secondary);
    margin-bottom: 30px;
    letter-spacing: 4px;
}

#loading-bar-container {
    width: 200px;
    height: 4px;
    background: rgba(0, 255, 255, 0.15);
    border-radius: 2px;
    margin: 0 auto 16px;
    overflow: hidden;
}

#loading-bar {
    height: 100%;
    width: 0%;
    background: var(--secondary);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--secondary);
    transition: width 0.3s ease;
}

#loading-text {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 3px;
}

/* ---- Menu Screen ---- */
#menu-screen {
    gap: 20px;
    background: radial-gradient(ellipse at center, rgba(0,255,255,0.03) 0%, transparent 70%);
}

#menu-logo {
    text-align: center;
    margin-bottom: 10px;
}

#logo-void {
    font-family: var(--font-display);
    font-size: clamp(48px, 14vw, 80px);
    font-weight: 900;
    color: var(--secondary);
    text-shadow:
        0 0 10px var(--secondary),
        0 0 30px var(--secondary),
        0 0 60px rgba(0, 255, 255, 0.5);
    letter-spacing: 8px;
    line-height: 1;
}

#logo-runner {
    font-family: var(--font-display);
    font-size: clamp(32px, 9vw, 52px);
    font-weight: 700;
    color: var(--primary);
    text-shadow:
        0 0 10px var(--primary),
        0 0 30px var(--primary),
        0 0 60px rgba(255, 105, 180, 0.4);
    letter-spacing: 12px;
    line-height: 1;
}

#menu-tagline {
    font-family: var(--font-body);
    font-size: clamp(12px, 3vw, 16px);
    color: var(--text-secondary);
    letter-spacing: 6px;
    margin-top: -5px;
}

#menu-best {
    font-family: var(--font-display);
    font-size: clamp(14px, 3.5vw, 18px);
    color: var(--accent);
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

/* ---- Buttons ---- */
.neon-btn {
    font-family: var(--font-display);
    font-size: clamp(16px, 4vw, 22px);
    font-weight: 700;
    color: var(--secondary);
    background: transparent;
    border: 2px solid var(--secondary);
    padding: 14px 48px;
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: 3px;
    text-shadow: 0 0 10px var(--secondary);
    box-shadow:
        0 0 10px rgba(0, 255, 255, 0.3),
        inset 0 0 10px rgba(0, 255, 255, 0.1);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.neon-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(0,255,255,0.1), transparent);
    transform: translateX(-100%);
    animation: btnShimmer 3s infinite;
}

.neon-btn:active {
    background: rgba(0, 255, 255, 0.15);
    box-shadow:
        0 0 20px rgba(0, 255, 255, 0.5),
        inset 0 0 20px rgba(0, 255, 255, 0.2);
    transform: scale(0.96);
}

.neon-btn.pulse {
    animation: btnPulse 2s infinite;
}

.text-btn {
    font-family: var(--font-display);
    font-size: clamp(12px, 3vw, 14px);
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    letter-spacing: 2px;
    padding: 8px 16px;
    transition: color 0.2s;
}

.text-btn:active {
    color: var(--secondary);
}

#menu-buttons {
    display: flex;
    gap: 24px;
    margin-top: 10px;
}

.menu-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-icon-btn .btn-icon {
    font-size: 20px;
    color: var(--secondary);
}

.menu-icon-btn .btn-label {
    font-family: var(--font-display);
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.menu-icon-btn:active {
    background: rgba(0, 255, 255, 0.1);
    border-color: var(--secondary);
}

/* ---- HUD ---- */
#hud {
    justify-content: flex-start;
    padding-top: calc(12px + var(--safe-top));
}

#hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    padding: 0 16px;
}

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

#hud-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

#hud-center {
    text-align: center;
    flex: 1;
}

#score-display {
    font-family: var(--font-display);
    font-size: clamp(28px, 7vw, 42px);
    font-weight: 900;
    color: var(--text-primary);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    line-height: 1;
    transition: transform 0.1s;
}

#score-display.bump {
    transform: scale(1.15);
}

#combo-display {
    display: inline-block;
    margin-top: 4px;
    transition: opacity 0.3s, transform 0.3s;
}

#combo-display.hidden {
    opacity: 0;
    transform: scale(0.5);
}

#combo-count {
    font-family: var(--font-display);
    font-size: clamp(18px, 5vw, 28px);
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 15px var(--accent), 0 0 30px rgba(255, 255, 0, 0.3);
    letter-spacing: 2px;
}

#distance-display {
    font-family: var(--font-display);
    font-size: clamp(14px, 3.5vw, 18px);
    color: var(--text-secondary);
    letter-spacing: 1px;
}

#distance-display .unit {
    font-size: 0.7em;
    opacity: 0.6;
}

#coin-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display);
    font-size: clamp(14px, 3.5vw, 18px);
    color: var(--collectible);
    text-shadow: 0 0 8px rgba(255, 204, 0, 0.5);
}

#coin-icon {
    font-size: 1.1em;
}

#pause-btn {
    font-size: 18px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    letter-spacing: -2px;
}

#pause-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

/* Power-up indicator */
#powerup-indicator {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--bg-card);
    border: 1px solid var(--powerup);
    border-radius: 20px;
    transition: opacity 0.3s, transform 0.3s;
}

#powerup-indicator.hidden {
    opacity: 0;
    transform: translateX(-50%) scale(0.8);
    pointer-events: none;
}

#powerup-name {
    font-family: var(--font-display);
    font-size: 12px;
    color: var(--powerup);
    letter-spacing: 2px;
    text-shadow: 0 0 8px var(--powerup);
}

#powerup-timer-bar {
    width: 60px;
    height: 3px;
    background: rgba(148, 0, 211, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

#powerup-timer-fill {
    height: 100%;
    width: 100%;
    background: var(--powerup);
    box-shadow: 0 0 6px var(--powerup);
    transition: width 0.1s linear;
}

/* ---- Game Over Screen ---- */
#gameover-screen {
    gap: 16px;
    background: radial-gradient(ellipse at center, rgba(10, 10, 30, 0.95) 0%, rgba(6, 6, 18, 0.92) 60%, rgba(6, 6, 18, 0.85) 100%);
}

#gameover-title {
    font-family: var(--font-display);
    font-size: clamp(28px, 8vw, 42px);
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary), 0 0 40px rgba(255, 105, 180, 0.4);
    letter-spacing: 4px;
}

#gameover-new-best {
    font-family: var(--font-display);
    font-size: clamp(16px, 4vw, 22px);
    color: var(--accent);
    text-shadow: 0 0 15px var(--accent);
    letter-spacing: 3px;
    animation: newBestPulse 0.8s infinite alternate;
}

#gameover-new-best.hidden {
    display: none;
}

#gameover-stats {
    width: min(300px, 85vw);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* Progress bar */
#gameover-progress {
    width: min(300px, 85vw);
    text-align: center;
}

#progress-label {
    font-family: var(--font-display);
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 2px;
    margin-bottom: 6px;
}

#progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(0, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

#progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    border-radius: 3px;
    box-shadow: 0 0 10px var(--secondary);
    transition: width 1s ease;
}

#progress-text {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

/* ---- Shop Screen ---- */
#shop-screen {
    justify-content: flex-start;
    padding-top: calc(20px + var(--safe-top));
    background: var(--bg-dark);
}

#shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 16px;
    margin-bottom: 20px;
}

#shop-header h2 {
    font-family: var(--font-display);
    font-size: 20px;
    color: var(--secondary);
    letter-spacing: 4px;
}

#shop-coins {
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--collectible);
}

#shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    padding: 0 16px;
    width: 100%;
    max-width: 400px;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.shop-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: var(--bg-card);
    border: 1px solid rgba(0, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.shop-item:active {
    border-color: var(--secondary);
    background: rgba(0, 255, 255, 0.05);
}

.shop-item.owned {
    border-color: rgba(0, 255, 255, 0.3);
}

.shop-item.selected {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.3);
}

.shop-item-preview {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.shop-item-name {
    font-family: var(--font-display);
    font-size: 9px;
    color: var(--text-secondary);
    letter-spacing: 1px;
    text-align: center;
}

.shop-item-price {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--collectible);
}

/* ---- Popups ---- */
.popup {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 3px;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 50;
}

.popup.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
}

#near-miss {
    font-size: clamp(16px, 4vw, 22px);
    color: var(--accent);
    text-shadow: 0 0 15px var(--accent), 0 0 30px rgba(255, 255, 0, 0.4);
}

#milestone {
    font-size: clamp(32px, 10vw, 56px);
    color: var(--secondary);
    text-shadow: 0 0 20px var(--secondary), 0 0 50px rgba(0, 255, 255, 0.5);
}

/* Flash overlay */
#flash-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    z-index: 40;
}

#flash-overlay.active {
    opacity: 1;
}

/* ---- Tutorial ---- */
#tutorial {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: opacity 0.5s;
}

#tutorial.hidden {
    opacity: 0;
}

.tutorial-hint {
    text-align: center;
    animation: tutorialFloat 2s ease-in-out infinite;
}

.tutorial-arrows {
    font-family: var(--font-display);
    font-size: clamp(24px, 7vw, 36px);
    color: var(--secondary);
    text-shadow: 0 0 15px var(--secondary);
    letter-spacing: 6px;
    margin-bottom: 8px;
}

.tutorial-text {
    font-family: var(--font-display);
    font-size: clamp(12px, 3vw, 16px);
    color: var(--text-secondary);
    letter-spacing: 4px;
}

/* ---- Animations ---- */
@keyframes btnPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 255, 255, 0.3), inset 0 0 10px rgba(0, 255, 255, 0.1); }
    50% { box-shadow: 0 0 25px rgba(0, 255, 255, 0.6), inset 0 0 20px rgba(0, 255, 255, 0.2); }
}

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

@keyframes newBestPulse {
    from { transform: scale(1); opacity: 0.8; }
    to { transform: scale(1.08); opacity: 1; }
}

@keyframes tutorialFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    60% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-4px, 2px); }
    20% { transform: translate(4px, -2px); }
    30% { transform: translate(-3px, 3px); }
    40% { transform: translate(3px, -1px); }
    50% { transform: translate(-2px, 2px); }
    60% { transform: translate(2px, -2px); }
    70% { transform: translate(-1px, 1px); }
    80% { transform: translate(1px, -1px); }
}

.shake {
    animation: screenShake 0.4s ease-out;
}

/* ---- Responsive ---- */
@media (max-height: 600px) {
    #menu-logo { margin-bottom: 5px; }
    #logo-void { font-size: 40px; }
    #logo-runner { font-size: 28px; }
    .neon-btn { padding: 10px 36px; }
    #gameover-stats { padding: 10px 16px; }
}

@media (min-width: 768px) {
    .neon-btn:hover {
        background: rgba(0, 255, 255, 0.1);
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.4), inset 0 0 15px rgba(0, 255, 255, 0.15);
    }

    .menu-icon-btn:hover {
        background: rgba(0, 255, 255, 0.08);
        border-color: rgba(0, 255, 255, 0.4);
    }

    .text-btn:hover {
        color: var(--secondary);
    }
}

/* ---- Privacy Policy Link ---- */
#privacy-link {
    position: fixed;
    bottom: 8px;
    right: 12px;
    font-family: var(--font-body);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
    z-index: 5;
    pointer-events: auto;
    transition: color 0.2s;
}
#privacy-link:hover {
    color: rgba(255, 255, 255, 0.5);
}
