:root {
    --bg-color: #050510;
    --neon-green: #00ff41;
    --neon-green-dim: #008f11;
    --quantum-purple: #b026ff;
    --glitch-cyan: #00f0ff;
    --terminal-black: #000000;
    --font-heading: 'Press Start 2P', cursive;
    --font-body: 'VT323', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--neon-green);
    font-family: var(--font-body);
    font-size: 1.2rem;
    overflow-x: hidden;
    line-height: 1.4;
    width: 100%;

    /* REQUEST: Equal Padding */
    padding: 25px;

    /* Subtle Body Scanline */
    background-image: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 255, 65, 0.02) 50%);
    background-size: 100% 4px;
}

/* --- Global Glitch Effects (Applied to Everything) --- */
h1,
h2,
h3,
h4,
.nav-link,
.pixel-btn,
.time-marker,
.prize-text {
    position: relative;
    animation: text-twitch 4s infinite linear alternate-reverse;
}

@keyframes text-twitch {
    0% {
        transform: translate(0, 0) skew(0deg);
        text-shadow: 2px 2px 0 var(--neon-green-dim);
    }

    1% {
        transform: translate(-1px, 0) skew(0deg);
        text-shadow: -2px 0 0 var(--glitch-cyan);
    }

    2% {
        transform: translate(1px, 0) skew(0deg);
        text-shadow: 2px 0 0 var(--quantum-purple);
    }

    3% {
        transform: translate(0, 0) skew(0deg);
        text-shadow: 2px 2px 0 var(--neon-green-dim);
    }

    98% {
        transform: translate(0, 0) skew(0deg);
        text-shadow: 2px 2px 0 var(--neon-green-dim);
    }

    99% {
        transform: translate(1px, 0) skew(5deg);
        text-shadow: 2px 2px 0 var(--glitch-cyan);
    }

    100% {
        transform: translate(0, 0) skew(0deg);
        text-shadow: 2px 2px 0 var(--neon-green-dim);
    }
}

/* --- Video Background --- */
#bg-video {
    position: fixed;
    right: 0;
    bottom: 0;
    min-width: 100%;
    min-height: 100%;
    z-index: -10;
    object-fit: cover;
    opacity: 0.4;
    /* Subtle texture */
    mix-blend-mode: screen;
    /* Blends noise with dark bg */
    pointer-events: none;
}

/* --- Layout --- */
.container {
    width: 98%;
    max-width: none;
    margin: 0 auto;
}

.hidden {
    display: none;
}

/* Header */
.retro-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px dashed var(--neon-green-dim);
    padding-bottom: 1rem;
    margin-bottom: 4rem;
    width: 100%;
}

.logo-text {
    font-family: var(--font-heading);
    color: var(--neon-green);
    font-size: 1.5rem;
}

.bracket {
    color: var(--glitch-cyan);
    font-weight: bold;
}

.nav-link {
    color: var(--neon-green);
    text-transform: uppercase;
    margin-left: 2rem;
}

/* --- HERO: SIDE BY SIDE --- */
.hero-section {
    display: flex;
    /* Flex Layout */
    flex-direction: row;
    /* Side by Side */
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 6rem;
    gap: 2rem;
    border: 4px solid #000;
    /* Define the container boundary visually (optional, based on sketch) */
    padding: 2rem;
}

.hero-text-content {
    flex: 1;
    /* Take 50% (roughly) */
    text-align: left;
    /* Align Left matches sketch */
}

/* Adjusted for Left Alignment */
.hero-title {
    font-family: var(--font-heading);
    font-size: 5vw;
    color: var(--glitch-cyan);
    margin-bottom: 1rem;
    text-align: left;
}

.hero-subtitle {
    font-family: var(--font-heading);
    font-size: 2.5vw;
    color: var(--quantum-purple);
    text-align: left;
}

.hero-actions {
    text-align: left;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Game Container - Right Side */
#hero-game-container {
    flex: 1;
    /* Take other 50% */
    position: relative;
    border: 4px solid var(--neon-green);
    box-shadow: 0 0 20px var(--neon-green-dim);
    background: #000;
    max-width: 800px;
    /* Keep game size controlled */
    height: 500px;
    animation: image-glitch 3s infinite linear alternate-reverse;
}

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

.game-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.press-start {
    font-family: var(--font-heading);
    color: var(--glitch-cyan);
    font-size: 1.5rem;
    animation: blink 0.8s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Mobile Stack */
@media screen and (max-width: 900px) {
    .hero-section {
        flex-direction: column;
        /* Stack vertically on mobile */
        text-align: center;
    }

    .hero-text-content {
        text-align: center;
    }

    .hero-title,
    .hero-subtitle {
        text-align: center;
    }

    .hero-actions {
        align-items: center;
    }

    #hero-game-container {
        width: 100%;
        height: 300px;
    }
}

/* UI Elements */
.pixel-btn {
    background: transparent;
    border: 4px solid var(--neon-green);
    color: var(--neon-green);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    padding: 1.5rem 3rem;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
    margin-top: 2rem;
}

/* --- HUD Panel (Replaces Violet Box) --- */
.hud-panel {
    background: rgba(0, 0, 0, 0.4);
    /* Dark semi-transparent */
    border-top: 2px solid var(--quantum-purple);
    border-bottom: 2px solid var(--quantum-purple);
    padding: 3rem;
    width: 100%;
    margin: 0 auto 2rem auto;
    position: relative;
}

/* Corner Brackets for HUD */
.hud-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 10px;
    background: var(--quantum-purple);
}

.hud-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 10px;
    background: var(--quantum-purple);
}

/* --- Timeline: Minimalist Snake Grid --- */
.timeline {
    position: relative;
    margin: 4rem 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    width: 100%;
}

.timeline-item {
    position: relative;
    padding-left: 2rem;
    border-left: 2px solid var(--neon-green);
}

@media screen and (min-width: 900px) {
    .timeline {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8rem 2rem;
        border: none;
        margin: 8rem 0;
    }

    .timeline-item {
        border: none;
        padding: 0;
        text-align: center;
    }

    .timeline-item:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }

    .timeline-item:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }

    .timeline-item:nth-child(3) {
        grid-column: 3;
        grid-row: 1;
    }

    .timeline-item:nth-child(4) {
        grid-column: 3;
        grid-row: 2;
    }

    .timeline-item:nth-child(5) {
        grid-column: 2;
        grid-row: 2;
    }

    .timeline-item:nth-child(6) {
        grid-column: 1;
        grid-row: 2;
    }

    .timeline-item:nth-child(7) {
        grid-column: 1;
        grid-row: 3;
    }

    .timeline-item:nth-child(8) {
        grid-column: 2;
        grid-row: 3;
    }

    .timeline-item:nth-child(9) {
        grid-column: 3;
        grid-row: 3;
    }

    /* Connector Logic */
    .timeline-item::after {
        content: '';
        position: absolute;
        background: var(--neon-green-dim);
        z-index: -1;
    }

    .timeline-item:nth-child(1)::after,
    .timeline-item:nth-child(2)::after,
    .timeline-item:nth-child(7)::after,
    .timeline-item:nth-child(8)::after {
        height: 2px;
        width: 100%;
        top: 52%;
        left: 50%;
    }

    .timeline-item:nth-child(4)::after,
    .timeline-item:nth-child(5)::after {
        height: 2px;
        width: 100%;
        top: 52%;
        right: 50%;
    }

    .timeline-item:nth-child(3)::before {
        content: '';
        position: absolute;
        top: 52%;
        right: -25%;
        width: 2px;
        height: calc(100% + 8rem);
        background: var(--neon-green-dim);
        border-radius: 0 10px 10px 0;
    }

    .timeline-item:nth-child(6)::before {
        content: '';
        position: absolute;
        top: 52%;
        left: -25%;
        width: 2px;
        height: calc(100% + 8rem);
        background: var(--neon-green-dim);
        border-radius: 10px 0 0 10px;
    }
}

.event-details {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    transition: transform 0.2s;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.event-details:hover {
    transform: scale(1.1);
    animation: text-twitch 0.2s infinite;
}

.event-details::before {
    content: '';
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #000;
    border: 4px solid var(--glitch-cyan);
    box-shadow: 0 0 20px var(--glitch-cyan);
    margin-bottom: 2rem;
    z-index: 10;
}

.time-marker {
    color: var(--glitch-cyan);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    background: #000;
    padding: 0.2rem 0.5rem;
}

.event-details h4 {
    font-family: var(--font-heading);
    color: var(--neon-green);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.event-details p {
    color: #ccc;
    font-size: 1rem;
    max-width: 300px;
    margin: 0 auto;
}

/* Tracks Grid */
.tracks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 4rem;
    width: 100%;
}

.pixel-card {
    border: 2px solid var(--neon-green-dim);
    padding: 4rem;
    background: rgba(0, 10, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.pixel-card:hover {
    border-color: var(--neon-green);
    box-shadow: 0 0 30px var(--neon-green-dim);
}

.pixel-card h4 {
    color: var(--quantum-purple);
    font-size: 2.2rem;
    /* Increased size */
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.pixel-card p {
    font-size: 1.5rem;
    /* Increased size for readability */
    color: #fff;
    /* Keep white but bigger */
    text-shadow: 2px 2px 0 #000;
    /* Contrast boost */
    line-height: 1.6;
}

/* Intro Overlay */
#intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--terminal-black);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.intro-stage {
    display: none;
    text-align: center;
    width: 100%;
}

.intro-stage.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.progress-container {
    width: 320px;
    height: 30px;
    border: 4px solid var(--neon-green);
    margin: 2rem 0;
    padding: 4px;
    background: #001100;
    box-shadow: 0 0 10px var(--neon-green-dim);
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--neon-green);
    transition: width 0.1s linear;
    box-shadow: 0 0 15px var(--neon-green);
}

.console-text {
    font-family: var(--font-body);
    font-size: 1.5rem;
    color: var(--neon-green);
}

/* Prizes */
.prize-text {
    font-size: 4rem;
    color: #ffd700;
    margin-bottom: 1rem;
}

.info-box p {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.section-title {
    font-family: var(--font-heading);
    color: var(--glitch-cyan);
    font-size: 3rem;
    margin-bottom: 5rem;
    border-bottom: 4px solid var(--neon-green-dim);
    display: inline-block;
    padding-bottom: 1rem;
}

.center-align {
    text-align: center;
}

.content-block {
    margin-bottom: 10rem;
    width: 100%;
}

/* Logo Styles */
.header-logo {
    height: 40px;
    width: auto;
    margin-right: 1rem;
    vertical-align: middle;
}

.logo-area {
    display: flex;
    align-items: center;
}

footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 2px dashed var(--neon-green-dim);
    margin-top: 4rem;
}

.footer-logo-link {
    display: inline-block;
    margin-bottom: 1rem;
}

.footer-logo {
    height: 50px;
    width: auto;
    transition: transform 0.2s, filter 0.2s;
}

.footer-logo:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px var(--neon-green));
}

/* ==========================================
   MOBILE OPTIMIZATION (screens < 768px)
   ========================================== */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 1rem;
    }

    .container {
        width: 100%;
        padding: 0 10px;
    }

    /* GLOBAL HEADING SIZES FOR MOBILE */
    h1 {
        font-size: 1.6rem !important;
    }

    h2 {
        font-size: 1.3rem !important;
    }

    h3 {
        font-size: 1.1rem !important;
    }

    h4 {
        font-size: 1rem !important;
    }

    /* HERO: Hide Game, Center Text */
    .hero-section {
        flex-direction: column;
        justify-content: center;
        text-align: center;
        margin-bottom: 3rem;
        border: none;
        padding: 1rem 0;
        gap: 1rem;
    }

    #hero-game-container {
        display: none !important;
        /* HIDE GAME ON MOBILE */
    }

    .hero-text-content {
        text-align: center;
    }

    .hero-title {
        font-size: 1.8rem !important;
        text-align: center;
    }

    .hero-subtitle {
        font-size: 1rem !important;
        text-align: center;
    }

    .hero-actions {
        align-items: center;
    }

    .status-box {
        font-size: 0.9rem;
    }

    .pixel-btn {
        font-size: 1rem;
        padding: 1rem 2rem;
    }

    /* HEADER */
    .retro-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        margin-bottom: 2rem;
    }

    .pixel-nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .nav-link {
        margin-left: 0;
        font-size: 0.8rem;
    }

    .logo-text {
        font-size: 1rem;
    }

    /* TIMELINE: Compact Vertical List */
    .timeline {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        margin: 2rem 0 !important;
    }

    .timeline-item {
        border-left: 2px solid var(--neon-green-dim);
        padding-left: 1rem;
        margin-left: 0;
        grid-column: auto !important;
        grid-row: auto !important;
    }

    .timeline-item::after,
    .timeline-item::before {
        display: none !important;
        /* Remove snake connectors */
    }

    .event-details {
        align-items: flex-start;
        text-align: left;
    }

    .event-details::before {
        display: none;
        /* Remove glowing node circle */
    }

    .time-marker {
        font-size: 0.9rem;
        padding: 0.1rem 0.3rem;
    }

    .event-details h4 {
        font-size: 1rem;
        margin-bottom: 0.2rem;
    }

    .event-details p {
        font-size: 0.85rem;
        line-height: 1.3;
    }

    /* SECTION TITLES */
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 2rem;
    }

    .content-block {
        margin-bottom: 4rem;
    }

    /* PROBLEM CARDS */
    .tracks-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .pixel-card {
        padding: 1.5rem;
    }

    .pixel-card h4 {
        font-size: 1.2rem;
    }

    .pixel-card p {
        font-size: 1rem;
    }

    /* PRIZES & REGISTER */
    .prize-text {
        font-size: 2rem;
    }

    .hud-panel {
        padding: 1.5rem;
    }

    .info-box p {
        font-size: 1rem;
    }
}