/* Arcade look, same family as the Pong and Sierpinski pages: pixel fonts,
   flat colors, hard shadows (no blur). */
:root {
    --bg: #07060b;
    --fg: #f4f1ea;
    --muted: #9a958c;
    --line: #2a2733;
    --panel: #110f17;
    --yellow: #ffd23f;
    --cyan: #3ee6ff;
    --pink: #ff4f9a;
    --pixel: "Press Start 2P", monospace;
    --retro: "VT323", monospace;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--retro);
    font-size: 22px;
    /* VT323 joins "fi" into one glyph; keep code readable. */
    font-variant-ligatures: none;
    line-height: 1.25;
}

.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 48px 16px 64px;
}

/* Header */
/* The header spans the page (the language switch sits on the right);
   the text stays at a readable width. */
.intro .lead {
    max-width: 700px;
}

.eyebrow {
    margin: 0;
    color: var(--cyan);
    font: 10px/1.6 var(--pixel);
    text-transform: uppercase;
}

h1 {
    margin: 20px 0 0;
    color: var(--yellow);
    font: clamp(28px, 7.5vw, 64px)/1 var(--pixel);
    text-transform: uppercase;
    text-shadow: 5px 5px 0 var(--pink);
}

.lead {
    margin: 24px 0 0;
    color: var(--muted);
    font-size: 24px;
}

/* Canvas + control panel */
.stage {
    display: grid;
    gap: 32px;
    margin-top: 40px;
    align-items: start;
}

@media (min-width: 820px) {
    .stage {
        grid-template-columns: minmax(0, 1fr) 300px;
    }
}

.cabinet {
    padding: 12px;
    background: #15131c;
    border: 4px solid var(--fg);
    box-shadow: 8px 8px 0 var(--cyan);
}

.screen {
    position: relative;
    background: #000;
    border: 4px solid #000;
}

/* Faint CRT scanlines. */
.screen::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, 0.18) 2px 4px);
}

/* Three.js sizes the drawing buffer from this box (see onWindowResize). */
canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    background: #000;
}

.panel {
    padding: 20px;
    background: var(--panel);
    border: 4px solid var(--yellow);
    box-shadow: 6px 6px 0 var(--line);
}

/* Pixel buttons: flat face, hard bottom edge that "presses" in. */
button {
    cursor: pointer;
    border: 0;
    background: var(--fg);
    color: var(--bg);
    font: 12px/1 var(--pixel);
    text-transform: uppercase;
    box-shadow: 0 4px 0 var(--muted);
}

button:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: none;
}

button:disabled {
    cursor: default;
    opacity: 0.3;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 4px;
}

.panel-label {
    margin: 0;
    color: var(--yellow);
    font: 12px/1.6 var(--pixel);
    text-transform: uppercase;
}

/* Speed: four pixel buttons; the active one turns pink. */
.speeds {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.speeds button {
    padding: 12px 8px;
}

.speeds button[aria-pressed="true"] {
    background: var(--pink);
    box-shadow: 0 4px 0 #a32a62;
}

.stats {
    display: grid;
    gap: 16px;
    margin: 28px 0 0;
    padding-top: 20px;
    border-top: 4px dashed var(--line);
}

.stats dt {
    color: var(--muted);
}

.stats dd {
    margin: 6px 0 0;
    color: var(--cyan);
    font: 18px/1.2 var(--pixel);
}

/* Info cards */
.info {
    display: grid;
    gap: 24px;
    margin-top: 48px;
}

@media (min-width: 760px) {
    .info {
        grid-template-columns: repeat(3, 1fr);
    }
}

.card {
    --accent: var(--yellow);
    padding: 20px;
    background: var(--panel);
    border: 4px solid var(--accent);
    box-shadow: 6px 6px 0 var(--line);
}

.card-cyan {
    --accent: var(--cyan);
}

.card-pink {
    --accent: var(--pink);
}

.card h2 {
    margin: 0 0 16px;
    color: var(--accent);
    font: 12px/1.6 var(--pixel);
    text-transform: uppercase;
}

.card p {
    margin: 0;
    color: var(--muted);
}

.card sup {
    line-height: 0;
}

code {
    color: var(--fg);
    font-family: var(--retro);
}

/* Links */
.links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
    margin-top: 48px;
}

.links a {
    color: var(--fg);
    font: 10px/1.6 var(--pixel);
    text-decoration: none;
    text-transform: uppercase;
}

.links a::before {
    content: "▶ ";
    color: var(--pink);
}

.links a:hover {
    color: var(--yellow);
}

/* Eyebrow on the left, EN / ES switch (from ../i18n.js) on the right. */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.lang-switch {
    display: flex;
    gap: 8px;
    align-items: center;
    font: 10px/1.6 var(--pixel);
    color: var(--muted);
}

.lang-switch a {
    color: var(--muted);
    text-decoration: none;
}

.lang-switch a:hover,
.lang-switch a:focus-visible {
    color: var(--fg);
}

.lang-switch a[aria-current] {
    color: var(--yellow);
}
