/* ======================================
   economics.quest - Vaporwave Economics
   ====================================== */

/* --- CSS Custom Properties --- */
:root {
    --void: #0a0014;
    --neon-pink: #ff2d95;
    --neon-cyan: #00f5d4;
    --grid-purple: #7b2fbe;
    --chrome-silver: #c0c0c0;
    --score-gold: #ffd700;
    --dim-magenta: #1a0030;
    --white: #ffffff;
    --grey: #808080;

    --font-primary: 'Press Start 2P', monospace;
    --font-secondary: 'Exo 2', sans-serif;
    --font-accent: 'Bungee', sans-serif;

    --health-pct: 100;
}

/* --- Reset --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--void);
    color: var(--white);
    font-family: var(--font-secondary);
}

/* --- Scanline Overlay --- */
#scanline-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
}

/* --- Score Bar --- */
#score-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(180deg, #1a0030 0%, #0a0014 100%);
    border-bottom: 2px solid var(--grid-purple);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    z-index: 1000;
    font-family: var(--font-primary);
}

#score-label {
    font-size: 0.55rem;
    color: var(--score-gold);
    letter-spacing: 2px;
    white-space: nowrap;
}

#health-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.health-segment {
    width: 15px;
    height: 20px;
    background: #1a0030;
    border: 1px solid #333;
    transition: background 0.3s, box-shadow 0.3s;
}

.health-segment.filled {
    border-color: transparent;
}

.health-segment.filled.green {
    background: #00ff66;
    box-shadow: 0 0 6px #00ff66;
}

.health-segment.filled.yellow {
    background: #ffd700;
    box-shadow: 0 0 6px #ffd700;
}

.health-segment.filled.red {
    background: #ff2d2d;
    box-shadow: 0 0 6px #ff2d2d;
}

#score-value {
    font-size: 0.6rem;
    color: var(--score-gold);
    min-width: 40px;
    text-align: right;
}

#decade-indicator {
    font-size: 0.5rem;
    color: var(--neon-pink);
    margin-left: auto;
    letter-spacing: 2px;
}

/* --- Horizontal Scroll Container --- */
#scroll-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    height: 100vh;
    width: 100vw;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#scroll-container::-webkit-scrollbar {
    display: none;
}

/* --- Panel Base --- */
.panel {
    min-width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Neon Grid Floor --- */
.neon-grid {
    position: absolute;
    bottom: 0;
    left: -50%;
    width: 200%;
    height: 60%;
    background:
        linear-gradient(transparent 95%, var(--grid-purple) 95%),
        linear-gradient(90deg, transparent 95%, var(--grid-purple) 95%);
    background-size: 40px 40px;
    transform: perspective(500px) rotateX(60deg);
    transform-origin: center top;
    opacity: 0.5;
}

/* --- Panel Content --- */
.panel-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 900px;
    padding: 60px 30px 30px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* --- Chrome Text Effect --- */
.chrome-text {
    background: linear-gradient(
        180deg,
        #ffffff 0%,
        #c0c0c0 40%,
        #ffffff 50%,
        #808080 80%,
        #ffffff 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* ============ HERO PANEL ============ */
.panel-hero {
    background: radial-gradient(ellipse at center bottom, #1a0030 0%, #0a0014 70%);
}

.hero-content {
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 30px;
}

.hero-title-wrapper {
    margin-bottom: 10px;
}

.hero-title-wrapper h1 {
    font-family: var(--font-accent);
    font-size: clamp(2rem, 6vw, 5rem);
    line-height: 1.2;
    margin-bottom: 12px;
    text-transform: lowercase;
    background: linear-gradient(180deg, #fff, #aaa, #fff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-family: var(--font-secondary);
    font-size: 1.1rem;
    color: var(--neon-cyan);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.hero-instructions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.blink-text {
    font-family: var(--font-primary);
    font-size: 0.85rem;
    color: var(--score-gold);
    letter-spacing: 4px;
    animation: blink 1.2s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.scroll-hint {
    font-family: var(--font-primary);
    font-size: 0.5rem;
    color: var(--chrome-silver);
    letter-spacing: 1px;
}

.key-icon {
    color: var(--neon-pink);
}

/* --- Pixel Art Icons --- */
.pixel-icons-row {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-top: 10px;
}

.pixel-icon {
    width: 32px;
    height: 32px;
    position: relative;
}

/* Pixel Factory */
.pixel-factory {
    box-shadow:
        4px 0px 0 0 var(--neon-pink),
        8px 0px 0 0 var(--neon-pink),
        12px 0px 0 0 var(--neon-pink),
        0px 4px 0 0 var(--neon-pink),
        4px 4px 0 0 var(--neon-pink),
        8px 4px 0 0 var(--neon-pink),
        12px 4px 0 0 var(--neon-pink),
        16px 4px 0 0 var(--neon-pink),
        0px 8px 0 0 var(--neon-pink),
        4px 8px 0 0 var(--grid-purple),
        8px 8px 0 0 var(--neon-pink),
        12px 8px 0 0 var(--grid-purple),
        16px 8px 0 0 var(--neon-pink),
        0px 12px 0 0 var(--neon-pink),
        4px 12px 0 0 var(--neon-pink),
        8px 12px 0 0 var(--neon-pink),
        12px 12px 0 0 var(--neon-pink),
        16px 12px 0 0 var(--neon-pink),
        20px 0px 0 0 var(--chrome-silver),
        20px -4px 0 0 var(--chrome-silver),
        20px -8px 0 0 var(--chrome-silver);
}

/* Pixel Coin */
.pixel-coin {
    box-shadow:
        4px 0px 0 0 var(--score-gold),
        8px 0px 0 0 var(--score-gold),
        0px 4px 0 0 var(--score-gold),
        4px 4px 0 0 #fff8b0,
        8px 4px 0 0 var(--score-gold),
        12px 4px 0 0 var(--score-gold),
        0px 8px 0 0 var(--score-gold),
        4px 8px 0 0 var(--score-gold),
        8px 8px 0 0 #fff8b0,
        12px 8px 0 0 var(--score-gold),
        0px 12px 0 0 var(--score-gold),
        4px 12px 0 0 var(--score-gold),
        8px 12px 0 0 var(--score-gold),
        12px 12px 0 0 var(--score-gold),
        4px 16px 0 0 var(--score-gold),
        8px 16px 0 0 var(--score-gold);
}

/* Pixel Chart */
.pixel-chart {
    box-shadow:
        0px 12px 0 0 var(--neon-cyan),
        0px 16px 0 0 var(--neon-cyan),
        4px 8px 0 0 var(--neon-cyan),
        4px 12px 0 0 var(--neon-cyan),
        4px 16px 0 0 var(--neon-cyan),
        8px 4px 0 0 var(--neon-cyan),
        8px 8px 0 0 var(--neon-cyan),
        8px 12px 0 0 var(--neon-cyan),
        8px 16px 0 0 var(--neon-cyan),
        12px 0px 0 0 var(--neon-cyan),
        12px 4px 0 0 var(--neon-cyan),
        12px 8px 0 0 var(--neon-cyan),
        12px 12px 0 0 var(--neon-cyan),
        12px 16px 0 0 var(--neon-cyan),
        16px 8px 0 0 var(--neon-cyan),
        16px 12px 0 0 var(--neon-cyan),
        16px 16px 0 0 var(--neon-cyan);
}

/* Pixel House */
.pixel-house {
    box-shadow:
        8px 0px 0 0 var(--grid-purple),
        4px 4px 0 0 var(--grid-purple),
        8px 4px 0 0 var(--grid-purple),
        12px 4px 0 0 var(--grid-purple),
        0px 8px 0 0 var(--grid-purple),
        4px 8px 0 0 var(--grid-purple),
        8px 8px 0 0 var(--grid-purple),
        12px 8px 0 0 var(--grid-purple),
        16px 8px 0 0 var(--grid-purple),
        0px 12px 0 0 var(--grid-purple),
        4px 12px 0 0 var(--dim-magenta),
        8px 12px 0 0 var(--grid-purple),
        12px 12px 0 0 var(--dim-magenta),
        16px 12px 0 0 var(--grid-purple),
        0px 16px 0 0 var(--grid-purple),
        4px 16px 0 0 var(--score-gold),
        8px 16px 0 0 var(--score-gold),
        12px 16px 0 0 var(--grid-purple),
        16px 16px 0 0 var(--grid-purple);
}

/* ============ CHALLENGE PANELS ============ */
.panel-challenge {
    background: radial-gradient(ellipse at center bottom, #1a0030 0%, #0a0014 70%);
}

.panel-challenge .panel-content {
    justify-content: flex-start;
    gap: 0;
}

/* --- Crisis Top Half --- */
.crisis-top {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 14px;
    padding-bottom: 10px;
}

.decade-header {
    font-family: var(--font-accent);
    font-size: clamp(2rem, 6vw, 5rem);
    color: var(--grid-purple);
    text-shadow:
        0 0 20px rgba(123, 47, 190, 0.5),
        0 0 40px rgba(123, 47, 190, 0.3);
    letter-spacing: 4px;
}

.crisis-title {
    font-family: var(--font-primary);
    font-size: clamp(0.7rem, 2vw, 1.1rem);
    color: var(--neon-pink);
    text-shadow: 0 0 15px rgba(255, 45, 149, 0.6);
    letter-spacing: 3px;
}

.crisis-description {
    max-width: 650px;
}

.crisis-description p {
    font-family: var(--font-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--chrome-silver);
}

.crisis-stats {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: 1px solid var(--grid-purple);
    background: rgba(123, 47, 190, 0.1);
}

.stat-label {
    font-family: var(--font-primary);
    font-size: 0.45rem;
    color: var(--chrome-silver);
    letter-spacing: 1px;
}

.stat-value {
    font-family: var(--font-primary);
    font-size: 0.7rem;
    letter-spacing: 1px;
}

.neon-pink {
    color: var(--neon-pink);
    text-shadow: 0 0 10px rgba(255, 45, 149, 0.5);
}

/* --- Crisis Options Bottom Half --- */
.crisis-options {
    display: flex;
    gap: 16px;
    padding: 20px 0 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.option-tile {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    padding: 20px 16px;
    background: rgba(10, 0, 20, 0.8);
    border: 2px solid var(--grid-purple);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s, background 0.3s;
    position: relative;
    font-family: inherit;
    color: inherit;
}

.option-tile::before {
    content: '';
    position: absolute;
    inset: -2px;
    border: 2px solid transparent;
    background: linear-gradient(135deg, var(--neon-pink), var(--grid-purple), var(--neon-cyan)) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s;
}

.option-tile:hover::before {
    opacity: 1;
}

.option-tile:hover {
    border-color: var(--neon-pink);
    box-shadow: 0 0 20px rgba(255, 45, 149, 0.3), inset 0 0 20px rgba(255, 45, 149, 0.05);
    transform: translateY(-3px);
    background: rgba(26, 0, 48, 0.9);
}

.option-tile.selected {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 25px rgba(0, 245, 212, 0.4), inset 0 0 25px rgba(0, 245, 212, 0.08);
    background: rgba(0, 245, 212, 0.08);
}

.option-tile.selected::after {
    content: 'SELECTED';
    position: absolute;
    top: 6px;
    right: 8px;
    font-family: var(--font-primary);
    font-size: 0.35rem;
    color: var(--neon-cyan);
    letter-spacing: 1px;
}

.option-tile:disabled {
    pointer-events: none;
}

.option-tile:not(.selected):disabled {
    opacity: 0.35;
}

.option-label {
    font-family: var(--font-primary);
    font-size: 0.8rem;
    color: var(--score-gold);
    width: 28px;
    height: 28px;
    line-height: 28px;
    border: 1px solid var(--score-gold);
    display: block;
    flex-shrink: 0;
}

.option-text {
    font-family: var(--font-primary);
    font-size: 0.55rem;
    line-height: 1.8;
    color: var(--white);
}

.option-hint {
    font-family: var(--font-secondary);
    font-size: 0.75rem;
    color: var(--grey);
    font-style: italic;
}

/* ============ RESULTS PANEL ============ */
.panel-results {
    background: radial-gradient(ellipse at center bottom, #1a0030 0%, #0a0014 70%);
}

.results-content {
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 30px;
}

#final-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.results-label {
    font-family: var(--font-primary);
    font-size: 0.55rem;
    color: var(--score-gold);
    letter-spacing: 2px;
}

#final-score-number {
    font-family: var(--font-accent);
    font-size: clamp(3rem, 10vw, 8rem);
    line-height: 1;
}

#results-grade {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#grade-letter {
    font-family: var(--font-accent);
    font-size: clamp(2rem, 5vw, 4rem);
}

#grade-title {
    font-family: var(--font-primary);
    font-size: 0.65rem;
    color: var(--neon-cyan);
    letter-spacing: 2px;
}

.results-description {
    font-family: var(--font-secondary);
    font-size: 0.95rem;
    color: var(--chrome-silver);
    max-width: 500px;
    line-height: 1.6;
}

#restart-btn {
    margin-top: 10px;
    min-width: 220px;
    max-width: 280px;
}

#restart-btn:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 245, 212, 0.3);
}

/* ============ ANIMATIONS ============ */
@keyframes neon-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.7; }
}

.neon-grid {
    animation: neon-pulse 4s ease-in-out infinite;
}

/* Panel entrance animations */
.panel-content {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.panel.visible .panel-content {
    opacity: 1;
    transform: translateY(0);
}

/* Score change flash */
@keyframes score-flash {
    0% { color: var(--neon-cyan); transform: scale(1.3); }
    100% { color: var(--score-gold); transform: scale(1); }
}

.score-flash {
    animation: score-flash 0.5s ease-out;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .crisis-options {
        flex-direction: column;
        align-items: center;
    }

    .option-tile {
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }

    .crisis-stats {
        gap: 12px;
    }

    .stat-item {
        padding: 6px 10px;
    }

    #score-bar {
        padding: 0 10px;
        gap: 8px;
    }

    #score-label {
        font-size: 0.45rem;
    }

    .health-segment {
        width: 10px;
        height: 14px;
    }

    .pixel-icons-row {
        gap: 24px;
    }
}

@media (max-width: 480px) {
    .health-segment {
        width: 7px;
        height: 12px;
    }

    #score-label {
        display: none;
    }

    .decade-header {
        font-size: clamp(1.5rem, 8vw, 3rem);
    }
}
