/* santi quiroz · PS1 menu home. Cel Cut palette (plum night, one warm orange line, paper type, green only for the way in). */
:root {
  --bg: #030202; --paper: #f4e9dc; --dim: rgba(244,233,220,.6); --faint: rgba(244,233,220,.34);
  --amber: #ff9d55; --gold: #efad78; --plum: #401b33; --green: #8fcdb3;
  --btn: #140a11; --btn-hi: #2c1526; --line: rgba(244,233,220,.14);
  --ui: "Avenir Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Avenir Next Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--paper); }
body {
  min-height: 100svh; display: flex; flex-direction: column;
  font: 15px/1.5 var(--ui); -webkit-tap-highlight-color: transparent;
  background: radial-gradient(120% 70% at 50% 38%, #1a0a15 0%, var(--bg) 62%) fixed;
}
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 16px; top: -80px; z-index: 10; padding: 8px 12px; background: var(--paper); color: var(--bg); font-size: 13px; }
.skip-link:focus { top: 12px; }

/* top bar, as on the film */
.bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: max(14px, env(safe-area-inset-top)) 16px 10px; }
.mark { color: var(--paper); text-decoration: none; font-weight: 600; font-size: 15px; letter-spacing: .01em; }
.bar-links { display: flex; gap: 18px; }
.bar-links a, .index a { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--dim); text-decoration: none; }
.bar-links a:hover, .index a:hover { color: var(--paper); }

/* the console screen */
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 0 16px 6px; -webkit-user-select: none; user-select: none; }
.screen-wrap {
  position: relative; container-type: inline-size; aspect-ratio: 4 / 3; background: #000;
  width: min(100%, max(360px, calc((100svh - 190px) * 4 / 3)), 1080px);
  box-shadow: 0 0 0 1px var(--line), 0 28px 90px rgba(64,27,51,.5);
}
#screen { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: manipulation; cursor: pointer; }

/* words over the panel: readable HTML type, typed out */
.words {
  position: absolute; left: 10.5%; right: 10.5%; top: 20.5%; bottom: 19.5%; overflow: auto; scrollbar-width: none;
  font-family: var(--ui); font-size: clamp(12px, 2.3cqw, 19px); line-height: 1.5; color: var(--paper);
  text-shadow: 1px 1px 0 rgba(28,7,20,.95); -webkit-user-select: text; user-select: text;
  padding: .8em 0; -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 .8em, #000 calc(100% - .8em), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 .8em, #000 calc(100% - .8em), transparent 100%);
}
/* Phones: the words take the whole panel under the title, down to just above the prompts. */
@container (max-width: 520px) {
  .words { top: 16%; bottom: 10.5%; font-size: 11px; line-height: 1.32; padding: .35em 0; }
  .words p { margin-bottom: .45em; }
  .wayin { top: 15.5%; bottom: 11.5%; }
}
.words::-webkit-scrollbar { display: none; }
.words p { margin: 0 0 .65em; }
.words .stance { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gold); font-size: 1.06em; }
.words .lead { color: var(--dim); }
.words .caret { display: inline-block; width: .5em; height: 1em; margin-left: 1px; vertical-align: -.14em; background: var(--paper); animation: caret .266s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* the way in: the request form inside the panel */
.wayin {
  position: absolute; left: 9%; right: 9%; top: 22.5%; bottom: 20%; overflow: auto; scrollbar-width: none;
  display: flex; flex-direction: column; gap: .5em; margin: 0;
  font-size: clamp(11px, 2.05cqw, 16px); text-shadow: 1px 1px 0 rgba(28,7,20,.95);
}
.wayin::-webkit-scrollbar { display: none; }
.words[hidden], .wayin[hidden] { display: none; }
.wayin-sub { margin: 0; }
.wayin label { display: flex; flex-direction: column; gap: .3em; font-size: .78em; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.wayin input, .wayin textarea {
  font: 16px/1.3 var(--ui); letter-spacing: 0; text-transform: none; color: var(--paper);
  background: rgba(10,3,8,.62); border: 1px solid rgba(244,233,220,.3); border-radius: 0; padding: .4em .55em; resize: none;
  -webkit-user-select: text; user-select: text;
}
.wayin input:focus, .wayin textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.wayin [aria-invalid=true] { border-color: var(--amber); }
.opt { text-transform: none; letter-spacing: 0; color: var(--faint); }
.hp { position: absolute; left: -9999px; }
.wayin-msg { margin: 0; min-height: 1.3em; color: var(--gold); }
.wayin-send {
  align-self: flex-start; font: 600 12px/1 var(--ui); letter-spacing: .2em; text-transform: uppercase;
  color: var(--bg); background: var(--green); border: 0; padding: .9em 1.3em; cursor: pointer;
}
.wayin-send:disabled { opacity: .5; cursor: default; }
.wayin-done p { margin: 0 0 .5em; }
.wayin-done:focus { outline: none; }
.wayin label .opt { display: inline; }
.wayin.sent label, .wayin.sent .wayin-send, .wayin.sent .wayin-sub { display: none; }

/* hidden field that brings up the phone keyboard on the name screen */
.namekey { position: absolute; left: 50%; top: 50%; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; font-size: 16px; pointer-events: none; }

/* on-screen controller (touch) */
#pad { display: none; width: min(100%, 420px); justify-content: space-between; align-items: center; }
.dpad { display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(3, 52px); }
.dpad [data-k=up] { grid-area: 1/2; } .dpad [data-k=left] { grid-area: 2/1; }
.dpad [data-k=right] { grid-area: 2/3; } .dpad [data-k=down] { grid-area: 3/2; }
.face { display: grid; grid-template-columns: repeat(2, 60px); grid-template-rows: repeat(2, 60px); gap: 4px; }
.face [data-k=tri] { grid-area: 1/2; } .face [data-k=o] { grid-area: 2/2; } .face [data-k=x] { grid-area: 2/1; }
#pad button { font: 20px/1 var(--mono); color: var(--paper); background: var(--btn); border: 1px solid var(--line); border-radius: 10px; touch-action: none; cursor: pointer; }
#pad .face button { border-radius: 50%; }
#pad button.on { background: var(--btn-hi); border-color: rgba(255,157,85,.5); }

.foot { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; align-items: center; color: var(--faint); font: 12px/1.5 var(--mono); text-align: center; }
.foot kbd { font: inherit; color: var(--dim); }
.foot button { font: inherit; color: var(--paper); background: var(--btn); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.foot button[hidden] { display: none; }

/* plain links to every page: the reading route, and the no-JS fallback */
.index { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; padding: 8px 16px max(18px, env(safe-area-inset-bottom)); }
.index h2 { width: 100%; margin: 0; }
.nojs { max-width: 34rem; margin: 2rem auto; padding: 0 16px; color: var(--dim); }

.mark, .bar-links a { white-space: nowrap; }
@media (max-width: 440px) {
  .bar { gap: 10px; }
  .bar-links { gap: 12px; }
  .bar-links a { font-size: 10px; letter-spacing: .14em; }
}
@media (pointer: coarse) {
  #pad { display: flex; }
  .screen-wrap { width: min(100%, calc((100svh - 330px) * 4 / 3)); }
  #keys { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .words .caret { animation: none; }
}

/* Options > Screen > CRT: curved glass, a soft vignette and a faint reflection over the pixels. */
.screen-wrap.crt { border-radius: 4.5% / 6%; overflow: hidden; }
.screen-wrap.crt::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background:
    radial-gradient(120% 90% at 50% 50%, transparent 58%, rgba(0,0,0,.55) 100%),
    linear-gradient(160deg, rgba(255,255,255,.07) 0%, transparent 32%);
  box-shadow: inset 0 0 40px rgba(0,0,0,.6), inset 0 0 3px rgba(255,220,200,.15);
}
