:root {
  color-scheme: dark;
  --bg: #101215;
  --panel: rgba(22, 25, 29, 0.92);
  --panel-2: rgba(34, 38, 43, 0.95);
  --line: rgba(255, 255, 255, 0.15);
  --text: #f6f2e8;
  --muted: #c8c0b3;
  --gold: #f4c84a;
  --green: #63d889;
  --red: #ff6f6f;
  --blue: #79b8ff;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% 0%, rgba(244, 200, 74, 0.18), transparent 32rem),
    radial-gradient(circle at 85% 12%, rgba(121, 184, 255, 0.16), transparent 34rem),
    linear-gradient(135deg, #111418 0%, #1c2025 55%, #151210 100%);
  color: var(--text);
}

button,
a {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app-shell {
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 10px;
}

.landing-screen {
  position: relative;
  display: grid;
  align-content: center;
  min-height: min(720px, calc(100vh - 28px));
  padding: clamp(22px, 5vw, 64px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(10, 11, 12, 0.92) 0%, rgba(10, 11, 12, 0.72) 42%, rgba(10, 11, 12, 0.12) 100%),
    url("./assets/dice-chase-hero.png") center / cover no-repeat;
  box-shadow: var(--shadow);
}

.landing-screen::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 36%;
  background: linear-gradient(0deg, rgba(10, 11, 12, 0.72), transparent);
  pointer-events: none;
}

.landing-screen[hidden],
.game-surface[hidden] {
  display: none;
}

.landing-bee {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 1;
  display: block;
}

.landing-bee img {
  display: block;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.32);
}

.landing-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  max-width: 560px;
  padding-top: 54px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.provenance-badge {
  width: fit-content;
  border: 1px solid rgba(248, 210, 74, 0.35);
  border-radius: 999px;
  padding: 0.24rem 0.55rem;
  background: rgba(16, 24, 40, 0.44);
}

.game-titlemark {
  display: block;
  width: min(100%, 620px);
  height: auto;
  object-fit: contain;
}

.game-titlemark--landing {
  width: min(100%, 640px);
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.25));
}

.game-titlemark--compact {
  width: clamp(172px, 22vw, 300px);
}

.landing-copy p,
.landing-copy h1,
.landing-copy span {
  margin: 0;
}

.landing-copy p {
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing-copy h1 {
  font-size: clamp(3.6rem, 9vw, 7.4rem);
  line-height: 0.86;
  text-wrap: balance;
}

.landing-copy span {
  max-width: 460px;
  color: #efe4cd;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.35;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.landing-actions button {
  min-height: 48px;
  padding-inline: 18px;
  font-weight: 900;
}

.landing-actions .primary-action {
  width: auto;
  min-width: 178px;
}

.landing-teaser {
  position: absolute;
  z-index: 1;
  left: clamp(22px, 5vw, 64px);
  right: clamp(22px, 5vw, 64px);
  bottom: 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: #efe4cd;
}

.landing-teaser strong {
  color: var(--gold);
}

.landing-teaser span {
  color: var(--muted);
  text-align: right;
}

.game-surface {
  display: grid;
  gap: 8px;
}

.play-footer {
  display: none;
}

.topbar,
.scorebar,
.recipe-panel,
.board-panel,
.preview-panel,
.log-panel,
.boost-panel,
.buzz-footer {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.recipe-panel,
.board-panel,
.preview-panel,
.log-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 38%),
    var(--panel);
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 62px;
  padding: 8px 10px;
  border-radius: 8px;
}

.bee-link,
.bee-link img {
  width: 44px;
  height: 44px;
  display: block;
}

.title-block p,
.title-block h1 {
  margin: 0;
}

.title-block p {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.title-block h1 {
  font-size: clamp(1.85rem, 3.3vw, 3rem);
  line-height: 0.94;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.top-actions > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.icon-button {
  width: 44px;
  border-radius: 50%;
  font-weight: 900;
}

.scorebar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
}

.scorebar div {
  min-width: 0;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
}

.scorebar span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.scorebar strong {
  display: block;
  font-size: 1.28rem;
}

.first-turn-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(244, 200, 74, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(244, 200, 74, 0.12), rgba(255, 255, 255, 0.04));
  box-shadow: var(--shadow);
}

.first-turn-panel strong {
  flex: 0 0 auto;
  color: var(--gold);
}

.first-turn-panel span {
  color: #eadfcf;
  line-height: 1.35;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.95fr) minmax(390px, 1.28fr) minmax(250px, 0.82fr);
  gap: 8px;
  align-items: start;
}

.recipe-panel,
.board-panel,
.preview-panel,
.log-panel {
  min-width: 0;
  border-radius: 8px;
  padding: 10px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.82rem;
}

.recipe-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.recipe-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 2px 7px;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
}

.recipe-choice {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px 7px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.recipe-card::after {
  content: attr(data-help);
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  display: none;
  padding: 8px;
  border: 1px solid rgba(244, 200, 74, 0.32);
  border-radius: 8px;
  background: rgba(19, 20, 20, 0.98);
  color: #f5ecd9;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
  font-size: 0.76rem;
  line-height: 1.3;
  white-space: normal;
}

.recipe-card:hover::after,
.recipe-card:focus-within::after {
  display: block;
}

.recipe-choice strong,
.recipe-choice span,
.recipe-choice em,
.recipe-choice small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-choice strong {
  grid-column: 1 / 2;
  font-size: 0.84rem;
}

.recipe-choice span {
  grid-column: 1 / 2;
  color: var(--muted);
  font-size: 0.68rem;
}

.recipe-choice em {
  grid-column: 1 / -1;
  color: var(--green);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 850;
}

.recipe-card.is-repeat .recipe-choice em {
  color: #ff8f75;
}

.recipe-choice small {
  justify-self: start;
  max-width: 100%;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(121, 184, 255, 0.14);
  color: #cfe5ff;
  font-size: 0.62rem;
  font-weight: 800;
}

.recipe-choice small:first-of-type {
  background: rgba(99, 216, 137, 0.14);
  color: #caffd8;
}

.recipe-card.is-repeat .recipe-choice small:first-of-type {
  background: rgba(255, 143, 117, 0.14);
  color: #ffd0c5;
}

.recipe-card.is-active {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(244, 200, 74, 0.18), rgba(255, 255, 255, 0.06));
}

.recipe-preview-button {
  position: relative;
  align-self: start;
  justify-self: end;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  height: 30px;
  padding: 0;
  border-color: rgba(99, 216, 137, 0.38);
  background: rgba(99, 216, 137, 0.12);
}

.recipe-preview-button::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 7px;
  width: 10px;
  height: 10px;
  border: 2px solid #caffd8;
  border-radius: 50%;
}

.recipe-preview-button::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 18px;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: #caffd8;
  transform: rotate(45deg);
  transform-origin: left center;
}

.recipe-preview-button:hover,
.recipe-preview-button:focus-visible {
  border-color: var(--gold);
  background: rgba(244, 200, 74, 0.18);
}

.board-panel {
  display: grid;
  gap: 8px;
  background:
    linear-gradient(180deg, rgba(244, 200, 74, 0.05), transparent 32%),
    rgba(16, 19, 21, 0.96);
}

.board-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}

.board-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.board-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.face-counts {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.face-count {
  display: grid;
  grid-template-rows: auto 30px auto;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 64px;
  padding: 5px;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.055);
}

.face-count.is-match {
  border-color: rgba(99, 216, 137, 0.42);
  background: rgba(99, 216, 137, 0.1);
}

.face-count__face {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff7e6, #cdbb92);
  color: #18120b;
  font-size: 0.78rem;
  font-weight: 950;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.face-count__bar {
  align-self: end;
  width: min(100%, 18px);
  height: var(--bar-height);
  min-height: 10px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, var(--gold), #a66c2d);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.24);
}

.face-count.is-match .face-count__bar {
  background: linear-gradient(180deg, #8ef0aa, #23965c);
}

.face-count strong {
  font-size: 0.92rem;
}

.dice-board {
  perspective: 1200px;
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 64px));
  justify-content: center;
  gap: clamp(7px, 1vw, 11px);
  padding: clamp(9px, 1.1vw, 14px);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 18%, rgba(22, 102, 87, 0.18), transparent 16rem),
    linear-gradient(145deg, rgba(7, 20, 18, 0.76), rgba(39, 28, 18, 0.4));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 18px 46px rgba(255, 255, 255, 0.04),
    inset 0 -22px 42px rgba(0, 0, 0, 0.32);
}

.die {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  aspect-ratio: 1;
  min-height: 0;
  min-width: 0;
  padding: clamp(7px, 1vw, 13px);
  border-radius: 18%;
  border: 1px solid rgba(50, 35, 18, 0.36);
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.98) 0 12%, rgba(255, 255, 255, 0.5) 20%, transparent 34%),
    radial-gradient(circle at 72% 78%, rgba(91, 58, 25, 0.22), transparent 38%),
    linear-gradient(145deg, #fffdf5 0%, #f1e8cf 42%, #c9b990 78%, #9d8662 100%);
  color: #121417;
  box-shadow:
    inset 0 3px 2px rgba(255, 255, 255, 0.96),
    inset 0 -8px 0 rgba(77, 51, 20, 0.18),
    inset -7px -9px 14px rgba(62, 41, 18, 0.2),
    inset 6px 7px 16px rgba(255, 255, 255, 0.36),
    0 2px 0 rgba(255, 255, 255, 0.12),
    0 13px 18px rgba(0, 0, 0, 0.34),
    0 24px 34px rgba(0, 0, 0, 0.18);
  transform: rotate(var(--tilt, 0deg)) translateZ(0);
  transition: transform 150ms ease, outline-color 150ms ease, box-shadow 150ms ease;
}

.die:hover {
  transform: rotate(var(--tilt, 0deg)) translateY(-3px) scale(1.02);
}

.die::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 7%;
  border-radius: 15%;
  border: 1px solid rgba(255, 255, 255, 0.46);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(78, 52, 21, 0.16);
  pointer-events: none;
}

.die::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), transparent 36%),
    radial-gradient(circle at 75% 88%, rgba(45, 27, 10, 0.18), transparent 35%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.die.hint {
  outline: 2px solid rgba(99, 216, 137, 0.44);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.78),
    inset 0 -7px 0 rgba(68, 50, 26, 0.2),
    0 0 0 4px rgba(99, 216, 137, 0.08),
    0 11px 18px rgba(0, 0, 0, 0.28);
}

.die.green {
  outline: 4px solid var(--green);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.92),
    inset 0 -6px 0 rgba(79, 56, 28, 0.2),
    0 0 0 5px rgba(99, 216, 137, 0.24),
    0 14px 24px rgba(0, 0, 0, 0.36);
}

.die.red {
  outline: 4px solid var(--red);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.92),
    inset 0 -6px 0 rgba(79, 56, 28, 0.2),
    0 0 0 5px rgba(255, 111, 111, 0.24),
    0 14px 24px rgba(0, 0, 0, 0.36);
}

.pip {
  position: relative;
  z-index: 3;
  align-self: center;
  justify-self: center;
  width: min(52%, 13px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #62676a 0 6%, #2a2c2e 24%, #070808 70%, #000 100%);
  box-shadow:
    inset 0 2px 2px rgba(0, 0, 0, 0.82),
    inset 0 -1px 1px rgba(255, 255, 255, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.5),
    0 -1px 0 rgba(53, 34, 14, 0.28);
}

.pip::after {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.16), transparent 48%);
}

.pip-1 {
  grid-area: 1 / 1;
}

.pip-3 {
  grid-area: 1 / 3;
}

.pip-4 {
  grid-area: 2 / 1;
}

.pip-5 {
  grid-area: 2 / 2;
}

.pip-6 {
  grid-area: 2 / 3;
}

.pip-7 {
  grid-area: 3 / 1;
}

.pip-9 {
  grid-area: 3 / 3;
}

.score-preview {
  display: grid;
  gap: 7px;
  margin: 0 0 8px;
}

.score-preview div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.score-preview dt,
.preview-note {
  color: var(--muted);
}

.score-preview dd {
  margin: 0;
  font-weight: 900;
}

.score-preview .total-row {
  background: linear-gradient(135deg, rgba(244, 200, 74, 0.2), rgba(251, 143, 59, 0.16));
  color: #fff3ce;
}

.preview-note {
  min-height: 34px;
  margin: 0 0 8px;
  line-height: 1.35;
}

.preview-panel {
  position: sticky;
  top: 12px;
}

.preview-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, 0.42fr);
  gap: 8px;
}

.primary-action {
  width: 100%;
  min-height: 48px;
  background: linear-gradient(135deg, #f4c84a, #fb8f3b);
  color: #19140b;
  font-weight: 900;
}

.secondary-action {
  width: 100%;
  min-height: 48px;
  border-color: rgba(121, 184, 255, 0.34);
  background: rgba(121, 184, 255, 0.1);
  color: #dcecff;
  font-weight: 850;
}

.secondary-action:hover,
.secondary-action:focus-visible {
  border-color: var(--gold);
  color: #fff3ce;
}

.boost-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
}

.boost-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.boost-panel.is-unavailable {
  border: 1px solid rgba(255, 143, 117, 0.28);
  background: rgba(255, 143, 117, 0.08);
}

.boost-panel[hidden] {
  display: none;
}

.boost-panel span {
  display: block;
  color: var(--muted);
}

.log-panel ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.log-panel li {
  display: grid;
  gap: 3px;
  min-height: 42px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.log-panel small {
  color: var(--muted);
}

.log-panel li span:only-child {
  min-height: 0;
}

dialog {
  width: min(560px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #181b1f;
  color: var(--text);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.dialog-body {
  max-height: 60vh;
  overflow: auto;
}

.rules-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.rules-summary article {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(244, 200, 74, 0.22);
  border-radius: 8px;
  background: rgba(244, 200, 74, 0.08);
}

.rules-summary strong {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: #17120b;
}

.rules-summary span {
  line-height: 1.25;
}

.rules-points {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.rules-points li {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  line-height: 1.35;
}

.rules-points strong {
  color: var(--gold);
}

.rules-scorecard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 0;
}

.rules-scorecard div {
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.rules-scorecard dt {
  color: var(--gold);
  font-weight: 900;
}

.rules-scorecard dd {
  margin: 3px 0 0;
  color: #efe5d5;
  line-height: 1.3;
}

.buzz-footer {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  min-height: 86px;
  padding: 10px;
  border-radius: 8px;
}

.buzz-footer img {
  width: 52px;
  height: 52px;
}

.buzz-footer p {
  margin: 0 0 8px;
  color: var(--muted);
}

.buzz-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.buzz-footer a,
.buzz-footer button {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 980px) {
  .play-layout {
    grid-template-columns: 1fr;
  }

  .recipe-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recipe-card {
    grid-template-columns: minmax(0, 1fr) 32px;
  }

  .preview-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 8px;
  }

  .topbar {
    grid-template-columns: auto 1fr;
    gap: 10px;
  }

  .top-actions {
    grid-column: 1 / -1;
  }

  .bee-link,
  .bee-link img {
    width: 46px;
    height: 46px;
  }

  .title-block h1 {
    font-size: 2.25rem;
  }

  .scorebar {
    grid-template-columns: repeat(2, 1fr);
  }

  .scorebar strong {
    font-size: 1.25rem;
  }

  .first-turn-panel {
    align-items: start;
    flex-direction: column;
    gap: 5px;
    padding: 9px 10px;
  }

  .recipe-panel,
  .board-panel,
  .preview-panel,
  .log-panel {
    padding: 10px;
  }

  .scorecard-note {
    font-size: 0.76rem;
  }

  .recipe-list {
    display: flex;
    gap: 8px;
    margin-inline: -2px;
    padding: 2px 2px 8px;
    width: calc(100% + 4px);
    max-width: calc(100% + 4px);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .recipe-card {
    flex: 0 0 152px;
    min-height: 66px;
    padding: 8px;
    scroll-snap-align: start;
  }

  .recipe-choice strong {
    font-size: 0.82rem;
  }

  .recipe-choice span,
  .recipe-choice em {
    font-size: 0.68rem;
  }

  .recipe-choice small {
    position: static;
    grid-row: auto;
    justify-self: start;
    max-width: 100%;
    padding: 2px 5px;
    font-size: 0.62rem;
  }

  .recipe-preview-button {
    width: 28px;
    min-width: 28px;
    min-height: 28px;
    height: 28px;
  }

  .dice-board {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
    padding: 10px;
  }

  .die {
    padding: 7px;
  }

  .face-counts {
    gap: 5px;
    padding: 6px;
  }

  .face-count {
    grid-template-rows: auto 34px auto;
    min-height: 74px;
    padding: 5px 3px;
  }

  .face-count__face {
    width: 21px;
    height: 21px;
  }

  .board-heading {
    align-items: start;
  }

  .board-heading span {
    font-size: 0.76rem;
  }

  .buzz-footer {
    grid-template-columns: auto 1fr;
    align-items: start;
  }

  .rules-summary {
    grid-template-columns: 1fr;
  }

  .rules-scorecard {
    grid-template-columns: 1fr;
  }
}

/* BuzzGames landing-family contract. Dice Chase keeps its original art and solo rules. */
.landing-screen {
  align-content: start;
  grid-template-rows: auto minmax(240px, 1fr) auto auto;
  gap: 10px;
  padding: 10px;
}

.landing-commandbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 64px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 230, 164, 0.24);
  border-radius: 8px;
  background: rgba(3, 18, 16, 0.82);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(3px);
}

.landing-branding,
.landing-utilities {
  display: flex;
  align-items: center;
  gap: 6px;
}

.landing-commandbar :is(.landing-bee, .landing-provenance) {
  position: static;
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  place-items: center;
}

.landing-commandbar :is(.landing-bee, .landing-provenance) img {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 50%;
  box-shadow: none;
}

.landing-commandbar :is(.landing-account, .landing-daily) {
  min-height: 40px;
  padding: 6px 10px;
  font-weight: 900;
  white-space: nowrap;
}

.landing-commandbar .landing-account {
  margin-left: auto;
}

.landing-commandbar .landing-daily {
  min-width: 112px;
  border-color: #f1d27e;
  background: linear-gradient(180deg, #ffe9a9, #f0bd43);
  color: #2c1b00;
}

.landing-commandbar .landing-utilities .icon-button {
  display: inline-grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  background: linear-gradient(180deg, #ffe9a9, #f0bd43);
  color: #2c1b00;
}

.landing-copy {
  align-self: center;
  justify-self: center;
  justify-items: center;
  width: min(100%, 920px);
  max-width: 920px;
  padding: 20px;
  text-align: center;
}

.landing-copy .game-titlemark--landing {
  width: min(94%, 720px);
  max-height: 260px;
}

.landing-copy > span {
  max-width: 58ch;
}

.landing-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 620px);
}

.landing-actions :is(button, a) {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
}

.landing-actions .primary-action {
  grid-column: 1 / -1;
  width: 100%;
  background: linear-gradient(180deg, #93ffac, #1fb45f 70%, #0d843f);
  color: #04140c;
}

.landing-teaser {
  position: relative;
  inset: auto;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 230, 164, 0.22);
  border-radius: 8px;
  background: rgba(2, 12, 10, 0.64);
}

.landing-screen > .buzz-footer--landing {
  position: relative;
  z-index: 2;
  display: grid !important;
  grid-column: 1 / -1;
  grid-template-columns: 1fr !important;
  width: 100% !important;
  min-height: 40px;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  place-items: center;
}

.landing-screen > .buzz-footer--landing > .buzz-footer__mark {
  grid-column: 1;
  justify-self: center;
}

.landing-screen .buzz-footer__mark,
#gameSurface:not([hidden]) .play-footer__home {
  display: grid;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  place-items: center;
}

.landing-screen .buzz-footer__mark img,
#gameSurface:not([hidden]) .play-footer__home img {
  width: 28px;
  height: 28px;
}

.title-block .provenance-mark {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

body:has(#landingScreen:not([hidden])) > .buzz-footer {
  display: none;
}

@media (max-width: 640px) {
  .landing-screen {
    grid-template-rows: auto minmax(220px, 1fr) auto auto;
    min-height: calc(100dvh - 16px);
    padding: 8px;
  }

  .landing-commandbar {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: 40px 38px;
    gap: 4px;
    min-height: 86px;
    padding: 4px;
  }

  .landing-branding {
    grid-column: 1 / span 2;
    grid-row: 1;
    justify-content: center;
  }

  .landing-commandbar :is(.landing-bee, .landing-provenance) {
    flex-basis: 36px;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
  }

  .landing-commandbar :is(.landing-bee, .landing-provenance) img {
    width: 34px;
    height: 34px;
  }

  .landing-commandbar .landing-account {
    grid-column: 1 / span 3;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    min-height: 34px;
    margin: 0;
  }

  .landing-commandbar .landing-daily {
    grid-column: 4 / span 3;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    min-height: 34px;
  }

  .landing-utilities {
    display: contents;
  }

  .landing-commandbar .landing-utilities .icon-button {
    grid-column: 6;
    grid-row: 1;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    place-self: center;
  }

  .landing-copy {
    gap: 10px;
    padding: 10px;
  }

  .landing-copy .game-titlemark--landing {
    max-height: 176px;
  }

  .landing-copy > span {
    font-size: 0.88rem;
  }

  .landing-teaser {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .landing-teaser span {
    font-size: 0.76rem;
    text-align: left;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .die:active {
    transform: rotate(var(--tilt, 0deg)) translateY(1px) scale(0.98);
  }
}

/* Active runs use the same one-screen table contract as the card games. */
body:has(#gameSurface:not([hidden])) {
  overflow: hidden;
}

body:has(#gameSurface:not([hidden])) .app-shell {
  min-height: 100dvh;
  max-height: 100dvh;
  padding: 8px;
  overflow: hidden;
}

body:has(#gameSurface:not([hidden])) > .buzz-footer {
  display: none;
}

#gameSurface:not([hidden]) {
  position: relative;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: calc(100dvh - 16px);
  max-height: calc(100dvh - 16px);
  overflow: hidden;
}

#gameSurface:not([hidden]) .play-layout {
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

#gameSurface:not([hidden]) .recipe-panel,
#gameSurface:not([hidden]) .board-panel,
#gameSurface:not([hidden]) .preview-panel {
  min-height: 0;
  overflow: hidden;
}

#gameSurface:not([hidden]) .preview-panel {
  position: static;
}

#gameSurface:not([hidden]) .log-panel {
  display: none;
}

#gameSurface:not([hidden]) .play-footer {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#gameSurface:not([hidden]) .play-footer a,
#gameSurface:not([hidden]) .play-footer img {
  display: block;
  width: 38px;
  height: 38px;
}

#gameSurface:not([hidden]) .boost-panel:not([hidden]) {
  position: absolute;
  z-index: 4;
  right: 12px;
  bottom: 52px;
  left: 12px;
}

@media (max-width: 640px) {
  body:has(#gameSurface:not([hidden])) .app-shell {
    padding: 6px;
  }

  #gameSurface:not([hidden]) {
    min-height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
    gap: 5px;
  }

  #gameSurface:not([hidden]) .play-toolbar {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    min-height: 42px;
    gap: 6px;
    padding: 3px;
    overflow: hidden;
  }

  #gameSurface:not([hidden]) .bee-link,
  #gameSurface:not([hidden]) .bee-link img {
    width: 34px;
    height: 34px;
  }

  #gameSurface:not([hidden]) .title-block {
    min-width: 0;
  }

  #gameSurface:not([hidden]) .title-block .provenance-badge {
    display: none;
  }

  #gameSurface:not([hidden]) .game-titlemark--compact {
    max-width: 118px;
    max-height: 28px;
    object-fit: contain;
  }

  #gameSurface:not([hidden]) .top-actions {
    grid-column: auto;
    gap: 5px;
    overflow: hidden;
  }

  #gameSurface:not([hidden]) .top-actions button {
    min-height: 32px;
    padding: 4px 7px;
    font-size: 0.72rem;
  }

  #gameSurface:not([hidden]) .icon-button {
    width: 32px;
    padding: 0;
  }

  #gameSurface:not([hidden]) .scorebar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
  }

  #gameSurface:not([hidden]) .scorebar div {
    min-height: 38px;
    padding: 4px;
  }

  #gameSurface:not([hidden]) .scorebar span {
    font-size: 0.56rem;
  }

  #gameSurface:not([hidden]) .scorebar strong {
    font-size: 0.78rem;
    line-height: 1.05;
  }

  #gameSurface:not([hidden]) .play-layout {
    grid-template-areas:
      "recipe"
      "board"
      "preview";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 104px minmax(0, 1fr) 118px;
    gap: 5px;
  }

  #gameSurface:not([hidden]) .recipe-panel {
    grid-area: recipe;
    padding: 6px;
  }

  #gameSurface:not([hidden]) .recipe-panel .panel-heading {
    margin-bottom: 4px;
  }

  #gameSurface:not([hidden]) .recipe-panel .panel-heading h2 {
    font-size: 0.78rem;
  }

  #gameSurface:not([hidden]) .recipe-panel .panel-heading span {
    font-size: 0.64rem;
  }

  #gameSurface:not([hidden]) .recipe-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 38px;
    gap: 4px;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  #gameSurface:not([hidden]) .recipe-card {
    min-width: 0;
    width: auto;
    flex: initial;
    grid-template-columns: minmax(0, 1fr) 26px;
    min-height: 38px;
    padding: 4px;
  }

  #gameSurface:not([hidden]) .recipe-choice strong {
    font-size: 0.64rem;
  }

  #gameSurface:not([hidden]) .recipe-choice :is(span, em, small) {
    display: none;
  }

  #gameSurface:not([hidden]) .recipe-choice span {
    display: block;
    font-size: 0.52rem;
    line-height: 1;
  }

  #gameSurface:not([hidden]) .recipe-preview-button {
    width: 24px;
    min-width: 24px;
    min-height: 24px;
    height: 24px;
  }

  #gameSurface:not([hidden]) .board-panel {
    grid-area: board;
    gap: 5px;
    padding: 6px;
  }

  #gameSurface:not([hidden]) .board-heading h2 {
    font-size: 0.82rem;
  }

  #gameSurface:not([hidden]) .board-heading span,
  #gameSurface:not([hidden]) .face-counts {
    display: none;
  }

  #gameSurface:not([hidden]) .dice-board {
    align-self: center;
    gap: clamp(5px, 1.5vw, 8px);
    width: min(100%, 330px);
    margin: auto;
    padding: 8px;
  }

  #gameSurface:not([hidden]) .die {
    padding: clamp(5px, 2vw, 8px);
  }

  #gameSurface:not([hidden]) .preview-panel {
    grid-area: preview;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(112px, 0.72fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 4px 8px;
    padding: 6px;
  }

  #gameSurface:not([hidden]) .preview-panel .panel-heading {
    grid-column: 1 / -1;
    margin: 0;
  }

  #gameSurface:not([hidden]) .preview-panel .panel-heading h2,
  #gameSurface:not([hidden]) .preview-panel .panel-heading span {
    font-size: 0.72rem;
  }

  #gameSurface:not([hidden]) .score-preview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    margin: 0;
  }

  #gameSurface:not([hidden]) .score-preview div {
    display: grid;
    gap: 1px;
    min-width: 0;
    padding: 3px 4px;
  }

  #gameSurface:not([hidden]) .score-preview dt,
  #gameSurface:not([hidden]) .score-preview dd {
    overflow: hidden;
    font-size: 0.57rem;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #gameSurface:not([hidden]) .score-preview .total-row {
    grid-column: span 2;
  }

  #gameSurface:not([hidden]) .preview-note {
    display: none;
  }

  #gameSurface:not([hidden]) .preview-actions {
    align-content: end;
    grid-template-columns: 1fr;
    gap: 4px;
  }

  #gameSurface:not([hidden]) .preview-actions button {
    min-height: 34px;
    padding: 4px;
    font-size: 0.68rem;
  }

  #gameSurface:not([hidden]) .play-footer {
    min-height: 40px;
  }

  #gameSurface:not([hidden]) .play-footer a,
  #gameSurface:not([hidden]) .play-footer img {
    width: 36px;
    height: 36px;
  }

  #gameSurface:not([hidden]) .boost-panel:not([hidden]) {
    right: 6px;
    bottom: 46px;
    left: 6px;
    padding: 8px;
  }
}

/* Crazy Eights is the literal landing-page composition benchmark. */
.landing-screen {
  align-content: start;
  grid-template-rows: auto auto auto auto;
  gap: 10px;
  min-height: calc(100dvh - 20px);
  padding: 12px;
  background: linear-gradient(rgba(2, 16, 13, 0.5), rgba(2, 16, 13, 0.76)), url("./assets/dice-chase-hero.png") center / cover no-repeat;
}

.landing-commandbar {
  min-height: 70px;
}

.landing-commandbar .hero-room-actions {
  display: flex;
  gap: 8px;
}

.landing-copy.hero-title-lane {
  position: relative;
  display: grid;
  align-self: auto;
  justify-self: stretch;
  place-items: center;
  width: 100%;
  max-width: none;
  min-height: clamp(230px, 34vh, 420px);
  margin: 0;
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 226, 148, 0.34);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.34)), url("./assets/dice-chase-hero.png") center 58% / cover no-repeat;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
}

.landing-copy .game-titlemark--landing {
  width: min(64vw, 360px);
  max-height: 88%;
  margin: 0;
  object-fit: contain;
}

.landing-actions.hero-landing-actions {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(255, 230, 164, 0.2);
  border-radius: 8px;
  background: rgba(5, 18, 13, 0.82);
  backdrop-filter: blur(8px);
}

.landing-actions :is(.setup-label, .mode-description, .provenance-copy) {
  margin: 0;
}

.landing-actions .provenance-copy {
  color: #f1d27e;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing-actions .setup-label {
  color: #f1d27e;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.landing-actions .mode-description {
  color: #efe4cd;
  font-size: 0.84rem;
  line-height: 1.35;
}

.landing-actions :is(.mode-picker, .opponent-picker, .landing-secondary-actions) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.landing-actions .mode-picker {
  grid-template-columns: minmax(0, 1fr);
}

.landing-actions :is(.mode-picker, .opponent-picker) button,
.landing-actions .landing-secondary-actions :is(button, a) {
  display: grid;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 7px;
  border: 1px solid rgba(255, 230, 164, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff7e7;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  place-items: center;
}

.landing-actions :is(.mode-picker, .opponent-picker) button.is-active {
  border-color: #f1d27e;
  background: linear-gradient(180deg, #ffe9a9, #f0bd43);
  color: #2c1b00;
}

.landing-actions .opponent-roster-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 230, 164, 0.18);
  border-radius: 8px;
  color: #fff7e7;
  background: rgba(10, 56, 43, 0.62);
}

.landing-actions .opponent-roster-panel span {
  color: #d7e7df;
  font-size: 0.78rem;
  text-align: right;
}

.landing-actions #playButton {
  width: 100%;
  min-height: 48px;
  background: linear-gradient(180deg, #93ffac, #1fb45f 70%, #0d843f);
  color: #04140c;
}

@media (max-width: 640px) {
  .landing-screen {
    grid-template-rows: auto auto auto auto;
    gap: 8px;
    padding: 12px;
  }

  .landing-commandbar {
    grid-template-columns: 28px 28px minmax(78px, 1fr) 28px 28px;
    grid-template-rows: 34px 28px;
    grid-template-areas:
      "bee provenance account utility rules"
      "records records records daily daily";
    min-height: 70px;
    padding: 4px;
  }

  .landing-branding,
  .landing-commandbar .hero-room-actions,
  .landing-utilities {
    display: contents;
  }

  .landing-commandbar .landing-bee { grid-area: bee; }
  .landing-commandbar .landing-provenance { grid-area: provenance; }
  .landing-commandbar .landing-account { grid-area: account; }
  .landing-commandbar #landingRecordsButton { grid-area: records; }
  .landing-commandbar .landing-daily { grid-area: daily; }
  .landing-commandbar #landingRulesButton { grid-area: rules; }

  .landing-commandbar :is(.landing-bee, .landing-provenance) {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
  }

  .landing-commandbar :is(.landing-bee, .landing-provenance) img {
    width: 28px;
    height: 28px;
  }

  .landing-commandbar .landing-account {
    width: 100%;
    min-height: 34px;
    margin: 0;
  }

  .landing-commandbar :is(#landingRecordsButton, .landing-daily) {
    width: 100%;
    min-width: 0;
    min-height: 28px;
    padding: 3px 5px;
  }

  .landing-commandbar .landing-utilities .icon-button {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
  }

  .landing-copy.hero-title-lane {
    min-height: clamp(96px, 13vh, 116px);
  }

  .landing-copy .game-titlemark--landing {
    width: min(64vw, 300px);
    max-height: 94px;
  }

  .landing-actions.hero-landing-actions {
    gap: 10px;
  }

  .landing-actions .mode-description {
    font-size: 0.78rem;
  }
}
