/* Save Your Game: a game's save screen. The pixel face is for headings and buttons only: its 5 and S, and B and G,
   are too alike for game names and day counts, so those use the reading face.
    Deep indigo menus, pixel-cut frames made with box-shadow (so focus
   rings are never clipped), a yellow "save" colour for actions, and a health bar for the time a game has left.
   Pixelify Sans for headings, Atkinson Hyperlegible Next for reading. */

@font-face { font-family: "Pixelify Sans"; src: url("pixelify-sans.woff") format("woff"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("atkinson-next-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("atkinson-next-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #15122b;          /* the menu screen */
  --panel: #1d1939;       /* save slots */
  --panel-2: #262150;     /* the letter */
  --line: #423b7a;        /* pixel frames */
  --text: #f3efe2;
  --soft: #c2bcdf;
  --save: #ffd447;        /* actions: the colour of a save icon */
  --save-deep: #f5bd1f;
  --link: #93d8ff;
  --hp-high: #5fe08b;
  --hp-mid: #ffb84d;
  --hp-low: #ff6470;
  --pixel: "Pixelify Sans", "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --read: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --px: 4px;              /* one "pixel" of the frames */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--read); font-size: 1.0625rem; line-height: 1.6; }
[hidden] { display: none !important; }
a { color: var(--link); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { color: #c3e9ff; }
:focus-visible { outline: 3px solid var(--save); outline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--pixel); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: 0.01em; }
/* The pixel face's fi and fl ligatures come out as odd shapes, so they're off everywhere. */
h1, h2, h3, h4, .brand, .btn, .slot-kicker, legend { font-variant-ligatures: none; }
p { margin: 0 0 1rem; }
.wrap { max-width: 70rem; margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--save); color: var(--bg); padding: 0.6rem 1rem; z-index: 10; font-weight: 700; }
.skip:focus { left: 1rem; top: 1rem; }

/* A pixel frame: four borders, no corners. */
.slot {
  background: var(--panel);
  box-shadow:
    0 calc(-1 * var(--px)) 0 0 var(--line),
    0 var(--px) 0 0 var(--line),
    calc(-1 * var(--px)) 0 0 0 var(--line),
    var(--px) 0 0 0 var(--line);
  margin: var(--px);
}

/* ---------------------------------------------------------------- header */
.site-header { border-bottom: var(--px) solid var(--panel); }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 0.9rem; padding-bottom: 0.9rem; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--text); text-decoration: none; font-family: var(--pixel); font-weight: 700; font-size: 1.35rem; white-space: nowrap; }
.disk { width: 2.25rem; height: 2.25rem; flex: none; }
.disk-body { fill: var(--save); }
.disk-shutter { fill: #4a4290; }
.disk-label { fill: var(--text); }
.disk-line { fill: #8a83b8; }
.header-links { display: flex; flex-wrap: wrap; gap: 0.35rem 1.4rem; }
.header-links a { color: var(--soft); }
.header-links a:hover { color: var(--text); }

/* ---------------------------------------------------------------- hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 2.5rem; align-items: center; padding-top: 3.5rem; padding-bottom: 3rem; }
.hero h1 { font-size: clamp(2.35rem, 1.4rem + 3.6vw, 4.1rem); line-height: 1.02; margin-bottom: 1.4rem; }
.hero h1 span { display: block; }
.lede { font-size: 1.22rem; line-height: 1.55; color: var(--soft); max-width: 36rem; margin-bottom: 1.75rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 1.1rem; }
.fine-print { color: var(--soft); font-size: 0.95rem; margin: 0; }

.next-slot { padding: 1.6rem 1.6rem 1.4rem; }
.slot-kicker { font-family: var(--pixel); color: var(--soft); font-size: 1rem; margin: 0 0 0.4rem; }
.slot-name { font-weight: 700; font-size: 1.55rem; line-height: 1.2; margin: 0 0 0.9rem; }
.slot-days { font-weight: 700; font-size: 2.6rem; line-height: 1; margin: 0 0 0.7rem; color: var(--save); letter-spacing: -0.01em; }
.slot-date { color: var(--soft); margin: 0.7rem 0 0; font-size: 0.98rem; }

/* The health bar: one segment for every ~18 days left, out of a year. */
.bar { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; height: 1.1rem; }
.bar span { background: #2e2a58; }
.bar.high span.on { background: var(--hp-high); }
.bar.mid span.on { background: var(--hp-mid); }
.bar.low span.on { background: var(--hp-low); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--pixel); font-weight: 700; font-size: 1.12rem; line-height: 1.1; text-decoration: none; cursor: pointer;
  padding: 0.85rem 1.3rem; border: 0; margin: var(--px); color: var(--bg); background: var(--save);
  box-shadow: 0 calc(-1 * var(--px)) 0 0 var(--save), 0 var(--px) 0 0 var(--save-deep), calc(-1 * var(--px)) 0 0 0 var(--save), var(--px) 0 0 0 var(--save);
}
.btn:hover { color: var(--bg); background: #ffe07a; }
.btn:active { transform: translateY(2px); }
.btn-ghost { background: transparent; color: var(--text); box-shadow: 0 calc(-1 * var(--px)) 0 0 var(--line), 0 var(--px) 0 0 var(--line), calc(-1 * var(--px)) 0 0 0 var(--line), var(--px) 0 0 0 var(--line); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-small { font-size: 0.98rem; padding: 0.6rem 0.95rem; }

/* ---------------------------------------------------------------- sections */
.block { padding-top: 3.5rem; padding-bottom: 1rem; }
.block h2 { font-size: clamp(1.8rem, 1.3rem + 1.6vw, 2.5rem); margin-bottom: 0.8rem; }
.section-intro { color: var(--soft); max-width: 46rem; }
.notice { background: var(--panel); padding: 1rem 1.2rem; }

/* The list of games */
.slots { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); gap: 1.4rem; }
.game { padding: 1.3rem 1.35rem 1.2rem; display: flex; flex-direction: column; }
.game h3 { font-family: var(--read); font-size: 1.35rem; line-height: 1.2; margin-bottom: 0.35rem; }
.game-when { color: var(--soft); margin: 0 0 0.85rem; font-size: 0.98rem; }
.game-days { font-weight: 700; font-size: 1.45rem; color: var(--text); margin: 0 0 0.5rem; }
.game .bar { height: 0.8rem; margin-bottom: 1rem; }
.game-facts { margin: 0 0 1rem; font-size: 0.98rem; }
.game-facts dt { font-weight: 700; color: var(--text); }
.game-facts dd { margin: 0 0 0.55rem; color: var(--soft); }
.game-note { font-size: 0.95rem; color: var(--hp-mid); margin: 0 0 1rem; }
.game-foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
.game-foot .source { font-size: 0.9rem; margin: 0; }
.gone-title { font-size: 1.5rem; margin: 3rem 0 0.6rem; }
.game.is-gone { opacity: 0.85; }

/* The request writer */
.writer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 2.5rem; align-items: start; margin-top: 1.75rem; }
.field-group { border: 0; padding: 0; margin: 0 0 2rem; min-width: 0; }
.field-group legend { font-family: var(--pixel); font-weight: 700; font-size: 1.35rem; padding: 0; margin-bottom: 0.7rem; }
.label { display: block; font-weight: 700; margin: 0.9rem 0 0.35rem; }
.optional { font-weight: 400; color: var(--soft); }
.hint { color: var(--soft); font-size: 0.97rem; margin: 0.2rem 0 0.6rem; }
input[type="text"], input[type="email"], select {
  width: 100%; font: inherit; color: var(--text); background: var(--panel); border: 0; padding: 0.7rem 0.85rem; margin: var(--px) 0;
  box-shadow: 0 calc(-1 * var(--px)) 0 0 var(--line), 0 var(--px) 0 0 var(--line), calc(-1 * var(--px)) 0 0 0 var(--line), var(--px) 0 0 0 var(--line);
  border-radius: 0;
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h10v2H8v2H6v2H4V4H2V2H0z' fill='%23ffd447'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.9rem center; background-size: 0.75rem; padding-right: 2.4rem; }
input::placeholder { color: #8f88b8; }
input:focus-visible, select:focus-visible { outline-offset: 6px; }
.choice { display: flex; gap: 0.7rem; align-items: center; padding: 0.55rem 0.3rem; cursor: pointer; }
.choice input { width: 1.25rem; height: 1.25rem; accent-color: var(--save); margin: 0; flex: none; }

.letter-panel { padding: 1.4rem 1.4rem 1.3rem; position: sticky; top: 1rem; }
.letter-panel h3 { font-size: 1.4rem; margin-bottom: 0.7rem; }
.letter-subject { font-size: 0.98rem; margin: 0 0 0.6rem; }
.label-inline { font-weight: 700; color: var(--soft); }
.letter {
  white-space: pre-wrap; word-wrap: break-word; font-family: var(--read); font-size: 0.98rem; line-height: 1.55; color: var(--text);
  background: var(--panel-2); padding: 1rem 1.1rem; margin: 0 0 1rem; max-height: 30rem; overflow: auto;
}
.letter-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.copy-status { min-height: 1.6em; color: var(--hp-high); font-weight: 700; margin: 0.5rem 0 0.4rem; }
.copy-fallback { width: 100%; min-height: 10rem; font: inherit; background: var(--panel-2); color: var(--text); border: 0; padding: 0.8rem; }
.send { border-top: var(--px) solid var(--panel-2); padding-top: 1rem; margin-top: 0.4rem; }
.send h4 { font-size: 1.15rem; margin-bottom: 0.6rem; }
.routes { list-style: none; margin: 0 0 0.8rem; padding: 0; }
.routes li { margin: 0 0 0.75rem; }
.routes .route-how { display: block; color: var(--soft); font-size: 0.95rem; }
.send-after, .sources, .source { color: var(--soft); font-size: 0.93rem; }

/* Checklist with pixel ticks */
.checklist { list-style: none; margin: 1.5rem 0 0; padding: 0; max-width: 48rem; }
.checklist li { position: relative; padding: 0 0 1.1rem 2.4rem; }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 0.2rem; width: 1.3rem; height: 1.3rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 13' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h13v13H0z' fill='%23262150'/%3E%3Cpath d='M2 6h2v2h2v-2h1V5h1V4h1V3h2v2h-1v1H9v1H8v1H7v1H6v1H4V9H3V8H2z' fill='%23ffd447'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* FAQ */
details { border-top: var(--px) solid var(--panel); padding: 0.9rem 0; max-width: 48rem; }
details:last-of-type { border-bottom: var(--px) solid var(--panel); }
summary { cursor: pointer; font-weight: 700; font-size: 1.08rem; }
details[open] summary { margin-bottom: 0.7rem; }

.about p { max-width: 46rem; color: var(--soft); }

.site-footer { margin-top: 4rem; padding: 2rem 0 3rem; border-top: var(--px) solid var(--panel); color: var(--soft); font-size: 0.95rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

@media (max-width: 52rem) {
  .hero { grid-template-columns: 1fr; padding-top: 2.25rem; gap: 2rem; }
  .writer { grid-template-columns: 1fr; }
  .letter-panel { position: static; }
}
@media (max-width: 30rem) {
  .header-links { gap: 0.3rem 1rem; font-size: 0.95rem; }
  .btn { width: calc(100% - 2 * var(--px)); }
  .slot-days { font-size: 2.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:active { transform: none; }
}
@media print {
  body { background: #fff; color: #000; }
  .site-header, .hero, #games, #before, #questions, .about, .site-footer, .writer-form, .letter-actions, .send { display: none; }
  .letter { background: none; color: #000; max-height: none; }
  .slot { box-shadow: none; background: none; }
}
