/* Slow Reveal — the look, shared by the entry page, the table and the board.
 *
 * The picture is the product, so almost everything here is in service of
 * getting out of its way: a dark room, one square of light in the middle, and
 * the few numbers a player needs (what it is worth, how long is left, who
 * already has it) arranged around the edge where they can be read without
 * looking away from the picture.
 *
 * A pack overrides the custom properties at the top via sr_theme_css().
 */

:root {
  --bg: #0d0a0c;
  --surface: #1a1518;
  --surface-2: #241c20;
  --ink: #f7efe3;
  --muted: #a3928c;
  --line: rgba(247, 239, 227, .14);
  --coral: #e0402e;
  --aqua: #3fb2a6;
  --yellow: #f0b429;
  --green: #35c98a;
  --shadow: 0 30px 80px rgba(0, 0, 0, .55);
  --radius: 18px;
}

* { box-sizing: border-box; }

/* The UA rule for `hidden` is a bare `[hidden] { display: none }`, which any
   class that sets `display` outranks. This page hides things by setting the
   attribute from JS, so without this the tile grid stays on top of the picture
   and every zoom and blur round is a black square. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(90rem 50rem at 50% -20%, rgba(90, 120, 236, .12), transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.55 "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .join-code, .sr-worth b {
  font-family: "Space Grotesk", "DM Sans", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -.02em;
}

.shell { max-width: 1080px; margin: 0 auto; padding: 28px 20px 90px; }
.screen { display: none; }
.screen.is-active { display: block; }

.kicker {
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 8px;
}
h1 { font-size: clamp(28px, 4.4vw, 42px); margin: 0 0 10px; }
.lede { color: var(--muted); margin: 0 0 26px; max-width: 56ch; font-size: 17px; }
.note { color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.form-error { color: var(--coral); font-weight: 600; margin: 0 0 16px; }

/* ------------------------------------------------------------- controls */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 20px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: filter .15s ease, border-color .15s ease, color .15s ease;
}
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-primary { background: linear-gradient(180deg, #ea5340, #b92e1f); color: #fff; }
.button-primary:hover:not(:disabled) { filter: brightness(1.08); }
.button-dark { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.button-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.button-ghost:hover { color: var(--ink); border-color: rgba(247, 239, 227, .32); }
.button-wide { width: 100%; }
.button-small { padding: 8px 14px; font-size: 14px; }
.link-button {
  background: none; border: 0; color: var(--muted); font: inherit;
  cursor: pointer; text-decoration: underline; padding: 6px;
}
.link-button:hover { color: var(--ink); }

.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
input[type="text"], input:not([type]) {
  width: 100%; background: rgba(0, 0, 0, .32); border: 1px solid var(--line);
  color: var(--ink); border-radius: 12px; padding: 12px 14px; font: inherit;
}
input:focus { outline: none; border-color: var(--yellow); }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented button {
  background: var(--surface); color: var(--muted); border: 1px solid var(--line);
  border-radius: 11px; padding: 9px 15px; font: inherit; font-size: 14px; cursor: pointer;
}
.segmented button.on { background: var(--surface-2); border-color: var(--yellow); color: var(--yellow); }

.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px; }
.setup-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; align-items: center; }
.join-form { max-width: 420px; }
.pill {
  display: inline-block; font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
}
.mode-chosen { color: var(--muted); font-size: 14px; margin: -14px 0 24px; }
.mode-chosen a { color: var(--aqua); margin-left: 10px; }

/* ---------------------------------------------------------------- lobby */

.lobby-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 30px; align-items: start; }
@media (max-width: 780px) { .lobby-cols { grid-template-columns: 1fr; } }

.join-code {
  font-size: clamp(46px, 9vw, 74px); font-weight: 700; letter-spacing: .14em;
  color: var(--yellow); line-height: 1;
}
.qr-box { margin-top: 14px; background: #fff; border-radius: 14px; padding: 10px; width: max-content; }
.qr-box img { display: block; }

.lobby-seats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.seat-chip {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 14px; font-size: 14px;
}
.seat-chip.is-empty { color: var(--muted); border-style: dashed; }
.seat-chip.is-away { opacity: .5; }
.seat-chip b { font-weight: 600; }
.seat-chip em { font-style: normal; color: var(--muted); font-size: 13px; }
.seat-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.open-table-row { justify-content: space-between; width: 100%; }
.open-tables-title { font-size: 17px; margin: 34px 0 4px; }

/* ------------------------------------------------------------ the stage */

.play-shell { max-width: 1180px; margin: 0 auto; padding: 18px 18px 90px; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.top-right { display: flex; align-items: center; gap: 10px; }
.round-label { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.round-label b { color: var(--ink); }

.paused-bar {
  background: rgba(240, 180, 41, .12); border: 1px solid rgba(240, 180, 41, .4);
  border-radius: 12px; padding: 11px 16px; margin-bottom: 16px; font-size: 14px;
}
.paused-bar strong { margin-right: 8px; }

.play-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(290px, 1fr); gap: 22px; align-items: start; }
@media (max-width: 900px) { .play-grid { grid-template-columns: 1fr; } }

.panel {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px;
}

.sr-stage {
  position: relative; aspect-ratio: 1 / 1; width: 100%;
  border-radius: 14px; overflow: hidden; background: #05060a;
  border: 1px solid var(--line);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
/* The frames the server cut, stacked. Two are live at a time: the one being
   shown and the one taking over from it, which crossfades in so a reveal made
   of a dozen steps does not look like one. */
.sr-frames { position: absolute; inset: 0; }
.sr-shot {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block;
  background: transparent center / cover no-repeat;
  opacity: 0; transition: opacity .5s ease;
  /* The reveal repaints every frame; promoting it keeps a 5x zoom smooth on
     a phone, and blur especially is expensive without it. */
  will-change: transform, filter;
  /* reveal.js does its own translation, so the corner is the fixed point. */
  transform-origin: 0 0;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.sr-shot[src] {
  /* The resolved picture, the only moment an <img> is allowed on the stage. */
  object-fit: cover;
}
.sr-shot.is-front { opacity: 1; }
/* Pixels is the one style that wants the browser to leave the frame alone. */
.sr-stage[data-style="pixels"] .sr-shot { image-rendering: pixelated; }

.sr-tiles {
  position: absolute; inset: 0; display: grid;
  grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(6, 1fr);
}
.sr-tiles[data-shape="columns"] { grid-template-columns: repeat(12, 1fr); grid-template-rows: 1fr; }
.sr-tiles[data-shape="rows"] { grid-template-columns: 1fr; grid-template-rows: repeat(12, 1fr); }
.sr-tiles i { background: #0e1016; transition: opacity .4s ease; }
.sr-tiles i.is-off { opacity: 0; }

/* The one thing allowed to sit over the picture: who already has it. */
.sr-callouts {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; gap: 6px;
  padding: 30px 12px 12px; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(5, 6, 10, .78));
}
.sr-callout {
  background: rgba(53, 201, 138, .18); border: 1px solid rgba(53, 201, 138, .5);
  color: #b6f0d5; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600;
}

.meter { height: 6px; border-radius: 999px; background: rgba(247, 239, 227, .12); margin-top: 14px; overflow: hidden; }
.meter span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--coral));
}
.meter-note { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 8px; }

/* --------------------------------------------------------- answer panel */

.sr-worth { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.sr-worth b { display: block; font-size: 42px; line-height: 1.05; color: var(--yellow); font-weight: 700; }
.sr-worth.is-banked b { color: var(--green); }

.guess-form { display: flex; gap: 8px; margin: 18px 0 0; }
.guess-form input { flex: 1; }
.guess-form .button { flex: none; }

.sr-verdict { margin-top: 14px; font-size: 14px; min-height: 42px; }
.sr-verdict .is-wrong { color: var(--muted); }
.sr-verdict .is-right { color: var(--green); font-weight: 600; }
.sr-verdict .is-out { color: var(--coral); font-weight: 600; }

.scoreboard { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.score-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px;
}
.score-row .seat-dot { flex: none; }
.score-row b { font-weight: 600; flex: 1; }
.score-row .pts { color: var(--muted); font-variant-numeric: tabular-nums; }
.score-row.has-it .pts { color: var(--green); font-weight: 600; }
.score-row.is-away { opacity: .5; }

/* --------------------------------------------------------- round result */

.result { position: fixed; inset: 0; background: rgba(6, 4, 6, .82); display: grid; place-items: center; z-index: 40; padding: 20px; }
.result[hidden] { display: none; }
.result-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  padding: 26px; max-width: 460px; width: 100%; text-align: center;
}
.result-shot {
  width: 190px; height: 190px; object-fit: cover; border-radius: 14px;
  margin: 0 auto 16px; display: block; border: 1px solid var(--line);
}
.result-kicker { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.result-answer { font-size: 30px; margin: 6px 0 16px; }
.result-list { text-align: left; margin: 0 0 12px; }
.result-line { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; border-top: 1px solid var(--line); }
.result-line b { font-weight: 600; }
.result-line span { color: var(--muted); font-variant-numeric: tabular-nums; }
.result-line.is-you b { color: var(--yellow); }
.result-none { color: var(--muted); font-size: 14px; margin: 0 0 12px; }

/* The photographer's name. It can only appear once the round is over — a
   caption names the thing about half the time — so it lives here and on the
   credits page, and nowhere a player can see it while they are guessing. */
.result-credit { color: var(--muted); font-size: 12px; margin: 0 0 16px; }
.result-credit a { color: var(--muted); }
.result-credit:empty { display: none; }

/* --------------------------------------------------------- credits page */

.credit-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px; margin: 26px 0;
}
.credit-card { margin: 0; }
.credit-card img {
  width: 100%; aspect-ratio: 1 / 1; height: auto; object-fit: cover;
  border-radius: 12px; border: 1px solid var(--line); display: block;
}
.credit-card figcaption { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.4; }
.credit-card a { color: var(--muted); }

/* ---------------------------------------------------------------- board */

.board-stage { max-width: min(78vh, 1000px); margin: 0 auto; }
.board-strip { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.board-headline { text-align: center; }
.board-headline .sr-worth b { font-size: 56px; }

/* ---------------------------------------------------------------- done */

.finish-board { margin: 22px 0; }
.finish-row {
  display: flex; justify-content: space-between; gap: 14px; align-items: baseline;
  padding: 12px 0; border-top: 1px solid var(--line); font-size: 16px;
}
.finish-row.is-winner b { color: var(--yellow); font-size: 20px; }
.finish-row span { color: var(--muted); font-size: 14px; }
.finish-signup {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin: 26px 0;
}
.finish-signup h2 { margin: 0 0 8px; font-size: 20px; }
.finish-signup p { color: var(--muted); margin: 0; max-width: 52ch; }
