/* dobbel.fun: four looks, from quiet to circus (data-theme on <html>, the
   `dobbel_theme` cookie; src/theme.rs). Colour roles, not colours, below:
   --accent fills the one main action and --accent-ink is its text;
   --accent-text is the accent where it is text or a line on paper; --hold
   marks kept dice and rolls left; red is kept for errors (the toast). */
:root, :root[data-theme="classic"] {
  --bg: #eef2ff;
  --paper: #ffffff;
  --ink: #1b2048;
  --muted: #5f6491;
  --line: #dfe3f7;
  --felt: #5b5bf0;
  --felt-2: #3b2fc9;
  --accent: #ffc533;
  --accent-ink: #1b2048;
  --accent-text: #4338ca;
  --hold: #2ee6a6;
  --mint: #16a974;
  --die: #ffffff;
  --pip: #1b2048;
  --die-edge: #c9cdf0;
  --off: #c4c8e8;
  --error: #d92d20;
  --radius: 14px;
  --tumble: .6s;
  color-scheme: light;
}
:root[data-theme="quiet"] {
  --bg: #f5f6f8;
  --paper: #ffffff;
  --ink: #262a33;
  --muted: #5d636f;
  --line: #e3e6eb;
  --felt: #e6e9ef;
  --felt-2: #dde1e8;
  --accent: #3b5bdb;
  --accent-ink: #ffffff;
  --accent-text: #3b5bdb;
  --hold: #3b5bdb;
  --mint: #2f9e44;
  --die: #ffffff;
  --pip: #262a33;
  --die-edge: #cfd4dc;
  --off: #c9ced8;
  --radius: 10px;
  --tumble: 0s;
}
:root[data-theme="bright"] {
  --bg: #fff4fb;
  --paper: #ffffff;
  --ink: #23103a;
  --muted: #6b5a7e;
  --line: #f6dcef;
  --felt: #12c2d6;
  --felt-2: #0b7f9e;
  --accent: #8b2cf5;
  --accent-ink: #ffffff;
  --accent-text: #7a1fe0;
  --hold: #ffe14d;
  --mint: #12a150;
  --die: #ffffff;
  --pip: #23103a;
  --die-edge: #b9e8f0;
  --off: #d9c7ef;
  --radius: 18px;
}
:root[data-theme="circus"] {
  --bg: repeating-linear-gradient(115deg, #fff3c4 0 28px, #ffe08a 28px 56px);
  --paper: #fffdf5;
  --ink: #2a0a12;
  --muted: #6e4a3a;
  --line: #f3d9a8;
  --felt: #c8102e;
  --felt-2: #7d0a1f;
  --accent: #ffd000;
  --accent-ink: #2a0a12;
  --accent-text: #b00d29;
  --hold: #00e0ff;
  --mint: #12a150;
  --die: #ffffff;
  --pip: #2a0a12;
  --die-edge: #f1c96b;
  --off: #e9cf9b;
  --radius: 20px;
  --tumble: .9s;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]), :root[data-theme="classic"] {
    --bg: #0f1230;
    --paper: #191d45;
    --ink: #eef0ff;
    --muted: #a3a8da;
    --line: #2c3170;
    --felt: #4b46e0;
    --felt-2: #2b2399;
    --accent-text: #b7b4ff;
    --die-edge: #a9aee6;
    --off: #3a3f80;
    color-scheme: dark;
  }
  :root[data-theme="quiet"] {
    --bg: #15171c;
    --paper: #1e2128;
    --ink: #e8eaee;
    --muted: #a0a6b2;
    --line: #2d313a;
    --felt: #262a33;
    --felt-2: #20232b;
    --accent: #7c95ff;
    --accent-ink: #10131a;
    --accent-text: #9fb0ff;
    --hold: #7c95ff;
    --die-edge: #8b929f;
    --off: #3a3f4a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
/* `hidden` wins over a button's own display (the bell and the sound button
   wait hidden until static/app.js shows them). */
[data-bell][hidden], [data-sound][hidden] { display: none; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 16px/1.5 ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* One column, --page wide, with a gutter that clears a notch in landscape. */
:root { --page: 640px; --gutter: 16px; }
main, .top {
  max-width: calc(var(--page) + 2 * var(--gutter)); margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right));
}
main { padding-bottom: max(48px, env(safe-area-inset-bottom)); }
a { color: inherit; }
.top { padding-top: 14px; padding-bottom: 14px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.brand svg { width: 30px; height: 30px; }
.brand rect { fill: var(--accent-text); }
.brand circle { fill: var(--paper); }
.brand b { color: var(--accent-text); font-weight: 800; }

h1 { font-size: clamp(26px, 6vw, 38px); line-height: 1.15; letter-spacing: -0.02em; margin: 8px 0 12px; }
h2 { font-size: 20px; margin: 0 0 8px; }
.lead { color: var(--muted); font-size: 18px; margin: 0 0 20px; }
.small { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.notice { background: #fff1c2; color: #5b4300; padding: 10px 14px; border-radius: 10px; }

/* `hidden` wins over the display rules below: the bell and the sound
   button stay out of sight until static/app.js shows them. */
[hidden] { display: none !important; }

button, .button {
  font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 12px 18px;
  background: var(--line); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block;
  min-height: 44px; touch-action: manipulation;
}
button:disabled { cursor: default; }
.primary:disabled { background: var(--off); color: var(--paper); }
.tray .primary:disabled { background: rgb(255 255 255 / .18); color: rgb(255 255 255 / .7); }
.primary { background: var(--accent); color: var(--accent-ink); }
@media (hover: hover) { .primary:not(:disabled):hover { filter: brightness(1.06); } }
.big { font-size: 18px; padding: 14px 26px; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }

input {
  font: inherit; padding: 11px 14px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--paper); color: var(--ink); min-width: 0; flex: 1; min-height: 44px;
}
label { display: block; font-weight: 700; margin-bottom: 6px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row input { flex: 1 1 180px; }

.hero { padding: 24px 0 8px; }
/* Against the computer: three level buttons in the start form. */
.bots { border: 0; border-top: 1px solid var(--line); margin: 14px 0 0; padding: 12px 0 0; min-width: 0; }
.bots legend { font-weight: 700; padding: 0 6px 0 0; }
.bots .small { margin: 0 0 8px; }
.bots .row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bots .row button { padding-left: 8px; padding-right: 8px; }
.start { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.howto { margin-top: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.howto ol { margin: 0; padding-left: 20px; }
.howto li { margin: 6px 0; }

/* Your games: a tally per kind, then the last results. */
.stats { margin-top: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stats h3 { font-size: 15px; margin: 0 0 6px; color: var(--muted); }
.tallies { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 20px; margin-bottom: 14px; }
.tally dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; }
.tally dl div { background: var(--bg); border-radius: 10px; padding: 6px 8px; text-align: center; }
.tally dt { font-size: 12px; color: var(--muted); }
.tally dd { margin: 0; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.recent { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.recent li { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 14px; font-variant-numeric: tabular-nums; }
.recent li.won { border-color: var(--accent-text); color: var(--accent-text); font-weight: 700; }
.recent li.lost { color: var(--muted); }

/* Small decorative dice on the start page. */
.hero-dice { display: flex; gap: 10px; margin-bottom: 8px; }
.hero-dice .d { width: 44px; height: 44px; border-radius: 11px; background: var(--felt); position: relative; transform: rotate(-8deg); }
.hero-dice .d:nth-child(2) { transform: rotate(6deg) translateY(4px); background: var(--accent-text); }
.hero-dice .d:nth-child(3) { transform: rotate(-3deg); background: var(--mint); }
.hero-dice .d::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(circle, var(--die) 0 4px, transparent 4.5px) center / 100% 100% no-repeat;
}
.hero-dice .d3::after { background:
  radial-gradient(circle at 25% 25%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 50% 50%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 75% 75%, var(--die) 0 4px, transparent 4.5px); }
.hero-dice .d2::after { background:
  radial-gradient(circle at 28% 28%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 72% 72%, var(--die) 0 4px, transparent 4.5px); }
.hero-dice .d4::after { background:
  radial-gradient(circle at 28% 28%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 72% 28%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 28% 72%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 72% 72%, var(--die) 0 4px, transparent 4.5px); }
.hero-dice .d5::after { background:
  radial-gradient(circle at 25% 25%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 75% 25%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 50% 50%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 25% 75%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 75% 75%, var(--die) 0 4px, transparent 4.5px); }
.hero-dice .d6::after { background:
  radial-gradient(circle at 28% 22%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 72% 22%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 28% 50%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 72% 50%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 28% 78%, var(--die) 0 4px, transparent 4.5px),
  radial-gradient(circle at 72% 78%, var(--die) 0 4px, transparent 4.5px); }

/* The game. */
.players { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.player {
  display: flex; align-items: center; gap: 8px; background: var(--paper); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px; min-width: 0;
}
.player .who { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .total { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.player.on-turn { border-color: var(--accent-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-text) 22%, transparent); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.dot.online { background: var(--mint); }

.status { text-align: center; font-weight: 700; margin: 14px 0 10px; min-height: 1.5em; }
.status.yours { color: var(--accent-text); }
.last { text-align: center; color: var(--muted); font-size: 14px; margin: 8px 0; }

.invite { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 8px 0 16px; }
.invite [data-share] { display: none; }
.can-share .invite [data-share] { display: inline-block; }
.can-share .invite .row input { flex-basis: 100%; }
/* The QR code stays black on white in every look: scanners want it so. */
.qr { display: flex; align-items: center; gap: 14px; margin: 14px 0 0; }
.qr div { flex: none; display: block; line-height: 0; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.qr svg { width: 148px; height: 148px; }
.qr figcaption { margin: 0; }

.tray {
  background: radial-gradient(120% 100% at 50% 0%, var(--felt), var(--felt-2));
  border-radius: 18px; padding: 18px 12px 14px; box-shadow: inset 0 2px 10px rgb(0 0 0 / .25);
}
.dice { display: flex; justify-content: center; gap: clamp(6px, 3cqi, 16px); margin: 0; }
/* The tray is a container: the dice grow with it, from a small phone to a
   desktop's left column. */
.tray { container-type: inline-size; }
.die {
  --s: clamp(40px, 15cqi, 84px);
  width: var(--s); height: var(--s); padding: calc(var(--s) * .16); border-radius: 22%; flex: none;
  background: var(--die); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); gap: 2px;
  box-shadow: 0 3px 0 var(--die-edge), 0 6px 12px rgb(0 0 0 / .3);
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 0;
}
.die:disabled { opacity: 1; }
.die i { border-radius: 50%; }
.die i.p { background: var(--pip); }
.die.held { transform: translateY(-6px); box-shadow: 0 0 0 4px var(--hold), 0 9px 14px rgb(0 0 0 / .35); }
@media (hover: hover) {
  .die:not(:disabled):hover { transform: translateY(-2px); }
  .die.held:not(:disabled):hover { transform: translateY(-6px); }
}
.unrolled .die i.p { background: transparent; }
.unrolled .die { opacity: .55 !important; }
/* Rolling (static/app.js): shaking while the dice are in the cup, then a
   drop and a bounce onto the real faces. */
.die.shaking { animation: shake .16s linear infinite; }
.die.shaking:nth-child(2n) { animation-duration: .19s; animation-direction: reverse; }
.die.shaking:nth-child(3n) { animation-duration: .14s; }
.die.rolling { animation: land var(--tumble, .45s) cubic-bezier(.25, .8, .35, 1) both; }
@media (prefers-reduced-motion: reduce) { .die.rolling, .die.shaking { animation: none; } .die { transition: none; } }

.roll { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 0; }
.rolls { display: inline-flex; gap: 5px; }
.rolls i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid rgb(255 255 255 / .5); }
.rolls i.left { background: var(--hold); border-color: var(--hold); }

.end { text-align: center; margin: 12px 0; }
.outcome { font-size: 26px; font-weight: 800; margin: 4px 0 10px; }
.new-best { color: var(--accent-text); font-weight: 800; margin: -4px 0 12px; }
.series { font-weight: 700; margin: -4px 0 12px; font-variant-numeric: tabular-nums; }
.rematch-ask { color: var(--accent-text); font-weight: 800; margin: 0 0 10px; }
/* Alone: the score to beat stands where the opponent would. */
.player.best { border-style: dashed; color: var(--muted); }

/* Two narrow sheets side by side: the whole game fits a phone's screen. */
.sheets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.sheet {
  width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; background: var(--paper);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-variant-numeric: tabular-nums; font-size: 14px;
}
.sheet th, .sheet td { padding: 0 6px; height: 31px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet th:first-child { width: 50%; }
.sheet thead th {
  height: 24px; font-size: 11px; color: var(--muted); text-align: right; font-weight: 700;
  background: color-mix(in srgb, var(--line) 40%, var(--paper));
}
.sheet thead th:first-child { text-align: left; }
.sheet tbody th { text-align: left; font-weight: 700; }
.sheet td { text-align: right; font-weight: 700; padding: 0 4px; }
.sheet tfoot th, .sheet tfoot td { color: var(--muted); font-size: 12px; font-weight: 600; height: 24px; }
.sheet tfoot th { text-align: left; }
.sheet tfoot tr:last-child > * { border-bottom: 0; }
.sheet tfoot small { font-weight: 400; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.offer {
  width: 100%; min-height: 25px; padding: 0 4px; border-radius: 8px; font-weight: 800; font-size: 14px; text-align: right;
  background: color-mix(in srgb, var(--accent-text) 10%, var(--paper)); color: var(--accent-text);
  border: 2px dashed color-mix(in srgb, var(--accent-text) 55%, transparent);
}
@media (hover: hover) { .offer:hover { background: var(--accent-text); color: var(--paper); border-style: solid; } }
.offer.zero { color: var(--muted); border-color: var(--line); background: transparent; }

/* Three or four at the table: the names three abreast (four go two by
   two), and the two sheets one above the other (side by side only on a
   tablet held upright), so each column still holds a three-digit score. */
.players.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.players.n3 .player { padding: 6px 8px; gap: 6px; }
.players.n3 .player .total { font-size: 18px; }
.sheets.many { grid-template-columns: minmax(0, 1fr); }
.sheets.many .sheet th:first-child { width: 34%; }
.sheets.many .sheet td { padding: 0 4px; }
@media (min-width: 700px) and (max-width: 999px) and (orientation: portrait) {
  .sheets.many { grid-template-columns: 1fr 1fr; }
  .sheets.many .sheet th:first-child { width: 38%; }
}
.start-now { text-align: center; margin: 4px 0 12px; }

/* How many play: 2, 3 or 4, under the name on the start page. */
.seats { border: 0; padding: 0; margin: 12px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.seats legend { float: left; margin-right: 6px; font-weight: 700; color: var(--muted); font-size: 14px; }
.seats label { position: relative; display: inline-block; margin: 0; }
.seats input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seats span {
  display: inline-grid; place-items: center; min-width: 40px; height: 36px; padding: 0 10px; border-radius: 999px;
  border: 2px solid var(--line); font-weight: 800; font-variant-numeric: tabular-nums;
}
.seats input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seats input:focus-visible + span { outline: 3px solid var(--accent-text); outline-offset: 2px; }

/* Tighter on a phone. */
@media (max-width: 520px) {
  .top { padding-top: 8px; padding-bottom: 8px; }
  .brand { font-size: 17px; }
  .brand svg { width: 24px; height: 24px; }
  .player { padding: 6px 10px; }
  .player .total { font-size: 18px; }
  .status { margin: 8px 0 6px; font-size: 15px; }
  .last { margin: 4px 0 0; font-size: 13px; }
  .tray { padding: 12px 8px 10px; }
  .roll { margin-top: 10px; }
  .big { font-size: 17px; padding: 9px 22px; min-height: 42px; }
  .sheets { margin-top: 8px; gap: 6px; }
  .sheet { font-size: 13px; }
  .sheet th, .sheet td { height: 29px; }
}

#toast {
  position: fixed; border-left: 4px solid transparent; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 140%); background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 12px; font-weight: 700; transition: transform .2s ease, opacity .2s ease; max-width: calc(100% - 32px);
  opacity: 0; pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast.error { border-left-color: var(--error); }

/* A new version is out (static/app.js): a bar at the bottom with a reload. */
.update {
  position: fixed; z-index: 20; bottom: calc(12px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: var(--radius);
  background: var(--paper); color: var(--ink); border: 2px solid var(--accent-text); box-shadow: 0 8px 24px rgb(0 0 0 / .18); font-weight: 700;
}
.update .button { flex: none; padding: 8px 16px; }
body:has(.update) #toast { bottom: 88px; }

/* Someone else's turn: their dice under a grey layer, and who is rolling. */
.tray { position: relative; }
.tray.theirs { background: linear-gradient(#6b7088, #4a4e66); }
.tray.theirs .dice, .tray.theirs .roll { filter: grayscale(.85); opacity: .6; }
.tray.theirs .roll { visibility: hidden; }
.their-roll {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0; z-index: 1;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  background: var(--paper); color: var(--ink); font-weight: 800; padding: 8px 16px; border-radius: 999px;
  box-shadow: 0 4px 14px rgb(0 0 0 / .25);
}
.ghost { color: var(--muted); font-weight: 600; font-style: italic; opacity: .75; }

/* The style picker in the header. */
.top { display: flex; align-items: center; justify-content: space-between; }
.style-picker { position: relative; }
.style-picker summary {
  list-style: none; cursor: pointer; font-weight: 700; font-size: 14px; padding: 8px 12px; min-height: 44px;
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line);
}
.style-picker summary::-webkit-details-marker { display: none; }
.style-picker form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: 220px; padding: 8px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 30px rgb(0 0 0 / .18);
  display: grid; gap: 4px;
}
.style-picker button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent;
  padding: 8px 10px; border-radius: 10px; font-weight: 700;
}
@media (hover: hover) { .style-picker button:hover { background: var(--line); } }
.style-picker button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent-text) 14%, var(--paper)); }
.style-picker small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.swatch { width: 28px; height: 28px; border-radius: 8px; flex: none; box-shadow: inset 0 0 0 2px rgb(255 255 255 / .6); }
.swatch.quiet { background: linear-gradient(135deg, #e6e9ef 50%, #3b5bdb 50%); }
.swatch.classic { background: linear-gradient(135deg, #5b5bf0 50%, #ffc533 50%); }
.swatch.bright { background: linear-gradient(135deg, #12c2d6 50%, #8b2cf5 50%); }
.swatch.circus { background: repeating-linear-gradient(45deg, #c8102e 0 6px, #ffd000 6px 12px); }

/* Circus: everything a little louder. */
:root[data-theme="circus"] body { font-weight: 500; }
:root[data-theme="circus"] .die.held { animation: wobble 1.2s ease-in-out infinite; }
:root[data-theme="circus"] .end .outcome::before, :root[data-theme="circus"] .end .outcome::after { content: " \2605 "; color: var(--accent-text); }
@keyframes wobble { 0%, 100% { rotate: -4deg; } 50% { rotate: 4deg; } }
/* Quiet: no motion, flat. */
:root[data-theme="quiet"] .rolls i { border-color: var(--die-edge); }
:root[data-theme="quiet"] .hero-dice .d { transform: none; }
@media (prefers-reduced-motion: reduce) { :root[data-theme="circus"] .die.held { animation: none; } }
.style-picker summary .swatch { width: 18px; height: 18px; border-radius: 5px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.sound {
  width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 999px; font-size: 18px;
  background: var(--paper); border: 1px solid var(--line);
}
.sound[aria-pressed="false"] { opacity: .7; }
.sound[hidden] { display: none; }
/* A narrow phone with the bell too: the style button keeps only its swatch. */
@media (max-width: 400px) {
  .top-actions { gap: 6px; }
  .top-actions:has([data-bell]:not([hidden])) .style-picker:not(.lang-picker) summary .label { display: none; }
}
/* The language picker: the same menu, a two-letter code for a swatch. */
.lang-picker form { width: 180px; }
.lang-picker .code {
  text-transform: uppercase; font-size: 12px; font-weight: 800; letter-spacing: .04em; min-width: 28px; text-align: center;
}
.lang-picker summary .code { min-width: 0; font-size: 14px; }

/* Depth and play. Everything stands on the page: cards and buttons have a
   lit top and a thicker bottom edge (press a button and it sinks onto it),
   the dice are bevelled with carved pips and tumble in 3D, and the tray is
   a felt box in a rim, on a table that runs off into the distance. Built
   from roles, so each look and dark mode get their own:
   --hi a highlight on a top edge, --edge the side of a card, --shade the
   shadow it casts, --accent-edge the side of the main button, --rim the
   tray's frame. Quiet keeps it low and still. */
:root {
  --hi: rgb(255 255 255 / .8);
  --edge: color-mix(in srgb, var(--line), var(--ink) 16%);
  --shade: color-mix(in srgb, var(--ink) 22%, transparent);
  --accent-edge: color-mix(in srgb, var(--accent), #000 28%);
  --text-edge: color-mix(in srgb, var(--accent-text), #000 35%);
  --rim: color-mix(in srgb, var(--felt-2), #000 30%);
  --rim-edge: color-mix(in srgb, var(--felt-2), #000 55%);
  --hold-edge: color-mix(in srgb, var(--hold), #000 30%);
  --die-shade: color-mix(in srgb, var(--die), var(--die-edge) 55%);
  --bounce: cubic-bezier(.34, 1.56, .64, 1);
  --lift: 4px;
}
:root[data-theme="classic"], :root:not([data-theme]) { --radius: 18px; }
:root[data-theme="bright"] { --radius: 22px; --rim: #0a5f78; --rim-edge: #063d4f; }
:root[data-theme="circus"] { --radius: 24px; --rim: var(--accent); --rim-edge: #a98a00; }
:root[data-theme="quiet"] { --lift: 2px; --shade: color-mix(in srgb, var(--ink) 12%, transparent); --rim: var(--line); --rim-edge: var(--edge); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]), :root[data-theme="classic"], :root[data-theme="quiet"] {
    --hi: rgb(255 255 255 / .07);
    --edge: color-mix(in srgb, var(--line), #000 45%);
    --shade: rgb(0 0 0 / .5);
  }
}

/* The table: a soft light from above and a floor that runs off into the
   distance, with dice drifting by in the background. */
body {
  background:
    radial-gradient(ellipse 80% 55% at 50% -8%, color-mix(in srgb, var(--accent-text) 16%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
body::before {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  left: -60%; right: -60%; bottom: 0; height: 110vh;
  background-image:
    linear-gradient(color-mix(in srgb, var(--accent-text) 22%, transparent) 2px, transparent 2px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent-text) 22%, transparent) 2px, transparent 2px);
  background-size: 64px 64px;
  transform: perspective(500px) rotateX(58deg); transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 85%);
  mask-image: linear-gradient(to top, #000 10%, transparent 85%);
}
body::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  top: 30vh; left: -20px; width: 70px; height: 70px; border-radius: 20px;
  background: color-mix(in srgb, var(--felt) 10%, transparent);
  box-shadow:
    80vw 4vh 0 10px color-mix(in srgb, var(--accent) 14%, transparent),
    74vw 62vh 0 -14px color-mix(in srgb, var(--hold) 14%, transparent),
    -2vw 66vh 0 -6px color-mix(in srgb, var(--accent-text) 9%, transparent);
  rotate: 18deg;
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift { to { translate: 0 -24px; rotate: 26deg; } }
:root[data-theme="quiet"] body::after { display: none; }
:root[data-theme="quiet"] body::before { opacity: .5; }

/* Cards stand on the page. */
.start, .howto, .stats, .skins, .skin, .invite, .player, .sheet, .update, .their-roll {
  border-color: var(--line);
  box-shadow: inset 0 1px 0 var(--hi), 0 var(--lift) 0 var(--edge), 0 14px 26px -10px var(--shade);
}
.start, .howto, .stats, .skins, .invite { border-radius: var(--radius); }
.start { rotate: -.4deg; }
.howto { rotate: .4deg; }
.howto li::marker { color: var(--accent-text); font-weight: 800; }
.player { transition: translate .3s var(--bounce), box-shadow .3s ease; }
.player.on-turn {
  translate: 0 -3px;
  box-shadow: inset 0 1px 0 var(--hi), 0 var(--lift) 0 var(--text-edge), 0 0 0 4px color-mix(in srgb, var(--accent-text) 18%, transparent), 0 16px 26px -10px var(--shade);
}
.player .total { text-shadow: 0 2px 0 color-mix(in srgb, var(--accent-text) 22%, transparent); }
.player .total { display: inline-block; }
.player .total.bump { animation: bump .55s var(--bounce); }
@keyframes bump { 0% { scale: 1; } 35% { scale: 1.45; color: var(--accent-text); } 100% { scale: 1; } }
.dot { box-shadow: inset 0 -1px 2px rgb(0 0 0 / .25); }
.dot.online { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--mint), #fff 45%), var(--mint) 60%); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 22%, transparent); }

/* Headings stand out a little, like letters cut from card. */
h1 {
  text-shadow: 0 1px 0 color-mix(in srgb, var(--accent-text) 30%, var(--paper)), 0 2px 0 color-mix(in srgb, var(--accent-text) 30%, var(--paper)),
    0 3px 0 color-mix(in srgb, var(--accent-text) 30%, var(--paper)), 0 8px 14px var(--shade);
}
.outcome { text-shadow: 0 2px 0 var(--accent), 0 4px 0 var(--accent-edge), 0 10px 16px var(--shade); }
.end.won .outcome { animation: cheer 1s var(--bounce) both; }
@keyframes cheer { 0% { scale: .4; rotate: -8deg; opacity: 0; } 60% { scale: 1.15; rotate: 3deg; opacity: 1; } 100% { scale: 1; rotate: 0deg; } }

/* The logo: a little die, tipped over, that hops when you point at it. */
.brand svg { rotate: -10deg; filter: drop-shadow(0 3px 0 var(--text-edge)) drop-shadow(0 6px 6px var(--shade)); transition: rotate .4s var(--bounce), translate .4s var(--bounce); }
@media (hover: hover) { .brand:hover svg { rotate: 12deg; translate: 0 -3px; } }

/* Buttons: pushed, they sink onto their edge. */
button, .button {
  box-shadow: inset 0 1px 0 var(--hi), 0 var(--lift) 0 var(--edge);
  transition: translate .18s var(--bounce), box-shadow .18s ease, filter .15s ease, background-color .15s ease;
}
button:not(:disabled):active, .button:active { translate: 0 var(--lift); box-shadow: inset 0 1px 0 var(--hi), 0 0 0 var(--edge); }
.primary {
  background: linear-gradient(color-mix(in srgb, var(--accent), #fff 22%), var(--accent) 55%);
  box-shadow: inset 0 2px 0 rgb(255 255 255 / .45), inset 0 -2px 0 rgb(0 0 0 / .08), 0 var(--lift) 0 var(--accent-edge), 0 10px 18px -6px var(--shade);
  text-shadow: 0 1px 0 color-mix(in srgb, var(--accent-ink) 15%, transparent);
}
.primary:not(:disabled):active { box-shadow: inset 0 2px 0 rgb(255 255 255 / .35), 0 0 0 var(--accent-edge), 0 2px 6px -2px var(--shade); }
@media (hover: hover) {
  .primary:not(:disabled):hover { translate: 0 -2px; box-shadow: inset 0 2px 0 rgb(255 255 255 / .45), 0 calc(var(--lift) + 2px) 0 var(--accent-edge), 0 14px 22px -6px var(--shade); }
}
.primary:disabled, .tray .primary:disabled { box-shadow: inset 0 2px 6px rgb(0 0 0 / .25); text-shadow: none; }
.big { border-radius: 999px; }
.start .primary { border-radius: 999px; padding-left: 22px; padding-right: 22px; }
input { box-shadow: inset 0 2px 4px color-mix(in srgb, var(--ink) 10%, transparent); }

/* The tray: a felt box in a rim. */
.tray {
  background:
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / .08) 1px, transparent 1.6px) 0 0 / 6px 6px,
    radial-gradient(120% 100% at 50% 0%, var(--felt), var(--felt-2));
  box-shadow:
    inset 0 10px 22px rgb(0 0 0 / .35), inset 0 -3px 10px rgb(255 255 255 / .1),
    0 0 0 6px var(--rim), 0 6px 0 6px var(--rim-edge), 0 22px 34px 2px var(--shade);
  margin: 6px 0 18px;
}
.tray.theirs {
  background:
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / .06) 1px, transparent 1.6px) 0 0 / 6px 6px,
    linear-gradient(#6b7088, #4a4e66);
}
.dice { perspective: 700px; }

/* The dice: bevelled, lit from the top left, with carved pips. */
.die {
  background: linear-gradient(150deg, var(--die) 45%, var(--die-shade));
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / .9), inset 0 -3px 0 color-mix(in srgb, var(--die-edge) 70%, transparent),
    0 5px 0 var(--die-edge), 0 6px 0 color-mix(in srgb, var(--die-edge), #000 25%), 0 14px 14px -4px rgb(0 0 0 / .45);
  transition: transform .28s var(--bounce), box-shadow .2s ease;
}
.die i.p {
  background: radial-gradient(circle at 38% 32%, color-mix(in srgb, var(--pip), #fff 28%), var(--pip) 62%);
  box-shadow: inset 0 2px 2px rgb(0 0 0 / .45), 0 1px 0 rgb(255 255 255 / .7);
}
.unrolled .die i.p { box-shadow: none; }
.die.held {
  transform: translateY(-10px) scale(1.05);
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / .9), inset 0 -3px 0 color-mix(in srgb, var(--die-edge) 70%, transparent),
    0 0 0 4px var(--hold), 0 5px 0 4px var(--hold-edge), 0 26px 16px -6px rgb(0 0 0 / .4);
}
@media (hover: hover) {
  .die:not(:disabled):hover { transform: translateY(-4px) rotate(-3deg); }
  .die.held:not(:disabled):hover { transform: translateY(-12px) scale(1.05) rotate(2deg); }
}
.die:not(:disabled):active { transform: translateY(2px) scale(.96); }
@keyframes shake {
  0% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(-3px, -7px) rotateZ(-16deg) rotateY(25deg); }
  50% { transform: translate(2px, 1px) rotateZ(10deg) rotateX(-20deg); }
  75% { transform: translate(4px, -6px) rotateZ(18deg) rotateY(-20deg); }
  100% { transform: translate(0, 0) rotate(0); }
}
@keyframes land {
  0% { transform: translateY(-46px) rotateX(240deg) rotateZ(-200deg) scale(.8); }
  50% { transform: translateY(6px) rotateX(-12deg) rotateZ(12deg) scale(1.1, .9); }
  70% { transform: translateY(-9px) rotateZ(-5deg) scale(.96, 1.05); }
  86% { transform: translateY(1px) scale(1.02, .98); }
  100% { transform: none; }
}
/* Five of a kind: the dice jump for joy in a wave. */
.tray.jackpot .die { animation: hooray .7s var(--bounce) 2; }
.tray.jackpot .die:nth-child(2) { animation-delay: .07s; }
.tray.jackpot .die:nth-child(3) { animation-delay: .14s; }
.tray.jackpot .die:nth-child(4) { animation-delay: .21s; }
.tray.jackpot .die:nth-child(5) { animation-delay: .28s; }
.tray.jackpot { box-shadow: inset 0 10px 22px rgb(0 0 0 / .35), 0 0 0 6px var(--accent), 0 6px 0 6px var(--accent-edge), 0 0 40px 10px color-mix(in srgb, var(--accent) 55%, transparent); }
@keyframes hooray { 0%, 100% { transform: none; } 40% { transform: translateY(-22px) rotate(-10deg) scale(1.1); } }

/* Rolls left: little gems. */
.rolls i { transition: scale .3s var(--bounce); }
.rolls i.left {
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--hold), #fff 55%), var(--hold) 60%);
  box-shadow: 0 2px 0 var(--hold-edge), 0 0 10px color-mix(in srgb, var(--hold) 60%, transparent);
  scale: 1.15;
}

/* The score sheets: cards with a lit header; a box to write in is a soft
   button that pops up after a roll, and a score just written pops in. */
.sheet thead th { background: linear-gradient(var(--paper), color-mix(in srgb, var(--line) 55%, var(--paper))); }
.sheet tfoot th, .sheet tfoot td { background: color-mix(in srgb, var(--line) 30%, var(--paper)); box-shadow: inset 0 2px 3px -2px var(--shade); }
.offer {
  border: 0;
  background: linear-gradient(color-mix(in srgb, var(--accent-text) 8%, var(--paper)), color-mix(in srgb, var(--accent-text) 18%, var(--paper)));
  box-shadow: inset 0 1px 0 var(--hi), 0 3px 0 color-mix(in srgb, var(--accent-text) 45%, var(--paper));
  translate: 0 -2px;
}
.offer:not(:disabled):active { translate: 0 1px; box-shadow: 0 0 0 transparent; }
@media (hover: hover) { .offer:hover { background: var(--accent-text); color: var(--paper); box-shadow: 0 3px 0 var(--text-edge); } }
.offer.zero { border: 2px dashed var(--line); box-shadow: none; translate: none; }
.offer.pop { animation: pop .42s var(--bounce) both; }
td:nth-child(3) .offer.pop { animation-delay: .04s; }
/* Score hints: an upper offer also shows its bonus pace (three of that face
   is par), small on the left; with hints off an offer is a plain pen. */
.offer.paced { display: flex; align-items: center; justify-content: space-between; gap: 2px; }
.offer .pace { font-size: .72em; font-weight: 700; color: var(--muted); letter-spacing: -.02em; }
.offer .pace.behind { opacity: .8; }
@media (hover: hover) { .offer:hover .pace { color: inherit; } }
.offer.plain { text-align: center; font-weight: 400; }
.hints-switch { margin: 10px 0 0; text-align: right; }
.hints-switch .link {
  border: 0; background: none; padding: 6px 4px; min-height: 32px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--muted);
  text-decoration: underline dotted; text-underline-offset: 3px; box-shadow: none; translate: none;
}
@media (hover: hover) { .hints-switch .link:hover { color: var(--accent-text); } }
@keyframes pop { 0% { scale: .2; opacity: 0; } 100% { scale: 1; opacity: 1; } }
.sheet td.fresh { animation: fresh 1.4s ease-out; color: var(--accent-text); }
@keyframes fresh { 0%, 30% { background: color-mix(in srgb, var(--accent) 65%, var(--paper)); text-shadow: 0 0 10px var(--accent); } }

/* The menus in the header: pills that stand up, panels that pop open. */
.style-picker summary, .sound { box-shadow: inset 0 1px 0 var(--hi), 0 3px 0 var(--edge); transition: translate .18s var(--bounce), box-shadow .18s ease; }
.style-picker summary:active, .sound:active { translate: 0 3px; box-shadow: inset 0 1px 0 var(--hi), 0 0 0 var(--edge); }
.style-picker form { box-shadow: inset 0 1px 0 var(--hi), 0 var(--lift) 0 var(--edge), 0 18px 34px -8px var(--shade); transform-origin: 90% 0; }
.style-picker[open] form { animation: menu .3s var(--bounce); }
@keyframes menu { from { scale: .85; opacity: 0; translate: 0 -6px; } }
.style-picker button { box-shadow: none; }
.style-picker button:active { translate: 0 1px; box-shadow: none; }
.swatch { box-shadow: inset 0 0 0 2px rgb(255 255 255 / .6), 0 2px 0 rgb(0 0 0 / .2); }
#toast { box-shadow: 0 4px 0 rgb(0 0 0 / .25), 0 16px 26px -8px var(--shade); }

/* The start page's dice: bevelled, bobbing. */
.hero-dice .d { --c: var(--felt); background: linear-gradient(150deg, color-mix(in srgb, var(--c), #fff 18%), var(--c)); box-shadow: inset 0 2px 0 rgb(255 255 255 / .35), 0 5px 0 color-mix(in srgb, var(--c), #000 32%), 0 14px 14px -4px var(--shade); animation: bob 2.8s ease-in-out infinite; }
.hero-dice .d:nth-child(2) { --c: var(--accent-text); background: linear-gradient(150deg, color-mix(in srgb, var(--c), #fff 18%), var(--c)); animation-delay: -.9s; }
.hero-dice .d:nth-child(3) { --c: var(--mint); background: linear-gradient(150deg, color-mix(in srgb, var(--c), #fff 18%), var(--c)); animation-delay: -1.8s; }
@keyframes bob { 50% { translate: 0 -8px; } }

/* Confetti for the winner (static/app.js scatters the pieces). */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.confetti i {
  position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; background: var(--accent);
  animation: fall var(--t, 2.6s) cubic-bezier(.3, .6, .5, 1) var(--d, 0s) both;
}
.confetti i:nth-child(5n+1) { background: var(--hold); }
.confetti i:nth-child(5n+2) { background: var(--felt); }
.confetti i:nth-child(5n+3) { background: var(--accent-text); border-radius: 50%; }
.confetti i:nth-child(5n+4) { background: var(--mint); }
@keyframes fall { to { translate: var(--x, 0) 110vh; rotate: var(--r, 540deg); } }

/* Circus: a gold rim with a red ring; Quiet: thin edges, nothing moves. */
:root[data-theme="circus"] .tray {
  box-shadow:
    inset 0 10px 22px rgb(0 0 0 / .35), 0 0 0 6px var(--accent), 0 0 0 10px var(--felt),
    0 8px 0 10px #5a0716, 0 24px 34px 6px var(--shade);
  margin: 10px 0 24px;
}
:root[data-theme="circus"] h1 { text-shadow: 2px 2px 0 var(--accent), 4px 4px 0 var(--accent-edge), 6px 10px 14px var(--shade); }
:root[data-theme="circus"] .primary:not(:disabled) { box-shadow: inset 0 2px 0 rgb(255 255 255 / .5), 0 var(--lift) 0 #b38f00, 0 10px 18px -6px var(--shade); }
:root[data-theme="quiet"] .tray { border: 1px solid var(--line); box-shadow: inset 0 3px 8px rgb(0 0 0 / .1), 0 0 0 4px var(--rim), 0 2px 0 4px var(--rim-edge); }
:root[data-theme="quiet"] .die { box-shadow: inset 0 -2px 0 var(--die-edge), 0 0 0 1px var(--die-edge), 0 3px 0 var(--die-edge), 0 6px 8px -4px var(--shade); }
:root[data-theme="quiet"] .die.held { box-shadow: 0 0 0 3px var(--hold), 0 3px 0 3px var(--hold-edge); transform: none; }
:root[data-theme="quiet"] .die:not(:disabled):hover, :root[data-theme="quiet"] .die.held:not(:disabled):hover { transform: none; }
:root[data-theme="quiet"] .start, :root[data-theme="quiet"] .howto, :root[data-theme="quiet"] .stats, :root[data-theme="quiet"] .skins, :root[data-theme="quiet"] .brand svg { rotate: none; }
:root[data-theme="quiet"] h1 { text-shadow: none; }
:root[data-theme="quiet"] .hero-dice .d, :root[data-theme="quiet"] .end.won .outcome, :root[data-theme="quiet"] .tray.jackpot .die,
:root[data-theme="quiet"] .offer.pop, :root[data-theme="quiet"] .sheet td.fresh, :root[data-theme="quiet"] .player .total { display: inline-block; }
.player .total.bump { animation: none; }
:root[data-theme="quiet"] .rolls i.left { box-shadow: none; scale: none; }
@media (prefers-reduced-motion: reduce) {
  body::after, .hero-dice .d, .end.won .outcome, .tray.jackpot .die, .offer.pop, .sheet td.fresh, .player .total.bump, .style-picker[open] form { animation: none; }
  .confetti { display: none; }
}

/* Responsive. The phone in portrait is the base above; from there:
   - a very narrow phone (≤360px) gets tighter score sheets;
   - a tablet in portrait (≥700px) gets a wider column and bigger rows to tap;
   - a wide screen (≥1000px: tablet in landscape, laptop, desktop), or a phone
     on its side, puts the dice on the left and the score sheets on the right,
     the dice staying in view while the sheets scroll. */
@media (max-width: 360px) {
  :root { --gutter: 10px; }
  .brand span { font-size: 16px; }
  .style-picker summary { padding: 8px 10px; }
  .sheets { gap: 4px; }
  .sheet { font-size: 12px; }
  .sheet th, .sheet td { padding: 0 3px; }
  .sheet th:first-child { width: 54%; }
  .offer { font-size: 13px; padding: 0 2px; }
  .player { padding: 6px 8px; gap: 6px; }
}

/* A tall phone: the spare height goes to bigger rows to tap. */
@media (max-width: 699px) and (min-height: 760px) {
  .sheet th, .sheet td { height: 37px; }
  .offer { min-height: 30px; }
  .tray { padding-top: 20px; padding-bottom: 16px; }
}

@media (min-width: 700px) {
  :root { --page: 760px; --gutter: 24px; }
  .top { padding-top: 18px; padding-bottom: 18px; }
  .player { padding: 12px 16px; }
  .player .total { font-size: 24px; }
  .status { font-size: 18px; margin: 18px 0 12px; }
  .tray { padding: 24px 16px 18px; border-radius: 22px; }
  .sheets { gap: 12px; margin-top: 14px; }
  .sheet { font-size: 16px; border-radius: 14px; }
  .sheet th, .sheet td { height: 40px; padding: 0 10px; }
  .sheet thead th { height: 30px; font-size: 13px; }
  .sheet tfoot th, .sheet tfoot td { height: 30px; font-size: 14px; }
  .offer { min-height: 32px; font-size: 16px; }
  .hero { padding-top: 40px; }
  .hero-dice .d { width: 56px; height: 56px; border-radius: 14px; }
}

@media (min-width: 1000px) {
  .page-game { --page: 1120px; }
  .page-home { --page: 1080px; }
  .page-home main { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: start; }
  .page-home .hero { padding-top: 56px; }
  .page-home .howto { margin-top: 64px; }
  /* With your games: they and the how-to share the right column. */
  .page-home .hero { grid-row: span 3; }
  .page-home .stats, .page-home .skins { grid-column: 2; margin-top: 64px; }
  .page-home .stats + .skins { margin-top: 0; }
  .page-home .skins + .howto { grid-column: 2; margin-top: 0; }
}

/* Side by side: the board's two halves as columns. */
@media (min-width: 1000px), (orientation: landscape) and (min-width: 640px) and (max-height: 600px) {
  #board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
  #board .play { position: sticky; top: 12px; }
  #board .sheets { margin-top: 0; }
  #board .hints-switch { grid-column: 2; margin-top: -16px; }
  #board .status { margin-top: 14px; }
}
@media (min-width: 1000px) {
  .page-game .tray { padding: 32px 20px 22px; }
  .page-game .roll { margin-top: 22px; }
}

/* A phone on its side: little height, so everything is compact. */
@media (orientation: landscape) and (max-height: 600px) {
  :root { --gutter: 16px; }
  .top { padding-top: 6px; padding-bottom: 6px; }
  .brand { font-size: 17px; }
  .brand svg { width: 24px; height: 24px; }
  .style-picker summary, .sound { min-height: 38px; height: 38px; }
  .sound { width: 38px; }
  #board { gap: 14px; }
  .player { padding: 6px 10px; }
  .player .total { font-size: 18px; }
  .status { font-size: 15px; margin: 8px 0 6px; }
  .tray { padding: 12px 10px 10px; border-radius: 16px; }
  .die { --s: clamp(36px, 13cqi, 60px); }
  .roll { margin-top: 10px; }
  .big { font-size: 16px; padding: 8px 20px; min-height: 40px; }
  .sheets { gap: 8px; margin-top: 0; }
  .sheet { font-size: 13px; }
  .sheet th, .sheet td { height: 25px; padding: 0 5px; }
  .sheet thead th, .sheet tfoot th, .sheet tfoot td { height: 21px; font-size: 11px; }
  .offer { min-height: 21px; font-size: 13px; }
  .hero { padding-top: 8px; }
}

/* Quick reactions: a row of round emoji buttons under the tray, and the
   emoji a player sent rising from their name (static/app.js). */
.reactions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.reactions button {
  min-height: 40px; width: 40px; padding: 0; border-radius: 50%; font-size: 20px; line-height: 40px;
  background: var(--paper); border: 1px solid var(--line);
}
@media (hover: hover) { .reactions button:hover { scale: 1.12; } }
.reaction {
  position: fixed; z-index: 30; pointer-events: none; font-size: 40px; line-height: 1;
  translate: -50% -50%; filter: drop-shadow(0 4px 6px var(--shade));
  animation: rise 2.1s cubic-bezier(.2, .7, .3, 1) both;
}
@keyframes rise {
  0% { opacity: 0; scale: .4; transform: translateY(0); }
  15% { opacity: 1; scale: 1.15; }
  25% { scale: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-70px); }
}
@keyframes linger { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
.reaction.still { animation-name: linger; }
:root[data-theme="quiet"] .reactions button:hover { scale: none; }
@media (prefers-reduced-motion: reduce) { .reaction { animation-name: linger; } .reactions button:hover { scale: none; } }
@media (max-width: 520px) { .reactions { gap: 6px; margin: 8px 0 2px; } .reactions button { width: 36px; min-height: 36px; line-height: 36px; font-size: 18px; } }
/* The daily challenge: a card under the start form, and the leaderboard. */
.daily-card {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: inset 0 1px 0 var(--hi), 0 var(--lift) 0 var(--edge), 0 14px 26px -10px var(--shade);
  rotate: .3deg;
}
.daily-card > div { flex: 1 1 240px; }
.daily-card h2 { margin: 0; }
.daily-card h2 a, .daily-card .small a { text-decoration: none; }
.daily-card .small a { color: var(--accent-text); font-weight: 700; }
.daily-tag { text-align: center; margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.daily-tag a { color: var(--accent-text); text-decoration: none; }
.daily-done { font-size: 20px; font-weight: 800; color: var(--accent-text); }
.ranks-card {
  margin-top: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: inset 0 1px 0 var(--hi), 0 var(--lift) 0 var(--edge), 0 14px 26px -10px var(--shade);
}
.ranks-card h2 small { color: var(--muted); font-weight: 600; font-size: 14px; }
.ranks { width: 100%; border-collapse: collapse; margin-top: 10px; font-variant-numeric: tabular-nums; table-layout: fixed; }
.ranks th, .ranks td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranks thead th { font-size: 12px; color: var(--muted); }
.ranks td:first-child, .ranks thead th:first-child { width: 4.5em; }
.ranks td:last-child, .ranks thead th:last-child { width: 5em; text-align: right; font-weight: 800; }
.ranks tbody th { font-weight: 700; }
.ranks tbody tr:first-child td:first-child { color: var(--accent-text); font-weight: 800; }
.ranks tr.mine { background: color-mix(in srgb, var(--hold) 22%, transparent); }
.ranks tr.gap td { text-align: center; color: var(--muted); border-bottom: 0; }
.ranks tbody tr:last-child > * { border-bottom: 0; }
:root[data-theme="quiet"] .daily-card { rotate: none; }

/* Letterdobbel (templates/letters/): the board of squares, the letter
   dice, the secret word's slots and the words laid. Letters are tiles of
   their own colour (--tile, --tile-ink); a letter's colour against the
   secret word is --right (in its place) or --near (elsewhere), grey when
   it is not in it. */
:root {
  --tile: #fff4d6;
  --tile-edge: #e0c98f;
  --tile-ink: #3a2a05;
  --right: #1f9d55;
  --near: #e2a516;
  --square: color-mix(in srgb, var(--paper), var(--line) 45%);
  --dl: color-mix(in srgb, var(--felt) 22%, var(--paper));
  --dw: color-mix(in srgb, var(--accent-text) 30%, var(--paper));
}
:root[data-theme="quiet"] { --right: #2f9e44; --near: #d9a400; --tile: #ffffff; --tile-edge: #cfd4dc; --tile-ink: #262a33; }
:root[data-theme="bright"] { --right: #12a150; --near: #ffb800; --tile: #fffbe6; --tile-edge: #f0c3e4; --tile-ink: #23103a; }
:root[data-theme="circus"] { --right: #0f8a43; --near: #ff8a00; --tile: #fffdf5; --tile-edge: #d9a93c; --tile-ink: #2a0a12; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]), :root[data-theme="classic"], :root[data-theme="quiet"] {
    --square: color-mix(in srgb, var(--paper), #000 18%);
    --dl: color-mix(in srgb, var(--felt) 35%, var(--paper));
    --dw: color-mix(in srgb, var(--accent-text) 35%, var(--paper));
  }
}
.lmeta { text-align: center; margin: 6px 0 0; }
.lboard {
  display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; container-type: inline-size;
  background: var(--line); padding: 3px; border-radius: 12px; margin: 6px 0 10px;
  box-shadow: 0 var(--lift) 0 var(--edge), 0 14px 26px -12px var(--shade);
}
.sq {
  aspect-ratio: 1; min-height: 0; padding: 0; border: 0; border-radius: 4px; position: relative;
  display: grid; place-items: center; font-weight: 800; line-height: 1;
  font-size: calc(70cqi / var(--n)); background: var(--square); color: var(--muted);
}
.sq.dl { background: var(--dl); color: var(--ink); font-size: calc(30cqi / var(--n)); }
.sq.dw { background: var(--dw); color: var(--ink); font-size: calc(30cqi / var(--n)); }
.sq.start { color: var(--accent-text); font-size: calc(55cqi / var(--n)); }
button.sq.empty { cursor: pointer; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-text) 30%, transparent); }
@media (hover: hover) { button.sq.empty:hover { background: color-mix(in srgb, var(--accent) 40%, var(--paper)); } }
.sq.tile { background: var(--tile); color: var(--tile-ink); box-shadow: inset 0 -2px 0 var(--tile-edge); }
.sq.tile.own { box-shadow: inset 0 -2px 0 var(--tile-edge), inset 0 0 0 1px color-mix(in srgb, var(--accent-text) 35%, transparent); }
.sq.laid { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 -2px 0 var(--accent-edge); cursor: pointer; }
.sq small, .ldie small { position: absolute; right: 8%; bottom: 6%; font-size: .38em; font-weight: 700; opacity: .75; }
.ltray {
  background: radial-gradient(120% 100% at 50% 0%, var(--felt), var(--felt-2));
  border-radius: 18px; padding: 12px 10px; box-shadow: inset 0 2px 10px rgb(0 0 0 / .25); container-type: inline-size;
}
.ltray.theirs { filter: grayscale(.6); opacity: .8; }
.ltray .hint { color: rgb(255 255 255 / .85); text-align: center; margin: 6px 0 0; font-size: 13px; }
.ldice { display: flex; justify-content: center; gap: clamp(4px, 1.6cqi, 10px); }
.ldie {
  --s: clamp(36px, 12.4cqi, 64px);
  width: var(--s); height: var(--s); min-height: 0; padding: 0; border-radius: 18%; position: relative; flex: none;
  background: var(--tile); color: var(--tile-ink); font-size: calc(var(--s) * .52); font-weight: 800; line-height: var(--s);
  box-shadow: 0 3px 0 var(--tile-edge), 0 6px 12px rgb(0 0 0 / .3); transition: transform .12s ease, box-shadow .12s ease;
}
.ldie:disabled { opacity: 1; cursor: default; }
.ldie.used { opacity: .25 !important; box-shadow: none; }
.ldie.selected { transform: translateY(-6px); box-shadow: 0 0 0 4px var(--hold), 0 9px 14px rgb(0 0 0 / .35); }
.lactions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; }
.lactions form { display: flex; align-items: center; gap: 8px; margin: 0; }
.lactions .small { color: rgb(255 255 255 / .8); margin: 0; }
.lactions .why { flex-basis: 100%; text-align: center; color: #fff; font-weight: 700; font-size: 14px; margin: 0; }
.lactions .link { background: transparent; color: rgb(255 255 255 / .85); text-decoration: underline; padding: 8px 10px; }
.lactions button:not(.primary):not(.link) { background: rgb(255 255 255 / .9); }
.secret, .lwords { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 14px; }
.secret h2, .lwords h2 { font-size: 16px; margin: 0 0 8px; }
.slots { display: flex; gap: 6px; }
.slot {
  width: 40px; height: 44px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center;
  font-size: 22px; font-weight: 800; background: var(--paper);
}
.slot.right { background: var(--right); border-color: var(--right); color: #fff; }
.solved { font-weight: 800; color: var(--accent-text); margin: 8px 0 0; }
.tried { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 10px; }
.tried span { width: 22px; height: 24px; border-radius: 5px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--square); color: var(--muted); }
.tried .right, .lwords .word i.right { background: var(--right); color: #fff; }
.tried .near, .lwords .word i.near { background: var(--near); color: #1d1500; }
.tried .miss { background: transparent; color: var(--off); text-decoration: line-through; }
.guess { margin-top: 10px; }
.guess input { text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.lwords ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lwords li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.lwords .who { flex: 0 0 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.lwords li.mine .who { color: var(--accent-text); }
.lwords .word { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.lwords .word i { font-style: normal; width: 22px; height: 24px; border-radius: 5px; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--square); color: var(--ink); }
.lwords .pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.credit { text-align: center; }
.levels { border: 0; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.levels legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.levels label { font-weight: 400; display: flex; gap: 8px; align-items: baseline; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.levels label:has(input:checked) { border-color: var(--accent-text); background: color-mix(in srgb, var(--accent-text) 8%, var(--paper)); }
.levels small { color: var(--muted); }
.page-letters .start > input { width: 100%; margin-bottom: 4px; }
.hero-letters { display: flex; gap: 6px; margin-bottom: 8px; }
.hero-letters span {
  width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 22px;
  background: var(--tile); color: var(--tile-ink); box-shadow: 0 3px 0 var(--tile-edge); rotate: -5deg;
}
.hero-letters span:nth-child(2n) { rotate: 4deg; translate: 0 3px; background: var(--right); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--right), #000 30%); }
.hero-letters span:nth-child(3n) { background: var(--near); color: #1d1500; box-shadow: 0 3px 0 color-mix(in srgb, var(--near), #000 30%); }
.letters-card .button { flex: none; }
@media (max-width: 400px) {
  .slot { width: 34px; height: 38px; font-size: 19px; }
  .lboard { gap: 1px; padding: 2px; }
}
/* Wide: the board on the left, the dice, clues and words beside it. */
@media (min-width: 1000px) {
  .page-letters.page-game { --page: 1120px; }
  .lplay { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
  .lplay > * { grid-column: 2; }
  .lplay > .lboard { grid-column: 1; grid-row: 1 / span 12; margin-top: 0; position: sticky; top: 12px; }
}

/* ---- Dobbelbord (templates/bord.html) ----------------------------------
   The board is a felt square of 9×9 paper squares. Bonus squares take the
   look's own roles: --hold for a die's bonus, --accent for a line's, the
   felt for a blocked square, so every theme colours them its own way. */
#board:has(> .bord-game) { display: block; }
.bord-game { display: grid; gap: 10px; }
.bord-tag { text-align: center; font-size: 14px; font-weight: 700; color: var(--muted); margin: 8px 0 0; }
.bord-game .status { margin: 6px 0 0; }
.bord { container-type: inline-size; margin: 0; }
.grid {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: clamp(2px, .8cqi, 4px);
  padding: clamp(4px, 1.6cqi, 10px); border-radius: 16px;
  background: radial-gradient(120% 100% at 50% 0%, var(--felt), var(--felt-2));
  box-shadow: inset 0 2px 10px rgb(0 0 0 / .25);
}
.sq {
  aspect-ratio: 1; min-height: 0; min-width: 0; padding: 0; margin: 0; border: 0; border-radius: clamp(3px, 1.2cqi, 8px);
  background: var(--paper); color: var(--ink); display: grid; place-items: center; position: relative;
  font-size: clamp(8px, 2.5cqi, 14px); font-weight: 800; line-height: 1;
}
.sq b { font-weight: 800; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.sq.die2 b::before, .sq.die3 b::before { content: "◆"; font-size: .8em; }
.sq.line2 b::before, .sq.line3 b::before { content: "═"; font-size: .9em; }
.sq.die2 { background: color-mix(in srgb, var(--hold) 30%, var(--paper)); }
.sq.die3 { background: color-mix(in srgb, var(--hold) 62%, var(--paper)); }
.sq.line2 { background: color-mix(in srgb, var(--accent) 38%, var(--paper)); }
.sq.line3 { background: color-mix(in srgb, var(--accent) 75%, var(--paper)); color: var(--accent-ink); }
.sq.blocked {
  background: repeating-linear-gradient(45deg, rgb(0 0 0 / .28) 0 4px, rgb(0 0 0 / .12) 4px 8px);
  box-shadow: inset 0 1px 3px rgb(0 0 0 / .35);
}
.sq.start::after {
  content: ""; position: absolute; inset: 18%; border-radius: 50%;
  border: 2px dashed var(--accent-text);
}
button.sq { cursor: pointer; }
@media (hover: hover) { button.sq:not(.staged):hover { box-shadow: inset 0 0 0 3px var(--accent-text); } }
.sq.tile, .sq.staged { background: var(--die); box-shadow: 0 2px 0 var(--die-edge); }
.sq.tile { box-shadow: inset 0 0 0 2px var(--off), 0 2px 0 var(--die-edge); }
.sq.tile.mine { box-shadow: inset 0 0 0 2px var(--accent-text), 0 2px 0 var(--die-edge); }
.sq.tile.fresh { outline: 3px solid var(--hold); outline-offset: -1px; z-index: 1; }
.sq.staged { box-shadow: 0 0 0 3px var(--hold), 0 4px 8px rgb(0 0 0 / .35); translate: 0 -2px; z-index: 1; }
.pipgrid { width: 76%; height: 76%; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); gap: 6%; }
.pipgrid i { border-radius: 50%; }
.pipgrid i.p { background: var(--pip); }
.preview { text-align: center; font-weight: 800; color: var(--accent-text); margin: 0; }
.preview.wrong { color: var(--error); font-weight: 700; }
.bord-tray .die { --s: clamp(38px, 14cqi, 64px); }
.bord-tray .die.picked { transform: translateY(-6px); box-shadow: 0 0 0 4px var(--hold), 0 9px 14px rgb(0 0 0 / .35); }
.bord-tray .dice:empty { min-height: 8px; }
.bord-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.bord-actions form { margin: 0; }
.bord-actions .roll { margin: 0; }
.bord-actions .pass .link {
  background: none; color: rgb(255 255 255 / .85); text-decoration: underline; padding: 8px 10px; min-height: 40px;
}
.tray.theirs .bord-actions { visibility: hidden; }
.bord-game .end { margin: 4px 0; }
.bord-game .end form { margin: 0 0 10px; }
.bord-rules { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; }
.bord-rules summary { font-weight: 700; cursor: pointer; }
.bord-rules ol { margin: 8px 0 0; padding-left: 20px; }
.bord-rules li { margin: 4px 0; }
@media (min-width: 1000px), (orientation: landscape) and (min-width: 640px) and (max-height: 600px) {
  .bord-game { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); grid-template-rows: auto 1fr; gap: 12px 24px; align-items: start; }
  .bord-game .bord { grid-column: 2; grid-row: 1 / span 2; }
  .bord-game .bord-head { grid-column: 1; grid-row: 1; }
  .bord-game .bord-side { grid-column: 1; grid-row: 2; display: grid; gap: 10px; align-content: start; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .bord-game .bord { max-width: calc(100dvh - 80px); }
}
.bord-side { display: grid; gap: 10px; }

/* On the start page: the Dobbelbord card, with the levels as buttons. */
.bord-card {
  margin-top: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: inset 0 1px 0 var(--hi), 0 var(--lift) 0 var(--edge), 0 14px 26px -10px var(--shade);
  rotate: -.3deg; position: relative;
}
:root[data-theme="quiet"] .bord-card { rotate: none; }
.bord-card h2 { margin: 0; }
.bord-card h3 { font-size: 15px; margin: 12px 0 6px; }
.bord-card p { margin: 6px 0 0; }
.bord-card .levels { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; }
.bord-card .levels button { padding: 0; min-height: 40px; }
.bord-card .levels button:disabled { opacity: .45; }
.bord-mini {
  float: right; width: 54px; height: 54px; margin: 0 0 6px 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
  padding: 4px; border-radius: 10px; background: radial-gradient(120% 100% at 50% 0%, var(--felt), var(--felt-2));
}
.bord-mini i { border-radius: 3px; background: var(--paper); }
.bord-mini .m1, .bord-mini .m3, .bord-mini .m4, .bord-mini .m5 { background: var(--die); box-shadow: inset 0 0 0 2px var(--accent-text); }
.bord-mini .m0, .bord-mini .m8 { background: color-mix(in srgb, var(--hold) 50%, var(--paper)); }

/* Tournaments: best of 3 or 5 against the same friend. */
.best-of { border: 0; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.best-of legend { float: left; width: 100%; font-size: 14px; color: var(--muted); margin: 0 0 6px; padding: 0; }
.best-of label { position: relative; }
.best-of input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.best-of span {
  display: inline-block; padding: 6px 11px; border-radius: 999px; border: 2px solid var(--line);
  font-size: 14px; font-weight: 700; color: var(--muted);
}
.best-of input:checked + span { border-color: var(--accent); color: var(--accent-text); }
.best-of input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.match-tag { text-align: center; margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.rule { font-weight: 700; margin: -8px 0 20px; }
.end.champion .trophy { font-size: 56px; line-height: 1; margin: 0; animation: cheer 1s var(--bounce) both; }
.games { margin: 0 auto 14px; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
.games th, .games td { padding: 3px 12px; }
.games th { text-align: left; font-weight: 600; color: var(--muted); }
.games td { text-align: right; }
.games td.win { font-weight: 800; color: var(--accent-text); }
@media (prefers-reduced-motion: reduce) { .end.champion .trophy { animation: none; } }
:root[data-theme="quiet"] .end.champion .trophy { animation: none; }

/* Weekly leagues: a card on the start page, and the league's table. */
.league-card {
  margin-top: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: inset 0 1px 0 var(--hi), 0 var(--lift) 0 var(--edge), 0 14px 26px -10px var(--shade);
  rotate: -.3deg;
}
.league-card h2 { margin: 0 0 4px; }
.leagues { list-style: none; margin: 6px 0 10px; padding: 0; display: grid; gap: 4px; }
.leagues a { color: var(--accent-text); font-weight: 800; text-decoration: none; }
.league-card summary { cursor: pointer; font-weight: 700; color: var(--accent-text); margin: 6px 0; }
.league-card .row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.league-card label { flex: 1 1 160px; display: grid; gap: 4px; font-size: 14px; font-weight: 700; }
.league-card input { width: 100%; }
.league-table [class^="c"] { width: 3em; text-align: right; }
.league-table td.c6 { font-weight: 800; }
.league-table td:last-child, .league-table thead th:last-child { width: 3.4em; }
.league-table abbr { text-decoration: none; }
.leave { margin: 18px 0 8px; text-align: center; }
.leave button { background: none; border: 0; color: var(--muted); text-decoration: underline; box-shadow: none; }
@media (max-width: 520px) { .league-table .c3, .league-table .c4, .league-table .c5 { display: none; } }
:root[data-theme="quiet"] .league-card { rotate: none; }
.ranks-card .week { margin: 2px 0 0; font-weight: 700; }

/* Dice skins (src/skins.rs), earned by playing: the class on the dice of
   the player on turn, and on each sample in the start page's picker. Each
   sets the dice's own colours, the same in every look and in the dark;
   --die-shade is set again here, :root's is worked out from :root's die. */
.skins { margin-top: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; rotate: -.3deg; }
.skins > .small { margin-top: -4px; }
.skin-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin: 0; }
.skin {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px 10px;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  font: inherit; text-align: center; cursor: pointer; min-height: 0;
}
.skin.on { border-color: var(--accent-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-text) 30%, transparent), 0 var(--lift) 0 var(--text-edge); }
.skin.locked { cursor: default; opacity: 1; }
.skin.locked .sample { filter: grayscale(1) brightness(.9); opacity: .45; }
.skin .sample { display: block; padding: 4px 0 10px; }
.skin .die { --s: 46px; transform: rotate(-6deg); }
.skin:nth-child(2n) .die { transform: rotate(5deg); }
.skin-name { font-weight: 800; }
.skin-goal { font-size: 12px; color: var(--muted); line-height: 1.3; }
.skin.on .skin-goal { color: var(--accent-text); font-weight: 700; }
.skin .new { font-style: normal; font-size: 11px; font-weight: 800; color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 1px 6px; vertical-align: 2px; }
.unlocked { font-weight: 700; color: var(--accent-text); margin: -4px 0 12px; }

.skin-wood {
  --die: #e0a868; --die-shade: #b27a42; --die-edge: #7f5229; --pip: #3a2110;
}
.skin-wood .die {
  background:
    repeating-linear-gradient(97deg, transparent 0 5px, rgb(110 60 20 / .16) 5px 6px, transparent 6px 9px, rgb(110 60 20 / .1) 9px 11px),
    radial-gradient(60% 35% at 70% 75%, rgb(110 60 20 / .25), transparent 70%),
    linear-gradient(150deg, #edbb7f 40%, var(--die-shade));
}
.skin-night {
  --die: #30364a; --die-shade: #1a1e2b; --die-edge: #0b0d14; --pip: #f6f0dc;
}
.skin-night .die { background: radial-gradient(120% 90% at 25% 15%, #465072, transparent 55%), linear-gradient(150deg, var(--die) 45%, var(--die-shade)); }
.skin-night .die i.p { box-shadow: inset 0 -1px 2px rgb(0 0 0 / .35), 0 0 6px rgb(255 240 200 / .35); }
.skin-glass {
  --die: rgb(214 238 255 / .6); --die-shade: rgb(120 180 240 / .55); --die-edge: rgb(60 120 190 / .75); --pip: #0d3f8f;
}
.skin-glass .die {
  background:
    linear-gradient(150deg, rgb(255 255 255 / .85) 0 18%, transparent 19% 100%),
    linear-gradient(150deg, rgb(220 240 255 / .55) 40%, rgb(110 170 235 / .55));
  backdrop-filter: blur(3px) saturate(1.3);
}
.skin-gold {
  --die: #f6d36a; --die-shade: #c4932a; --die-edge: #8c6410; --pip: #4e3300;
}
.skin-gold .die {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, #fff4bf 0%, #f6d36a 30%, #d9a73a 62%, #f3cf6b 85%, #b9861f 100%);
}
/* A glint across the gold. */
.skin-gold .die::after {
  content: ""; position: absolute; inset: -20%; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgb(255 255 255 / .65) 50%, transparent 60%);
  translate: -110% 0; animation: glint 3.6s ease-in-out infinite;
}
.skin-gold .die:nth-child(2)::after { animation-delay: .15s; }
.skin-gold .die:nth-child(3)::after { animation-delay: .3s; }
.skin-gold .die:nth-child(4)::after { animation-delay: .45s; }
.skin-gold .die:nth-child(5)::after { animation-delay: .6s; }
@keyframes glint { 0%, 55% { translate: -110% 0; } 85%, 100% { translate: 110% 0; } }
:root[data-theme="quiet"] .skin-gold .die::after { display: none; }
@media (prefers-reduced-motion: reduce) { .skin-gold .die::after { display: none; } }
/* On the other player's turn the tray greys, a little less for earned
   dice: they stay recognisable. */
.tray.theirs .dice[class*="skin-"] { filter: grayscale(.5); }

/* Watch links (src/watch.rs): the box under a player's game, the line on
   top of a watcher's board, and how many are watching. */
.watch-link { margin: 16px 0 0; }
.watch-link summary {
  cursor: pointer; text-align: center; color: var(--muted); font-size: 14px; font-weight: 700;
  list-style: none; padding: 6px 0;
}
.watch-link summary::-webkit-details-marker { display: none; }
@media (hover: hover) { .watch-link summary:hover { color: var(--accent-text); } }
.watch-link[open] summary { color: var(--accent-text); }
.watch-link .invite { margin-top: 4px; }
.watching-tag { text-align: center; margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--accent-text); }
.watchers { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 0; }
@media (min-width: 1000px) { .page-game .watch-link { max-width: 520px; margin-inline: auto; } }
