@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&family=Fira+Code:wght@400;600&display=swap");

:root {
    --bg: #05040b;
    --bg-soft: #0d0f1f;
    --panel: #11142b;
    --text: #f0f1ff;
    --muted: #9aa4d6;
    --accent: #4fe3ff;
    --accent-2: #ff6ad5;
    --success: #7dffb1;
    --border: rgba(255, 255, 255, 0.18);
    --shadow: 0 6px 0 rgba(6, 8, 20, 0.8), 0 20px 40px rgba(0, 0, 0, 0.55);
}

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

body {
    font-family: "VT323", "Press Start 2P", monospace;
    font-size: 20px;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        linear-gradient(135deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%),
        linear-gradient(225deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%),
        linear-gradient(45deg, rgba(0, 0, 0, 0.2) 25%, transparent 25%),
        linear-gradient(315deg, rgba(0, 0, 0, 0.2) 25%, transparent 25%);
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
    background-size: 8px 8px;
    line-height: 1.55;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.08) 0px,
        rgba(255, 255, 255, 0.08) 1px,
        rgba(0, 0, 0, 0.25) 2px,
        rgba(0, 0, 0, 0.25) 3px
    );
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
    position: relative;
    z-index: 1;
}

.hero {
    padding: 1.6rem 0 2.6rem;
    display: grid;
    gap: 1.2rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.9rem;
    border-radius: 6px;
    background: #0c1125;
    color: var(--accent);
    border: 2px solid var(--accent);
    font-family: "Press Start 2P", monospace;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.6rem;
    width: fit-content;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.6);
}

h1,
h2 {
    font-family: "Press Start 2P", monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

h1 {
    font-size: clamp(1.8rem, 3.4vw, 2.9rem);
    line-height: 1.25;
}

.subtitle {
    font-family: "Press Start 2P", monospace;
    font-size: clamp(1.2rem, 3.6vw, 2.2rem);
    color: var(--accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero p {
    max-width: 740px;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.audio-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    font-family: "Press Start 2P", monospace;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.audio-hint.is-hidden {
    opacity: 0;
    transform: translateX(6px);
    pointer-events: none;
}

.audio-arrow {
    display: inline-flex;
    animation: nudge 1.2s ease-in-out infinite;
}

.audio-arrow svg {
    width: 32px;
    height: 16px;
    fill: var(--accent);
    image-rendering: pixelated;
}

@keyframes nudge {
    0%,
    100% {
        transform: translateX(0);
        opacity: 0.6;
    }
    50% {
        transform: translateX(-6px);
        opacity: 1;
    }
}

button {
    font: inherit;
    border: 2px solid rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.7rem 1.4rem;
    border-radius: 6px;
    background: #161b35;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.7rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.65);
}

button.primary {
    background: linear-gradient(180deg, #9cf6ff 0%, #2b8bff 100%);
    color: #050509;
    border-color: #d5fbff;
    font-weight: 700;
}

button.ghost {
    background: #0f1226;
    color: var(--text);
    border: 2px solid #3b3f6f;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.7);
}

.hero-meta {
    font-size: 0.95rem;
    color: var(--muted);
}

.stage {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.2fr);
    gap: 2rem;
    padding: 2rem;
    background: linear-gradient(145deg, #0c0f22, #15193a);
    border-radius: 12px;
    border: 2px solid #1e234a;
    box-shadow: 0 0 0 2px #0b0f22 inset, var(--shadow);
    align-items: stretch;
}

.stage-info {
    display: grid;
    gap: 0.8rem;
    align-content: start;
    min-height: 0;
}

.stage-label {
    color: var(--success);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.7rem;
}

.stage-info h2 {
    font-size: 1.6rem;
}

.stage-info p {
    color: var(--muted);
}

.stage-links {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    font-size: 0.95rem;
}

.stage-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

.stage-visual {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    align-content: start;
    min-height: 0;
}

.canvas-wrap {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    min-height: 320px;
    border: 2px solid #2b2f5f;
    box-shadow: inset 0 0 0 2px #0a0a14;
}

.code-panel {
    background: #0b1024;
    border-radius: 10px;
    border: 2px solid #1e234a;
    padding: 1rem;
    box-shadow: inset 0 0 0 2px #0a0a14;
    width: 100%;
}

.code-title {
    font-family: "Press Start 2P", monospace;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--success);
    margin-bottom: 0.6rem;
}

.code-panel pre {
    margin: 0;
    padding: 0.8rem;
    background: #050509;
    border: 2px solid #2b2f5f;
    border-radius: 8px;
    max-height: 320px;
    overflow: auto;
    font-family: "Fira Code", "JetBrains Mono", "Courier New", monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    letter-spacing: 0;
    color: #b7f3ff;
    white-space: pre;
    tab-size: 2;
    word-break: normal;
    overflow-wrap: normal;
    font-variant-ligatures: none;
}

.code-panel code {
    display: block;
}

#demo-canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}

.scanlines {
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.1),
        rgba(255, 255, 255, 0.1) 1px,
        rgba(0, 0, 0, 0.2) 2px,
        rgba(0, 0, 0, 0.2) 3px
    );
    opacity: 0.35;
    mix-blend-mode: screen;
}

.webgl-warning {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    font-size: 0.95rem;
    color: #ffd7c8;
    background: rgba(6, 6, 12, 0.72);
    backdrop-filter: blur(2px);
}

.list {
    margin-top: 3rem;
    display: grid;
    gap: 1.4rem;
}

.section-title h2 {
    font-size: 1.4rem;
    margin-bottom: 0.4rem;
}

.section-title p {
    color: var(--muted);
}

.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
}

.demo-card {
    background: #0f1224;
    border-radius: 12px;
    border: 2px solid #1e234a;
    padding: 1.2rem;
    display: grid;
    gap: 0.6rem;
    cursor: pointer;
    transition: transform 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.6);
}

.demo-card:hover {
    transform: translateY(-3px);
    border-color: rgba(79, 210, 255, 0.7);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.7);
}

.demo-rank {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
}

.demo-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.demo-meta {
    color: var(--muted);
    font-size: 0.95rem;
}

.demo-effect {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.demo-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--muted);
}

.demo-actions a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

.lab {
    margin-top: 3rem;
    display: grid;
    gap: 1.5rem;
}

.lab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.2rem;
}

.lab-card {
    display: grid;
    gap: 0.6rem;
    background: #0f1224;
    border-radius: 12px;
    border: 2px solid #1e234a;
    padding: 1.4rem;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.6);
    transition: transform 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
}

.lab-card:hover {
    transform: translateY(-3px);
    border-color: rgba(79, 210, 255, 0.7);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.7);
}

.lab-title {
    font-family: "Press Start 2P", monospace;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
}

.lab-meta {
    color: var(--muted);
    font-size: 0.95rem;
}

.lab-desc {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
}

.lab-cta {
    color: var(--success);
    font-weight: 700;
    font-size: 0.9rem;
}

.notes {
    margin-top: 3rem;
    padding: 2rem;
    background: var(--bg-soft);
    border-radius: 12px;
    border: 2px solid #1e234a;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.6);
}

.notes ul {
    margin-top: 0.8rem;
    padding-left: 1.2rem;
    color: var(--muted);
    display: grid;
    gap: 0.6rem;
}

.footer {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.95rem;
}

@media (max-width: 900px) {
    .stage {
        grid-template-columns: 1fr;
    }

    .canvas-wrap {
        min-height: 280px;
    }
}

@media (max-width: 600px) {
    .page {
        padding: 2rem 1rem 3rem;
    }

    .stage {
        padding: 1.4rem;
    }

    button {
        width: 100%;
        justify-content: center;
    }
}
