/* Sampled base swatches from assets/references/ui-storyboard.png, palette row.
   Sky (80,201,252), grass (23,200,108), yellow (252,195,26),
   red (251,66,69), blue (50,130,251), purple (159,80,251),
   ink (14,25,38), panel (229,236,238). Lighter/darker values below are
   same-hue contrast variants; no new base hue is introduced. */
:root {
  --sky: #50c9fc;
  --grass: #17c86c;
  --yellow: #fcc31a;
  --red: #fb4245;
  --blue: #3282fb;
  --purple: #9f50fb;
  --ink: #0e1926;
  --panel: #e5ecee;
  --paper: #fff;
  --sky-soft: #c9f1ff;
  --grass-soft: #b7f7d1;
  --ink-soft: #33475c;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, var(--sky-soft) 0 44%, var(--sky) 60%, var(--grass-soft) 60%, var(--grass) 100%);
}

button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--ink); }
:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; }

.shell {
  width: min(100%, 1180px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 40px) env(safe-area-inset-bottom, 16px);
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  min-height: 64px;
  /* The Home Screen app draws under a translucent status bar (and the side
     insets in landscape): keep the bar's text clear of them. */
  padding: max(12px, calc(env(safe-area-inset-top) + 8px)) max(22px, env(safe-area-inset-right))
    12px max(22px, env(safe-area-inset-left));
  color: var(--paper);
  background: var(--ink);
  border-radius: 0 0 12px 12px;
}
.brand, .topbar-tag, h1, h2, .eyebrow, .action {
  font-weight: 900;
  letter-spacing: .02em;
}
.brand { font-size: clamp(1.15rem, 2.5vw, 1.6rem); line-height: 1; }
.topbar-tag { font-size: .8rem; }
.preview-banner {
  /* ps-pb64: a compact strip, never the first thing a player reads. */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  padding: 4px 14px;
  font-size: .82rem;
  line-height: 1.3;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 10px 10px;
}
.preview-banner a { margin-left: auto; font-weight: 800; }

.hero { padding: clamp(28px, 5vw, 64px) 0 22px; }
.eyebrow {
  display: inline-block;
  padding: 6px 10px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 4px;
  font-size: .75rem;
}
h1 {
  margin: 12px 0 6px;
  font-size: clamp(2.2rem, 7vw, 4.7rem);
  line-height: 1.03;
  text-wrap: balance;
}
.lede {
  max-width: 56ch;
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 650;
}
.content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
  align-content: start;
  gap: 18px;
}
.home-content { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  min-width: 0;
  padding: clamp(18px, 2.4vw, 28px);
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 7px 0 var(--ink);
}
.card h2 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 2.2vw, 1.9rem);
  line-height: 1.1;
}
.card p { margin: 0 0 18px; line-height: 1.48; }
.card p:last-child { margin-bottom: 0; }
/* ps-ialy: a computer's join card says Enter or a pad button joins. */
.card p.join-keys { margin: 14px 0 0; font-size: .95rem; font-weight: 800; }
.card-details { margin: 0 0 18px; color: var(--ink-soft); font-size: .9rem; }
.card-details summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.card-details p { margin: 6px 0 0; }
.promo-card { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1.1fr; gap: 24px; scroll-margin-top: 24px; }
.promo-copy h2 { margin-top: 14px; font-size: clamp(1.7rem, 3vw, 2.6rem); }
.promo-screen { align-self: center; overflow: hidden; border: 3px solid var(--ink); border-radius: 10px; background: var(--ink); }
.promo-screen img, .promo-screen video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
.promo-screen [hidden], .promo-share-fallback[hidden] { display: none; }
.promo-downloads { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.promo-downloads .text-link { font-size: .9rem; }
.card .promo-status { font-size: .9rem; margin: 12px 0; }
.card .promo-note { font-size: .8rem; margin: 12px 0 0; }
.promo-share-fallback { width: 100%; min-height: 48px; padding: 8px; color: var(--ink); }
@media (max-width: 760px) { .promo-card { grid-template-columns: 1fr; gap: 18px; } }
/* W14 Rejoin card: this phone's W16 number chips beside the detail line. */
.rejoin-card p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.who-badge {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: 9px; background: var(--who-fill); color: var(--who-ink);
  font-weight: 900; font-size: 15px; box-shadow: 0 3px 0 rgb(0 0 0 / 0.28);
}
.danger-card { border-color: var(--red); box-shadow: 0 7px 0 var(--red); }
.warning { color: #a52226; font-weight: 700; }
.muted { color: var(--ink-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 130px;
  padding: 10px 16px;
  border: 3px solid var(--ink);
  border-radius: 7px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 4px 0 var(--ink);
  text-align: center;
  text-decoration: none;
  line-height: 1.15;
}
.action:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.action:active:not(:disabled) { box-shadow: 0 1px 0 var(--ink); transform: translateY(3px); }
.action:disabled { opacity: .65; cursor: wait; }
.action.secondary { background: var(--panel); }
.action.ghost { background: var(--paper); }
.action.danger { color: var(--paper); background: var(--red); }
.text-link { display: inline-block; margin-top: 8px; font-weight: 800; text-underline-offset: 4px; }
.code-form { display: grid; gap: 8px; max-width: 24rem; }
/* ps-dzu0: the optional name on the join card. */
.name-field { display: grid; gap: 6px; max-width: 24rem; margin: 4px 0 14px; }
.name-field label { font-weight: 800; }
.name-field small { font-weight: 600; color: var(--ink-soft, #33475c); }
.name-input { width: 100%; min-height: 48px; padding: 8px 12px; border: 3px solid var(--ink); border-radius: 7px;
  background: var(--paper); color: var(--ink); font-size: 1.15rem; font-weight: 800; }
.name-input:focus-visible { outline: 3px solid var(--blue, #3282fb); outline-offset: 2px; }
.code-form label { font-weight: 800; }
.code-input {
  width: 100%;
  min-height: 54px;
  padding: 8px 12px;
  border: 3px solid var(--ink);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
/* C55 Join choice: Scan host QR beside Enter room code. The in-page
   scanner entry orders them (touch: Scan first; computer: code first). */
.join-card h2 { margin-bottom: 14px; }
.join-routes { display: grid; gap: 14px; }
.route-card {
  display: grid;
  grid-template-columns: 50px 1fr 20px;
  grid-template-rows: auto auto;
  gap: 0 14px;
  align-items: center;
  width: 100%;
  min-height: 100px;
  padding: 14px 16px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  color: var(--paper);
  background: #1b2d3d;
  box-shadow: 0 5px 0 var(--ink);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.route-card:active { box-shadow: 0 1px 0 var(--ink); transform: translateY(4px); }
.route-icon {
  display: grid;
  place-items: center;
  grid-row: span 2;
  width: 50px;
  height: 50px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  color: var(--ink);
  background: var(--yellow);
  font-size: 1.5rem;
  font-weight: 900;
}
.route-title { align-self: end; font-size: 1.25rem; font-weight: 900; line-height: 1.05; text-transform: uppercase; }
.route-detail { align-self: start; margin-top: 4px; color: #e2f0f5; font-size: .9rem; line-height: 1.25; }
.route-arrow { grid-column: 3; grid-row: 1 / span 2; font-size: 2rem; font-weight: 900; }
.route-code { padding: 14px 16px; border: 3px solid var(--ink); border-radius: 12px; background: var(--panel); }
.route-code .code-form { max-width: none; }
.route-code .code-form label { font-size: 1.05rem; text-transform: uppercase; }
.route-code .code-help { margin: 8px 0 0; color: var(--ink-soft); font-size: .88rem; line-height: 1.35; }
.join-card .warning { margin: 14px 0 0; }
.join-message { margin: 0 0 12px; font-weight: 700; }
.join-message:empty { display: none; }
.c55-fallback { margin-bottom: 10px; }
@media (pointer: fine) { .join-routes:not([data-c55-device]) .route-code { order: -1; } }
/* Landscape phones: both routes side by side so Scan sits above the fold. */
@media (max-height: 500px) and (min-width: 650px) {
  .shell:has(.join-card) :is(.lede, .eyebrow) { display: none; }
  .join-card h2, .route-code .code-help { display: none; }
  .join-routes { grid-template-columns: 1fr 1fr; }
  .route-card { min-height: 0; }
}
/* ps-t1sw: a sideways phone's invite shows its name field and Join without
   scrolling: no eyebrow or lede, and the card in two columns (the room on
   the left, the name and Join on the right). */
@media (max-height: 500px) and (min-width: 650px) {
  .shell:has(.invite-card) :is(.lede, .eyebrow) { display: none; }
  .shell:has(.invite-card) .hero { padding: 6px 0 8px; }
  .shell:has(.invite-card) h1 { font-size: clamp(1.6rem, 4.4vw, 2.2rem); margin: 0; }
  .invite-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px;
    align-items: start; grid-auto-flow: dense; padding: 12px 18px; }
  .invite-card > :is(h2, p, details) { grid-column: 1; margin-block: 0 6px; }
  .invite-card > .name-field { grid-column: 2; grid-row: 1 / span 2; margin: 0 0 8px; }
  .invite-card > .actions { grid-column: 2; grid-row: 3 / span 2; margin: 0; }
  .invite-card > .join-keys { grid-column: 1 / -1; margin: 6px 0 0; }
}

.status {
  min-height: 48px;
  margin: 22px 0;
  padding: 10px 14px;
  border-radius: 7px;
  color: var(--ink);
  font-weight: 700;
}
.status:empty { display: none; }
.status[data-kind="error"] { background: var(--red); color: var(--paper); }
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: auto;
  padding: 30px 0 18px;
  font-size: .8rem;
  font-weight: 900;
}
.footer-tagline { margin-right: auto; }
.footer-credit { margin: 0; font-size: .9rem; font-weight: 700; }
.credit-link { font-weight: 900; text-underline-offset: 3px; }
.credits-open {
  min-height: 44px;
  padding: 6px 16px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 3px 0 var(--ink);
  font-size: .9rem;
  font-weight: 900;
  letter-spacing: .02em;
}
.credits-open:active { box-shadow: 0 1px 0 var(--ink); transform: translateY(2px); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Credits dialog (ps-5dhg): a storyboard card over a dimmed page. */
.credits-dialog {
  width: min(calc(100vw - 28px), 36rem);
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 14px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 8px 0 var(--ink);
  overflow: auto;
  overscroll-behavior: contain;
}
.credits-dialog::backdrop { background: rgb(14 25 38 / .6); }
.credits-body { display: grid; gap: 16px; padding: clamp(18px, 3vw, 28px); }
.credits-head { display: flex; align-items: center; justify-content: space-between; }
.credits-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel);
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
}
.credits-dialog h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.05; }
.credits-thanks {
  margin: 0;
  padding: 16px 18px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--sky-soft);
}
.credits-thanks p { margin: 0; font-size: 1.12rem; font-weight: 650; line-height: 1.5; }
.credits-thanks .credits-sign { margin-top: 10px; font-weight: 900; }
.credits-play { justify-self: start; }
.credits-roll { display: grid; gap: 10px; margin: 0; padding-top: 14px; border-top: 3px solid var(--panel); }
.credits-roll div { display: grid; grid-template-columns: minmax(8rem, 14rem) 1fr; gap: 4px 14px; align-items: baseline; }
.credits-roll dt { color: var(--ink-soft); font-size: .78rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.credits-roll dd { margin: 0; font-size: 1.1rem; font-weight: 800; }

@media (max-width: 620px) {
  .shell { padding-inline: 14px; }
  /* Phone widths keep the safe-area padding: in the Home Screen app the
     status bar sits over the top of the page (round-21 simulator: this rule
     used to reset it to 12px and the header slid under the clock). */
  .topbar { padding: max(12px, calc(env(safe-area-inset-top) + 8px)) max(14px, env(safe-area-inset-right))
    12px max(14px, env(safe-area-inset-left)); }
  .topbar-tag { font-size: .7rem; }
  .content { grid-template-columns: 1fr; }
  .actions { align-items: stretch; }
  .actions .action { flex: 1 1 100%; }
  .card > .action { width: 100%; }
  /* ps-pb64: one line on a phone; the top bar already says TESTING BUILD. */
  .preview-banner > span { display: none; }
  .preview-banner a { margin-left: auto; }
  .footer { flex-direction: column; align-items: flex-start; }
  .credits-play { justify-self: stretch; }
  .credits-roll div { grid-template-columns: 1fr; }
}

@media (max-height: 500px) and (min-width: 650px) {
  .topbar { min-height: 48px; padding-block: max(8px, calc(env(safe-area-inset-top) + 8px)) 8px; }
  .hero { padding: 12px 0 12px; }
  h1 { font-size: clamp(2rem, 5vw, 3rem); margin-top: 7px; }
  .card { padding: 16px 20px; }
  .card p { margin-bottom: 10px; }
  .footer { padding: 12px 0; }
  .credits-body { position: relative; gap: 10px; padding: 14px 20px; }
  .credits-head { position: absolute; top: 14px; right: 16px; }
  .credits-head .eyebrow { display: none; }
  .credits-dialog h2 { display: flex; align-items: center; min-height: 44px; padding-right: 52px; font-size: 1.7rem; }
  .credits-thanks { padding: 12px 16px; }
  .credits-thanks p { font-size: 1rem; line-height: 1.4; }
  .credits-thanks .credits-sign { margin-top: 6px; }
  .credits-roll { grid-template-columns: 1fr 1fr; padding-top: 10px; }
  .credits-roll div { grid-template-columns: 1fr; }
}

@media (min-width: 1800px) and (min-height: 900px) {
  :root { font-size: 20px; }
  .shell { width: min(86vw, 1540px); }
  .topbar { min-height: 76px; }
  .card { padding: 32px; }
  .action { min-height: 60px; padding: 14px 20px; }
}

@media (min-width: 3000px) {
  :root { font-size: 28px; }
  .shell { width: min(80vw, 2400px); }
  .topbar { min-height: 100px; }
  .card { padding: 48px; }
  .action { min-height: 80px; padding: 18px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .action:hover:not(:disabled), .action:active:not(:disabled), .credits-open:active { transform: none; }
}
/* ps-psff (council round 14): the display type (brand, tag, eyebrow, the
   page title) is already large, so it stays at its designed size when the
   phone's text is set to 200%; the copy, the name field and the buttons
   still grow. A join page that still cannot show Join on its first screen
   drops the lede (the card says it too) and tightens the hero (app.mjs). */
.brand, .topbar-tag, .hero .eyebrow, .hero h1 { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body[data-tight="true"] .hero .lede { display: none; }
body[data-tight="true"] .hero { padding: 8px 0 6px; }
body[data-tight="true"] .hero h1 { margin: 4px 0 0; }
