/* AMBER PROTOCOL — style.css
   The canvas is the game; this is the paperwork around it. Menus read as InGen
   site documents: stencilled headings, amber rules, a typewriter face. The
   phone layer is a body class, never a second stylesheet. */

:root {
  --ink: #d9d2bd;
  --ink-dim: #8fa39b;
  --ink-faint: #5c6a70;
  --amber: #e0a33a;
  --crimson: #cf4442;
  --teal: #5fd39a;
  --panel: rgba(10, 18, 22, 0.93);
  --edge: rgba(150, 170, 175, 0.24);
  --mono: "Courier New", "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  background: #070c10; color: var(--ink);
  font-family: var(--mono);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#view {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  background: #070c10;
  touch-action: none;
}

/* ─────────────── screens ─────────────── */
#screens { position: fixed; inset: 0; pointer-events: none; }

.screen {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  padding: 3vh 3vw;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(20, 40, 44, 0.55), rgba(4, 8, 11, 0.92) 70%);
  backdrop-filter: blur(2px);
  pointer-events: auto;
  overflow-y: auto;
}
.screen.show { display: flex; }

.plate {
  width: min(560px, 94vw);
  max-height: 94vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-left: 4px solid var(--amber);
  padding: 26px 28px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.plate.wide { width: min(880px, 96vw); }

.stamp {
  font-size: 11px; letter-spacing: 0.22em;
  color: var(--amber); opacity: 0.8;
  border-bottom: 1px solid rgba(224, 163, 58, 0.3);
  padding-bottom: 8px; margin-bottom: 16px;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 4px; font-size: clamp(30px, 6vw, 58px);
  letter-spacing: 0.12em; line-height: 0.98; font-weight: 700;
}
h1 span { display: block; color: var(--amber); }
h2 {
  margin: 0 0 12px; font-size: clamp(18px, 3vw, 26px);
  letter-spacing: 0.16em; color: var(--ink);
}
h3 {
  margin: 14px 0 6px; font-size: 12px; letter-spacing: 0.2em;
  color: var(--amber); text-transform: uppercase;
}

.sub { color: var(--ink-dim); font-size: 13px; letter-spacing: 0.08em; margin: 0 0 20px; }
.note { color: var(--ink-dim); font-size: 13px; line-height: 1.6; margin: 10px 0 16px; }
.note.small { font-size: 12px; }
.tip {
  color: var(--amber); font-size: 12px; font-style: italic;
  border-left: 2px solid rgba(224, 163, 58, 0.4);
  padding-left: 10px; margin: 14px 0;
}
.foot { color: var(--ink-faint); font-size: 11px; line-height: 1.6; margin: 18px 0 0; }
.err { color: var(--crimson); font-size: 12px; min-height: 16px; margin: 8px 0 0; }

/* ─────────────── buttons ─────────────── */
.menu { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 0; }

button {
  font-family: var(--mono);
  font-size: 14px; letter-spacing: 0.14em;
  color: var(--ink);
  background: rgba(28, 40, 46, 0.7);
  border: 1px solid var(--edge);
  padding: 12px 16px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.08s;
}
button.big { font-size: 16px; padding: 14px 18px; }
button em {
  display: block; margin-top: 5px;
  font-style: normal; font-size: 10px; letter-spacing: 0.14em;
  color: var(--ink-faint);
}
button.navon em, button:hover em { color: var(--amber); }
button:hover { background: rgba(46, 64, 70, 0.85); border-color: rgba(224, 163, 58, 0.5); }
button:active { transform: translateY(1px); }

/* the pad cursor and the mouse hover deliberately look the same, so nobody has
   to learn two visual languages for "this is the thing you are about to press" */
button.navon, .row.navon, input.navon {
  background: rgba(224, 163, 58, 0.16);
  border-color: var(--amber);
  color: #fff;
  outline: none;
  box-shadow: inset 3px 0 0 var(--amber);
}

/* ─────────────── rows and inputs ─────────────── */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 6px 0;
  border: 1px solid var(--edge);
  background: rgba(20, 30, 34, 0.5);
}
.row .lbl { flex: 0 0 auto; font-size: 12px; letter-spacing: 0.16em; color: var(--ink-dim); }
.row .lbl em { color: var(--ink-faint); font-style: normal; }
.row .val { margin-left: auto; color: var(--amber); font-size: 15px; letter-spacing: 0.16em; }
.row .hint { color: var(--ink-faint); font-size: 12px; }
.row[data-nav] { cursor: pointer; }

input[type=text] {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.14em;
  color: var(--ink);
  background: rgba(8, 14, 18, 0.8);
  border: 1px solid var(--edge);
  padding: 8px 10px;
}
input[type=text]:focus { outline: none; border-color: var(--amber); }
input::placeholder { color: var(--ink-faint); letter-spacing: 0.08em; }

/* ─────────────── lobby ─────────────── */
.code-box {
  display: flex; align-items: center; gap: 16px;
  border: 1px solid rgba(224, 163, 58, 0.4);
  background: rgba(224, 163, 58, 0.07);
  padding: 12px 16px; margin: 10px 0;
}
.code-box .lbl { font-size: 11px; letter-spacing: 0.2em; color: var(--ink-dim); }
.code {
  margin-left: auto;
  font-size: clamp(28px, 6vw, 44px); letter-spacing: 0.3em;
  color: var(--amber); font-weight: 700;
}
.roster {
  min-height: 78px; padding: 10px 12px;
  border: 1px solid var(--edge); background: rgba(20, 30, 34, 0.5);
  font-size: 14px; line-height: 1.8; letter-spacing: 0.1em;
}

/* ─────────────── tables ─────────────── */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left; color: var(--amber); font-weight: 400;
  letter-spacing: 0.18em; font-size: 10px;
  border-bottom: 1px solid rgba(224, 163, 58, 0.3);
  padding: 6px 8px 6px 0;
}
td {
  padding: 5px 8px 5px 0; color: var(--ink-dim);
  border-bottom: 1px dotted rgba(120, 140, 145, 0.18);
  letter-spacing: 0.06em;
}
td:first-child { color: var(--ink); }
.brieftable { max-height: 34vh; overflow-y: auto; margin: 8px 0; }

.ctlgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 4px 26px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.stats > div {
  border: 1px solid var(--edge); background: rgba(20, 30, 34, 0.5);
  padding: 10px 12px;
}
.stats span { display: block; font-size: 10px; letter-spacing: 0.2em; color: var(--ink-faint); }
.stats b { font-size: 22px; color: var(--amber); font-weight: 700; }

/* ─────────────── rotate nag ─────────────── */
#rotate { display: none; }

/* ─────────────── phone layer ───────────────
   One body class. Nothing above is duplicated: this only moves and resizes
   what is already there, which is why a rotation cannot desynchronise it. */
body.touch .plate { padding: 18px 18px 16px; }
body.touch button { padding: 14px 14px; font-size: 15px; }
body.touch button.big { font-size: 16px; }
body.touch .note { font-size: 12px; }
body.touch .foot { display: none; }
body.touch .brieftable { max-height: 26vh; }

@media (orientation: portrait) and (max-width: 900px) {
  body.touch #rotate {
    display: flex; position: fixed; inset: 0; z-index: 50;
    align-items: center; justify-content: center;
    background: #070c10; text-align: center;
  }
  body.touch .rot-icon { font-size: 54px; color: var(--amber); animation: spin 2.6s ease-in-out infinite; }
  body.touch #rotate p { letter-spacing: 0.2em; font-size: 14px; margin: 18px 0 6px; }
  body.touch #rotate small { color: var(--ink-faint); font-size: 11px; }
}
@keyframes spin { 0%, 60% { transform: rotate(0deg); } 80%, 100% { transform: rotate(90deg); } }

/* short landscape phones: the plates have to fit between the notches */
@media (orientation: landscape) and (max-height: 460px) {
  body.touch .screen { padding: 6px 10px; }
  body.touch .plate { padding: 12px 16px; max-height: 96vh; }
  body.touch h1 { font-size: 30px; }
  body.touch h2 { font-size: 17px; margin-bottom: 6px; }
  body.touch .menu { flex-direction: row; flex-wrap: wrap; }
  body.touch .menu button { flex: 1 1 40%; }
  body.touch .stamp { margin-bottom: 8px; padding-bottom: 5px; }
  body.touch .ctlgrid { grid-template-columns: repeat(3, 1fr); font-size: 11px; }
}

/* while a menu is open, the canvas must not eat the taps meant for it */
body.menuing #view { pointer-events: none; }

/* ─────────────── the title screen ───────────────
   Every other screen is a document on a scrim: a panel, centred, over a
   blurred game. The title is the one screen that is a *picture*, so it gets
   none of that — no scrim, no blur, no plate — and the lockup is anchored into
   the column the poster leaves quiet for it (js/title.js, QUIET = 0.46).

   The split is deliberate: the canvas owns the image and the DOM owns the
   words, because the words have to stay crisp, reflow on a phone, and remain
   real <button>s for the gamepad cursor to walk. Drawing the type on the
   canvas would have cost all three. Nothing here is positioned against a pixel
   in the artwork — the only contract between the two halves is "the left of
   the frame is dark", which holds at every aspect ratio. */
#sc-title.bare {
  background: none;
  backdrop-filter: none;
  align-items: center;
  justify-content: flex-start;
  padding: 4vh 0 4vh 5vw;
}

.lockup {
  /* 40vw, not 44: the poster keeps its left 46% quiet (js/title.js, QUIET)
     and the lockup has to finish inside that at every width, not just at the
     one it was designed on. */
  width: min(430px, 40vw);
  max-height: 92vh;
  overflow-y: auto;
  padding-left: 18px;
  border-left: 2px solid var(--amber);
  /* the type sits over artwork, so it carries its own shadow rather than a box */
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85), 0 0 3px rgba(0, 0, 0, 0.7);
}

.lockup .stamp { border-bottom: none; padding-bottom: 0; margin-bottom: 14px; font-size: 10px; }

.lockup h1 {
  font-size: clamp(34px, 5.2vw, 62px);
  letter-spacing: 0.14em;
  line-height: 0.92;
  margin: 0;
}
/* the two words are one lockup: the second is indented to hang off the first,
   which is what stops a two-line title reading as two titles */
.lockup h1 span { display: block; color: var(--amber); margin-left: 0.09em; }

.lockup .rule {
  height: 1px; margin: 16px 0 12px;
  background: linear-gradient(90deg, var(--amber), rgba(224, 163, 58, 0));
}

.lockup .sub {
  margin: 0 0 4px;
  font-size: 12px; letter-spacing: 0.24em; color: var(--ink-dim);
}
.lockup .sub i {
  display: block; margin-top: 5px;
  font-style: normal; font-size: 11px; letter-spacing: 0.14em; color: var(--ink-faint);
}

.lockup .foot { margin-top: 16px; max-width: 34em; }

/* The menu loses its boxes. Filled panels are right on a document screen and
   wrong on a poster — five grey slabs down the left of an image read as a
   toolbar. A rule that lights up and a caret that steps in says the same thing
   and lets the artwork through. */
.menu.lean { gap: 0; margin-top: 20px; }
.menu.lean button {
  background: none;
  border: none;
  border-bottom: 1px solid rgba(150, 170, 175, 0.16);
  box-shadow: none;
  padding: 11px 6px 11px 22px;
  position: relative;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
}
.menu.lean button::before {
  content: '▸';
  position: absolute; left: 2px;
  color: var(--amber);
  opacity: 0; transform: translateX(-5px);
  transition: opacity 0.14s, transform 0.14s;
}
.menu.lean button.navon, .menu.lean button:hover {
  background: linear-gradient(90deg, rgba(224, 163, 58, 0.14), rgba(224, 163, 58, 0));
  border-bottom-color: rgba(224, 163, 58, 0.55);
  color: #fff;
  box-shadow: none;
}
.menu.lean button.navon::before, .menu.lean button:hover::before {
  opacity: 1; transform: translateX(0);
}
.menu.lean button em { letter-spacing: 0.12em; }

/* phones: the poster keeps its subject on the right at every size, so the
   lockup only has to get out of its own way */
/* 46vw, not 52: the poster's quiet column is 46% of the frame (js/title.js,
   QUIET) and the lockup has to finish inside it, which on a 844-wide phone a
   52vw box does not quite do. */
body.touch .lockup { width: min(340px, 46vw); padding-left: 14px; }
body.touch #sc-title.bare { padding-left: 4vw; }
body.touch .lockup .foot { display: none; }

@media (orientation: landscape) and (max-height: 460px) {
  body.touch #sc-title.bare { padding: 2vh 0 2vh 4vw; }
  body.touch .lockup h1 { font-size: 30px; }
  body.touch .lockup .rule { margin: 9px 0 7px; }
  body.touch .lockup .stamp { margin-bottom: 8px; }
  /* the shared short-landscape rule turns menus into a two-column grid; the
     lean menu is a list of rules and has to opt out or the rules collide */
  body.touch .menu.lean { flex-direction: column; }
  body.touch .menu.lean button { flex: none; padding: 8px 6px 8px 20px; font-size: 13px; }
}

/* Short viewports, touch or not. The phone rules above are gated on body.touch
   because that is where the rest of the phone layer lives, but a desktop
   window dragged down to 400px tall has exactly the same problem and no touch
   class to catch it — the lockup scrolls instead of fitting, which puts the
   blurb below the fold and, on a bad day, a menu item with it. */
@media (max-height: 520px) {
  .lockup .foot { display: none; }
  .lockup h1 { font-size: clamp(26px, 4.4vw, 44px); }
  .lockup .rule { margin: 10px 0 8px; }
  .lockup .stamp { margin-bottom: 8px; }
  .menu.lean { margin-top: 12px; }
  .menu.lean button { padding: 8px 6px 8px 20px; }
}
