/* dice.place — the web app's one stylesheet: the site's pages, the start panel
   on a game's page (the archive widget's own rules, scoped to #stage), and the
   room. The same tokens forji's chat widget and the app draw with, so the site,
   the room's chat and the phone are recognisably one product; where the page
   and the start panel share a word, the page's rule stops at the panel
   (`:where(:not(#stage *))`, ¶pieces). */

/* `--s` and `--pad` are the start panel's: its sizes are the phone's points
   times --s, and --pad its inset. */
:root {
  --bg: #faf9f7; --panel: #fff; --ink: #1b1a18; --muted: #6b6862; --line: #e4e1db;
  --accent: #5c3a1e; --accent-ink: #fff; --danger: #a8342a; --soft: #f3f1ec; --gold: #b8860b;
  --shadow: 0 10px 30px rgba(20, 18, 12, .18), 0 1px 3px rgba(20, 18, 12, .12);
  --bar: rgba(250, 249, 247, .82);
  --radius: 14px;
  --s: 1; --pad: 12px;
}
/* Dark, by the machine's own setting or by an explicit data-theme — written the
   way the widget writes it, so the two cannot drift and a page can be forced
   either way to be looked at. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151513; --panel: #1e1e1c; --ink: #eceae5; --muted: #9a968e; --line: #33322e;
    --accent: #b08256; --accent-ink: #241a10; --danger: #e0796d; --soft: #26261f; --gold: #e0b64a;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
    --bar: rgba(21, 21, 19, .82);
  }
}
:root[data-theme="dark"] {
  --bg: #151513; --panel: #1e1e1c; --ink: #eceae5; --muted: #9a968e; --line: #33322e;
  --accent: #b08256; --accent-ink: #241a10; --danger: #e0796d; --soft: #26261f; --gold: #e0b64a;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
  --bar: rgba(21, 21, 19, .82);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
/* Tell the engine which mode we are in, so form controls, scrollbars and the
   default focus ring come out of the right set. Without it a light page draws
   dark native widgets on a dark-mode machine, which is half of what "the light
   mode is unreadable" was. */
:root { color-scheme: light dark; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration: none; }
img, video { max-width: 100%; }
h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 8px; }
h2 { font-size: 19px; letter-spacing: -.01em; margin: 34px 0 12px; }
h3 { font-size: 16px; margin: 0 0 4px; }
p { margin: 0 0 14px; }
.muted:where(:not(#stage *)) { color: var(--muted); }
.small:where(:not(#stage *)) { font-size: 14px; }
.lead { font-size: 18px; line-height: 1.55; color: var(--muted); max-width: 62ch; }

/* ---- the shell ---------------------------------------------------------------- */
/* Two widths, chosen by the page: prose reads at 760, and anything that is a
   GRID of pictures runs the window (the catalog, which is a wall of posters and
   was previously squeezed into the same column as an API paragraph). */
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 36px 20px 72px; }
.wide:where(:not(#stage *, .btn)) { width: 100%; max-width: 1680px; margin: 0 auto; padding: 28px 24px 72px; }
/* The page is ONE column the height of the window at least, so the footer
   stands on the window's bottom edge under a short page and follows a long
   one down. `body` was the column and #app its only child, so the rule never
   reached the footer: the column is #app's. */
#app { flex: 1 0 auto; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
#app > main { flex: 1 0 auto; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 0 24px; height: 58px;
  background: var(--bar); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 650; font-size: 17px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.topbar nav { margin-left: auto; display: flex; gap: 4px; align-items: center; font-size: 14px; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: 7px 11px; border-radius: 9px; font-weight: 550; }
.topbar nav a:hover { color: var(--ink); background: var(--soft); }
.topbar nav a.on { color: var(--ink); }
/* The avatar IS the account link, as it is on the phone (client/design.md:
   the player's avatar opens Profile) — not the nickname spelled out in the bar. */
.topbar .me { padding: 0; margin-left: 6px; }
.topbar nav a.signin { color: var(--ink); border: 1px solid var(--line); margin-left: 6px; }
/* "Make a game": the one button in the bar, for whoever is signed in. */
.topbar nav .make { font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 9px; padding: 6px 11px; margin-left: 6px; cursor: pointer; }
.topbar nav .make:hover { background: var(--soft); }
.av:where(:not(#stage *)) {
  width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex: none;
  display: grid; place-items: center; object-fit: cover;
  font-size: 13px; font-weight: 700; color: #fff; letter-spacing: .01em;
}
.av.lg:where(:not(#stage *)) { width: 44px; height: 44px; font-size: 17px; }
/* a character's face: their portrait (a whole figure, standing) seen head and shoulders, on a soft night */
.av.face { position: relative; overflow: hidden; background: radial-gradient(circle at 50% 30%, #4a6480, #1d2a3b 75%); }
.av.face img { position: absolute; width: 200%; height: 200%; max-width: none; left: -48%; top: -24%; object-fit: contain; }

.sitefoot {
  flex: none; border-top: 1px solid var(--line); background: var(--panel);
  padding: 22px 24px; margin-top: auto;
  display: flex; gap: 8px 20px; flex-wrap: wrap; align-items: center;
  font-size: 13px; color: var(--muted);
}
.sitefoot a { color: var(--muted); text-decoration: none; }
.sitefoot a:hover { color: var(--ink); text-decoration: underline; }
.sitefoot .copy { margin-left: auto; }

/* ---- pieces -------------------------------------------------------------------- */
/* `:where(:not(#stage *))` — THE START PANEL'S DOM IS IN THIS DOCUMENT. A
   game's page mounts it inline (#lobby-mount), and the panel spells its own
   parts with the same plain words this page does: .btn, .row, .av, .notice,
   .empty. Its rules are scoped to #stage so none of them lands on the page;
   this suffix is the other half of that bargain — a generic name here STOPS at
   the panel. It is wrapped in `:where()` so the exclusion costs no
   specificity: written bare, `.btn:not(…)` would outrank `.btn.secondary` and
   every variant below would have to repeat it. It is not hypothetical —
   `.empty { padding: 40px 0 }` landed on the start panel's dashed chip and
   stood it 40 px below the row it is in. A rule whose subject is a name the
   panel never uses (.wrap, .facts, .ghero, .topbar) needs no suffix. */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 18px 0; }
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }
.btn:where(:not(#stage *)) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid transparent;
  border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:where(:not(#stage *)):hover { filter: brightness(1.07); }
.btn.secondary:where(:not(#stage *)) { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.secondary:where(:not(#stage *)):hover { background: var(--soft); filter: none; }
.btn.danger:where(:not(#stage *)) { background: transparent; color: var(--danger); border-color: var(--line); }
.btn.small:where(:not(#stage *)) { padding: 7px 13px; font-size: 14px; }
.btn.wide:where(:not(#stage *)) { display: flex; width: 100%; }
.row:where(:not(#stage *)) { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.pill:where(:not(#stage *)) { font-size: 12px; font-weight: 550; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.feature:where(:not(#stage *)) { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line); color: var(--muted); }
.err { background: var(--soft); border-left: 3px solid var(--danger); padding: 12px 15px; border-radius: 0 8px 8px 0; margin: 0 0 16px; }
.notice:where(:not(#stage *)) { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 15px; font-size: 14px; color: var(--muted); }

/* The same suffix for the most generic names there are: the form controls,
   labels and tables. `p`, `a`, the headings and `img` are left alone. */
input[type=text]:where(:not(#stage *)), input[type=url]:where(:not(#stage *)),
input[type=number]:where(:not(#stage *)), textarea:where(:not(#stage *)), select:where(:not(#stage *)) {
  font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--panel); color: var(--ink); width: 100%;
}
textarea { line-height: 1.5; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label:where(:not(#stage *)) { display: block; font-size: 14px; font-weight: 600; margin: 16px 0 6px; }
table:where(:not(#stage *)) { width: 100%; border-collapse: collapse; margin: 12px 0; }
th:where(:not(#stage *)), td:where(:not(#stage *)) { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th:where(:not(#stage *)) { color: var(--muted); font-weight: 600; }

/* ---- the catalog --------------------------------------------------------------- */
/* A wall of posters that fills the window, the way every catalog of anything
   does. The cards were 220 px minimum inside a 760 px column, which is three
   across on a 27-inch screen with the rest of it empty. */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px 18px; margin: 20px 0 0; }
.card:where(:not(#stage *)) { display: block; color: var(--ink); text-decoration: none; }
.card:where(:not(#stage *)) .poster {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  border-radius: 12px; background: var(--soft); border: 1px solid var(--line); margin-bottom: 10px;
  transition: transform .16s ease;
}
.card:where(:not(#stage *)):hover .poster { transform: translateY(-3px); }
/* A game with no poster of its own wears the default one (core/dom.js
   DEFAULT_POSTER): dice on a felt table — its trays are on its own page. */
.card:where(:not(#stage *)) h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
/* three lines kept for every tagline, so the pills under them stand in one line across the wall */
.cards .desc { min-height: 3lh; }
.card:where(:not(#stage *)) .cmeta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card:where(:not(#stage *)) .pills { margin: 7px 0 0; }
/* The poster carries the player range as a capsule, exactly as the app's grid
   does (client/design.md Catalog) rather than as another caption line. */
.card:where(:not(#stage *)) .pwrap { position: relative; }
.card:where(:not(#stage *)) .seats {
  position: absolute; top: 8px; left: 8px; display: flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; background: rgba(12, 11, 9, .66); color: #fff;
  font-size: 12px; font-weight: 600; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.empty:where(:not(#stage *)) { color: var(--muted); padding: 40px 0; }

/* The rooms you are at and the invitations waiting, as CIRCLES above the
   games (client/design.md §Catalog — the pinned circles): the game's poster
   in a disc, a caption under it, an invitation with the inviter's face in
   the corner. One row that scrolls sideways past the window's width. */
.circles { display: flex; gap: 18px; overflow-x: auto; padding: 6px 4px 12px; margin: 4px 0 10px; scrollbar-width: none; }
.circles::-webkit-scrollbar { display: none; }
.circle { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 84px; text-decoration: none; color: var(--ink); }
.circle .disc { position: relative; width: 68px; height: 68px; border-radius: 50%; overflow: visible; box-shadow: var(--shadow); }
.circle .disc > img, .circle .disc > .none { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; background: var(--soft); border: 1px solid var(--line); }
.circle .disc > .none { display: grid; place-items: center; font-weight: 700; font-size: 20px; color: #fff; background: linear-gradient(160deg, hsl(var(--h) 42% 38%), hsl(var(--h) 38% 26%)); border: 0; }
.circle .disc .av.corner { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; font-size: 11px; border: 2px solid var(--bg); }
.circle .disc .badge { position: absolute; right: -2px; top: -2px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 10px; border: 2px solid var(--bg); }
.circle .cap { font-size: 12px; font-weight: 600; max-width: 84px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.circle.room .disc { box-shadow: var(--shadow), 0 0 0 2px var(--accent); }
/* An invitation before it is answered (core/invite.js): a card over the page. */
.invitewrap { position: fixed; inset: 0; z-index: 2147483100; display: grid; place-items: center; padding: 16px; }
.invitewrap .scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.invitecard { position: relative; width: min(420px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.invitecard .ihead { display: flex; gap: 14px; align-items: center; }
.invitecard .ihead h2 { margin: 2px 0; font-size: 22px; }
.invitecard .iposter { position: relative; flex: none; width: 72px; height: 72px; }
.invitecard .iposter > img, .invitecard .iposter > .none { width: 100%; height: 100%; border-radius: 16px; object-fit: cover; display: grid; place-items: center; font-weight: 700; font-size: 22px; color: #fff; background: linear-gradient(160deg, hsl(var(--h) 42% 38%), hsl(var(--h) 38% 26%)); }
.invitecard .iposter .av.corner { position: absolute; right: -6px; bottom: -6px; width: 30px; height: 30px; font-size: 12px; border: 2px solid var(--panel); }
.invitecard .pills { margin: 0; }
.invitecard .ipeople { display: flex; flex-wrap: wrap; gap: 10px; }
.invitecard .iperson { display: flex; align-items: center; gap: 6px; }
.invitecard .iperson .av { width: 28px; height: 28px; font-size: 11px; }
.invitecard .iacts { justify-content: flex-end; margin-top: 4px; }
.invitecard .btn:disabled { opacity: .5; cursor: default; }
/* An open turn waits on you: a thicker ring and a pulsing dot; a finished game: a check. */
.circle.room.awaiting .disc { box-shadow: var(--shadow), 0 0 0 3px var(--accent); }
.circle .disc .badge.turn { width: 16px; height: 16px; right: 0; top: 0; animation: turn-dot 1.2s ease-in-out infinite; }
.circle .disc .badge.done { font-size: 12px; font-weight: 800; }
.circle.room.finished .disc { box-shadow: var(--shadow), 0 0 0 2px var(--line); }
@keyframes turn-dot { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.3); opacity: .8; } }
.circle:hover .disc { transform: translateY(-2px); }

/* ---- a game's page ------------------------------------------------------------- */
.wrap.gamepage { max-width: 1060px; }
.ghead { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; }
.ghead h1 { margin: 0 0 2px; }
.ghead .tagline { font-size: 17px; color: var(--muted); margin: 0; }
.ghead .pills { margin-top: 8px; }
.ghead .gart { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); flex: none; }
.ghead .gtext { flex: 1; min-width: 0; }

/* A store page's top: the pictures (and the start panel under them) on the
   left, the description and the facts on the right, from the top down. */
.gtop { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto 1fr; grid-template-areas: "media side" "start side"; gap: 0 28px; }
.gmedia { grid-area: media; min-width: 0; }
.gside { grid-area: side; min-width: 0; align-self: start; }
.gtop #lobby-mount { grid-area: start; min-width: 0; align-self: start; }
.gview { position: relative; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.gview img.gopen { cursor: zoom-in; }
.gview img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* the poster standing in for screenshots fills the frame (the default one is a table, not a screenshot) */
.gview > img.gposter { object-fit: cover; }
.garrow { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 56px; border: 0; border-radius: 8px; background: rgb(0 0 0 / 45%); color: #fff; font-size: 22px; cursor: pointer; opacity: 0; transition: opacity .15s; display: grid; place-items: center; }
.garrow.prev { left: 8px; } .garrow.next { right: 8px; }
.gview:hover .garrow, .garrow:focus-visible { opacity: 1; }
.garrow:hover { background: rgb(0 0 0 / 65%); }
@media (hover: none) { .garrow { opacity: 1; background: rgb(0 0 0 / 30%); } }
.gthumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; scrollbar-width: thin; }
.gthumb { flex: none; width: 124px; aspect-ratio: 16 / 10; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: #000; cursor: pointer; opacity: .6; scroll-snap-align: start; transition: opacity .15s, border-color .15s; }
.gthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gthumb:hover { opacity: .9; }
.gthumb.on { opacity: 1; border-color: var(--accent); }
.gdesc { font-size: 15px; line-height: 1.55; }
.gdesc p:first-child { margin-top: 0; }
.gside .facts { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; gap: 8px 16px; }
.gside .facts dt { font-size: 13px; }
/* The trays the game is played in, each with the game's dice inside (pages/game.js trays) */
.gtrays { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.gtrays h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.gtraylist { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.gtray { margin: 0; color: var(--ink); }
.gtray svg { width: 100%; height: auto; display: block; border-radius: 10px; background: var(--soft); }
.gtray figcaption { margin-top: 6px; font-size: 12px; color: var(--muted); text-align: center; }

/* The screenshots full screen (pages/game.js openViewer), on <body>. */
html.lbopen { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgb(0 0 0 / 97%); display: flex; touch-action: pan-y; }
.lightbox .lbstage { flex: 1; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; box-sizing: border-box; padding: max(48px, env(safe-area-inset-top)) 64px max(48px, env(safe-area-inset-bottom)); }
.lightbox .lbstage img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; border-radius: 6px; user-select: none; }
.lightbox .garrow { opacity: 1; width: 48px; height: 72px; font-size: 28px; }
.lightbox .garrow.prev { left: 12px; } .lightbox .garrow.next { right: 12px; }
.lightbox .lbclose { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgb(255 255 255 / 12%); color: #fff; font-size: 20px; cursor: pointer; display: grid; place-items: center; }
.lightbox .lbclose:hover { background: rgb(255 255 255 / 22%); }
.lightbox .lbcount { position: absolute; top: max(22px, env(safe-area-inset-top)); left: 0; right: 0; text-align: center; color: rgb(255 255 255 / 75%); font-size: 14px; pointer-events: none; }
@media (max-width: 640px) {
  .lightbox .lbstage { padding: 64px 0; }
  .lightbox .lbstage img { border-radius: 0; }
  .lightbox .garrow { width: 40px; height: 60px; font-size: 24px; background: rgb(0 0 0 / 35%); }
  .lightbox .garrow.prev { left: 6px; } .lightbox .garrow.next { right: 6px; }
}

/* A phone: one column — the pictures, the words, then the start panel. */
@media (max-width: 820px) {
  .gtop { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "media" "side" "start"; }
  .gside { margin-top: 18px; }
}
@media (max-width: 640px) {
  .gamepage .gtop { margin: 0 -16px; }
  .gamepage .gview { border-radius: 0; border-left: 0; border-right: 0; }
  .gamepage .gthumbs { padding: 0 16px 4px; scroll-padding: 0 16px; }
  .gamepage .gthumb { width: 96px; }
  .gamepage .gside, .gamepage .gtop #lobby-mount { padding: 0 16px; }
  .gamepage .gside .facts { grid-template-columns: max-content 1fr; gap: 8px 16px; }
  .gamepage .gside .facts dd { margin-bottom: 0; }
  .ghead .gart { width: 52px; height: 52px; }
}

/* The parameter list — the facts the start panel above does NOT say: what it
   is played with, what it runs on. */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; margin: 14px 0 0; font-size: 15px; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* The start panel, inline (room/start.js): a section of the article, full width
   of the column, no card of its own. The rule above it is the only thing that
   separates it from the prose. */
#lobby-mount { margin: 26px 0 10px; border-top: 1px solid var(--line); padding-top: 24px; position: relative; }

/* ---- small screens ------------------------------------------------------------- */
@media (max-width: 640px) {
  .wrap { padding: 24px 16px 56px; }
  .wide:where(:not(#stage *, .btn)) { padding: 20px 16px 56px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar nav a { padding: 7px 8px; }
  h1 { font-size: 25px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 12px; }
  .facts { grid-template-columns: 1fr; gap: 2px 0; }
  .facts dd { margin-bottom: 10px; }
  .sitefoot .copy { margin-left: 0; }
}

/* Font Awesome 6 Free Solid, self-hosted (SIL OFL): the icons `icon()` draws
   (core/dom.js), each glyph declared by name. */
@font-face { font-family: "faw"; font-style: normal; font-weight: 900; font-display: block; src: url("/fonts/fa-solid.woff2") format("woff2"); }
.fa { font-family: "faw"; font-weight: 900; font-style: normal; line-height: 1; display: inline-block; text-rendering: auto; -webkit-font-smoothing: antialiased; }
.fa-camera::before { content: "\f030"; }
.fa-gear::before { content: "\f013"; }
.fa-xmark::before { content: "\f00d"; }
.fa-mobile-screen::before { content: "\f3cf"; }
.fa-angle-left::before { content: "\f104"; }
.fa-angle-right::before { content: "\f105"; }
.fa-chevron-down::before { content: "\f078"; }
.fa-eye::before { content: "\f06e"; }
.fa-user::before { content: "\f007"; }
.fa-play::before { content: "\f04b"; }
#stage .fa::before { display: inline-block; }
/* The party discs' two (core/parties.js partyAvatar). */
#stage .fa-wrench::before { content: "\f0ad"; }
#stage .fa-user-group::before { content: "\f500"; }

/* ---- The start panel (room/start.js), in the archive widget's own frame ----------
   #stage > #overlay > #pregame > #main + #footer, and every rule for what is
   inside it scoped to #stage: the panel spells its parts with the same plain
   words the page does (.btn, .row, .notice, .empty), and the page's rules for
   those stop at it (`:where(:not(#stage *))`, ¶pieces). */
#stage {
  color: var(--ink);
  font: calc(14px * var(--s))/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#stage button { font: inherit; }

/* The panel's column. It stands in the page's flow (html.standalone, always
   so while a game's page shows it), so the frame's own ground, edge and
   clipping are gone and only its column is left. */
#overlay { display: flex; flex-direction: column; position: relative; min-height: 0; color: var(--ink); isolation: isolate; }
#pregame { display: none; flex: 1; min-height: 0; flex-direction: column; }
html.pregame #pregame { display: flex; }
/* By id, not element: inline on the catalog page the site's own `main`/`footer`
   rules (max-width, margins) would otherwise reach in and narrow the panel. */
#main { flex: 1; min-height: 0; overflow: auto; padding: var(--pad); margin: 0; width: 100%; max-width: none; display: flex; flex-direction: column; gap: var(--pad); }
#main > * { flex: none; }
#footer { padding: calc(10px * var(--s)) var(--pad) var(--pad); margin: 0; width: 100%; max-width: none; border-top: 1px solid var(--line); display: flex; gap: calc(8px * var(--s)); flex-wrap: wrap; background: transparent; }
#footer:empty { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }


/* ---- Shared bits ---------------------------------------------------------------------------- */
#stage .av {
  width: 36px; height: 36px; border-radius: 50%; flex: none; background: var(--soft); color: var(--ink);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; position: relative; overflow: hidden;
}
#stage .av img { width: 100%; height: 100%; object-fit: cover; display: block; }
#stage .av.bot { background: var(--line); }
.av svg.botface { width: 100%; height: 100%; display: block; }
#stage .muted { color: var(--muted); } #stage .small { font-size: 12px; }
#stage .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  cursor: pointer; font-weight: 600; text-decoration: none; min-height: 38px;
}
#stage .btn:hover { background: var(--soft); }
#stage .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
#stage .btn.primary:hover { filter: brightness(1.05); background: var(--accent); }
#stage .btn.wide { width: 100%; }
#stage .btn:disabled { opacity: .5; cursor: default; }
#stage .btn.busy::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
#stage .row { display: flex; gap: 8px; align-items: center; }
#stage .notice { border-left: 3px solid var(--danger); background: var(--soft); padding: calc(8px * var(--s)) calc(12px * var(--s)); border-radius: 0 calc(8px * var(--s)) calc(8px * var(--s)) 0; font-size: calc(13px * var(--s)); }
/* The "nothing here" line. NOT a seat: `.seat.empty` is a dashed chip, and this
   rule's padding would push it out of line with the seats beside it. */
#stage .empty:not(.seat) { color: var(--muted); font-size: calc(13px * var(--s)); padding: calc(10px * var(--s)) calc(4px * var(--s)); }
#stage .list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: calc(12px * var(--s)); overflow: hidden; }
#stage .list .item { display: flex; align-items: center; gap: calc(10px * var(--s)); padding: calc(8px * var(--s)) calc(10px * var(--s)); border-top: 1px solid var(--line); cursor: pointer; }
#stage .list .item:first-child { border-top: 0; }
#stage .list .item:hover { background: var(--soft); }
#stage .list .who { flex: 1; min-width: 0; }
#stage .list .btn { padding: 5px 10px; min-height: 30px; font-size: 12px; }

/* ---- The start panel: Public | Private → the party → the seats → the primary ---- */
#stage .start { display: flex; flex-direction: column; gap: calc(10px * var(--s)); }
#stage .start .seg { display: flex; background: var(--soft); border-radius: calc(12px * var(--s)); padding: calc(3px * var(--s)); }
#stage .start .seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: calc(8px * var(--s)); border-radius: calc(10px * var(--s)); cursor: pointer; }
#stage .start .seg button.on-1 { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
/* The seats: everyone coming, then the dashed chips. The strip scrolls, and a
   scrolling box CLIPS: the padding is what the rings need — "You" wears a 3 px
   ring and a fixed seat a 2 px outline 2 px out — so nothing is cut at the top. */
#stage .chips-start { display: flex; gap: calc(8px * var(--s)); overflow-x: auto; padding: calc(6px * var(--s)) calc(4px * var(--s)); scrollbar-width: none; }
#stage .chips-start::-webkit-scrollbar { display: none; }
/* Every chip is one width, whatever its label: a party named "Two players"
   and one named "Bot vs bot", a seat "You" and a seat "Strong bot" stand the
   same distance apart. */
#stage .chips-start .seat { flex: none; width: 76px; }
#stage .chips-start .seat .name { max-width: 100%; }
#stage .chips-start .seat.watching { opacity: .6; }
#stage .chips-start .seat.watching .av { border: 2px dashed var(--muted); }
#stage .chips-start .seat-av, #stage .chips-start .seat-av .av { width: 48px; height: 48px; }
#stage .chips-start .seat-av .av { font-size: 16px; }
#stage .chips-start .seat.empty { cursor: pointer; }
#stage .chips-start .seat.empty .av { border: 2px dashed var(--muted); background: transparent; }
#stage .chips-start .seat.empty .av .fa { font-size: 15px; color: var(--muted); }
#stage .chips-start .seat.empty:hover:not(.off) .av { border-color: var(--ink); }
/* Every button across the foot stands the same height; the primary takes the room left over. */
#stage footer .act { gap: calc(10px * var(--s)); width: 100%; } #stage footer .act .btn { min-height: calc(46px * var(--s)); } #stage footer .act .btn.primary { flex: 1; }

/* The viewer's rooms of this game (room/start.js #ongoing), above the start
   panel: one line each, and Continue. */
#ongoing .item b { font-weight: 650; }

/* ---- The seats ----------------------------------------------------------------------------- */
#stage .seat { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
#stage .seat .name { font-size: 12px; color: var(--muted); max-width: 72px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#stage .seat .name.you { color: var(--ink); }
/* What a bot IS, under the name it sits under: the record's full name, given
   two lines rather than cut off — one record may sit twice, so the name above
   says WHO and this says WHAT. */
#stage .seat .sub {
  font-size: 10px; line-height: 1.2; color: var(--muted); opacity: .75; max-width: 100%; text-align: center;
  white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
#stage .seat-av { position: relative; width: 52px; height: 52px; }
#stage .seat-av .av { width: 52px; height: 52px; font-size: 18px; }
#stage .seat.empty .av { border: 2px dashed var(--muted); background: transparent; }
/* The sign-in, before a signed-out visitor may play. */
#stage .signin { display: flex; flex-direction: column; align-items: center; text-align: center; gap: calc(12px * var(--s)); padding: calc(18px * var(--s)) calc(6px * var(--s)); margin: auto 0; }
#stage .signin .stitle { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
#stage .signin .sub { font-size: 13px; line-height: 1.5; max-width: 300px; }
#stage .signin .btn { margin-top: 4px; min-height: 46px; }

/* ---- Standalone: the panel inline, a section of the page's own flow ---------------------------- */
/* No card of its own, and it runs the width of the column it is mounted in:
   inline, the panel's sides are the article's column — its own inner pad would
   stand the segmented control and the Start button a pad inside the text above
   them, a ragged left edge down the page. */
html.standalone #stage { position: relative; inset: auto; width: 100%; height: auto; clip-path: none !important; }
html.standalone #main { overflow: visible; }
html.standalone.pregame #main, html.standalone.pregame #footer { padding-left: 0; padding-right: 0; }
html.standalone #pregame { width: 100%; }


/* ---- The camera's feed ----------------------------------------------------------
   THE FEED'S HOST (widget/capture.js feedHost). The capture `<video>` lives here for
   its whole life, and the setup card only borrows it: a media element taken
   out of the document is a PAUSED media element, and a paused one hands the
   same frame to the recognizer for ever. Two pixels in the corner, all but
   transparent — RENDERED, because a browser may stop decoding for something it
   is not drawing, and `display: none` is exactly that. */
#camfeed { position: fixed; left: 0; bottom: 0; width: 2px; height: 2px; overflow: hidden; opacity: .01; pointer-events: none; z-index: 0; }
#camfeed video { width: 2px; height: 2px; object-fit: cover; }

/* a toast: what was just done or refused, a moment at the foot of the page —
   in a room at its head, clear of the chat's foot and the tray */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2000; max-width: min(440px, calc(100vw - 32px)); padding: 9px 16px; border-radius: 999px; background: rgba(28, 27, 24, .94); color: #f3f1ec; font-size: 13px; font-weight: 600; line-height: 1.35; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); pointer-events: none; animation: toastin .18s ease-out; }
html.inroom .toast { top: 16px; bottom: auto; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ---- The site's own pages: the account, friends and the inbox, a game's maker ---- */
.avrow { display: flex; align-items: center; gap: 10px; }
.tabs { display: flex; gap: 6px; margin: 8px 0 18px; }
.tabs a { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 550; }
.tabs a.on { color: var(--ink); background: var(--soft); }
.friendrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.friendrow:first-child { border-top: 0; }
.friendrow .grow { flex: 1; min-width: 0; }
.status { font-size: 12px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line); color: var(--muted); }
.status.listed { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.status.submitted { color: var(--gold); }
.status.rejected { color: var(--danger); }
.hero { padding: 24px 0 8px; }
.tray-diagram { width: 100%; max-width: 420px; }

/* ---- the dice trays (pages/trays.js) ------------------------------------------- */
/* Four across on a desk and two on a phone, like the app's grid. A tray's picture is
   its model shot on a transparent page, so it stands on a lit stage of the page's
   own tokens: a white tray reads on the light page and glows on the dark one. */
.trays .lead { margin-bottom: 26px; }
.traygrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px 18px; }
@media (max-width: 1000px) { .traygrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; } }
.traycard { display: flex; flex-direction: column; color: var(--ink); text-decoration: none; }
.traystage, .trayview {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid var(--line); border-radius: 14px;
  background: radial-gradient(115% 95% at 50% 30%, color-mix(in srgb, var(--panel) 88%, #fff) 0%, var(--soft) 72%, color-mix(in srgb, var(--soft) 85%, var(--ink)) 100%);
}
.traystage { margin-bottom: 11px; transition: transform .16s ease, box-shadow .16s ease; }
.traycard:hover .traystage { transform: translateY(-3px); box-shadow: var(--shadow); }
.traystage img, .trayview .poster { position: absolute; inset: 5%; width: 90%; height: 90%; object-fit: contain; }
.traycard h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.traycard .cmeta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.traycard .pills { margin: 8px 0 0; }
.trayfoot { margin: 34px 0 0; }
.traycrumb { margin: 0 0 16px; font-size: 14px; }
.traycrumb a { color: var(--muted); text-decoration: none; }
.traycrumb a:hover { color: var(--ink); }
.traypage { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 40px; align-items: center; max-width: 1280px; }
@media (max-width: 860px) { .traypage { grid-template-columns: minmax(0, 1fr); gap: 20px; } }
.trayview { border-radius: 18px; cursor: grab; }
.trayview:active { cursor: grabbing; }
.trayview canvas { position: absolute; inset: 0; opacity: 0; transition: opacity .35s ease; }
.trayview .poster { transition: opacity .35s ease; }
.trayview.live canvas { opacity: 1; }
.trayview.live .poster { opacity: 0; }
.trayview .hint {
  position: absolute; left: 50%; bottom: 12px; z-index: 1; transform: translateX(-50%); pointer-events: none;
  padding: 3px 11px; border-radius: 999px; font-size: 12px; color: var(--muted);
  background: color-mix(in srgb, var(--panel) 80%, transparent); opacity: 0; transition: opacity .35s ease;
}
.trayview.live .hint { opacity: 1; }
.trayabout h1 { margin: 12px 0 10px; }
.trayabout .pills { margin: 0; }
.trayshops { margin-top: 26px; }
.trayshops .muted { margin: 0 0 8px; }
.trayshops .btn:disabled { opacity: .55; cursor: default; }
.trayshops .btn:disabled:hover { background: transparent; }
.trayshops .soon { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }

/* the account's AI credits: what is left of the month, and when it renews */
.credits-bar { height: 10px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; }
.credits-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.credits-bar i.low { background: var(--danger); }
.credits-line { justify-content: space-between; margin-top: 10px; }
.traynet { max-width: 1280px; margin-top: 40px; }
.traynet .tray-diagram { display: block; max-width: 520px; background: #fff; border-radius: 8px; }
/* A paper tray's page printed is the net alone, black on white at the millimetres
   its SVG states: the site, the 3D stage and the text drop out, and the picture is
   let back to its own size so the markers print at 6.5 mm. */
@media print {
  @page { margin: 6mm; }
  html:has(.trays.paper) { color-scheme: light; background: #fff; }
  html:has(.trays.paper) body { background: #fff; margin: 0; }
  html:has(.trays.paper) :is(.topbar, .sitefoot, #stage, .toast, .traycrumb, .traypage, .traynet > :not(.tray-diagram)) { display: none !important; }
  .trays.paper, .trays.paper .traynet { margin: 0; padding: 0; max-width: none; border: 0; background: #fff; box-shadow: none; }
  .trays.paper .traynet .tray-diagram { width: auto; max-width: none; height: auto; border-radius: 0; }
}

.shots { display: flex; flex-wrap: wrap; gap: 12px; }
.shots .shot { width: 200px; display: flex; flex-direction: column; gap: 6px; }
.shots .shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
/* What may be done to a picture sits UNDER it as one line that wraps, not as a
   column of buttons as wide as the thumbnail. */
.shots .shot .row { gap: 6px; }
.shots .shot .row .btn { flex: 1 1 auto; justify-content: center; }
.checks { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.checks .check { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.checks .check input[type="number"] { width: 64px; }

/* ---- the start panel's party picker and its seats ---- */
/* One strip of discs, the same discs the seats row wears (the party is a
   thing you pick the way you pick who sits down), the picked one ringed in
   the accent the way "You" is — the disc AND its name in one pill, since what
   you pick is the party, not its face. What the party is: a count in the
   disc's corner, and one line under the strip for the picked one. */
#stage .partypick { display: flex; flex-direction: column; gap: calc(4px * var(--s)); }
/* The pill's padding and border are there in both states — only their colour
   changes — so picking a party never shifts the strip. */
#stage .chips-start.parties .seat.party { cursor: pointer; padding: calc(6px * var(--s)) calc(3px * var(--s)); border: 1px solid transparent; border-radius: calc(16px * var(--s)); }
#stage .chips-start.parties .seat.party .av.party { background: var(--soft); color: var(--ink); border: 1px solid var(--line); font-size: 18px; overflow: visible; }
#stage .chips-start.parties .seat.party .av.party .fa { font-size: 19px; opacity: .85; }
#stage .chips-start.parties .seat.party .av.party.withbot { background: color-mix(in srgb, var(--accent) 14%, var(--soft)); }
/* The digit is centred by the box, not by a line height: the 2px border is
   inside the 18px (border-box), so a line box of 18px would sit low. */
#stage .chips-start.parties .seat.party .av.party .count {
  position: absolute; right: -3px; bottom: -3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; line-height: 1; border: 2px solid var(--panel);
  display: inline-flex; align-items: center; justify-content: center;
}
#stage .chips-start.parties .seat.party.on { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
#stage .chips-start.parties .seat.party.on .av.party { border-color: var(--accent); }
#stage .chips-start.parties .seat.party.on .name { color: var(--ink); }
#stage .chips-start.parties .seat.party:hover:not(.on) { background: var(--soft); }
#stage .chips-start.parties .seat.party:hover:not(.on) .av.party { border-color: var(--ink); }
/* A party's name is a phrase ("You and Rookie", "Rookie vs Rookie"): two short
   lines under its disc rather than one cut off mid-word. */
#stage .chips-start.parties .seat .name { white-space: normal; text-align: center; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#stage .chips-start.parties .seat { display: flex; flex-direction: column; align-items: center; }
#stage .partypick .pdesc { padding: 0 calc(4px * var(--s)); line-height: 1.35; }
/* A party's own bot: a ring INSIDE the disc, so it is no bigger than the next. */
#stage .chips-start .seat.fixed .av { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
/* A bot seat that allows more than one bot: a chevron on the disc, a list on tap. */
#stage .seat.choose { cursor: pointer; }
#stage .seat.choose:hover .av { box-shadow: inset 0 0 0 2px var(--accent); }
#stage .seat-av .chev {
  position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 9px; border: 2px solid var(--panel);
}

/* ---- forji-client's chat in dice.place's colours ----
   The widget is styled by its --forji-* custom properties and ::part() (forji-client specs §6),
   never by its classes. These are the site's warm ones, light and dark as the widget is
   (`theme`, else the system's). */
forji-chat {
  --forji-ink: #1b1a18; --forji-muted: #6b6862; --forji-accent: #5c3a1e; --forji-on-accent: #fff; --forji-danger: #a8342a;
  --forji-surface: #fff; --forji-raised: #f4f2ee; --forji-line: #e4e0d8; --forji-glass: rgba(250, 249, 247, .78);
}
@media (prefers-color-scheme: dark) {
  forji-chat:not([theme="light"]) {
    --forji-ink: #eceae5; --forji-muted: #9a968e; --forji-accent: #b08256; --forji-on-accent: #17130f; --forji-danger: #e0796d;
    --forji-surface: #1e1e1c; --forji-raised: #2a2926; --forji-line: #3a3834; --forji-glass: rgba(24, 24, 22, .72);
  }
}
forji-chat[theme="dark"] {
  --forji-ink: #eceae5; --forji-muted: #9a968e; --forji-accent: #b08256; --forji-on-accent: #17130f; --forji-danger: #e0796d;
  --forji-surface: #1e1e1c; --forji-raised: #2a2926; --forji-line: #3a3834; --forji-glass: rgba(24, 24, 22, .72);
}
/* the room's own header in the chat's (its title stands in for the chat's); a room is one session: no picker of them */
forji-chat::part(title), forji-chat::part(sessions) { display: none; }
forji-chat .roomhead { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; color: inherit; }
forji-chat .roomhead .roomtitle { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
forji-chat .roomhead .roomback { appearance: none; border: 0; background: none; color: inherit; width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font: inherit; }
forji-chat .roomhead .roomback:hover { background: rgba(127, 127, 127, .16); }

/* ---- The room (/r/…): the game's sandbox over the whole page, the room's chat over it ----
   The chat is forji-chat's <forji-chat> (its own shadow styles): a popup by default, a sidebar
   when a hand sets it beside the page, a sheet on a phone, its icon when hidden. What is styled
   here is the page round it, the lobby card, and the player's tray — the chat's icon, or on the
   table beside the open chat. */
html.inroom, html.inroom body { margin: 0; height: 100%; overflow: hidden; background: #14161c; }
html.inroom #app { display: none; }
.roompage { position: fixed; inset: 0; display: flex; background: #14161c; color: var(--ink); }
.roompage .roomboard { position: absolute; inset: 0; min-width: 0; min-height: 0; }
/* the room's own view (its table, drawn by the sandbox's view) fills the board the chat leaves (room.js cover) */
.roompage .roomboard forji-view { position: absolute; inset: var(--dp-chat-top, 0px) var(--dp-chat-right, 0px) var(--dp-chat-bottom, 0px) var(--dp-chat-left, 0px); display: block; }
/* the widget is fixed over the page and places itself in its own box (forji-chat SPEC §3); what it covers is
   told to the table (room.js cover). Its glass is darker than the widget's own: over a bright card on the
   table (a white seat board) its muted words lose their ground */
.roompage forji-chat { z-index: 6; --forji-glass: rgba(24, 24, 22, .84); }
/* the chat open, the tray stands on the table beside it (room.js placeTray) */
/* (clear of the table's own buttons in its bottom-left corner: the sound, the camera's way home) */
.roompage > .roomtray.onboard { position: absolute; z-index: 5; left: calc(var(--dp-chat-left, 0px) + 72px); bottom: calc(var(--dp-chat-bottom, 0px) + 16px); }
/* the lobby's card stands in the middle of the table the chat leaves free
   (room.js cover: --dp-chat-*), not of the page under the chat */
.roompage .roomlobby { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: var(--dp-chat-top, 0px) var(--dp-chat-right, 0px) var(--dp-chat-bottom, 0px) var(--dp-chat-left, 0px); background: rgba(10, 11, 14, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.roompage .roomlobby[hidden] { display: none; }
/* the game over: a card at the foot of what the chat leaves of the table, the table still seen over it (room.js ended) */
.roompage .roomend { position: absolute; z-index: 5; left: var(--dp-chat-left, 0px); right: var(--dp-chat-right, 0px); bottom: calc(var(--dp-chat-bottom, 0px) + 24px); display: flex; justify-content: center; pointer-events: none; }
.roompage .roomend[hidden] { display: none; }
.roompage .endcard { pointer-events: auto; width: min(440px, calc(100% - 32px)); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4); animation: endcard-in .4s cubic-bezier(.2, .8, .2, 1); }
.roompage .endcard .etitle { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 650; }
.roompage .endcard .etitle .fa { color: var(--gold, #ffd49a); }
.roompage .endcard .act { justify-content: flex-end; gap: 10px; }
@keyframes endcard-in { from { opacity: 0; transform: translateY(14px); } }
.fa-rotate-right::before { content: "\f2f9"; }
/* the playtest's controls: a bar at the foot of the table the chat leaves free, over the game (playtest.js) */
.roompage .ptbar { position: absolute; z-index: 4; bottom: calc(14px + var(--dp-chat-bottom, 0px)); left: var(--dp-chat-left, 0px); right: var(--dp-chat-right, 0px); width: fit-content; margin: 0 auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: calc(100% - var(--dp-chat-left, 0px) - var(--dp-chat-right, 0px) - 24px); padding: 6px 8px; box-sizing: border-box; border-radius: 16px; background: rgba(20, 21, 24, .86); border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); color: #eef0f3; font-size: 13px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.roompage .ptbar[hidden] { display: none; }
.roompage .ptbar .ptbtn { appearance: none; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: inherit; border-radius: 10px; padding: 6px 10px; font: inherit; line-height: 1; cursor: pointer; white-space: nowrap; }
.roompage .ptbar .ptbtn:hover { background: rgba(255, 255, 255, .12); }
.roompage .ptbar .ptbtn.primary { background: #3b6fd8; border-color: #3b6fd8; }
.roompage .ptbar .ptbtn.danger { color: #ffb4ab; }
.roompage .ptbar .ptbtn.on { background: rgba(255, 255, 255, .2); }
.roompage .ptbar .ptseg { display: flex; }
.roompage .ptbar .ptseg .ptbtn:first-child { border-radius: 10px 0 0 10px; }
.roompage .ptbar .ptseg .ptbtn:last-child { border-radius: 0 10px 10px 0; border-left: none; }
.roompage .ptbar .ptlabel { opacity: .8; padding: 0 4px; white-space: nowrap; }
.roompage .ptbar .ptrec { color: #ff5a5a; opacity: 1; font-weight: 600; }
.roompage .ptbar .ptmenu { position: relative; }
.roompage .ptbar .ptpill { border-radius: 999px; font-size: 12px; }
.roompage .ptbar .ptdrop { position: absolute; bottom: calc(100% + 6px); left: 0; min-width: 180px; display: flex; flex-direction: column; padding: 4px; border-radius: 12px; background: rgba(20, 21, 24, .96); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.roompage .ptbar .ptitem { appearance: none; border: none; background: none; color: inherit; font: inherit; text-align: left; padding: 7px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.roompage .ptbar .ptitem:hover { background: rgba(255, 255, 255, .1); }
.roompage .btn:disabled { opacity: .5; cursor: default; filter: none; }
/* what a seat's menu asked for: whom to bring in, drawn over the room as the lobby is */
.roompage .pickwrap { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: var(--dp-chat-top, 0px) var(--dp-chat-right, 0px) var(--dp-chat-bottom, 0px) var(--dp-chat-left, 0px); background: rgba(10, 11, 14, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.roompage .pickwrap .lplayers .btn { flex: 1 1 auto; }
.roompage .lobbycard { width: min(420px, calc(100% - 32px)); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); }
.roompage .lobbycard .wtitle { font-size: 18px; font-weight: 650; }
.roompage .lobbycard .lplayers { display: flex; gap: 12px; flex-wrap: wrap; }
.roompage .lobbycard .seat { width: 72px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.roompage .lobbycard .seat .name { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roompage .codebox { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--soft); }
.roompage .codebox .code { font: 600 20px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; flex: 1; }
.roompage .row.act { display: flex; gap: 8px; justify-content: flex-end; }
/* the tray, in the chat's corner (light DOM: styled from here) — a square with
   the last roll in its layout, and nothing else. Shut, the chat is clipped to
   this box, rounded by ITS radius: nothing may hang outside it or stand in it
   but the tray */
.roomtray { position: relative; width: 112px; height: 112px; color: #eceae5; display: block; border-radius: 14px; animation: trayin .28s ease-out; }
/* unused, it is out of the corner (tray.js): hidden, and it comes back in with a small rise */
.roomtray[hidden] { display: none; }
@keyframes trayin { from { opacity: 0; transform: translateY(8px) scale(.94); } }
.roomtray .traybox { position: absolute; inset: 0; border-radius: 14px; background: rgba(20, 20, 18, .72); border: 1px solid rgba(255, 255, 255, .12); display: grid; place-items: center; overflow: hidden; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }
/* at a Dev party the square is a button: it lays a roll out by hand */
.roomtray button.traybox { padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; }
.roomtray button.traybox:disabled { cursor: default; }
.roomtray button.traybox:not(:disabled):hover { border-color: rgba(255, 255, 255, .3); }
.roomtray button.traybox:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* a hex tray is the box's whole width, its body the hexagon (drawn): the box round it is not there */
.roomtray.hex .traybox, .roomtray.hex button.traybox:not(:disabled):hover { background: none; border-color: transparent; box-shadow: none; }
/* the ring: the tray's own contour (the box's rounded edge, or the hexagon),
   drawn inward — an outward one is cut by the shut chat's clip. A roll wanted:
   gold, pulsed three times and then held. A camera looking: its state — green
   still, orange moving (pulsing while it moves), grey looking for the tray —
   and the settling going round it in green. It stays while the square inside
   it is drawn again at every change, so no pulse starts over */
.roomtray .trayring { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.roomtray .trayring path { fill: none; stroke-width: 2; stroke-linejoin: round; }
.roomtray .trayring .edge { stroke: transparent; }
.roomtray.hex .trayring .edge { stroke: rgba(255, 255, 255, .16); stroke-width: 1.2; }
.roomtray.hex:has(button.traybox:not(:disabled):hover) .trayring .edge { stroke: rgba(255, 255, 255, .34); }
.roomtray.want .trayring .edge { stroke: rgba(242, 193, 78, .75); stroke-width: 2; animation: traywant 1.6s ease-in-out 3; }
@keyframes traywant { 50% { stroke-opacity: 0; } }
.roomtray.live .trayring .edge { stroke: #8e8e93; stroke-width: 2; }
.roomtray.live.still .trayring .edge { stroke: #34c759; }
.roomtray.live.moving .trayring .edge { stroke: #ff9f0a; animation: traymoving .9s ease-in-out infinite; }
/* something wrong (the camera would not start, or cannot read the tray while a roll is wanted): the contour says it */
.roomtray.bad .trayring .edge, .roomtray.live.bad .trayring .edge { stroke: #ff453a; stroke-width: 2; animation: none; }
@keyframes traymoving { 50% { stroke-opacity: .3; } }
.roomtray .trayring .prog { stroke: #34c759; stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray .1s linear; }
/* the drawing keeps its own inset from its edge: no second one around it */
.roomtray .traybox svg.traypic { width: 100%; height: 100%; box-sizing: border-box; }
/* shut, the square is only the way back into the chat: a press there opens it and nothing else */
forji-chat[mode="icon"] .roomtray > :not(.traybox):not(.trayring) { display: none; }
.roomtray .traynote { position: absolute; left: 50%; top: -8px; transform: translate(-50%, -100%); max-width: 180px; padding: 4px 9px; border-radius: 999px; background: #f2c14e; color: #1b1a18; font-size: 11px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roomtray .traynote.bad { background: #e0796d; }
/* a button on the chat's title bar (a guest's "About dice trays"; forji draws it as its own; the page's rules win) */
.traycfg[hidden] { display: none; }
/* the tray's setup card (where its dice come from; the camera set up), on the page over the room while it is up */
.roomtray-setup .camsetup { position: fixed; z-index: 1100; right: 16px; bottom: 16px; width: min(368px, calc(100vw - 32px)); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.roomtray-setup .campic { position: relative; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.roomtray-setup .campreview, .roomtray-setup .camoverlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.roomtray-setup .camnote { font-size: 13px; } .roomtray-setup .camnote.bad { color: var(--danger); }
.roomtray-setup .camactions { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.roomtray-setup .chip { border: 1px solid rgba(127, 127, 127, .4); background: rgba(127, 127, 127, .14); color: inherit; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.roomtray-setup .chip.primary { background: var(--accent); color: var(--accent-ink, #fff); border-color: transparent; }
.roomtray-setup .chip:disabled { opacity: .5; cursor: default; }
.roomtray-setup .camhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.roomtray-setup .camclose { border: 0; background: rgba(127, 127, 127, .14); color: inherit; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }
.roomtray-setup .traysource .camactions { justify-content: flex-start; flex-wrap: wrap; }
.roomtray-setup .traysource .camnote .fa { opacity: .75; }

/* ---- the dice constructor (room/builder.js): the tray large, over the room.
   Pointer-driven, so nothing in it scrolls under a finger. */
.dicesheet { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(10, 11, 14, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); touch-action: none; user-select: none; -webkit-user-select: none; }
.dicesheet .bsheet { width: min(484px, calc(100vw - 32px)); max-height: calc(100vh - 32px); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.dicesheet .bhead { display: flex; align-items: center; gap: 8px; }
.dicesheet .bhead b { font-size: 15px; min-width: 0; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dicesheet .bhead .muted { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dicesheet .bicon { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--soft); color: inherit; font: inherit; cursor: pointer; }
/* the margin under it is the rim the direction triangle stands on, past a square floor */
.dicesheet .bboard { position: relative; width: 100%; aspect-ratio: 1; flex: none; margin-bottom: 6%; }
.dicesheet .bboard svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* a slot's name, over the dice (in the tray's thousand units: ~20 px on the
   sheet), haloed in the sheet's own ground so it reads over a die or a line */
.dicesheet .slotnames { pointer-events: none; }
.dicesheet .slotname { font-size: 50px; font-weight: 650; fill: var(--muted); text-anchor: middle; dominant-baseline: central; pointer-events: none; paint-order: stroke; stroke: var(--panel); stroke-width: 10px; stroke-linejoin: round; }
/* the slot under the finger, FILLED: a lit area says "the die lands here" better than a lit edge */
.dicesheet .slotregion.hot { fill: var(--accent); fill-opacity: .28; }
.dicesheet .die { cursor: grab; }
/* a die its slot does not take: ringed, and nothing refused (Roll stays) */
.dicesheet .die.wrong > .body { stroke: #e0443a; stroke-width: 14px; }
/* the palette: a row a kind of die, left-aligned with the caption and the foot */
.dicesheet .bpal { display: flex; flex-direction: column; gap: 6px; }
.dicesheet .bprow { display: flex; flex-wrap: wrap; gap: 4px; }
.dicesheet .bprow.off { opacity: .35; }
/* 34 px a face: a d12's two-digit number stays readable; twelve of them and
   their gaps are the sheet's inner width */
.dicesheet .pdie { width: 34px; height: 34px; cursor: grab; flex: none; }
.dicesheet .bcap { font-size: 12px; color: var(--muted); margin-top: -2px; }
.dicesheet .bfoot { display: flex; align-items: center; gap: 8px; }
.dicesheet .bfoot .grow { flex: 1; }
.dicesheet .chip { border: 1px solid rgba(127, 127, 127, .4); background: rgba(127, 127, 127, .14); color: inherit; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.dicesheet .chip.primary { background: var(--accent); color: var(--accent-ink, #fff); border-color: transparent; }
.dicesheet .chip:disabled { opacity: .5; cursor: default; }
.dicesheet .bghost { position: absolute; width: 40px; height: 40px; transform: translate(-50%, -50%); pointer-events: none; z-index: 41; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); }
/* a phone: the table is the whole screen, the chat maximized over it (the widget's own doing) */
@media (max-width: 760px) {
  .roomtray { width: 80px; height: 80px; }
}
