/* "Press Start 2P" by CodeMan38, SIL Open Font License; served from our own site (tools/fetch-web-vendor.sh) */
@font-face { font-family: "Press Start 2P"; src: url("fonts/press-start-2p.woff2") format("woff2"); font-display: swap; }

/* One type scale for every page, all in the pixel font:
   title 22 · heading 12 · body/labels 10 · fine print 8 · fields 12, with generous line height. */
:root {
  --bg: #1d1a2b;
  --shell: #5b4fa3;
  --shell-dark: #3f3578;
  --glass: #dfe9cf;
  --paper: #f6f9ef;
  --ink: #213018;
  --muted: #5f6f50;
  --line: #b7c4a3;
  --accent: #c8102e;
  --accent-dark: #7c0a1d;
  --night-ink: #f4f0e0;
  --night-soft: #c9c4ea;
  --night-faint: #8a84b8;
  --night-field: #14121f;

  --fs-title: 22px;
  --fs-head: 12px;
  --fs-body: 10px;
  --fs-fine: 8px;
  --fs-field: 12px;
  --lh: 1.9;

  font-family: "Press Start 2P", ui-monospace, monospace;
  -webkit-font-smoothing: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
.screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
[hidden] { display: none !important; }
p, h1, h2 { margin: 0; }

/* --- The GBA shell (gate + questions) --------------------------------------------------------------- */
.gba { background: var(--shell); border-radius: 28px 28px 56px 56px; padding: 26px 20px 38px;
       box-shadow: inset 0 -6px 0 var(--shell-dark), 0 12px 32px #0009; width: min(480px, 100%); }
.screen-glass { background: var(--glass); border-radius: 8px; padding: 26px 22px 24px; border: 6px solid #2b2b2b;
                box-shadow: inset 0 0 0 2px #c4d2b0; }

.masthead { text-align: center; margin-bottom: 26px; }
.title { font-size: var(--fs-title); letter-spacing: 3px; color: var(--accent); text-shadow: 2px 2px 0 #f3c3cb; }
.tagline { font-size: var(--fs-body); line-height: var(--lh); color: var(--muted); margin-top: 14px; }

.block { display: grid; gap: 14px; }
h2 { font-size: var(--fs-head); line-height: 1.6; color: var(--ink); }
.body { font-size: var(--fs-body); line-height: var(--lh); }
.fine { font-size: var(--fs-fine); line-height: var(--lh); color: var(--muted); text-align: center; }
.error { font-size: var(--fs-fine); line-height: var(--lh); color: var(--accent); min-height: 1em; }
.error:empty { display: none; }

label { display: grid; gap: 8px; font-size: var(--fs-body); line-height: 1.6; }
fieldset { border: 0; padding: 0; margin: 0; font-size: var(--fs-body); }
legend { line-height: 1.6; margin-bottom: 10px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin-right: 22px; }

input:not([type=radio]), textarea {
  font: inherit; font-size: var(--fs-field); line-height: 1.6; color: var(--ink); background: var(--paper);
  padding: 10px; width: 100%; border: 3px solid var(--ink); border-radius: 0; }
textarea { font-size: var(--fs-body); line-height: var(--lh); resize: vertical; }
input::placeholder, textarea::placeholder { color: #9aa58c; opacity: 1; }
input:focus, textarea:focus { outline: 3px solid var(--accent); outline-offset: 0; }
input[type=radio] { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }

button { font: inherit; font-size: var(--fs-head); letter-spacing: 1px; padding: 13px 14px; border: 0; border-radius: 22px;
         cursor: pointer; background: var(--accent); color: #fff; box-shadow: 0 4px 0 var(--accent-dark); }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-dark); }
button:disabled { opacity: .6; cursor: default; }
button.quiet { background: transparent; color: var(--night-faint); box-shadow: none; font-size: var(--fs-fine); }

/* The gate */
.code-row { display: flex; gap: 10px; }
.code-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 3px; text-align: center; }
.code-row button { padding: 10px 18px; border-radius: 18px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 28px 0; color: var(--muted); font-size: var(--fs-fine); }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 2px dashed var(--line); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.done { text-align: center; }

/* --- The game -------------------------------------------------------------------------------------- */
#play { flex-direction: column; gap: 12px; padding: 0; }
#game { width: min(100vw, 960px); height: min(100vh, 640px); aspect-ratio: 3 / 2; }
.keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px; padding: 0 16px; max-width: 960px;
        color: var(--night-soft); font-size: var(--fs-fine); line-height: var(--lh); }
.keys kbd { font: inherit; background: var(--shell-dark); border: 1px solid var(--night-faint); border-radius: 4px;
            padding: 2px 5px; color: #fff; }
.keys-tip { flex-basis: 100%; text-align: center; color: var(--night-faint); }
@media (hover: none) and (pointer: coarse) { .keys { display: none; } } /* touch devices get on-screen buttons */

/* --- The ending ------------------------------------------------------------------------------------ */
#closing { background: #000; align-items: flex-start; padding-top: max(56px, 9vh); }
.closing-card { color: var(--night-ink); width: min(520px, 100%); text-align: center; animation: fade 4s ease-in both; }
#closing-text { white-space: pre-line; font-size: var(--fs-head); line-height: 2.1; margin-bottom: 44px; }
.note, .note-thanks { display: grid; gap: 16px; animation: fade 2s 3s ease-in both; }
.note-thanks { animation-delay: 0s; }
.note label { display: block; font-size: var(--fs-body); line-height: var(--lh); color: var(--night-soft); }
.closing-card textarea, .share input { background: var(--night-field); color: var(--night-ink);
                                       border: 2px solid var(--shell); border-radius: 6px; }
.closing-card textarea:focus, .share input:focus { outline: none; border-color: var(--night-soft); }
.closing-card textarea::placeholder { color: #5d5880; }
.share-title { color: var(--night-soft); margin-top: 18px; }
.share { display: flex; gap: 10px; }
.share input { flex: 1; min-width: 0; font-size: var(--fs-body); }
.share button { padding: 10px 16px; border-radius: 18px; }
.closing-card .fine { color: var(--night-faint); min-height: 1.9em; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 380px) {
  :root { --fs-title: 18px; --fs-head: 11px; }
  .screen-glass { padding: 22px 16px 20px; }
}
