/* Sleekit: one hand-written stylesheet. Tokens, type, layout and components
   come from DESIGN.md sections 4 to 8 and design/reference.html; nothing else
   is used. One theme, dark, always. No gradients, shadows or images. */

/* ---------- fonts (self-hosted, SIL Open Font License; see fonts/) ---------- */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/fraunces-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- tokens (DESIGN.md section 4) ---------- */

:root {
  --peat: #17120E;
  --surface: #221A14;
  --surface-picked: #2B1D12;
  --line: #3A2D22;
  --line-strong: #806650;
  --cream: #F1E7D3;
  --muted: #B5A68C;
  --ember: #E8742A;
  --display: "Fraunces", Georgia, serif;
  --text: "Atkinson Hyperlegible", system-ui, sans-serif;
  --tab-bar: calc(67px + env(safe-area-inset-bottom, 0px));
  color-scheme: dark;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--peat); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--peat);
  color: var(--cream);
  font: 400 1.125rem/1.4 var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; } /* no double-tap zoom on a quick second tap */
a { color: inherit; }
p { margin: 0; }
svg { flex: none; }
:focus-visible { outline: 3px solid var(--ember); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- phone layout (DESIGN.md section 6) ---------- */

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tab-bar) + 16px);
}
.app--no-tabs { padding-bottom: 32px; }
.main { flex: 1; display: flex; flex-direction: column; }
.header {
  display: flex;
  flex-wrap: wrap; /* at 200% text on a narrow screen the pill drops below the wordmark */
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--cream);
  font: 600 1.625rem/1.1 var(--display);
  text-decoration: none;
}
.brand svg { width: 18px; height: 24px; color: var(--ember); }
.pill {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}
.section { padding: 16px 24px 0; }
.section--grow { flex: 1; }
h1 { margin: 4px 0 6px; font: 500 2rem/1.15 var(--display); overflow-wrap: anywhere; }
.secondary { margin: 0; font-size: 1rem; color: var(--muted); }
.secondary + .secondary { margin-top: 4px; }
.lead { margin: 0; }
.stack > * + * { margin-top: 16px; }

/* ---------- join page ---------- */

.join { text-align: center; padding-top: 48px; }
.tagline { margin: 8px 0 0; color: var(--muted); }

/* ---------- role card (DESIGN.md section 7) ---------- */

.role-card {
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
}
.role-card summary {
  list-style: none;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.role-card summary::-webkit-details-marker { display: none; }
.role-card summary::marker { content: ""; }
.role-card svg {
  width: 22px; height: 22px;
  fill: none; stroke: var(--ember); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.role-card p { margin: 0; padding: 0 16px 16px; }

/* ---------- name picker and primary button ---------- */

.picker { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.picker button {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 2px solid var(--surface);
  border-radius: 12px;
  text-align: left;
  overflow-wrap: anywhere;
}
.picker button svg {
  display: none;
  width: 22px; height: 22px;
  fill: none; stroke: var(--ember); stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
}
.picker button[aria-pressed="true"] {
  background: var(--surface-picked);
  border-color: var(--ember);
  font-weight: 700;
}
.picker button[aria-pressed="true"] svg { display: block; }

.primary {
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  background: var(--ember);
  color: var(--peat);
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.primary:disabled { background: var(--surface); color: var(--muted); cursor: default; }
/* The Confirm button, or once saved its quiet line, sits fixed on the tab bar while a
   long list scrolls under it. It reaches down to the tab bar, so nothing scrolling
   under it shows in a gap and looks like a button half hidden (DESIGN.md section 6). */
.confirm {
  position: sticky;
  bottom: var(--tab-bar);
  padding: 8px 0 16px;
  background: var(--peat);
}
.confirm:empty { display: none; }
.saved { margin: 0; font-size: 1rem; color: var(--muted); min-height: 24px; }
.quiet { font-size: 1rem; color: var(--muted); }

/* ---------- forms ---------- */

.field { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.field label { font-weight: 700; }
.input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  background: var(--surface);
  color: var(--cream);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}
.actions { margin-top: 24px; }
.actions .saved { margin-top: 12px; }
textarea.input { resize: vertical; line-height: 1.4; }
.notes { margin-top: 16px; min-height: 12rem; }

/* ---------- status card and notices ---------- */

.card {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px;
}
.card h1 { margin-top: 0; }
.card p { margin: 0; }
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--ember);
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--surface);
}
.notice + .notice, .notice + h1, .notice + .card, .notice + form { margin-top: 16px; }
.notice svg {
  width: 22px; height: 22px; margin-top: 2px;
  fill: none; stroke: var(--ember); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.notice p { margin: 0; }
.notices + * { margin-top: 16px; }
.log { display: flex; flex-direction: column; gap: 8px; }

/* ---------- the Conclave (R-CHAT-1 to R-CHAT-5; DESIGN.md section 7) ---------- */

.conclave h2 { margin: 4px 0 6px; font: 500 1.5rem/1.2 var(--display); }
.conclave .notice { margin-bottom: 12px; }
.conclave .agreed { margin-top: 12px; }
.conclave-form textarea.message { margin-top: 12px; min-height: 5.6rem; }
.conclave-form .actions { margin-top: 8px; }
.messages { list-style: none; margin: 16px 0 0; padding: 0; }
.messages li { padding: 8px 0; border-top: 1px solid var(--line); }
.messages .who { font-size: 1rem; color: var(--muted); }
.messages .text { white-space: pre-wrap; overflow-wrap: anywhere; }
#conclave-messages > .secondary { margin-top: 16px; }

/* ---------- the end-of-game record (R-END-1) ---------- */

.record { margin-top: 24px; }
.record h2 { margin: 0 0 8px; font: 500 1.5rem/1.2 var(--display); }
.record h3 { margin: 24px 0 8px; font: 700 1.125rem/1.4 var(--text); }
.record h4 { margin: 16px 0 4px; font: 700 1rem/1.4 var(--text); color: var(--muted); }
.record h3 + h4 { margin-top: 8px; }
.record ul.lines { list-style: none; margin: 0; padding: 0; }
.record ul.lines li { padding: 8px 0; border-top: 1px solid var(--line); }

/* ---------- tab bar ---------- */

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--peat);
  border-top: 1px solid var(--line);
  padding: 0 12px calc(10px + env(safe-area-inset-bottom, 0px));
}
.tabs__inner { max-width: 456px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; }
.tabs a {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9375rem;
  color: var(--muted);
  text-decoration: none;
  border-top: 3px solid transparent;
  touch-action: manipulation;
}
.tabs a[aria-current="page"] { color: var(--cream); font-weight: 700; border-top-color: var(--ember); }

/* ---------- Reveal screen (DESIGN.md section 7) ---------- */

.reveal {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--peat);
  padding: 7vh 7vw;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.eyebrow-row { display: flex; align-items: center; gap: 20px; }
.eyebrow {
  margin: 0;
  font-weight: 700;
  font-size: clamp(14px, 1.7vw, 28px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ember);
  white-space: nowrap;
}
.rule { flex: 1; height: 1px; background: var(--line-strong); }
.statement {
  margin: 0 0 0.3em;
  max-width: 12em;
  font: 500 clamp(48px, 8vw, 128px)/1.04 var(--display);
  letter-spacing: -0.01em;
  animation: step 400ms ease-out;
}
.second {
  margin: 0;
  font-size: clamp(20px, 2.5vw, 40px);
  color: var(--muted);
  animation: step 400ms ease-out;
}
.second + .second { margin-top: 0.2em; }
/* A tally (tally_only): short "Name n" lines in as many columns as fit, so
   sixteen of them still sit under the statement on a 720p screen. */
.reveal .lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(9em, 1fr)); column-gap: 1em; }
.reveal .lines .second { margin-top: 0; }
.reveal-foot { display: flex; justify-content: space-between; align-items: center; }
.reveal-foot .brand { font-size: clamp(20px, 2.3vw, 36px); }
.reveal-foot .brand svg { width: 0.7em; height: 0.93em; }
.reveal--idle { justify-content: center; align-items: center; text-align: center; }
.reveal--idle .brand { font-size: clamp(32px, 5vw, 80px); }
.reveal--idle .brand svg { width: 0.7em; height: 0.93em; }
.reveal--idle .tagline { font-size: clamp(18px, 2vw, 32px); margin-top: 0.5em; }
/* The narrator (DESIGN.md section 7): the screen's one control, and the opening's
   captions at the second line's size, in cream. */
.reveal--idle .sound { width: auto; display: inline-flex; margin: 1.5em auto 0; padding: 8px 24px; }
.caption { margin: 1.25em auto 0; max-width: 30em; font-size: clamp(20px, 2.5vw, 40px); color: var(--cream); }
@keyframes step { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .statement, .second { animation: none; }
}

/* ---------- host panel and the new-game form (DESIGN.md section 7) ---------- */

.section-heading { margin: 8px 0; font: 700 1.125rem/1.4 var(--text); }
.control { margin-top: 8px; }
.hint { margin-top: 12px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.row__name { overflow-wrap: anywhere; }
.row__state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 1rem;
  text-align: right;
}
.row__state svg {
  width: 22px; height: 22px;
  fill: none; stroke: var(--cream); stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
}
.row__state .empty-circle { stroke: var(--muted); stroke-width: 1.8; }
.mark {
  display: inline-block;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 1px 10px;
  white-space: nowrap;
  vertical-align: middle;
}
.disclosure {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  margin-top: 8px;
}
.disclosure summary {
  list-style: none;
  min-height: 52px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  touch-action: manipulation;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::marker { content: ""; }
.disclosure[open] > summary { border-bottom: 1px solid var(--line); }
.disclosure--inner { border-color: var(--line); }
.disclosure__body { padding: 8px 16px 16px; }
.disclosure__body > * + * { margin-top: 8px; }
.disclosure__body form { margin: 0; }
.disclosure__body h3 { margin: 16px 0 4px; font: 700 1.125rem/1.4 var(--text); }
.disclosure__body h3:first-child { margin-top: 8px; }
.toggle {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 2px solid var(--surface);
  border-radius: 12px;
  text-align: left;
  overflow-wrap: anywhere;
}
.toggle svg {
  display: none;
  width: 22px; height: 22px;
  fill: none; stroke: var(--ember); stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
}
.toggle[aria-pressed="true"] { background: var(--surface-picked); border-color: var(--ember); font-weight: 700; }
.toggle[aria-pressed="true"] svg { display: block; }
.secondary-button { width: 100%; display: flex; align-items: center; justify-content: center; text-align: center; }
/* A control that needs a second press: its summary looks like a secondary button
   and only opens the button that acts (no modal, DESIGN.md section 10). */
.second-press > summary {
  list-style: none;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background: var(--surface);
  color: var(--cream);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}
.second-press > summary::-webkit-details-marker { display: none; }
.second-press > summary::marker { content: ""; }
.second-press > form { margin-top: 8px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 52px; cursor: pointer; }
.check input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--ember); }
.choices { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.choices legend { padding: 0; font-weight: 700; }
.correction { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.correction h3 { margin: 0; }
.correction .field { margin-top: 12px; }
.correction .actions { margin-top: 16px; }
.copy { margin-top: 4px; }

/* ---------- the help pages and their links (DESIGN.md sections 3 and 7) ---------- */

/* A secondary link, under a screen's one primary button: full width, like every
   tappable thing (DESIGN.md section 6). */
a.secondary-button { text-decoration: none; }
.help-link { margin-top: 8px; }
.help-back { margin-top: 24px; }
/* The Video component: full width in the column, never taller than the screen; the
   picture keeps its shape inside, on the page's own colour. */
.video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 85vh;
  margin-top: 16px;
  object-fit: contain;
  background: var(--peat);
}
.video + .section-heading { margin-top: 24px; }
.chapters { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chapters a {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--surface);
  border-radius: 12px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

/* ---------- puppet page (development only) ---------- */

.app--wide { max-width: 960px; }
.puppet-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.puppet-table th, .puppet-table td {
  text-align: left;
  padding: 8px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.puppet-table th { font-size: 0.9375rem; color: var(--muted); font-weight: 400; }
.puppet-table form { margin: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.row-actions form { margin: 0; }
.secondary-button {
  min-height: 52px;
  padding: 8px 16px;
  background: var(--surface);
  color: var(--cream);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}
.puppet-table .secondary-button, .row-actions .secondary-button { width: auto; display: inline-block; }
.link-box {
  display: flex;
  align-items: center;
  min-height: 52px;
  margin: 4px 0 0;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 12px;
  font-size: 0.9375rem;
  color: var(--muted);
  overflow-wrap: anywhere;
  user-select: all;
}
.empty-circle { width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.tick-icon { width: 22px; height: 22px; fill: none; stroke: var(--cream); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.status-line { display: inline-flex; align-items: center; gap: 8px; }
