/* Direction A for the pages around the boards: the casebook,
   the account and the leaderboard, the way in to a table, the cards that
   say why a door is shut, the error pages and the administrator's pages.
   Colours and faces are shell.css's tokens and nothing else. Every rule is
   under .pg, the wrapper render/pages.py draws, so it outranks online.css,
   which a page may link after this one. */

.pg {
  max-width: 1240px;
  min-height: 100%;
  margin: 0 auto;
  padding: 0 32px 40px;
  display: flex;
  flex-direction: column;
  font-size: 16px;
  line-height: 1.45;
}
.pg-main { flex: 1 0 auto; }
.pg h1, .pg h2, .pg h3 { font-family: var(--font-title); font-weight: 700; letter-spacing: -0.015em; color: var(--ink); }
.pg a { color: inherit; }
.pg .icon { width: 18px; height: 18px; flex: none; display: block; }
.pg .sr, .pg .filter-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.pg [hidden] { display: none !important; }
.sprites { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }

/* -- buttons --------------------------------------------------------- */
.pg .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 2px solid var(--outline); border-radius: 12px;
  background: var(--surface); color: var(--ink);
  font: 700 15px/1.2 var(--font-ui); text-decoration: none; white-space: nowrap;
  box-shadow: 3px 3px 0 var(--shadow);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.pg .btn:hover { background: color-mix(in srgb, var(--act) 16%, var(--surface)); }
.pg .btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.pg .btn.primary { background: var(--act); color: var(--on-act); }
.pg .btn.primary:hover { background: var(--act-hover); }
.pg .btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; box-shadow: 2px 2px 0 var(--shadow); }

/* The buttons the page scripts make are .act: the same button, a size down. */
.pg .act {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: auto; min-height: 40px; padding: 0 14px;
  font: 700 14px/1.2 var(--font-ui); text-transform: none; letter-spacing: 0;
  color: var(--ink); background: var(--surface);
  border: 2px solid var(--outline); border-radius: 10px;
  box-shadow: 2px 2px 0 var(--shadow);
  text-decoration: none; white-space: nowrap;
}
.pg .act:hover { transform: none; background: color-mix(in srgb, var(--act) 16%, var(--surface)); }
.pg .act:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--shadow); }
.pg .act.primary, .pg a.act.primary, .pg button.act.primary { background: var(--act); color: var(--on-act); border-color: var(--outline); }
.pg .act.primary:hover { background: var(--act-hover); }
.pg button.act[aria-pressed="true"], .pg .act.is-on { background: var(--ink); color: var(--bg); border-color: var(--outline); }
.pg button.act[disabled] { color: var(--ink-3); box-shadow: none; border-style: dashed; cursor: default; }
.pg .act[hidden] { display: none; }

/* -- the header ------------------------------------------------------ */
.pg-top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  min-height: 72px; padding: 0;
  border-bottom: 2px solid var(--outline);
  margin-bottom: 48px;
}
.pg-top .grow { flex: 1 1 auto; }
.pg-top .brand {
  display: inline-flex; align-items: center;
  font: 700 26px/1 var(--font-title); letter-spacing: 0.01em; text-transform: none;
  color: var(--ink); text-decoration: none;
}
.pg-top .brand .o {
  display: inline-block; width: 0.72em; height: 0.72em; margin: 0 0.03em;
  border-radius: 50%; background: var(--crime);
  border: 2px solid var(--outline); box-shadow: 1.5px 1.5px 0 var(--shadow);
}
.pg-top .nav { display: flex; gap: 4px; }
.pg-top .nav a {
  padding: 9px 12px; border: 0; border-radius: 10px; box-shadow: none; background: none;
  font: 700 15px/1 var(--font-ui); text-transform: none; letter-spacing: 0;
  color: var(--ink-2); text-decoration: none;
}
.pg-top .nav a:hover { color: var(--ink); background: var(--surface-2); }
.pg-top .nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 2px var(--outline); }
.pg-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pg .control { display: inline-flex; align-items: center; gap: 8px; }
.pg .control-label { display: none; }
.pg .seg { display: inline-flex; border: 2px solid var(--outline); border-radius: 12px; overflow: hidden; background: var(--surface); }
.pg .seg button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border: 0; background: none; cursor: pointer;
  font: 700 14px/1.2 var(--font-ui); color: var(--ink-2);
}
.pg .seg button + button { border-left: 2px solid var(--outline); }
.pg .seg button:hover { color: var(--ink); }
.pg .seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.pg .seg .icon { width: 16px; height: 16px; }
.pg-top .act { min-height: 36px; }

.pg .pg-account { display: inline-flex; align-items: center; margin: 0; gap: 8px; }
.pg-account .online-user { display: inline; font-size: 14px; color: inherit; }
.pg .menu { position: relative; }
.pg .menu > summary { list-style: none; }
.pg .menu > summary::-webkit-details-marker { display: none; }
.pg .menu > summary .icon { width: 16px; height: 16px; transition: transform .15s; }
.pg .menu[open] > summary .icon { transform: rotate(180deg); }
.pg .menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  min-width: 190px; padding: 6px;
  display: flex; flex-direction: column;
  background: var(--surface); border: 2px solid var(--outline); border-radius: 14px;
  box-shadow: 5px 5px 0 var(--shadow);
}
.pg .menu-pop a, .pg .menu-pop button {
  display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px;
  background: none; text-align: left; cursor: pointer;
  font: 700 15px/1.2 var(--font-ui); color: var(--ink); text-decoration: none;
}
.pg .menu-pop a:hover, .pg .menu-pop button:hover { background: var(--surface-2); }
.pg .menu-pop hr { margin: 5px 4px; border: 0; border-top: 2px dotted var(--line); }

.pg .casebook-note { margin: -30px 0 30px; font-size: 15px; color: var(--ink-3); }

/* -- the footer ------------------------------------------------------ */
.pg-foot {
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline;
  max-width: none; margin: 64px 0 0; padding: 16px 0 0;
  border-top: 2px solid var(--outline);
  font: 400 14px/1.4 var(--font-ui); color: var(--ink-3); text-align: left;
}
.pg-foot a { color: var(--ink-3); text-underline-offset: 3px; }
.pg-foot a:hover { color: var(--ink); }
.pg-foot code { font: 600 13px/1 ui-monospace, monospace; color: var(--ink-2); }

/* -- small plans (minicase.js) ---------------------------------------- */
.mini-plan { --n: 4; display: block; width: 100%; }
.mp-board {
  position: relative; isolation: isolate;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  grid-template-rows: repeat(var(--n), minmax(0, 1fr));
  aspect-ratio: 1; width: 100%;
  background: var(--board-bg);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.mp-cell { position: relative; min-width: 0; min-height: 0; background: var(--floor); -webkit-tap-highlight-color: transparent; outline-offset: -3px; }
.mp-cell.blocked { background-image: repeating-linear-gradient(135deg, var(--hatch) 0 2px, transparent 2px 7px); }
.mp-furniture { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.mp-piece { position: absolute; display: block; overflow: visible; }
.mp-piece use { stroke: var(--sprite-stroke); stroke-width: 0.7; stroke-linejoin: round; }
.mp-walls { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; display: block; }
.mp-walls path { fill: none; vector-effect: non-scaling-stroke; }
.mp-grid { stroke: var(--grid-line); stroke-width: 1; }
.mp-wall { stroke: var(--wall); stroke-width: 2.5px; stroke-linecap: square; }
.mp-outer { stroke: var(--wall-outer, var(--wall)); stroke-width: 4px; stroke-linejoin: miter; }
.mp-slot { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.mp-token { position: absolute; inset: 9%; display: block; animation: slap .22s ease-out; }
.mp-face {
  position: absolute; inset: 0; overflow: hidden; border-radius: 50%;
  border: 3px solid var(--sticker-edge);
  box-shadow: 0 0 0 2px var(--outline), 2px 3px 0 2px var(--shadow);
  background: color-mix(in srgb, var(--who) 22%, var(--surface));
}
.mp-face .face { display: block; width: 100%; height: 100%; }
.mp-token.victim .mp-face { filter: grayscale(.85); }
.mp-token.culprit .mp-face { box-shadow: 0 0 0 2px var(--outline), 0 0 0 6px var(--crime), 3px 4px 0 6px var(--shadow); }
.mini-plan .mp-board { border: 3px solid var(--outline); border-radius: 12px; overflow: hidden; box-shadow: 4px 4px 0 var(--shadow); }
.mini-plan .mp-outer { display: none; }
@keyframes slap { from { transform: scale(1.3) rotate(-8deg); } to { transform: none; } }
@keyframes nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.nudge { animation: nudge .28s ease-in-out; }

/* -- the casebook: a case to solve before reading anything -------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
  grid-template-areas: "title plan" "clues plan" "ctas plan";
  grid-template-rows: auto auto 1fr;
  column-gap: 64px; row-gap: 28px; align-items: start;
  margin-bottom: 56px;
}
.pg .hero-title {
  grid-area: title; margin: 0; max-width: 19ch;
  font-size: clamp(34px, 4.4vw, 56px); line-height: 1.04; letter-spacing: -0.03em;
  text-wrap: balance;
}
.mini-case { display: contents; }
.mc-plan { grid-area: plan; position: relative; padding-top: 62px; }
.mc-mini .mp-board { border-radius: 14px; box-shadow: 6px 6px 0 var(--shadow); overflow: visible; }
.mc-mini .mp-cell { cursor: pointer; transition: box-shadow .12s; }
.mc-mini .mp-cell:first-of-type { border-top-left-radius: 11px; }
.mc-mini .mp-cell.blocked { cursor: not-allowed; }
.mc-mini .mp-board.choosing .mp-cell:not(.blocked):hover,
.mc-mini .mp-cell:focus-visible { box-shadow: inset 0 0 0 999px var(--hl-wash); outline: none; }
.mc-mini .mp-cell.lit { box-shadow: inset 0 0 0 999px var(--hl-wash); }
.mc-mini .mp-board.solved .mp-cell { cursor: default; }
.mc-label {
  position: absolute; z-index: 6; transform: translate(-50%, -50%);
  padding: 1px 7px 2px; white-space: nowrap; pointer-events: none;
  font: 700 13px/1.2 var(--font-title); color: var(--ink);
  background: var(--surface); border: 2px solid var(--outline); border-radius: 7px;
}
.mc-note { position: absolute; margin: 0; font: 600 23px/0.95 var(--font-hand); color: var(--ink-2); pointer-events: none; }
.mc-note-lines { top: 0; right: 4px; transform: rotate(3deg); text-align: right; }
.mc-note-lines::after {
  content: ""; position: absolute; right: -14px; bottom: -16px; width: 22px; height: 18px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  border-bottom-right-radius: 14px; transform: rotate(18deg);
}
.mc-note-alone { position: relative; margin: 14px 0 0 8px; transform: rotate(-2.5deg); }
.mc-note-alone::before { content: "↖ "; font-family: var(--font-ui); font-weight: 400; }
.pg .mc-status { margin: 18px 0 0; min-height: 1.5em; font-size: 15.5px; font-weight: 600; color: var(--ink-2); }
.pg .mc-status b { color: var(--ink); font-weight: 800; }
.mc-again {
  margin-left: 8px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--ink);
  text-decoration: underline 2px; text-underline-offset: 3px;
}
.mc-clues { grid-area: clues; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mc-card {
  width: 100%; height: 100%;
  display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 12px 14px 13px 12px; text-align: left; cursor: pointer;
  font: inherit; color: var(--ink);
  background: var(--surface); border: 2px solid var(--outline); border-radius: 14px;
  box-shadow: 3px 3px 0 var(--shadow);
  transition: transform .1s, box-shadow .1s, background .1s;
}
.mc-card:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow); }
.mc-card.on { background: var(--act); color: var(--on-act); }
.mc-card.wrong { box-shadow: 3px 3px 0 var(--crime); border-color: var(--crime); }
.mc-face {
  position: relative; width: 46px; height: 46px; overflow: hidden; border-radius: 50%;
  border: 2px solid var(--outline); background: color-mix(in srgb, var(--who) 22%, var(--surface));
}
.mc-face .face { display: block; width: 100%; height: 100%; }
.mc-card.is-victim .mc-face { filter: grayscale(.85); }
.mc-card.placed:not(.on) .mc-face { outline: 3px solid var(--good); outline-offset: 1px; }
.mc-words { display: grid; gap: 3px; }
.mc-name { font: 700 18px/1.15 var(--font-title); }
.mc-name small { margin-left: 7px; font: 600 12.5px var(--font-ui); color: var(--ink-3); }
.mc-card.on .mc-name small { color: inherit; }
.mc-clue { font-size: 15px; line-height: 1.4; }
.hero-ctas { grid-area: ctas; display: flex; flex-wrap: wrap; gap: 12px; }

/* Words in a card that point at the plan. */
.pg .k { border-radius: 3px; padding: 0 1px; transition: background-color .12s, box-shadow .12s; }
.pg .k-room { font-weight: 700; color: var(--gold-text); background: linear-gradient(transparent 62%, var(--gold-wash) 62%); }
.pg .k-line { font-weight: 700; color: var(--blue-text); text-decoration: underline 2px; text-decoration-color: color-mix(in srgb, var(--blue-text) 40%, transparent); text-underline-offset: 3px; }
.pg .k:hover { background: var(--hl-wash); box-shadow: 0 0 0 2px var(--hl-edge); }
.mc-card.on .k-room, .mc-card.on .k-line { color: inherit; }

/* -- the case left open --------------------------------------------------- */
.pg .resume {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 40px; padding: 0 2px;
  font-size: 15px; color: var(--ink-2); text-decoration: none;
}
.pg .resume b { color: var(--ink); text-decoration: underline 2px; text-underline-offset: 3px; }
.pg .resume:hover b { text-decoration-color: var(--act); }

/* -- filters: plain toggles, no box round them ------------------------------ */
.pg .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin: 0 0 8px; }
.pg .filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pg .filter {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 4px 12px; border: 2px solid var(--outline); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font: 700 14px/1.3 var(--font-ui);
}
.pg .filter .icon { width: 16px; height: 16px; }
.pg .filter[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.pg .pip { width: 9px; height: 9px; flex: none; border-radius: 50%; border: 1.5px solid var(--outline); }
.pg .pip-easy { background: var(--gr); }
.pg .pip-medium { background: var(--act); }
.pg .pip-hard { background: var(--crime); }
.pg .pip-expert { background: var(--ink); }
.pg .filter-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; font-size: 14px; }
.pg .filter-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }

/* -- a series: its plan once, its episodes in order ------------------------ */
.pg .shelf-list {
  display: grid; grid-template-columns: 188px minmax(0, 1fr); gap: 36px; align-items: start;
  margin: 0; padding: 36px 0; border-top: 2px solid var(--outline);
}
.pg .shelves > .shelf-list:first-child { border-top: 0; }
.pg .shelf-list.loose-shelf, .pg .shelf-list.together-shelf { grid-template-columns: minmax(0, 1fr); }
.pg .shelf-plan {
  width: 188px; aspect-ratio: 1; padding: 12px;
  background: var(--surface); border: 2px solid var(--outline); border-radius: 14px;
  box-shadow: 4px 4px 0 var(--shadow); transform: rotate(-1.5deg);
}
.pg .shelf-list:nth-of-type(even) .shelf-plan { transform: rotate(1.2deg); }
.pg .shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0; padding: 0; border: 0; }
.pg .shelf-title { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.pg .shelf-progress { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink-3); }
.pg .shelf-note { margin: 4px 0 0; font-size: 15px; color: var(--ink-2); }
.pg .episodes {
  margin-top: 16px; overflow: hidden;
  background: var(--surface); border: 2px solid var(--outline); border-radius: 14px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.pg .case-row { position: relative; }
.pg .case-row .case-link {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 118px 170px; align-items: center; gap: 16px;
  padding: 12px 18px 12px 14px;
  color: var(--ink); text-decoration: none;
  border-top: 1.5px solid var(--line);
}
.pg .episodes > .case-row:first-child .case-link,
.pg .episodes > .case-row[hidden] + .case-row .case-link { border-top: 0; }
.pg .case-row .case-link:hover { background: color-mix(in srgb, var(--act) 20%, var(--surface)); }
.pg .loose-shelf .case-row .case-link { grid-template-columns: 52px minmax(0, 1fr) 118px 170px; }
/* A case two may play leads two ways: the row is not a link, each chip is. */
.pg .together-shelf .case-row .case-link { grid-template-columns: 52px minmax(0, 1fr) 118px auto; }
.pg .together-row .case-link:hover { background: none; }
.pg .row-modes { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.pg .mode-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 12px 5px 9px;
  color: var(--ink); text-decoration: none; white-space: nowrap;
  background: var(--surface); border: 2px solid var(--outline); border-radius: 999px;
  box-shadow: 2px 2px 0 var(--shadow); font: 700 13.5px/1.2 var(--font-ui);
}
.pg .mode-chip:hover { background: color-mix(in srgb, var(--act) 28%, var(--surface)); }
.pg .mode-chip .icon { width: 17px; height: 17px; flex: none; }
.pg .mode-chip .chip-players { font-weight: 600; color: var(--ink-3); }
.pg .mode-chip .chip-done { width: 16px; height: 16px; color: var(--good); }
.pg .row-modes .turn-dot { position: static; transform: none; margin: 0; }
.pg .ep-no {
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 2px solid var(--outline); border-radius: 50%; background: var(--surface);
  font: 700 17px/1 var(--font-title); font-variant-numeric: tabular-nums;
}
.pg .case-row[data-status="solved"] .ep-no { background: var(--good); border-color: var(--good); color: var(--surface); }
.pg .row-main { display: grid; gap: 2px; min-width: 0; }
.pg .case-name { font: 700 18px/1.2 var(--font-title); letter-spacing: -0.01em; }
.pg .row-sub { font-size: 13.5px; color: var(--ink-3); }
.pg .row-diff { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; }
.pg .row-status { justify-self: end; white-space: nowrap; }
.pg .row-thumb { display: block; width: 52px; aspect-ratio: 1; padding: 3px; background: var(--surface-2); border: 2px solid var(--outline); border-radius: 8px; }
.pg .status { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--ink-3); }
.pg .status.solved { color: var(--good); }
.pg .status .icon { width: 16px; height: 16px; }
.pg .status.started { color: var(--ink-2); }
.pg .meter { position: relative; display: inline-block; width: 56px; height: 8px; overflow: hidden; border-radius: 4px; background: var(--surface-2); border: 1.5px solid var(--outline); }
.pg .meter::after { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 100%); background: var(--ink); }
.pg .case-row .turn-dot { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); margin: 0; }
.pg .no-match { padding: 28px; text-align: center; border: 2px dashed var(--line); border-radius: 16px; color: var(--ink-2); }

/* The plan, drawn small: tinted rooms, ink walls, what is in the way. */
.sketch { display: block; width: 100%; height: 100%; filter: drop-shadow(2px 2px 0 var(--shadow)); }
.row-thumb .sketch { filter: none; }
.sketch .tw { fill: none; stroke: var(--wall); stroke-width: 1.3px; stroke-linecap: square; }
.sketch .to { fill: none; stroke: var(--outline); stroke-width: 2.2px; }
.sketch .tb { fill: var(--ink); opacity: .28; }
.sketch .tp { fill: var(--ink); opacity: .2; }
.sketch .wa { fill: var(--wa); }
.sketch .r1 { fill: var(--room-1); } .sketch .r2 { fill: var(--room-2); } .sketch .r3 { fill: var(--room-3); }
.sketch .r4 { fill: var(--room-4); } .sketch .r5 { fill: var(--room-5); } .sketch .r6 { fill: var(--room-6); }
.sketch .r7 { fill: var(--room-7); } .sketch .r8 { fill: var(--room-8); } .sketch .r9 { fill: var(--room-9); }
.sketch .r10 { fill: var(--room-10); }

/* The Studio's saved plans. */
.pg .maps-shelf { padding: 36px 0 0; border-top: 2px solid var(--outline); }
.pg .maps { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 16px; }
.pg .map-card {
  display: grid; gap: 4px; padding: 10px; color: var(--ink); text-decoration: none;
  background: var(--surface); border: 2px solid var(--outline); border-radius: 14px; box-shadow: 3px 3px 0 var(--shadow);
}
.pg .map-card:hover { background: color-mix(in srgb, var(--act) 16%, var(--surface)); }
.pg .map-thumb { display: block; margin-bottom: 6px; border-radius: 8px; overflow: hidden; }
.pg .map-edit { font-size: 13.5px; font-weight: 700; color: var(--ink-2); text-decoration: underline 2px; text-underline-offset: 3px; }

/* -- standalone pages: account, leaderboard, lobby, administration --------- */
.pg .online-content { max-width: none; margin: 0; padding: 0; }
.pg .online-content h1 { margin: 0 0 8px; font: 700 clamp(30px, 3.6vw, 44px)/1.08 var(--font-title); letter-spacing: -0.025em; }
.pg .online-content h2 { margin: 36px 0 12px; font: 700 24px/1.2 var(--font-title); letter-spacing: -0.015em; color: var(--ink); }
.pg .online-content h3 { margin: 18px 0 8px; font: 700 18px/1.2 var(--font-title); }
.pg .online-lead { margin: 0 0 20px; font-size: 16px; color: var(--ink-2); }
.pg .online-lead:empty { display: none; }
.pg .online-content .hint { margin: 6px 0 10px; font: 400 14px/1.45 var(--font-ui); color: var(--ink-3); }
.pg .online-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.pg .online-status { margin: 12px 0; padding: 10px 14px; border-radius: 12px; font: 600 14.5px/1.4 var(--font-ui); color: var(--ink); background: var(--blue-wash); }
.pg .online-status.error { background: var(--crime-wash); color: var(--crime-text); }
.pg .online-status.good { background: var(--sage-wash); color: var(--sage-text); }
.pg .online-content table {
  width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden;
  background: var(--surface); border: 2px solid var(--outline); border-radius: 14px;
  box-shadow: 3px 3px 0 var(--shadow);
  font: 400 15px/1.35 var(--font-ui);
}
/* A table the page script drew sits in a box that scrolls on a phone. */
.pg .table-scroll {
  max-width: 100%; overflow-x: auto; margin: 0 0 4px;
  background: var(--surface); border: 2px solid var(--outline); border-radius: 14px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.pg .table-scroll > table { border: 0; border-radius: 0; box-shadow: none; }
.pg .table-scroll td, .pg .table-scroll th { white-space: nowrap; }
.pg .table-scroll td:first-child, .pg .table-scroll td:nth-child(2) { white-space: normal; }
.pg .online-content th, .pg .online-content td { padding: 11px 14px; border-bottom: 1.5px solid var(--line); text-align: left; vertical-align: middle; font-variant-numeric: tabular-nums; }
.pg .online-content th { font: 700 13px/1.3 var(--font-ui); text-transform: none; letter-spacing: 0; color: var(--ink-3); background: var(--surface); }
.pg .online-content tbody tr:last-child td { border-bottom: 0; }
.pg .online-content tr.is-me td { background: color-mix(in srgb, var(--act) 26%, var(--surface)); font-weight: 700; }
.pg .online-content td .online-actions { margin: 0; gap: 6px; }
.pg .online-content td .act { min-height: 32px; padding: 0 10px; font-size: 13px; box-shadow: 1.5px 1.5px 0 var(--shadow); }
.pg .mark-assisted { color: var(--gold-text); }
.pg .mark-replay { color: var(--ink-3); font-size: 13px; }
.pg .mark-lost { color: var(--crime-text); font-weight: 700; }
.pg .toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font: 600 15px/1.3 var(--font-ui); color: var(--ink); }
.pg .toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.pg #online-settings { margin: 36px 0 0; padding-top: 18px; border-top: 2px dotted var(--line); }
.pg .online-content .col-when { white-space: nowrap; }

/* The account: what is open, how it went, every run. */
.pg .acct-open { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; overflow: hidden; background: var(--surface); border: 2px solid var(--outline); border-radius: 14px; box-shadow: 3px 3px 0 var(--shadow); }
.pg .acct-open li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; border-top: 1.5px solid var(--line); }
.pg .acct-open li:first-child { border-top: 0; }
.pg .acct-open b { flex: 1 1 200px; font: 700 18px/1.2 var(--font-title); }
.pg .acct-stats td:first-child, .pg .acct-stats th:first-child { width: 34%; }
.pg .acct-mode { margin: 22px 0 8px; font: 700 18px/1.2 var(--font-title); }

/* The leaderboard: four tabs and a case to pick. */
.pg .lb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin: 8px 0 20px; }
.pg .online-tabs { display: inline-flex; flex-wrap: wrap; gap: 0; margin: 0; border: 2px solid var(--outline); border-radius: 12px; overflow: hidden; background: var(--surface); }
.pg .online-tabs .act { min-height: 38px; padding: 0 16px; border: 0; border-radius: 0; box-shadow: none; }
.pg .online-tabs .act + .act { border-left: 2px solid var(--outline); }
.pg .online-tabs .act[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.pg .lb-pick { display: inline-flex; align-items: center; gap: 8px; font: 700 14px/1.2 var(--font-ui); color: var(--ink-2); }
.pg .online-select, .pg .lb-pick select {
  display: inline-block; width: auto; max-width: min(100%, 420px); min-height: 40px; margin: 0; padding: 6px 34px 6px 12px;
  font: 600 15px/1.2 var(--font-ui); color: var(--ink); background: var(--surface);
  border: 2px solid var(--outline); border-radius: 10px;
}
.pg .lb-modes { display: inline-flex; gap: 6px; margin: 0 0 14px; }
.pg .lb-modes .act[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.pg .lb-note { margin: -8px 0 14px; font-size: 14px; color: var(--ink-3); }
.pg #lb-panel .online-status { background: none; padding: 0; margin: 0 0 14px; font-weight: 700; color: var(--ink-2); }

/* The way in to a table: what the mode is, beside the plan, then the ways in. */
.pg .online-content[data-page="table_start"] #online-lead { margin: 0 0 18px; font: 600 17px/1.35 var(--font-ui); color: var(--ink-2); }
.pg .table-explain {
  display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 22px; align-items: start;
  margin: 0 0 24px; padding: 18px 20px;
  background: var(--surface); border: 2px solid var(--outline); border-radius: 16px; box-shadow: 4px 4px 0 var(--shadow);
}
.pg .table-explain.no-plan { grid-template-columns: minmax(0, 1fr); }
.pg .table-plan { width: 148px; aspect-ratio: 1; }
.pg .table-roles { display: grid; gap: 12px; min-width: 0; }
.pg .table-players { display: inline-flex; align-items: center; gap: 7px; margin: 0; font: 700 14px/1.3 var(--font-ui); color: var(--ink-3); }
.pg .table-players .icon { width: 18px; height: 18px; }
.pg .table-seats { display: grid; gap: 10px; margin: 0; }
.pg .table-role { display: grid; gap: 3px; }
.pg .table-role dt { display: inline-flex; align-items: center; gap: 7px; font: 700 17px/1.25 var(--font-title); color: var(--ink); }
.pg .table-role dt .icon { width: 18px; height: 18px; flex: none; }
.pg .table-role dd { margin: 0 0 0 25px; font: 400 15px/1.45 var(--font-ui); color: var(--ink-2); }
.pg .table-rule { margin: 0; font: 400 14.5px/1.45 var(--font-ui); color: var(--ink-3); }
.pg .table-start { margin: 8px 0 0; }
.pg .table-pace { display: inline-flex; gap: 0; margin: 0 0 6px; border: 2px solid var(--outline); border-radius: 12px; overflow: hidden; background: var(--surface); }
.pg .table-pace .act { border: 0; border-radius: 0; box-shadow: none; min-height: 38px; }
.pg .table-pace .act + .act { border-left: 2px solid var(--outline); }
.pg .table-pace .act[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.pg .table-pace-note { margin: 4px 0 12px; }
.pg .table-join { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 28px 0 0; padding-top: 20px; border-top: 2px dotted var(--line); }
.pg .table-join label { font: 700 15px/1.2 var(--font-ui); text-transform: none; letter-spacing: 0; color: var(--ink); }
.pg .table-join input {
  width: 9em; min-height: 40px; padding: 6px 12px;
  font: 700 17px/1 var(--font-ui); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); background: var(--surface); border: 2px solid var(--outline); border-radius: 10px;
}
.pg .table-open-group { margin: 14px 0 0; }
.pg .table-open-head { margin: 0 0 8px; font: 700 15px/1.3 var(--font-ui); text-transform: none; letter-spacing: 0; color: var(--ink-3); }
.pg .table-open-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 8px; padding: 10px 14px;
  background: var(--surface); border: 2px solid var(--outline); border-radius: 12px;
}
.pg .table-open-row b { flex: 1 1 140px; font: 700 16px/1.2 var(--font-title); }
.pg .table-open-row.is-your-turn { box-shadow: 3px 3px 0 var(--act); }
.pg .table-open-code, .pg .table-open-role, .pg .table-open-state { font-size: 13.5px; color: var(--ink-3); letter-spacing: 0; }
.pg .table-open-row .table-close { margin-left: auto; }
.pg .turn-dot { display: inline-flex; align-items: center; gap: 6px; font: 700 13px/1.3 var(--font-ui); color: var(--ink); text-decoration: none; }
.pg .turn-dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--act); border: 1.5px solid var(--outline); box-shadow: none; }

/* A card that says why a door is shut: sign in, waiting, an invite, an error. */
.pg .signin { max-width: 560px; margin: 24px auto 0; width: 100%; }
.pg .signin-card {
  padding: 28px 28px 22px;
  background: var(--surface); border: 2px solid var(--outline); border-radius: 18px;
  box-shadow: 6px 6px 0 var(--shadow);
}
.pg .signin-card h1 { margin: 0 0 12px; font: 700 30px/1.12 var(--font-title); letter-spacing: -0.02em; }
.pg .signin-card p { margin: 0 0 12px; font: 400 16px/1.5 var(--font-ui); color: var(--ink-2); }
.pg .signin-card .signin-case { margin: 0 0 6px; font: 600 15px/1.3 var(--font-ui); color: var(--ink-3); }
.pg .signin-card .online-actions { margin: 20px 0 0; }
.pg .signin-card .online-status { margin: 14px 0 0; }
.pg .signin-card code { font: 600 14px/1 ui-monospace, monospace; }
/* An invite: the case's plan beside who asks, then what the seat does. */
.pg .invite-head { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 18px; align-items: center; margin: 0 0 16px; }
.pg .invite-plan { width: 96px; aspect-ratio: 1; }
.pg .invite-title .signin-case { margin: 0 0 6px; }
.pg .invite-title h1 { margin: 0; }
.pg .signin-card .invite-seat { margin: 0; padding-bottom: 16px; border-bottom: 1px solid var(--line); }

/* The administrator's pages keep their own layouts; the frame is the pages'. */
.pg .online-content[data-page="activity"], .pg .online-content[data-page="releases"],
.pg .online-content[data-page="players"], .pg .online-content[data-page="errors"] { max-width: none; }
.pg .online-content table.publications, .pg .online-content table.activity-table,
.pg .online-content table.versions-table { font-size: 13.5px; }
.pg .online-content table.publications th, .pg .online-content table.activity-table th,
.pg .online-content table.versions-table th { font: 700 12.5px/1.3 var(--font-ui); text-transform: none; letter-spacing: 0; }
.pg .tile { background: var(--surface); border: 2px solid var(--outline); border-radius: 12px; box-shadow: 3px 3px 0 var(--shadow); }
.pg .tile b { font: 700 26px/1.1 var(--font-title); }
.pg .tile span { font: 600 13px/1.3 var(--font-ui); text-transform: none; letter-spacing: 0; color: var(--ink-3); }
.pg .release-case { border-radius: 14px; }
.pg .release-case h2, .pg #upcoming h2 { margin: 0; font-size: 21px; }
.pg .activity-panel h2 { margin: 0 0 8px; }

/* -- phones and tablets ----------------------------------------------------- */
@media (max-width: 959px) {
  .pg { padding: 0 16px 32px; }
  .pg-top { min-height: 0; margin-bottom: 28px; padding: 10px 0; gap: 10px; }
  .pg-top .brand { font-size: 22px; }
  .pg-top .nav { display: none; }
  .pg-top .grow { display: none; }
  .pg-controls { order: 3; width: 100%; justify-content: space-between; gap: 8px; }
  .pg .pg-account { margin-left: auto; }
  .pg .lb-pick { flex: 1 1 100%; min-width: 0; }
  .pg .lb-pick select { flex: 1 1 auto; min-width: 0; width: 100%; max-width: none; }
  .pg .seg button { padding: 6px 9px; font-size: 13px; }
  .pg .casebook-note { margin: -12px 0 20px; }
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "plan" "clues" "ctas"; grid-template-rows: none; row-gap: 22px; margin-bottom: 40px; }
  .pg .hero-title { font-size: 34px; max-width: 18ch; }
  .mc-plan { max-width: 440px; width: 100%; padding-top: 56px; }
  .mc-note { font-size: 21px; }
  .mc-clues { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .mc-card { grid-template-columns: 40px minmax(0, 1fr); padding: 10px 12px; }
  .mc-face { width: 40px; height: 40px; }
  .hero-ctas .btn { flex: 1 1 100%; }
  .pg .resume { margin-bottom: 28px; }
  .pg .shelf-list { grid-template-columns: 84px minmax(0, 1fr); grid-template-areas: "plan head" "list list"; gap: 14px 16px; padding: 28px 0; }
  .pg .shelf-body { display: contents; }
  .pg .shelf-plan { grid-area: plan; width: 84px; padding: 6px; box-shadow: 3px 3px 0 var(--shadow); }
  .pg .shelf-head { grid-area: head; align-self: center; display: grid; gap: 2px; }
  .pg .shelf-note { display: none; }
  .pg .shelf-title { font-size: 22px; }
  .pg .episodes { grid-area: list; margin-top: 0; }
  .pg .shelf-list.loose-shelf, .pg .shelf-list.together-shelf { grid-template-areas: "head" "list"; grid-template-columns: minmax(0, 1fr); }
  .pg .case-row .case-link,
  .pg .loose-shelf .case-row .case-link,
  .pg .together-shelf .case-row .case-link {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    grid-template-areas: "ep main status" "ep diff status";
    gap: 2px 12px; padding: 11px 12px;
  }
  .pg .loose-shelf .case-row .case-link, .pg .together-shelf .case-row .case-link { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .pg .ep-no, .pg .row-thumb { grid-area: ep; align-self: center; }
  .pg .row-thumb { width: 44px; }
  .pg .row-main { grid-area: main; }
  .pg .row-diff { grid-area: diff; font-size: 13px; }
  .pg .row-status { grid-area: status; }
  .pg .row-sub { font-size: 13px; }
  .pg .together-shelf .together-row .case-link {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas: "ep main" "ep diff" "modes modes";
  }
  .pg .row-modes { grid-area: modes; justify-content: flex-start; margin-top: 8px; }
  .pg .meter { display: none; }
  .pg .case-row .turn-dot { right: 12px; }
  .pg-foot { margin-top: 40px; }
  .pg .online-content table { font-size: 14px; }
  .pg .online-content th, .pg .online-content td { padding: 9px 10px; }
  .pg .signin { margin-top: 0; }
  .pg .signin-card { padding: 22px 18px 18px; box-shadow: 4px 4px 0 var(--shadow); }
  .pg .signin-card h1 { font-size: 25px; }
  .pg .invite-head { grid-template-columns: 72px minmax(0, 1fr); gap: 14px; }
  .pg .invite-plan { width: 72px; }
  .pg .table-explain { grid-template-columns: 84px minmax(0, 1fr); gap: 14px 16px; padding: 14px; box-shadow: 3px 3px 0 var(--shadow); }
  .pg .table-plan { width: 84px; }
  .pg .table-role dd { margin-left: 0; font-size: 14.5px; }
  .pg .signin-card .online-actions .act, .pg .signin-card .online-actions .btn { flex: 1 1 100%; }
  .pg .table-join input { flex: 1 1 8em; }
}
@media (min-width: 700px) and (max-width: 959px) {
  .mc-clues { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .pg .online-content .col-when { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mp-token, .nudge { animation: none; }
}
