@font-face {
  font-family: 'DM Sans';
  src: url('/fonts/dm-sans.woff2') format('woff2');
  font-weight: 100 1000;
  font-display: swap;
}
@font-face {
  font-family: Fredoka;
  src: url('/fonts/fredoka.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --base: #074634;
  --game-base: #094535;
  --deep: #063a2d;
  --shade: #032e24;
  --surface: #115d46;
  --seam: #61a88b;
  --text: #fff;
  --accent: #f3c668;
  --accent-hi: #ffe39a;
  --primary-edge: #ffedbc;
  --primary-shadow: #8d6631;
  --mint: #76eab2;
  --paper: #fff8e6;
  --score-paper: #f9f0dc;
  --score-upper-fill: #e8dfc8;
  --score-upper-divider: #cbbfa5;
  --score-divider: #d9cfb6;
  --score-frame: #8b9279;
  --score-green: #355448;
  --score-points-fill: #196348;
  --score-zero-fill: #eee1c6;
  --score-zero-ink: #765b39;
  --ink: #242424;
  --gold: #ffd06a;
  --danger: #ffd893;
  --ivory-top: #fff9e8;
  --ivory-bottom: #ded0ac;
  --ivory-side: #a39676;
  --ivory-face-top: #fffaec;
  --ivory-face-bottom: #eee6d0;
  --ivory-face: linear-gradient(150deg, var(--ivory-face-top), var(--ivory-face-bottom));
  --held-top: #ffe89d;
  --held-bottom: #eabd5d;
  --held-side: #ac7732;
  --held-face-top: #fff3c8;
  --held-face-bottom: #f3d88f;
  --spelled-top: #c3d9ff;
  --spelled-bottom: #7da7e3;
  --spelled-side: #4b6ca5;
  --spelled-face-top: #e6efff;
  --spelled-face-bottom: #bbd2f7;
  --spelled-path: #a2bfff;
  --spelled-face: linear-gradient(var(--spelled-face-top), var(--spelled-face-bottom));
  --word-two-top: #aee6e3;
  --word-two-bottom: #72bdc0;
  --word-two-side: #418184;
  --word-two-face-top: #e4f5ef;
  --word-two-face-bottom: #b1ded8;
  --word-three-top: #eabfeb;
  --word-three-bottom: #c28acd;
  --word-three-side: #8d609a;
  --word-three-face-top: #f4e7fc;
  --word-three-face-bottom: #e1bdec;
  --invalid-top: #ffb9ad;
  --invalid-bottom: #e07365;
  --invalid-side: #a45048;
  --invalid-face-top: #ffe2db;
  --invalid-face-bottom: #f5a89d;
  --sans: 'DM Sans', system-ui, sans-serif;
  --display: Fredoka, 'DM Sans', system-ui, sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --target: 44px;
  --panel-border: 1px;
  --small-radius: 6px;
  --control-radius: 10px;
  --panel-radius: 14px;
  --field: #083e30;
  --focus: var(--gold);
  --label-type: 720 .84rem/1.25 var(--sans);
  --action-type: 700 1.09rem/1.12 var(--display);
  /* Safari may keep the initial toolbar tint while the app changes screens. */
  --page-edge: #0a6449;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --page-fade: linear-gradient(var(--page-edge) var(--safe-top),
    transparent calc(var(--safe-top) + 18%), transparent calc(82% - var(--safe-bottom)),
    var(--page-edge) calc(100% - var(--safe-bottom)));
  background-color: var(--page-edge);
  color: var(--text);
  font: 100% / 1.45 var(--sans);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root[data-starting] :is(.site-header, .shell) { visibility: hidden; }
body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  min-height: 100dvh;
  padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
  background-color: var(--page-edge);
  background-repeat: no-repeat;
  background-image: var(--page-fade), radial-gradient(ellipse at 50% -10%, #117451, var(--base) 74%);
}
/* Give Safari room to scroll even with its toolbar collapsed, and pin the screen to the viewport. */
:root[data-ios="browser"]:has(> body:is([data-screen="home"], [data-screen="game"])) {
  min-height: calc(100lvh + 64px);
}
:root[data-ios="browser"] > body:is([data-screen="home"], [data-screen="game"]) {
  position: sticky;
  top: 0;
}
/* Safari samples fixed elements at the viewport edges for its toolbar tint. */
.viewport-edge { display: none; }
:root[data-ios] .viewport-edge {
  --edge-depth: 14px;
  display: block; position: fixed; z-index: 6; inset-inline: 0;
  block-size: var(--edge-depth); background-color: var(--page-edge); pointer-events: none;
}
.viewport-edge-top { inset-block-start: min(0px, calc(var(--safe-top) - var(--edge-depth))); }
.viewport-edge-bottom { inset-block-end: min(0px, calc(var(--safe-bottom) - var(--edge-depth))); }
:root:has(> body[data-screen="game"]) { --base: var(--game-base); }
body[data-screen="game"], :root[data-starting="resume"] > body {
  background-image: var(--page-fade), radial-gradient(ellipse at 58% -10%, #166f51, var(--game-base) 76%);
}
body[data-screen="home"] {
  display: flex;
  flex-direction: column;
  background-image:
    var(--page-fade),
    radial-gradient(ellipse 57% 84% at -10% -9%, transparent 65%, #99f6a915 65.3% 70%, transparent 70.3% 76%, #99f6a91a 76.3% 76.8%, transparent 77.1%),
    radial-gradient(ellipse 70% 74% at 114% 108%, transparent 49%, #85edb41a 49.3% 54%, transparent 54.3% 62%, #85edb41a 62.3% 62.8%, transparent 63.1%),
    radial-gradient(ellipse at 49% 32%, #128258, #07694d 48%, #044c3b 82%, #034133);
}
button, input { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
a { color: var(--gold); text-underline-offset: .2em; }
h1, h2, h3, p, ul, ol, dl { margin: 0; }
h1, h2 { font: 700 1.65rem/1.06 var(--display); }
h3 { font-size: .9rem; }
:where(h1, h2)[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.site-header { padding-top: var(--safe-top); }
.header-inner, .shell { width: min(calc(100% - 32px), 866px); margin-inline: auto; }
.header-inner {
  --header-height: 61px;
  display: flex; align-items: center; justify-content: space-between; min-height: var(--header-height); gap: 7px;
}
body[data-screen="game"] .header-inner {
  --header-height: 48px;
  display: grid; gap: 0 4px;
  grid-template: "brand round tools" minmax(var(--header-height),auto) "players players players" auto / 27px minmax(0,1fr) auto;
}
body[data-screen="game"] :is(.header-inner, .shell) { max-width: 620px; }
.brand {
  grid-area: brand; justify-self: start;
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text);
  font: 700 1.58rem/.95 var(--display);
  min-width: 0; text-align: start;
}
.brand-mark { display: block; flex: none; }
body[data-screen="game"] .brand span {
  position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
body[data-screen="game"] .header-label { display: none; }
body[data-screen="home"] :is(.brand, .header-home) { display: none; }
body[data-screen="home"] .header-inner { justify-content: flex-end; }
.header-actions {
  grid-area: tools; justify-self: end;
  display: inline-flex; align-items: center; flex: none;
  border-radius: 22px; background: #073f32;
  box-shadow: inset 0 0 0 1px #96d6b64d;
}
.icon-button, .top-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 44px;
  min-height: var(--target);
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
}
.top-button { gap: 7px; padding: 0 11px; font-size: .88rem; font-weight: 750; }
.header-actions button {
  border: 0; border-radius: 22px; background: transparent; color: var(--text);
  white-space: nowrap;
}
.header-icon {
  display: block; flex: none; width: 22px; height: 22px; pointer-events: none;
  fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round;
}
#sound-button[aria-pressed="true"] .sound-muted,
#sound-button[aria-pressed="false"] .sound-waves { display: none; }
.header-actions button:focus-visible { outline-offset: -3px; }
@media (hover: hover) {
  :is(.top-button, .icon-button):hover { background: #e2f8df24; }
  .header-actions .tap-target:hover > button { background: #dbffdd20; }
}
.header-actions .tap-target:active > button { background: #dbffdd33; }
.shell { padding-bottom: calc(16px + var(--safe-bottom)); }
body[data-screen="home"] .shell { display: grid; flex: 1; }

.button {
  --button-top: #287454;
  --button-bottom: var(--surface);
  --button-edge: var(--seam);
  --button-shadow: var(--shade);
  --button-ink: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-width: var(--target); min-height: var(--target); padding: var(--space-2) var(--space-3);
  border: 1px solid var(--button-edge); border-radius: var(--control-radius);
  background: linear-gradient(var(--button-top), var(--button-bottom)); color: var(--button-ink);
  box-shadow: 0 3px var(--button-shadow); font: var(--action-type); text-align: center;
  transition: transform .12s, box-shadow .12s;
}
.button:hover:not(:disabled) { background: var(--button-top); }
.button:not(:disabled):active { transform: translateY(2px); box-shadow: none; }
.primary {
  --button-top: var(--accent-hi); --button-bottom: var(--accent); --button-edge: var(--primary-edge);
  --button-ink: var(--ink); --button-shadow: var(--primary-shadow);
}
.secondary {
  --button-top: #b2f7ce; --button-bottom: var(--mint); --button-edge: #ccffdf;
  --button-ink: var(--ink); --button-shadow: #358064;
}
.text-button { box-shadow: none; border-color: transparent; background: transparent; color: var(--text); font: 750 .92rem/1.15 var(--sans); }
.button.text-button:hover:not(:disabled), .text-button:hover { background: transparent; color: var(--text); text-decoration: underline; }
.button:disabled { color: var(--text); background: #405d50; border-color: #698876; box-shadow: 0 3px var(--shade); }
.tap-target { position: relative; display: flex; min-width: 0; }
.tap-target > button { width: 100%; }
.tap-switch {
  position: absolute; z-index: 2; inset: 0;
  width: 100%; height: 100%; margin: 0; padding: 0;
  appearance: auto; -webkit-appearance: auto; opacity: 0;
  clip-path: inset(0 round 10px); touch-action: manipulation;
}
.tap-switch:disabled { pointer-events: none; }

.home-view {
  display: grid; justify-items: center; align-content: center; gap: clamp(24px, 5vh, 44px);
  width: min(100%, 440px); margin-inline: auto; padding: 18px 0 45px;
}
.home-cover { display: grid; justify-items: center; width: 100%; min-width: 0; text-align: center; container-type: inline-size; }
.home-art { position: relative; width: min(88%, 385px); aspect-ratio: 400 / 166; margin-bottom: -2px; }
.home-dice {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  filter: drop-shadow(0 3px 1px #003d2e59); pointer-events: none;
}
#cover-dice:not([data-ready]), #cover-dice[data-ready] + #cover-poster { visibility: hidden; }
.home-cover h1 {
  color: var(--text); font: 700 min(17cqi, 6.85rem)/.98 var(--display); letter-spacing: -.036em;
  max-width: 100%; white-space: nowrap; text-transform: uppercase; padding-bottom: .08em; word-spacing: .015em;
  -webkit-text-stroke: .025em #084833; paint-order: stroke fill; text-shadow: 0 .052em #084833;
}
.home-cover h1 span { display: inline-block; transform: rotate(-4deg); }
.home-cover h1 span + span { color: var(--accent-hi); transform: translateY(.025em) rotate(4deg); }
.home-actions { display: grid; gap: 11px; width: 100%; }
.home-actions .button { min-height: 60px; border-radius: var(--control-radius); font-size: 1.17rem; }

.entry-panel {
  width: min(100%, 456px);
  margin: clamp(14px, 6vh, 62px) auto 0;
  padding-inline: 4px;
}
.entry-panel h1 { font-size: clamp(1.95rem, 8vw, 2.75rem); margin-bottom: 14px; }
.segments { display: inline-flex; flex: 0 0 auto; border: 1px solid var(--seam); border-radius: 9px; background: var(--deep); }
.segments button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  min-width: 44px;
  min-height: var(--target);
  padding-inline: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: .86rem;
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
  background: transparent;
  color: var(--text);
}
.segments button[aria-pressed="true"] { background: #50795b; border-color: #8bb28b; color: var(--text); }
.segments button:hover:not(:disabled):not([aria-pressed="true"]) { background: #d8ebcc1c; color: var(--text); }
.segments button:disabled { opacity: .63; }
.room-tabs { display: flex; margin-bottom: 15px; }
.room-tabs button { flex: 1; }
#room-form, #code-field { display: grid; gap: 6px; }
#room-form > :is(input, div, fieldset) { margin-bottom: 8px; }
#room-form label, #room-form legend { font-size: .94rem; font-weight: 750; }
#room-form input:not([type="radio"]) {
  width: 100%; min-height: 47px; border: 1px solid var(--seam); border-radius: 9px;
  padding: 6px 12px; background: var(--deep); color: var(--text);
}
#room-code { text-transform: uppercase; letter-spacing: .11em; }
#room-code::placeholder { color: var(--text); text-transform: none; letter-spacing: 0; }
#room-size { border: 0; padding: 0; margin-inline: 0; min-width: 0; }
.seat-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; padding-top: 5px; }
.seat-options label { display: flex; align-items: center; min-height: var(--target); gap: 7px; padding: 5px 8px; border: 1px solid var(--seam); border-radius: 8px; background: var(--base); }
input[type="radio"] { accent-color: var(--accent); }
.field-note { margin-block: 9px; font-size: .9rem; line-height: 1.4; color: var(--text); }
.field-note[data-error="true"] { color: var(--danger); }
.entry-panel .text-button { margin-top: 7px; }
.invite-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-block: 3px 8px;
}
.invite-row strong { display: block; font: 850 1.6rem/1.26 var(--sans); letter-spacing: .13em; }
.invite-row .button { min-height: var(--target); font-size: .93rem; }
.manual-invite { display: grid; gap: 4px; margin-top: 8px; font-weight: 700; }
.manual-invite input { width: 100%; min-height: var(--target); padding: 5px 8px; font-size: 16px; }
.lobby-players { padding: 0; margin-block: 10px; list-style: none; }
.lobby-players li { display: flex; align-items: center; min-height: 43px; padding: 5px 4px; border-bottom: 1px solid #d8ead741; gap: 8px; }
.lobby-players .open-seat { padding-left: 9px; font-size: .88rem; color: var(--text); }
.player-tag { margin-left: auto; font-size: .83rem; color: var(--text); }
.small-label { color: var(--text); font-size: .8125rem; font-weight: 600; line-height: 1.2; }

.game-hud, .round-heading { display: flex; align-items: center; }
.game-hud { grid-area: round; min-width: 0; }
.game-status { grid-area: players; display: flex; align-items: center; gap: 4px; min-width: 0; }
.game-status > .player-strip { flex: 1; }
.round-heading { gap: 9px; align-items: baseline; }
.round-heading h1 { font-size: clamp(1.12rem, 4.5vw, 1.55rem); white-space: nowrap; letter-spacing: -.02em; }
.card-toggle {
  display: none; flex: none; width: var(--target); min-height: var(--target);
  justify-content: center; align-items: center; padding: 0;
  background: var(--deep); color: var(--text); border: 1px solid var(--seam); border-radius: 8px;
}
.clock { color: var(--text); font: 700 1.05rem/1.15 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
:is(.clock, #turn-progress).low { color: var(--accent-hi); }
:is(.clock, #turn-progress).urgent { color: #ffbf80; }

.player-strip {
  --total-gap: clamp(3px, 1.1vw, 8px);
  --pill-width: calc((100cqi - (var(--player-count) - 1) * var(--total-gap)) / var(--player-count));
  container: players / inline-size; display: grid; grid-template-columns: repeat(var(--player-count), minmax(0, 1fr));
  gap: var(--total-gap); min-width: 0;
}
.player-pill {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 0; min-height: var(--target); gap: 3px; padding: 2px 3px 6px;
  color: var(--ink); background: var(--score-paper);
  border: 1px solid var(--score-divider); border-radius: var(--small-radius);
}
.player-pill:not([aria-current], :only-child)::after {
  content: ''; position: absolute; inset: auto 0 3px; margin-inline: auto;
  width: clamp(11px, 25%, 28px); height: 2px; border-radius: 2px; background: var(--seat-color);
}
.player-pill:only-child {
  flex-direction: row; justify-self: center; min-height: 36px; gap: 8px; padding: 3px 10px;
}
.player-mark {
  display: flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%;
  font: 750 min(.75rem, calc((var(--pill-width) - 4px) / 4)) / 1.1 var(--sans);
}
.player-mark .player-name { font: inherit; }
.player-status, .player-total { flex: none; }
.player-total {
  text-align: center;
  font: 700 min(1.125rem, calc((var(--pill-width) - 6px) / 3.45)) / 1 var(--display);
  font-variant-numeric: tabular-nums;
}
.avatar {
  --seat-fill: color-mix(in srgb, var(--player-tone, var(--accent)) 60%, var(--score-paper));
  position: relative; display: inline-grid; flex: 0 0 auto; place-items: center;
  width: 26px; height: 26px; border-radius: 8px;
  color: var(--ink); background: var(--seat-fill);
  font: 850 .84rem/1 var(--sans); outline: 1px solid #213e304b;
}
.avatar[data-wide="true"] { font-size: .6rem; letter-spacing: -.04em; }
.player-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; font-weight: 760; }
.connection-note {
  margin-bottom: 7px; padding: 5px 8px; border-radius: var(--small-radius);
  background: var(--deep); color: var(--accent-hi); box-shadow: inset 0 0 0 1px var(--seam); font-size: .88rem;
}

.scorecard {
  container: scorecard / inline-size;
  min-width: 0; padding: 10px 12px 4px;
  border-radius: 12px;
  background: var(--score-paper); color: var(--ink);
}
.card-layout {
  --section-count: 2;
  --section-gap: 20px;
  --section-width: calc((100cqi - (var(--section-count) - 1) * var(--section-gap)) / var(--section-count));
  --own-score-width: max(44px, 2.85rem);
  --peer-score-width: 1rem;
  --score-target-width: var(--own-score-width);
  --score-gap: 0px;
  --score-column-width: calc(var(--own-score-width) + var(--peer-count, 0) * var(--peer-score-width) + var(--score-gap));
  display: grid; grid-template-columns: repeat(var(--section-count), minmax(0, 1fr)); align-items: start; column-gap: var(--section-gap);
}
#scorecard .card-layout:has(.peer-score) { --score-gap: clamp(0px, calc((100cqi - 296px) / 15), 10px); }
.score-section { min-width: 0; }
#scorecard .score-section[data-tier="upper"] {
  position: relative; isolation: isolate;
}
#scorecard .score-section[data-tier="upper"]::before {
  --end-radius: calc((var(--section-count) - 1) * var(--small-radius));
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  inset-block: 0; inset-inline-start: calc(-1 * var(--score-inset));
  inline-size: calc((100cqi + 2 * var(--score-inset)) / var(--section-count));
  border-radius: 0 var(--end-radius) var(--end-radius) 0;
  background: var(--score-upper-fill);
  box-shadow: inset 0 3px 8px #46361b33;
}
.card-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.card-table th, .card-table td { text-align: left; vertical-align: middle; padding: 0; }
.card-table .score-column { width: var(--score-column-width); }
.card-table :is(th,td) { height: max(var(--score-row-height, 36px), calc(var(--score-target-height, 30px) + 1px)); }
.card-table tbody :is(th,td) { border-bottom: 1px solid var(--score-divider); }
#scorecard [data-tier="upper"] tbody :is(th,td) { border-bottom-color: var(--score-upper-divider); }
.card-table th[scope="row"] {
  padding-block: 3px; white-space: nowrap; font: 600 var(--score-label-size, .875rem)/1.16 var(--sans);
}
#scorecard tr[data-category="consonants"] .score-label { container-type: inline-size; }
#scorecard tr[data-category="consonants"] .score-label-text { font-size: min(1em, 16.7cqi); }
.score-line { display: flex; align-items: center; min-width: 0; }
.card-table .score-line > .score-target { flex: 0 0 var(--own-score-width); }
#scorecard .score-target:not(:last-child) { margin-inline-end: var(--score-gap); }
.card-table .peer-score { flex: 1; }
.peer-score {
  display: grid; place-items: center; min-width: 0; color: var(--seat-color);
  font: 750 var(--peer-font-size, .75rem)/1.12 var(--sans); font-variant-numeric: tabular-nums;
}
.peer-score.recent-score .peer-number { text-decoration: underline; text-underline-offset: 2px; }
.score-target { display: flex; isolation: isolate; }
.score-square {
  display: flex; align-items: center; justify-content: flex-end;
  min-height: var(--score-target-height, 30px); width: 100%; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink); font: 700 var(--score-number-size, .94rem)/1 var(--sans); font-variant-numeric: tabular-nums;
}
#scorecard .score-square { justify-content: center; }
.score-value {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  min-width: 2em; min-height: 1.6em; padding-inline: 3px; border: 1px solid transparent; border-radius: 5px;
}
.player-pill[aria-current="true"],
.score-square[data-state="filled"] .score-value,
.bonus-score[data-state="filled"] { background: var(--paper); border-color: var(--score-divider); }
.score-square[data-state="preview"] .score-value { border-color: var(--score-green); }
.score-square[data-state="zero"] .score-value { border-color: var(--score-zero-ink); border-style: dashed; }
.score-square:enabled[data-highlight="points"] .score-value {
  color: var(--paper); background: var(--score-points-fill); border-color: var(--score-points-fill);
  border-radius: 4px; box-shadow: inset 0 -2px #103d2d;
}
.score-square[data-highlight="zero"] .score-value { background: var(--score-zero-fill); }
.score-square:enabled:active .score-value { box-shadow: inset 0 1px 3px #30574940; }
.score-square.recent-score .score-value { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.score-square:focus-visible { outline-color: var(--score-green); outline-offset: -1px; }
.bonus-meter {
  display: grid; gap: 3px; max-width: 8rem; padding-inline-end: 4px;
  font-size: min(var(--score-label-size, .875rem), .84rem); line-height: 1.05;
}
.bonus-meter-track { position: relative; overflow: hidden; height: 4px; background: var(--score-divider); border-radius: 4px; }
.bonus-meter-track::before, .bonus-meter-track i { position: absolute; inset: 0 auto 0 0; }
.bonus-meter-track::before {
  content: ''; width: var(--projected);
  background: repeating-linear-gradient(135deg, var(--score-frame) 0 2px, var(--score-divider) 2px 4px);
}
.bonus-meter-track i { width: var(--meter); background: var(--score-green); }
.bonus-own { justify-content: center; }
.bonus-score { font: 700 var(--score-number-size, .94rem)/1 var(--sans); font-variant-numeric: tabular-nums; }
.bonus-score[data-state="progress"] { font-size: min(.8rem, calc((var(--own-score-width) - 4px) / 3)); }
#scorecard [data-tier="seven"] { grid-column: 1 / -1; }
#scorecard [data-tier="seven"] .card-table {
  --peer-font-size: clamp(.625rem, 3cqi, .95rem);
}
/* Start the full-width row at the same score column as the length categories. */
#scorecard [data-tier="seven"] col:first-child { width: calc(var(--section-width) - var(--score-column-width)); }
#scorecard [data-tier="seven"] .score-column { width: auto; }
#scorecard tr[data-category="yahtzee"] :is(th,td) { border-bottom: 0; }
#scorecard [data-tier="seven"] .score-line { flex-wrap: wrap; gap: 3px clamp(2px, .45cqi, 5px); }
#scorecard [data-tier="seven"] .score-line > .score-target { flex: none; margin-inline: 0; }
#scorecard [data-tier="seven"] .score-square {
  display: grid; grid-template-columns: var(--own-score-width) auto; justify-content: start; justify-items: center; width: max-content;
}
#scorecard [data-tier="seven"] .score-square .repeat-number {
  margin-inline-start: min(0px, calc(var(--score-number-size, .94rem) + 3px - var(--own-score-width) / 2));
  font-size: var(--peer-font-size);
}
#scorecard [data-tier="seven"] .peer-score {
  display: inline-flex; flex: none; align-items: baseline; justify-content: center; gap: 1px; min-inline-size: 2ch;
}
.repeat-number { white-space: nowrap; }
.repeat-number.recent-score { text-decoration: underline; text-underline-offset: 1px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 7px; border-top: 1px solid var(--score-divider); }
#card-progress { padding-block: 6px; color: var(--ink); font: 600 .76rem/1.25 var(--sans); font-variant-numeric: tabular-nums; }
@container scorecard (max-width: 22rem) {
  .card-layout { --score-label-size: .8125rem; --section-gap: 12px; }
}
@container scorecard (max-width: 26rem) {
  .card-layout[data-many-scores] {
    --own-score-width: 2.42rem;
    --peer-score-width: .94rem;
    --score-target-height: max(26px, 1.5rem);
    --score-label-size: .74rem;
    --score-number-size: .83rem;
    --peer-font-size: .7rem;
  }
  .card-layout[data-many-scores] .score-value { min-height: 1.4em; padding-inline: 2px; }
}
@container scorecard (max-width: 20.5rem) {
  .card-layout[data-many-scores] {
    --section-count: 1;
    --own-score-width: clamp(40px, 19cqi, 2.85rem);
    --peer-score-width: clamp(14px, 6.5cqi, 1.2rem);
    --score-number-size: min(.94rem, calc(var(--own-score-width) / 2.9));
    --peer-font-size: min(.75rem, calc(var(--peer-score-width) / 1.33));
    --score-label-size: min(.81rem, calc((100cqi - var(--own-score-width) - var(--peer-count) * var(--peer-score-width)) / 6.7));
    --score-row-height: max(24px, 1.5rem);
    --score-target-height: max(24px, 1.38rem);
    row-gap: 6px;
  }
}
@container scorecard (max-width: 15.5rem) {
  .card-layout { --section-count: 1; row-gap: 8px; }
}

.workbench { container: workbench / inline-size; min-width: 0; }
.tray {
  --die: clamp(52px, 15cqw, 64px);
  position: relative; isolation: isolate; container-type: inline-size;
  overflow: clip;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--control-radius); border: var(--panel-border) solid transparent;
}
.tray-body {
  --wheel: min(calc(100cqw - 8px), clamp(250px, calc(100svh - 290px), 332px));
  --radius: calc((var(--wheel) - var(--die)) / 2 - 16px);
  --word-line-width: clamp(2.5px, calc(var(--wheel) * .0115), 7.5px);
  position: relative; width: var(--wheel); height: var(--wheel);
}
#playback-line {
  position: absolute; top: 50%; left: 50%; translate: -50% -50%;
  width: calc(var(--radius) * 2); aspect-ratio: 1; pointer-events: none;
}
#turn-progress {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  color: var(--accent); fill: none; stroke: #ffffff30;
  stroke-width: 1; stroke-linecap: round;
}
#turn-progress-fill {
  stroke: currentColor; stroke-dasharray: 100 100; stroke-dashoffset: 100;
  transition: stroke-dashoffset .125s linear, stroke .2s ease-out;
}
#tray-body > .clock {
  position: absolute; z-index: 3; inset: auto auto calc(-1 * var(--clock-overhang)) 50%; translate: -50% 0;
  font-size: clamp(var(--clock-min-size), calc(var(--wheel) * .06), 1.5rem);
  pointer-events: none;
}
.tray-roll {
  position: absolute; z-index: 3; inset: 50% auto auto 50%; translate: -50% -50%;
  width: var(--roll-size); height: var(--roll-size);
}
#roll-button {
  flex-direction: column; gap: 4px; min-height: 0; padding: 0; border-radius: 50%;
  font-size: clamp(.81rem, calc(var(--roll-size) * .28), 1.1rem); letter-spacing: .045em; text-transform: uppercase;
}
#roll-button:not(:disabled, :active) { box-shadow: 0 3px var(--button-shadow), 0 0 0 2px var(--deep); }
.roll-dots { display: inline-flex; align-items: center; gap: 4px; }
.roll-dots i { width: 5px; height: 5px; border: 1px solid currentColor; border-radius: 50%; background: currentColor; }
.roll-dots i[data-spent] { background: transparent; opacity: .62; }
.tray[data-stroke] .tray-roll { visibility: hidden; }
.tray-tool {
  position: absolute; z-index: 3; bottom: 0;
  width: var(--tray-target, var(--target)); height: var(--tray-target, var(--target));
}
.tray-unlock { left: 0; }
.tray-shuffle { right: 0; }
.tray-tool button {
  display: grid; place-items: center; padding: 0; border: 1px solid var(--seam);
  border-radius: var(--control-radius); color: var(--text); background: var(--deep); box-shadow: 0 2px var(--shade);
}
.tray-tool button:disabled { opacity: .45; }
.tray-tool svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.tray-shuffle svg { transform-box: border-box; transform-origin: center; }
@media (hover: hover) {
  .tray-tool button:enabled:hover { background: var(--surface); color: var(--text); }
}
.dice-slots { position: relative; z-index: 2; width: 100%; height: 100%; }
.dice-slots:focus { outline: none; }
:is(.swipe-path, .saved-paths) { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; pointer-events: none; }
:is(.swipe-path, .saved-paths) { overflow: visible; }
.word-line {
  fill: none; stroke: var(--word-path, var(--spelled-path)); stroke-width: var(--word-line-width);
  stroke-linecap: round; stroke-linejoin: round;
}
.word-line-guide { stroke-width: calc(var(--word-line-width) * .66); opacity: .64; }
.tray[data-stroke] .saved-paths { opacity: .53; }
.die-slot { position: relative; display: grid; justify-items: center; flex: 0 0 var(--die); width: var(--die); height: var(--die); }
.die-slot.tap-target {
  --die-hit-inset: calc((.5 - var(--rest-die-half)) * var(--die));
  --die-hit-size: calc(2 * var(--rest-die-half) * var(--die));
  pointer-events: none;
}
/* Match the resting cube while keeping the full canvas available for each roll. */
.die-slot > .die:enabled::after, .die-slot > .tap-switch:enabled {
  position: absolute;
  inset: calc(var(--die-hit-inset) - var(--rest-die-rise) * var(--die)) auto auto var(--die-hit-inset);
  width: var(--die-hit-size); height: var(--die-hit-size);
  clip-path: inset(0 round calc(var(--rest-die-radius) * var(--die)));
  pointer-events: auto;
}
.die-slot > .die:enabled::after { content: ''; }
.die-slot .tap-switch { touch-action: none; }
.die-slot {
  position: absolute; translate: -50% -50%;
  left: calc(50% + var(--radius) * var(--x)); top: calc(50% + var(--radius) * var(--y));
}
.die {
  position: relative; z-index: 2;
  display: grid; place-items: center; width: var(--die); height: var(--die);
  padding: 0; border: 0; border-radius: 11px; background: transparent; touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.die .face {
  position: absolute; inset: 1px 2px 5px; display: grid; place-items: center; pointer-events: none;
  border: 1px solid var(--ivory-top); border-radius: 17%;
  color: var(--ink); background: var(--ivory-face);
  box-shadow: inset 0 1px 5px #fffdf3, 0 4px var(--ivory-side), 0 7px 9px #0c271eae;
  transition: translate .12s;
}
.die-letter { display: block; font: 700 calc(var(--die) * .56)/1 var(--display); }
.die-points { position: absolute; bottom: 8%; right: 9%; font: 850 max(10px, calc(var(--die) * .18))/1 var(--sans); }
.die[data-wild="true"][data-assigned="false"] .die-letter { font: 850 calc(var(--die) * .47)/1 var(--sans); }
.die[data-assigned="true"] .face::before {
  content: '★'; position: absolute; inset: auto auto 8% 9%;
  font: 850 max(8px, calc(var(--die) * .16))/1 var(--sans);
}
.die[data-held="true"] .face {
  background: linear-gradient(var(--held-face-top), var(--held-face-bottom)); border-color: var(--held-bottom);
  box-shadow: inset 0 1px 4px var(--held-face-top), 0 4px var(--held-side), 0 7px 9px #0c271eae;
}
.die:is([data-word-color], [data-spelling="true"], [data-used="true"]:not([data-held="true"])):not([data-invalid="true"]) .face {
  background: var(--word-face, var(--spelled-face)); border-color: var(--word-edge, var(--spelled-bottom));
  box-shadow: inset 0 1px 3px var(--word-top, #fff7dc), 0 4px var(--word-side, var(--spelled-side)), 0 6px 9px #0c271eae;
}
.die[data-invalid="true"] .face {
  background: linear-gradient(145deg,var(--invalid-face-top),var(--invalid-face-bottom)); border-color: var(--invalid-bottom);
  box-shadow: inset 0 1px 3px #ffe5dd, 0 4px var(--invalid-side), 0 6px 9px #0c271eae;
}
.die[data-preview="true"] { opacity: .68; }
.die[data-painted="true"] .face, .die[data-rolling="true"] .face { opacity: 0; }
.rolling-die { position: absolute; left: -50%; top: -50%; width: 200%; height: 200%; display: none; pointer-events: none; }
.die[data-painted="true"] .rolling-die, .die[data-rolling="true"] .rolling-die { display: block; }
@media (forced-colors: active) {
  .die[data-painted="true"] .face { opacity: 1; border: 1px solid ButtonText; }
  .die[data-painted="true"] .rolling-die { display: none; }
}
@media (hover: hover) { .die[aria-pressed]:enabled:hover :is(.face, .rolling-die, .die-lock) { translate: 0 -2px; } }
.die[aria-pressed]:enabled:active :is(.face, .rolling-die, .die-lock) { translate: 0 2px; }
.die-lock {
  --lock-size: clamp(5.5px, calc(var(--die) * .11), 12px);
  --lock-inset: calc((.5 - var(--rest-die-face-half)) * var(--die) + max(1.5px, var(--die) * .035));
  position: absolute; z-index: 1;
  inset: calc(var(--lock-inset) - var(--rest-die-rise) * var(--die)) auto auto var(--lock-inset);
  width: var(--lock-size); height: var(--lock-size);
  color: var(--ink); pointer-events: none;
}
.die-lock::before {
  position: absolute; content: ''; inset: 0 24% auto; height: 57%; border: max(1px, calc(var(--lock-size) * .13)) solid currentColor;
  border-bottom: 0; border-radius: 50% 50% 0 0;
}
.die-lock::after {
  position: absolute; content: ''; inset: 43% 5% 0;
  border-radius: 1.5px; background: currentColor;
}

#replay-actions { padding-bottom: 4px; }
.replay-actions .button { min-height: 56px; }
.locked-status {
  width: min(100%, 28rem); margin-inline: auto; padding: clamp(10px, 2.2vw, 20px) 4px 6px;
}
.locked-heading { display: flex; align-items: center; gap: 9px; }
.locked-heading > span {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-hi); color: var(--ink); font-weight: 900;
}
.locked-heading h2 { font-size: clamp(1.35rem, 4.8vw, 1.85rem); }
.locked-total { margin-left: auto; text-align: right; white-space: nowrap; font-size: .75rem; color: var(--text); }
.locked-total strong { display: block; color: var(--text); font: 700 1.45rem/1 var(--display); }
.locked-status[data-sending="true"] .locked-heading > span { display: none; }
.locked-play {
  display: grid; grid-template: "category category" auto "letters points" auto / minmax(0, 1fr) auto;
  align-items: center; gap: 7px 10px; margin-top: 14px;
}
.locked-category { grid-area: category; color: var(--text); font-size: .86rem; font-weight: 720; }
.locked-points { grid-area: points; color: var(--accent-hi); font: 700 1.85rem/1 var(--display); }
.locked-letters { grid-area: letters; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.locked-letters:has(.replay-die) { flex-wrap: nowrap; }
.locked-letters .word-chip { --mini-die-size: clamp(20px, 6vw, 30px); }
.locked-letters .replay-die {
  --mini-die-size: 30px;
  flex: 0 1 var(--mini-die-size);
}
.locked-wait { margin-top: 14px; font-size: .86rem; color: var(--text); overflow-wrap: anywhere; }
.locked-status > .clock { margin-top: 5px; }
.result-panel {
  width: min(100%, 30rem); margin-inline: auto; padding: clamp(12px, 2vw, 22px) 4px 6px;
}
.replay-heading { margin-bottom: 13px; }
.replay-heading :is(h1, h2) { font-size: clamp(2rem, 5vw, 3rem); margin-top: 3px; }
.replay-list { padding: 0; list-style: none; }
.replay-row {
  display: grid; grid-template-columns: minmax(28px, auto) minmax(0, 1fr) auto; align-items: center; gap: 4px 8px;
  min-height: 49px; padding-block: 5px;
}
.replay-row + .replay-row { border-top: 1px solid #ffffff30; }
.replay-row.featured .replay-points { color: var(--accent-hi); }
.replay-row .player-name { display: block; }
.replay-detail { display: flex; flex-wrap: wrap; align-items: center; column-gap: 7px; row-gap: 2px; font-size: .83rem; color: var(--text); font-weight: 650; overflow-wrap: anywhere; }
.finish-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 9px; overflow-wrap: anywhere; }
#result-margin { color: var(--text); font-weight: 650; }
[data-word-color="2"] {
  --word-top: var(--word-two-top); --word-path: #a2e3dd;
  --word-edge: var(--word-two-bottom); --word-side: var(--word-two-side);
  --word-face: linear-gradient(var(--word-two-face-top), var(--word-two-face-bottom));
}
[data-word-color="3"] {
  --word-top: var(--word-three-top); --word-path: #e0b9ed;
  --word-edge: var(--word-three-bottom); --word-side: var(--word-three-side);
  --word-face: linear-gradient(var(--word-three-face-top), var(--word-three-face-bottom));
}
.word-chip { --mini-die-gap: 2px; }
.word-chip {
  --mini-die-size: clamp(18px, 1.3rem, 25px);
  display: inline-flex; align-items: center; gap: var(--mini-die-gap); vertical-align: middle;
}
.chip-letter {
  display: inline-grid; place-items: center; flex: none;
  inline-size: var(--mini-die-size); block-size: var(--mini-die-size); border-radius: 16%;
  color: var(--ink);
  border: max(1.5px, calc(var(--mini-die-size) * .087)) solid transparent;
  background:
    var(--word-face, var(--spelled-face)) padding-box,
    linear-gradient(140deg, var(--word-top, var(--spelled-top)),
      var(--word-edge, var(--spelled-bottom)) 52%, var(--word-side, var(--spelled-side))) border-box;
  box-shadow: 0 1px 2px #082a205e;
  font: 700 calc(var(--mini-die-size) * .58)/1 var(--display);
}
@media (forced-colors: active) {
  .chip-letter { border-color: CanvasText; }
}
.word-row {
  position: relative; z-index: 1;
  display: flex; align-items: flex-end; justify-content: center; gap: clamp(9px, 2.4cqi, 14px);
  padding-block-end: 2px;
  --word-chip-size: clamp(21px, 7.1cqi, 29px);
  pointer-events: none;
}
.word-row .word-chip { --mini-die-size: var(--word-chip-size); }
.word-chip[data-word-state="invalid"] {
  --word-top: var(--invalid-top);
  --word-edge: var(--invalid-bottom);
  --word-side: var(--invalid-side);
  --word-face: linear-gradient(var(--invalid-face-top), var(--invalid-face-bottom));
}
@media (prefers-reduced-motion: no-preference) {
  .word-chip[data-word-state="invalid"] { animation: invalid-word-out .65s ease-out both; }
  @keyframes invalid-word-out { 65% { opacity: 1; } to { opacity: 0; } }
}
.replay-reason { color: var(--text); font-size: .87rem; font-weight: 650; }
.replay-die {
  --word-top: var(--ivory-top);
  --word-edge: var(--ivory-bottom);
  --word-side: var(--ivory-side);
  --word-face: var(--ivory-face);
}
.replay-points { font: 700 1.29rem/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.replay-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.replay-actions .tap-target { flex: 1 1 150px; }
.result-panel #best-score { margin: -3px 0 10px; }

@media (min-width: 810px) and (min-height: 456px) {
  .replay-heading :is(h1, h2) { font-size: 2.25rem; }
}

dialog {
  width: min(calc(100% - 20px), var(--dialog-width, 485px));
  max-height: calc(100% - 18px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow: auto; overscroll-behavior: contain; padding: var(--space-3);
  border: 1px solid var(--seam); border-radius: var(--panel-radius); background: var(--surface); color: var(--text);
  box-shadow: 0 17px 52px #0a261dbc;
}
dialog::backdrop { background: #0b251de0; }
dialog[open] { animation: reveal .16s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(7px); } }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 7px; margin-bottom: 8px; }
.dialog-heading h2 { font-size: clamp(1.65rem, 6vw, 2.08rem); }
.dialog-heading:has(.clock:not([hidden])) h2 { font-size: clamp(1.28rem, 5.2vw, 2.08rem); }
.dialog-heading .clock { margin-inline-start: auto; }
.close-button { flex: 0 0 44px; font: 28px/1 var(--sans); }
#card-dialog { --dialog-width: 515px; max-width: calc(100% - 12px); }
#card-dialog[open] {
  display: grid; grid-template: auto auto minmax(0, 1fr) auto / minmax(0, 1fr);
  overflow: hidden; animation: none;
}
#card-dialog .scorecard { padding-inline: var(--score-inset); padding-block-start: 3px; box-shadow: none; overflow-y: auto; overscroll-behavior: contain; }
@media (pointer: coarse) {
  #card-dialog .score-square { min-width: var(--score-target-width, var(--target)); min-height: var(--score-target-height, var(--target)); }
}
@media (pointer: coarse) and (orientation: portrait) {
  .score-target .score-square { min-width: var(--score-target-width, var(--target)); min-height: var(--score-target-height, var(--target)); }
}
#card-dialog .dialog-heading {
  position: relative; min-height: var(--target); padding-right: 51px; flex-wrap: wrap; gap: 3px 7px;
}
#card-dialog .close-button { position: absolute; top: 0; right: 0; }
#card-dialog .clock { flex: none; margin: 0; }
.score-label { display: block; }
.score-detail { display: none; }
#scorecard .card-table tr { position: relative; }
#scorecard .card-table { border-collapse: separate; border-spacing: 0; }
#scorecard .card-table th { padding-inline-start: clamp(2px, .75cqi, 6px); }
#scorecard :is([data-tier="upper"], [data-tier="seven"]) .card-table th { padding-inline-start: clamp(3px, 1cqi, 8px); }
#scorecard .card-table tr:has(.score-square[data-state="preview"]:enabled) {
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
#scorecard .score-target { position: static; isolation: auto; }
#scorecard .score-square:enabled::after { content: ''; position: absolute; inset: 0; cursor: pointer; }
#card-dialog .card-layout { --score-target-height: var(--target); }
#card-dialog .card-table {
  --score-detail-size: .72rem;
  /* Match the space for the label, detail line, padding and divider. */
  --score-row-height: calc(1.16 * var(--score-label-size, .875rem) + 1.15 * var(--score-detail-size) + 9px);
}
#card-dialog .card-table th { white-space: normal; }
#card-dialog [data-tier="seven"] .card-table th { white-space: nowrap; }
#card-dialog .score-detail {
  display: block; block-size: 1.15em; margin-top: 2px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 700 var(--score-detail-size)/1.15 var(--sans);
}
.score-footer {
  display: flex; align-items: center; gap: 7px; min-height: var(--target);
}
.score-footer[inert] { visibility: hidden; }
#turn-panel > .score-footer { position: absolute; z-index: 3; inset: 0 auto auto 0; }
#card-dialog > .score-footer { margin-top: 4px; }
.score-footer .text-button { min-height: var(--target); padding-inline: 5px; font-size: .8rem; }
.score-footer .button.text-button:hover:not(:disabled) { color: var(--text); }
.score-wild-icon { display: none; }
#turn-panel .score-wild-label { display: none; }
#turn-panel .score-wild-icon { display: inline; font: 700 1.3rem/1 var(--display); }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-block: 12px 4px; }
#wild-dialog { --dialog-width: 414px; }
#wild-title:focus { outline: none; }
.wild-word {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  border-block: 1px solid #749b794d; background: #193c30; border-radius: 8px;
  padding: 10px 4px; margin-bottom: 10px;
}
.wild-word > span {
  position: relative; display: grid; place-items: center;
  width: clamp(30px, 8.7vw, 38px); height: 37px; border-radius: 6px;
  color: var(--ink); background: var(--ivory-top); box-shadow: 0 2px #a4af8b;
  font: 650 1.45rem/1 var(--sans);
}
.wild-word .wild-slot { background: var(--gold); box-shadow: 0 2px #b68b48; color: var(--ink); }
.wild-slot::after { content: '0'; position: absolute; right: 3px; bottom: 2px; font: 750 .58rem/1 var(--sans); }
.wild-slot[data-preview="true"] { outline: 2px dashed var(--gold); outline-offset: 2px; }
.alphabet { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(44px, 100%), 1fr)); gap: 5px; }
.alphabet button {
  min-width: 0; min-height: 45px; border: 1px solid #809d81; border-radius: 7px;
  color: var(--text); background: #155c44; font: 700 1.22rem/1 var(--display);
}
.alphabet button[aria-pressed="true"] { color: var(--ink); background: var(--gold); border-color: var(--gold); }
.alphabet button:focus-visible { outline-offset: 1px; }
@media (hover: hover) {
  .alphabet button:hover { background: #4a7356; }
  .alphabet button[aria-pressed="true"]:hover { background: #ffdf9b; }
}
.wild-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.wild-tools > span { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: .84rem; }
.wild-tools b { color: var(--gold); }
.wild-tools .text-button { min-height: var(--target); padding: 0 4px; border: 0; font-size: .84rem; }
@media (max-width: 369px) {
  .alphabet { gap: 3px; }
}
@media (min-width: 481px) and (max-height: 455px) and (orientation: landscape) {
  #wild-dialog { --dialog-width: 590px; max-width: calc(100% - 12px); padding-block: 6px; }
  #wild-dialog .dialog-heading { margin-bottom: 2px; }
  .wild-word { padding-block: 5px; margin-bottom: 5px; }
  .wild-word > span { height: 30px; font-size: 1.2rem; }
  .alphabet { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; }
  .wild-tools { margin: 0; }
}
@media (forced-colors: active) {
  .wild-word > span { border: 1px solid CanvasText; }
  .wild-word .wild-slot, .alphabet button[aria-pressed="true"] { border: 3px double Highlight; }
}
#help-dialog[open]:has(#help-practice[hidden]) { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
#help-reference { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px; margin: -4px; }
.help-steps { padding-left: 22px; line-height: 1.4; }
.help-steps li { padding-left: 2px; margin-bottom: 7px; }
.help-steps li::marker { color: var(--gold); font-weight: 850; }
#help-dialog h3 { margin-top: 10px; font-size: 1.02rem; }
.help-scoring { margin-block: 5px 10px; }
.help-scoring > div { display: grid; grid-template-columns: 108px 1fr; gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--seam); font-size: .9rem; }
.help-scoring dt { font-weight: 810; }
.help-scoring dd { margin: 0; color: var(--text); }
#help-dialog details { border-top: 1px solid var(--seam); }
#help-dialog summary { min-height: var(--target); padding-block: 11px; cursor: pointer; color: var(--text); font-weight: 760; }
#help-dialog summary::marker { color: var(--accent); }
#help-dialog details p { margin: 0 0 10px; color: var(--text); line-height: 1.4; }
.help-try { display: block; margin: 13px 0 16px; }
.help-try button, .practice-actions button { width: 100%; }
#help-reference > .field-note { margin-block: 6px; }
#practice-instruction { min-height: 2.7em; margin-block: 0 8px; color: var(--text); line-height: 1.35; }
#practice-word-chips { block-size: 24px; gap: 8px; --word-chip-size: 20px; }
#practice-tray .tray-body {
  --wheel: min(calc(100cqw - 4px), clamp(195px, 33svh, 250px));
  --die: max(44px, min(clamp(46px, 14cqw, 58px), var(--die-limit)));
}
.practice-box {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center;
  gap: 6px; min-height: 42px; padding: 4px 8px; margin-top: 9px;
  border-radius: 7px; background: var(--paper); color: var(--ink); font-size: .9rem; font-weight: 700;
}
#practice-points { padding: 1px 6px; border: 1px dashed #7f9b81; border-radius: 4px; text-align: center; font-variant-numeric: tabular-nums; }
.practice-box[data-state="filled"] #practice-points { border: 1px solid #305c43; background: #305c43; color: var(--text); }
.practice-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
@media (max-width: 365px) {
  #help-dialog:has(#help-practice:not([hidden])) { width: calc(100% - 4px); max-width: 100%; padding: 8px; }
}
@media (min-width: 510px) and (max-height: 455px) and (orientation: landscape) {
  #help-dialog:has(#help-practice:not([hidden])) { --dialog-width: 620px; }
  #help-practice { display: grid; grid-template-columns: 210px 1fr; column-gap: 14px; align-content: center; }
  #help-practice .practice-rack { grid-area: 1 / 1 / 5; }
  #help-practice > :is(p, .practice-box, .practice-actions) { grid-column: 2; align-self: center; }
}
.setting-list { display: grid; }
.setting-list label { display: flex; justify-content: space-between; align-items: center; gap: 7px; min-height: 53px; border-top: 1px solid var(--seam); }
#match-setting { justify-content: start; width: 100%; padding-inline: 0; border-top: 1px solid var(--seam); border-radius: 0; }
.setting-list input {
  position: relative; flex: 0 0 auto; appearance: none; width: 46px; height: 29px; margin: 0;
  background: var(--deep); border: 1px solid #8fb397; border-radius: 14px; cursor: pointer;
}
.setting-list input::after { position: absolute; content: ''; top: 3px; left: 3px; width: 21px; height: 21px; background: #d1dfc8; border-radius: 50%; }
.setting-list input:checked { background: var(--accent); border-color: var(--primary-edge); }
.setting-list input:checked::after { left: 20px; background: #3d6045; }

.toast {
  pointer-events: none;
  position: fixed; z-index: 5; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); translate: -50% 0;
  width: max-content; max-width: min(calc(100% - 16px), 466px); padding: 7px 10px;
  background: var(--paper); color: var(--ink); border: 1px solid #8b9b70; border-radius: 8px;
  box-shadow: 0 7px 23px #0b281e9c; font-size: .89rem; font-weight: 820; text-align: center;
}
.effects { position: fixed; z-index: 4; inset: 0; overflow: hidden; pointer-events: none; }
.confetti {
  position: absolute; left: var(--x); top: -15px; width: var(--size); height: calc(var(--size) * .48);
  background: var(--color); border-radius: 1px; animation: confetti-fall var(--duration) cubic-bezier(.15,.34,.6,1) var(--delay) both;
}
@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(var(--drift), 102dvh) rotate(var(--spin)); opacity: 0; }
}

@media (max-width: 680px) {
  .header-inner, .shell { width: calc(100% - 20px); }
  .header-inner { --header-height: 52px; }
  .header-label { display: none; }
  .brand { font-size: 1.34rem; }
  .top-button { padding-inline: 0; }
  .scorecard { padding: 8px 9px 3px; }
}
@media (max-width: 680px) and (orientation: portrait) and (pointer: coarse) {
  :root:has(.turn-sheet[open]) { overflow: hidden; }
  .turn-sheet[open] {
    position: fixed; inset: auto 0 0; margin: 0 auto;
    width: min(calc(100% - 12px), var(--dialog-width, 485px));
    max-width: none;
    max-height: calc(100dvh - 10px - env(safe-area-inset-top, 0px));
    padding-bottom: max(13px, env(safe-area-inset-bottom, 0px));
    border-radius: 16px 16px 0 0; border-bottom: 0; animation: raise-sheet .18s ease-out;
  }
  .turn-sheet::backdrop { background: #0b251db3; }
  @keyframes raise-sheet { from { opacity: .6; transform: translateY(24px); } }
}
@media (max-width: 510px) {
  .home-view { gap: 26px; padding: 12px 0 22px; }
}
@media (max-height: 640px) {
  body[data-screen="home"] .shell { padding-bottom: max(6px, env(safe-area-inset-bottom, 0px)); }
  .home-view { gap: clamp(12px, 4svh, 26px); padding-block: 8px 14px; }
  .home-art { width: min(88%, 385px, calc(100svh - 210px)); }
  .home-cover h1 { font-size: min(17cqi, 12svh, 6.85rem); }
}
@media (max-height: 500px) {
  .home-view { gap: clamp(6px, calc(5svh - 10px), 18px); padding-block: 5px 8px; }
  .home-art { width: min(88%, clamp(116px, calc(65svh - 79px), 250px)); }
  .home-cover h1 { font-size: min(17cqi, 10.5svh, 6.85rem); }
  .home-actions { gap: 6px; }
  .home-actions .button { min-height: 46px; padding-block: 4px; font-size: 1rem; }
}
@media (max-height: 640px) {
  .replay-actions .button { min-height: 46px; }
}
@media (max-width: 359px) {
  .header-inner, .shell { width: calc(100% - 12px); }
  .game-status { gap: 0; }
  .segments button { padding-inline: 5px; font-size: .8rem; }
}
@media (max-width: 319px) {
  .tray { --die: 41px; }
}
@media (min-width: 320px) and (max-width: 680px) and (max-height: 635px) and (orientation: portrait) {
  .tray .tray-body { --wheel: min(calc(100cqw - 8px), clamp(224px, calc(100svh - 306px), 294px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition: none !important; }
  dialog[open], .turn-sheet[open] { animation: none; }
  .confetti { display: none; }
}
@media (min-width: 681px) and (max-height: 760px) {
  .header-inner { --header-height: 53px; }
}
@media (min-width: 481px) and (max-height: 455px) and (orientation: landscape) {
  .header-inner { --header-height: 46px; }
}
@media (max-height: 635px) {
  body:is([data-screen="rooms"], [data-screen="lobby"]) .shell { padding-bottom: 6px; }
  .entry-panel { margin: 6px auto 0; }
  .entry-panel h1, .room-tabs { margin-bottom: 7px; }
  #room-form { gap: 3px; }
  #room-form > :is(input, div, fieldset) { margin-bottom: 4px; }
  .entry-panel .field-note { margin-block: 5px; }
  .lobby-players { margin-block: 5px; }
  .lobby-players:has(> :nth-child(4)) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 6px; }
  .lobby-players li { min-width: 0; gap: 5px; }
}
@media (max-height: 455px) {
  .entry-panel h1 { font-size: 1.65rem; }
  #room-form input:not([type="radio"]) { min-height: var(--target); }
  #lobby-players li { min-height: 33px; padding-block: 2px; }
  .invite-row { flex-wrap: wrap; padding-block: 2px; gap: 2px 6px; }
  .invite-row strong { font-size: 1.14rem; }
}

#turn-panel {
  --max-wheel: 374px;
  position: relative; display: grid; grid-template-rows: var(--saved-words-height) minmax(0, 1fr);
  height: 100%; max-height: calc(var(--saved-words-height) + var(--max-wheel) + 2 * var(--panel-border)); min-height: 0;
  overflow: clip;
}
.workbench .tray { container-type: size; height: 100%; min-height: 0; }
.workbench .tray .tray-body {
  --wheel: min(calc(100cqw - 8px), calc(100cqh - 8px), var(--max-wheel, 366px));
  --die: clamp(44px, calc(var(--wheel) * .235), 84px);
  --radius: calc((var(--wheel) - var(--die)) / 2 - 2px);
  width: var(--wheel); height: var(--wheel);
}
:is(#tray, #practice-tray) .tray-body {
  /* The closest pair has its centers about .678 radii apart on its wider axis. */
  --die-limit: calc(var(--wheel) * .253 - 5px);
  --radius: calc((var(--wheel) - var(--die)) / 2 - 9px);
}
#practice-tray .tray-body { translate: 0 3px; }
/* The live rolls can rise behind the saved words at the top of the tray. */
#tray { align-items: flex-start; overflow: visible; }
#turn-panel :is(.tray-tool button, #score-pick-wild):focus-visible { outline-offset: -3px; }
#tray .tray-body {
  --clock-min-size: .875rem;
  /* Keep enlarged timer text clear of the two lower dice. */
  --clock-overhang: max(0px, calc(var(--clock-min-size) * 1.15 - var(--clock-inset, 10px)));
  --wheel: min(calc(100cqw - 8px), calc(100cqh - var(--clock-overhang)), var(--max-wheel));
  --die: clamp(44px, min(calc(var(--wheel) * .235), var(--die-limit)), var(--max-die, 84px));
  --roll-size: clamp(var(--target), calc(var(--wheel) * .205), var(--max-roll, 64px));
}
.tray-notice {
  position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%,-50%);
  padding: 5px 9px; max-width: 62%; border-radius: 8px; background: var(--base); color: var(--text);
  box-shadow: 0 2px 6px #042e2440; font: var(--label-type); text-align: center; pointer-events: none;
}
#tray-notice { top: calc(50% - var(--roll-size) / 2 - 8px); transform: translate(-50%, -100%); }
/* The replay uses an inert rack with the live dice renderer. */
#replay-panel {
  --replay-chip: clamp(22px, 7cqi, 37px);
  --replay-award-height: clamp(48px, 8.8svh, 60px);
  display: grid; grid-template: auto minmax(0, 1fr) auto minmax(var(--target), auto) / minmax(0, 1fr);
  gap: clamp(6px, 1.15svh, 11px);
  height: 100%; max-height: 640px; min-width: 0; min-height: 0; padding: 0; text-align: center;
}
#playback-felt .tray-body { --die: clamp(22px, calc(var(--wheel) * .235), var(--max-die, 84px)); }
.playback-heading { display: grid; justify-items: center; gap: 6px; }
.playback-summary, .playback-player, .playback-total { display: flex; align-items: center; gap: 8px; min-width: 0; }
.playback-summary {
  width: min(100%, 24rem); min-height: clamp(41px, 7.7svh, 56px); padding: 4px clamp(7px, 2.2cqi, 12px);
  text-align: start;
}
.playback-player { flex: 1; }
#replay-title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 700 min(clamp(1.14rem, 5vw, 1.6rem), 7.3svh, 8cqi)/1.1 var(--display);
}
#playback-avatar { display: flex; flex: none; }
#playback-avatar .avatar { width: clamp(28px, 6.8svh, 37px); height: clamp(28px, 6.8svh, 37px); }
.playback-total {
  flex-shrink: 0; border-inline-start: 1px solid color-mix(in srgb, var(--seam) 50%, transparent); padding-inline-start: 10px;
  font: var(--label-type); font-size: min(.82rem, 5svh, 4cqi);
}
#playback-total {
  display: block; font: 700 min(1.95rem, 8.5svh, 9.5cqi)/1 var(--display);
  text-align: end; font-variant-numeric: tabular-nums;
}
#replay-panel[data-awarded] #playback-total { color: var(--accent-hi); }
.playback-progress { display: flex; justify-content: center; gap: 4px; }
.playback-progress i { width: clamp(12px, 4cqi, 23px); height: 3px; border-radius: 3px; background: #ffffff38; }
.playback-progress i[data-state="current"] { background: var(--accent-hi); }
.playback-progress i[data-state="done"] { background: var(--seam); }
#playback-line { z-index: 1; overflow: visible; }
#playback-dice { pointer-events: none; }
#playback-dice .die[data-empty="true"] > * { visibility: hidden; }
#playback-dice .die[data-empty="true"]::before { content: ''; width: 76%; height: 76%; border: 1px dashed #acd8ad59; border-radius: var(--small-radius); }
.playback-caption { display: grid; grid-template-rows: var(--replay-chip) var(--replay-award-height); justify-items: center; gap: 7px; }
#playback-words { display: flex; align-items: center; gap: clamp(7px, 2.4cqi, 12px); font: var(--label-type); }
.playback-word { display: flex; min-width: calc(var(--replay-chip) * var(--letters) + 2px * (var(--letters) - 1)); }
#playback-words .word-chip { --mini-die-size: var(--replay-chip); }
#playback-award {
  position: relative; display: flex; gap: clamp(8px, 2.7cqi, 15px); align-items: center; justify-content: space-between;
  width: max-content; min-width: min(100%, 200px); max-width: calc(100% - 20px); padding: 4px 5px 4px 12px;
  border-radius: var(--control-radius); visibility: hidden; background: var(--score-paper); color: var(--ink);
  box-shadow: 0 3px var(--shade); font: 800 min(1.04rem, 5.3svh, 5.4cqi)/1.12 var(--sans); text-align: start;
}
#playback-award[data-revealed="true"] { visibility: visible; }
.playback-category { display: grid; gap: 2px; }
#playback-bonus { color: var(--score-green); font-size: min(.76rem, 4.3svh, 4.4cqi); }
#playback-gain {
  display: grid; place-items: center; min-width: 2.2em; height: 100%; padding-inline: 7px;
  border-radius: var(--small-radius); background: var(--accent-hi); color: var(--ink);
  font: 700 min(1.75rem, 7svh, 7cqi)/1 var(--display); white-space: nowrap;
}
#playback-award[data-zero] #playback-gain { background: var(--score-divider); }
.playback-spark {
  position: absolute; inset: 9% auto auto 100%; width: 12px; height: 12px; opacity: 0;
  background: var(--accent-hi); pointer-events: none;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.playback-spark:last-child { inset: auto 100% 17% auto; width: 9px; height: 9px; }
#replay-actions { grid-area: auto; justify-content: center; margin: 0; }
#replay-actions:not([hidden]) { animation: replay-action-in .25s ease-out; }
@keyframes replay-action-in { from { opacity: 0; translate: 0 4px; } }
#replay-actions #next-target { max-width: 258px; }
.round-countdown {
  display: grid; align-items: baseline; justify-items: center; column-gap: 12px;
  width: max-content; max-width: 100%; padding: 3px 8px; text-align: center; font: var(--label-type);
}
.round-countdown strong { margin-inline-start: 4px; color: var(--accent-hi); font: 700 1.15rem/1 var(--display); font-variant-numeric: tabular-nums; }
#replay-wait { margin-top: 2px; font-size: .79rem; }
body[data-screen="game"] {
  --deep: #0d3c30;
  --shade: #062f26;
  --surface: #185b47;
  --seam: #74a187;
  --field: var(--deep);
  --small-radius: 7px;
  --control-radius: 13px;
  --panel-radius: 17px;
  display: flex; flex-direction: column; height: var(--board-height, 100dvh); min-height: 0;
  padding-block: var(--safe-top) max(5px, var(--safe-bottom));
  container: game-screen / size;
}
body[data-screen="game"] .site-header { flex: none; padding-top: 0; }
body[data-screen="game"] .header-actions {
  border-radius: var(--control-radius); background: var(--deep);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--seam) 64%, transparent), 0 2px var(--shade);
}
body[data-screen="game"] .header-actions button { border-radius: calc(var(--control-radius) - 2px); }
body[data-screen="game"] .header-home::before {
  content: ''; position: absolute; inset-block: 10px; inset-inline-start: 0; width: 1px;
  background: color-mix(in srgb, var(--seam) 36%, transparent); pointer-events: none;
}
body[data-screen="game"] .shell { flex: 1; display: flex; flex-direction: column; min-height: 0; padding-bottom: 0; }
.game-status > .player-strip { margin: 0; }
.game-status .card-toggle { display: inline-flex; margin-inline-start: auto; }
.game-view[data-phase] {
  flex: 1; display: grid; min-height: 0; align-items: stretch;
  grid-template: "connection" auto "board" minmax(0,1fr) / minmax(0,1fr);
}
.game-view .connection-note { grid-area: connection; margin: 0 0 4px; }
.game-view .game-grid, #card-dialog {
  --score-inset: 6px;
  --score-radius: calc(var(--small-radius) + var(--score-inset));
}
#card-dialog { --score-inset: 10px; }
.game-view .game-grid {
  --board-gap: 6px;
  --saved-words-height: 31px;
  grid-area: board; container: game-board / size; display: flex; flex-direction: column; align-items: stretch; min-height: 0;
}
:is(.game-grid, #card-dialog) > .player-strip {
  --total-gap: clamp(3px, 1cqi, 8px);
  padding: 3px var(--score-inset) 2px;
  border-radius: var(--score-radius) var(--score-radius) 0 0;
  background: var(--score-paper); box-shadow: inset 0 1px var(--paper);
}
:is(.game-grid, #card-dialog) > .player-strip > .player-pill:not([aria-current]) + .player-pill::before {
  content: ''; position: absolute; inset-block: 8px; inset-inline-start: calc(-.5 * var(--total-gap));
  width: 1px; background: var(--score-divider); pointer-events: none;
}
:is(.game-grid, #card-dialog) > .player-strip .player-pill:not([aria-current]) { background: transparent; border-color: transparent; }
:is(.game-grid, #card-dialog) > .scorecard { border-radius: 0 0 var(--score-radius) var(--score-radius); }
.game-grid > .player-strip { flex: none; width: 100%; }
.game-grid > .scorecard {
  display: none; box-shadow: 0 3px var(--shade);
}
.game-grid > .workbench { flex: 1; min-height: 0; }
.game-grid > .player-strip + .scorecard + .workbench { margin-block-start: var(--board-gap); }
.game-view:is([data-phase="waiting"],[data-phase="finished"]):not([data-presenting="true"]) .workbench { flex: 0 1 auto; overflow: auto; }
@media (max-width: 680px) {
  .round-heading h1 { font-size: clamp(1rem, 5vw, 1.2rem); }
}
@container game-screen (width < 22rem) {
  body[data-screen="game"] .header-inner { column-gap: 3px; }
}
@container game-screen (width < 19.5rem) {
  body[data-screen="game"] .header-inner {
    grid-template-areas: "brand round round" "tools tools tools" "players players players";
    grid-template-rows: minmax(var(--header-height),auto) auto auto;
    row-gap: 2px;
  }
}
@container game-screen (width >= 480px) and (height < 455px) {
  body[data-screen="game"]:has(.game-view[data-phase="turn"]) .header-inner {
    grid-template: "brand round card tools" minmax(var(--header-height),auto) "players players players players" auto / 27px minmax(0,1fr) auto auto;
  }
  body[data-screen="game"]:has(.game-view[data-presenting="true"]) .header-inner {
    grid-template-areas: "brand round tools";
    grid-template-rows: minmax(var(--header-height),auto);
  }
  body:has(.game-view[data-phase="turn"]) #game-status { display: contents; }
  #game-status .card-toggle { grid-area: card; }
  #game-status > .player-strip { grid-area: players; }
  body:has(.game-view[data-phase="turn"]) #game-status .player-pill { flex-direction: row; gap: 4px; min-height: 32px; }
  body:has(.game-view[data-phase="turn"]) #game-status .player-total { font-size: min(.875rem, calc(var(--pill-width) / 4.7)); }
  .round-countdown { font-size: min(.84rem, 5.8svh); }
  .round-countdown:has(#replay-wait:not([hidden])) { grid-template-columns: auto auto; }
  .round-countdown strong { font-size: min(1.2rem, 8svh); }
  #replay-wait { font-size: min(.79rem, 5.25svh); }
}
@container game-screen (width >= 480px) and (height < 375px) {
  #turn-panel { grid-template-rows: minmax(0, 1fr); padding-block-start: 5px; }
  #saved-word-chips {
    position: absolute; z-index: 1; inset: 6px auto auto 4px;
    flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 5px;
    inline-size: 161px; block-size: 75px; --word-chip-size: 21px;
  }
}
@container (height < 210px) {
  #tray .tray-body {
    --radius: calc((var(--wheel) - var(--die)) / 2 - 2px);
  }
}
/* Stack the scorecard above the dice when the viewport is tall enough. */
@container game-screen (width >= 20rem) and (height >= 33rem) {
  .game-view:is([data-phase="turn"], [data-phase="waiting"]) .game-grid > .scorecard {
    display: block; flex: none; padding: 3px var(--score-inset) 4px;
  }
  .game-grid > .scorecard .card-layout {
    --section-count: 2;
    --section-gap: 8px;
    --own-score-width: clamp(1.875rem, 9cqi, 2.5rem);
    --peer-score-width: clamp(13px, 3.95cqi, 1.1rem);
    --score-label-size: clamp(.69rem, calc(3.4cqi + 1px), .9rem);
    --score-number-size: clamp(.8rem, calc(3.1cqi + 3px), .98rem);
    --peer-font-size: clamp(.62rem, 2.9cqi, .8rem);
    --score-row-height: clamp(26px, calc((100cqh - 321px - var(--saved-words-height)) / 7), 41px);
    --score-target-height: calc(var(--score-row-height) - 1px);
    row-gap: 0;
  }
  .game-grid > .scorecard .card-table th[scope="row"] { padding-block: 1px; }
  .game-grid > .scorecard .score-value { min-height: 1.4em; padding-inline: 2px; }
}
@container game-screen (width >= 46rem) and (height >= 36.125rem) {
  body[data-screen="game"] :is(.header-inner, .shell) { width: calc(100% - 32px); max-width: clamp(700px, 72vw, 1040px); }
  .game-view .game-grid { --board-gap: 8px; --score-inset: 12px; --saved-words-height: 36px; }
  .game-grid > .workbench { width: 100%; max-width: 560px; margin-inline: auto; }
  .game-view:is([data-phase="turn"], [data-phase="waiting"]) .game-grid > .scorecard { padding-block-end: 6px; }
  .game-grid > .scorecard .card-layout {
    --section-gap: 16px;
    --own-score-width: 3.25rem;
    --peer-score-width: clamp(18px, 3.4cqi, 27px);
    --score-label-size: .95rem;
    --score-number-size: .99rem;
    --peer-font-size: .8rem;
    --score-row-height: clamp(30px, calc((100cqh - 357px - var(--saved-words-height)) / 7), 63px);
  }
  .game-grid > .scorecard .score-value { min-height: 1.55em; padding-inline: 4px; }
  :is(#turn-panel, #replay-panel) { --max-wheel: 520px; --max-die: 122px; }
  #turn-panel { --max-roll: 82px; }
  #saved-word-chips { --word-chip-size: clamp(24px, 6.4cqi, 34px); }
  .game-view[data-presenting="true"] .game-grid > .workbench {
    display: grid; grid-template-rows: minmax(0, 1fr); align-items: center;
  }
  #replay-panel { max-height: 44rem; }
}
@container game-screen (height < 39rem) {
  .game-view:has(.connection-note:not([hidden])) .game-grid > .scorecard { display: none; }
}
@container game-screen ((width >= 64rem) and (height >= 34rem)) or
  ((width >= 36rem) and (height >= 17rem) and (height < 34rem) and (aspect-ratio >= 8/5)) {
  .game-view:is([data-phase="turn"], [data-phase="waiting"]) .game-grid:has(> #scorecard) {
    --board-gap: 0px;
    display: grid; align-items: center; gap: 0 var(--split-gap, 12px);
    grid-template:
      ".      play" minmax(0, 1fr)
      "totals play" auto
      "scores play" auto
      ".      play" minmax(0, 1fr) / var(--split-columns, minmax(0, 1.16fr) minmax(0, 1fr));
  }
  .game-grid > .player-strip { grid-area: totals; }
  .game-view:is([data-phase="turn"], [data-phase="waiting"]) .game-grid > #scorecard {
    display: block; grid-area: scores; padding: 3px var(--score-inset) 4px;
  }
  .game-grid > .workbench {
    grid-area: play; width: 100%; max-width: 44rem; max-height: 100cqh; margin-inline: auto;
  }
}

@container game-screen (width >= 36rem) and (height >= 17rem) and (height < 34rem) and (aspect-ratio >= 8/5) {
  body[data-screen="game"] :is(.header-inner, .shell) { width: calc(100% - 20px); max-width: 960px; }

  .game-view .game-grid { --split-columns: minmax(20.5rem, 1.3fr) minmax(0, 1fr); --saved-words-height: 24px; }
  .game-grid > .player-strip .player-pill { min-height: 32px; gap: 1px; padding-block: 2px 4px; }
  .game-grid > .player-strip .player-mark { font-size: min(.6875rem, calc((var(--pill-width) - 4px) / 4)); }
  .game-grid > .player-strip .player-total { font-size: min(1rem, calc((var(--pill-width) - 6px) / 3.45)); }
  .game-grid > .scorecard .card-layout {
    --section-count: 2;
    --section-gap: 8px;
    --own-score-width: clamp(29px, 8.8cqi, 38px);
    --peer-score-width: clamp(12px, 4.15cqi, 20px);
    --score-label-size: clamp(.66rem, calc(2.8cqi + 1px), .875rem);
    --score-number-size: clamp(.78rem, 3.5cqi, .98rem);
    --peer-font-size: clamp(.625rem, 2.95cqi, .8rem);
    --score-row-height: clamp(24px, calc((100cqh - 52px) / 7), 40px);
    --score-target-height: calc(var(--score-row-height) - 1px);
    row-gap: 0;
  }
  .game-grid > #scorecard [data-tier="seven"] .card-table { --peer-font-size: clamp(.54rem, 2.65cqi, .86rem); }
  .game-grid > #scorecard [data-tier="seven"] .score-line { column-gap: 1px; }
  .game-grid > #scorecard [data-tier="seven"] .peer-score { gap: 0; }
  .game-grid > #scorecard .card-table th[scope="row"] { padding-block: 1px; }
  .game-grid > .scorecard .score-value { min-height: 1.4em; padding-inline: 2px; }
  .game-view:is([data-phase="turn"], [data-phase="waiting"]) .game-grid:has(> #scorecard) > .workbench {
    align-self: stretch; display: flex; flex-direction: column; justify-content: center;
  }

  .game-view:has(.connection-note[hidden]) .game-grid:has(> #scorecard) #turn-panel {
    --clock-inset: 8px;
    height: min(100cqh, calc(100cqi - 8px + var(--saved-words-height) + 2 * var(--panel-border)));
    grid-template-rows: var(--saved-words-height) minmax(0, 1fr);
    padding-block-start: 0;
  }
  .game-view:has(.connection-note[hidden]) .game-grid:has(> #scorecard) #saved-word-chips {
    --word-chip-size: clamp(19px, 7.1cqi, 22px);
    position: relative; inset: auto; inline-size: auto; block-size: auto;
    flex-direction: row; align-items: flex-end; justify-content: center;
  }
  .game-view:has(.connection-note:not([hidden])) .game-grid:has(> #scorecard) { display: flex; }
  .game-view:has(.connection-note:not([hidden])) .game-grid > #scorecard { display: none; }
}

@container game-screen (width >= 64rem) and (height >= 34rem) {
  body[data-screen="game"] :is(.header-inner, .shell) {
    width: calc(100% - 2 * clamp(24px, 4vw, 88px)); max-width: 96rem;
  }
  body[data-screen="game"] .header-inner { padding-block: clamp(8px, 1.4vh, 20px); }
  .round-heading h1 { font-size: clamp(1.4rem, 1.75vw, 1.85rem); }

  .game-view:is([data-phase="turn"], [data-phase="waiting"]) .game-grid:has(> #scorecard) {
    --split-gap: clamp(22px, 3.5vw, 64px);
    --score-inset: clamp(9px, 1vw, 14px);
    --saved-words-height: clamp(36px, 3vw, 46px);
  }
  .game-grid > .player-strip .player-pill:not(:only-child) {
    min-height: clamp(48px, 4.1vw, 62px); gap: 4px; padding: 3px 6px 7px;
  }
  .game-grid > .player-strip .player-mark { font-size: clamp(.76rem, calc(var(--pill-width) * .15), .92rem); }
  .game-grid > .player-strip .player-total { font-size: clamp(1.1rem, calc(var(--pill-width) / 4), 1.44rem); }
  .game-view:is([data-phase="turn"], [data-phase="waiting"]) .game-grid > #scorecard {
    padding: 3px var(--score-inset) var(--score-inset);
  }
  .game-grid > .scorecard .card-layout {
    --section-count: 2;
    --section-gap: clamp(12px, 3cqi, 20px);
    --own-score-width: clamp(2.45rem, 8.4cqi, 3.55rem);
    --peer-score-width: clamp(.95rem, 3.6cqi, 1.6rem);
    --score-label-size: clamp(.88rem, 2.55cqi, 1.17rem);
    --score-number-size: clamp(.95rem, 2.75cqi, 1.24rem);
    --peer-font-size: clamp(.8rem, 2.3cqi, 1.03rem);
    --score-row-height: clamp(42px, min(8.75cqi, 8.9cqh), 66px);
    --score-target-height: calc(var(--score-row-height) - 1px);
    row-gap: 0;
  }
  .game-grid > #scorecard [data-tier="seven"] .card-table {
    --peer-font-size: clamp(.75rem, 2.6cqi, 1.22rem);
  }
  :is(#turn-panel, #replay-panel) { --max-wheel: 620px; --max-die: 144px; }
  #turn-panel {
    --max-roll: 92px;
    --tray-target: clamp(46px, 9cqi, 58px);
    height: min(100cqh, calc(100cqi - 8px + var(--saved-words-height) + 2 * var(--panel-border)));
  }
  #saved-word-chips { --word-chip-size: clamp(28px, 6.4cqi, 39px); gap: clamp(12px, 3cqi, 18px); }
  #roll-button { font-size: 1.28rem; }
  #replay-panel { max-height: 48rem; }
}
@container game-screen (height < 30rem) {
  #replay-panel { --replay-chip: clamp(18px, 5.5svh, 24px); --replay-award-height: clamp(36px, 10svh, 46px); gap: 4px; }
  .playback-heading { gap: 4px; }
  .playback-summary { min-height: 34px; padding-block: 2px; }
  .playback-caption { gap: 5px; }
  #playback-words { font-size: min(.84rem, 5.6svh); }
}
