@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Press+Start+2P&display=swap');

:root {
    --bg-color: #0b0c10;
    --card-bg: rgba(22, 26, 38, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --glow-cyan: #00f2fe;
    --glow-orange: #ff4e50;
    --glow-yellow: #f9d423;
    --glow-green: #00ff87;
    --glow-purple: #a18cd1;
    --font-arcade: 'Press Start 2P', monospace;
    --font-modern: 'Outfit', sans-serif;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
}

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

body {
    background: radial-gradient(circle at center, #1b2030 0%, #08090d 100%);
    color: var(--text-primary);
    font-family: var(--font-modern);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Steam Particles */
.ambient-steam {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    opacity: 0.3;
    pointer-events: none;
}

.steam-cloud {
    position: absolute;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: drift 20s infinite linear;
}

@keyframes drift {
    0% {
        transform: translateY(110vh) translateX(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-20vh) translateX(100px) scale(2.5);
        opacity: 0;
    }
}

/* Game Wrapper */
.game-wrapper {
    position: relative;
    width: 960px;
    height: 540px;
    background-color: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8),
                0 0 40px rgba(0, 242, 254, 0.15);
    border: 1px solid var(--border-color);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Canvas screen */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    z-index: 1;
}

/* CRT Scanlines Overlay */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 6px 100%;
    z-index: 5;
    pointer-events: none;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.crt-overlay.disabled {
    opacity: 0;
}

/* Vignette Shadow */
.vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.8);
    z-index: 6;
    pointer-events: none;
}

/* UI Container (Screens) */
.ui-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(rgba(11, 12, 16, 0.85) 0%, rgba(5, 5, 8, 0.98) 100%);
    backdrop-filter: blur(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    padding: 40px;
    text-align: center;
}

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

/* Titles */
h1.retro-title {
    font-family: var(--font-arcade);
    font-size: 32px;
    line-height: 1.5;
    background: linear-gradient(to bottom, var(--glow-cyan), var(--glow-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.5));
    animation: pulseGlow 2s infinite ease-in-out;
}

h2.sub-title {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

@keyframes pulseGlow {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.4)); }
    50% { filter: drop-shadow(0 0 18px rgba(161, 140, 209, 0.8)); }
}

/* Premium Buttons */
.btn {
    font-family: var(--font-arcade);
    font-size: 12px;
    color: #fff;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid var(--border-color);
    padding: 15px 35px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--glow-cyan) 0%, #0072ff 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.4);
    font-weight: 600;
}

.btn:hover {
    transform: translateY(-3px);
}

.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(0, 242, 254, 0.7), 0 0 15px rgba(255, 255, 255, 0.3);
}

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

/* How to Play Section */
.instructions-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-width: 580px;
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    text-align: left;
}

.instruction-col h3 {
    font-size: 14px;
    color: var(--glow-cyan);
    margin-bottom: 10px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 5px;
}

.instruction-col ul {
    list-style: none;
}

.instruction-col li {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.key-badge {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: var(--font-arcade);
    font-size: 9px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* HUD Overlay */
.hud-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.hud-overlay.visible {
    opacity: 1;
}

.hud-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* HUD Bars */
.hud-bar-container {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    backdrop-filter: blur(5px);
}

.hud-label {
    font-family: var(--font-arcade);
    font-size: 8px;
    color: var(--text-secondary);
    min-width: 60px;
}

.hud-bar-bg {
    width: 140px;
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.hud-bar-fill {
    height: 100%;
    width: 100%;
    border-radius: 5px;
    transition: width 0.1s ease-out;
}

#tempFill {
    background: linear-gradient(90deg, #ff4e50 0%, #f9d423 50%, #00f2fe 100%);
    box-shadow: 0 0 8px rgba(249, 212, 35, 0.5);
}

#tractionFill {
    background: linear-gradient(90deg, #e0c3fc 0%, #8ec5fc 100%);
    box-shadow: 0 0 8px rgba(142, 197, 252, 0.5);
}

/* Distance Indicator */
.distance-container {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 200px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    backdrop-filter: blur(5px);
}

.distance-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    position: relative;
    margin-top: 8px;
    margin-bottom: 2px;
}

.distance-marker {
    position: absolute;
    top: -4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--glow-cyan);
    box-shadow: 0 0 8px var(--glow-cyan);
    transform: translateX(-50%);
    transition: left 0.1s linear;
}

.distance-marker.towel {
    left: 100%;
    background: var(--glow-orange);
    box-shadow: 0 0 10px var(--glow-orange);
    width: 14px;
    height: 14px;
    top: -5px;
}

.distance-text {
    font-family: var(--font-arcade);
    font-size: 8px;
    color: var(--text-primary);
}

/* Controls reminder (bottom-right during gameplay) */
.controls-reminder {
    position: absolute;
    bottom: 15px;
    right: 20px;
    z-index: 4;
    display: flex;
    gap: 15px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.controls-reminder.visible {
    opacity: 0.6;
}

.controls-reminder span {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Audio Toggle (top-right, clickable) */
.settings-bar {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 12;
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
}

.icon-btn:hover {
    background: var(--glow-cyan);
    color: #000;
    border-color: var(--glow-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
}

/* MOCK AD MODAL SCREEN */
.ad-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px;
    font-family: var(--font-modern);
}

.ad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
}

.ad-sponsor-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ad-badge {
    background: #ffcc00;
    color: #000;
    font-weight: 800;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.ad-sponsor-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.ad-timer {
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto;
    position: relative;
    z-index: 110;
}

.ad-timer.can-skip {
    background: var(--glow-cyan);
    color: #000;
    font-weight: 600;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
}

.ad-content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    gap: 40px;
    padding: 20px 0;
}

.ad-image-container {
    width: 240px;
    height: 240px;
    background: linear-gradient(45deg, #222, #111);
    border: 3px solid var(--glow-cyan);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    overflow: hidden;
    position: relative;
}

.ad-image-mock {
    font-size: 72px;
    animation: adBob 2s infinite ease-in-out;
}

@keyframes adBob {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

.ad-text-details {
    max-width: 450px;
    text-align: left;
}

.ad-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--glow-cyan);
}

.ad-description {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.ad-cta-btn {
    font-family: var(--font-modern);
    font-weight: 700;
    font-size: 14px;
    padding: 12px 25px;
    background: var(--glow-cyan);
    color: #000;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 242, 254, 0.3);
    transition: all 0.2s;
    pointer-events: auto;
    position: relative;
    z-index: 110;
}

.ad-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 242, 254, 0.5);
}

.ad-footer {
    text-align: center;
    font-size: 11px;
    color: #444;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 15px;
}

/* Resume Prompt overlay */
.resume-modal {
    background: rgba(11, 12, 16, 0.9);
    border: 2px solid var(--glow-purple);
    box-shadow: 0 0 30px rgba(161, 140, 209, 0.4);
    border-radius: 16px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
}

.resume-countdown {
    font-family: var(--font-arcade);
    font-size: 40px;
    color: var(--glow-yellow);
    margin: 20px 0;
    animation: countdownPulse 1s infinite linear;
}

@keyframes countdownPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); color: var(--glow-orange); }
    100% { transform: scale(1); }
}

.resume-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Victory Screen Details */
.win-stat-group {
    display: flex;
    gap: 20px;
    margin: 20px 0 30px 0;
}

.win-stat {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px 25px;
    min-width: 120px;
}

.win-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.win-stat-value {
    font-family: var(--font-arcade);
    font-size: 18px;
    color: var(--glow-green);
}
