:root {
  color-scheme: light;
  --paper: #f7f7f2;
  --ink: #17201b;
  --muted: #657168;
  --line: #d8ddd5;
  --felt: #0f6f56;
  --felt-dark: #084936;
  --mint: #a6e3cb;
  --gold: #f4c76b;
  --coral: #e95f4f;
  --blue: #2767b1;
  --card-w: 64px;
  --card-h: 92px;
  --board-grid: 36px;
  --board-row-h: 108px;
  --board-row-gap: calc(var(--board-row-h) - var(--card-h));
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 111, 86, 0.1), transparent 34rem),
    repeating-linear-gradient(
      90deg,
      rgba(23, 32, 27, 0.035) 0 1px,
      transparent 1px 18px
    ),
    var(--paper);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button,
a {
  font: inherit;
}

a {
  color: var(--blue);
}

.screen-warning {
  display: none;
}

[hidden] {
  display: none !important;
}

.game-shell {
  width: min(1180px, calc(100vw - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr minmax(180px, 220px);
  gap: 14px;
}

.score-panel,
.board-panel,
.side-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 50px rgba(22, 34, 29, 0.1);
}

.score-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand-line,
.board-header,
.controls,
.meter-row,
.decision-panel {
  display: flex;
  align-items: center;
}

.brand-line,
.board-header {
  justify-content: space-between;
  gap: 14px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow,
.field-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 22px;
}

.board-score h2 {
  font-size: 38px;
}

.board-score-metrics {
  display: flex;
  align-items: flex-start;
  gap: 42px;
}

.board-score-metric {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
}

.board-score-metric-active {
  border-color: rgba(244, 199, 107, 0.78);
  background: rgba(244, 199, 107, 0.16);
}

.board-score-metric-link {
  cursor: pointer;
}

.board-score-metric-link:hover {
  border-color: rgba(244, 199, 107, 0.9);
  background: rgba(244, 199, 107, 0.22);
}

.board-score-metric-link:focus-visible {
  outline: 3px solid rgba(244, 199, 107, 0.7);
  outline-offset: 2px;
}

.board-score-metric .eyebrow {
  margin-bottom: 6px;
}

.board-score-metric-active h2,
.board-score-metric-active .best-possible-score {
  color: var(--coral);
}

.best-possible-score {
  display: block;
  color: var(--ink);
  font-size: 38px;
  font-weight: 950;
  line-height: 1;
}

.board-score p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.perfect-game-label {
  color: var(--coral);
  font-weight: 950;
  white-space: nowrap;
}

.board-score .score-final {
  color: var(--coral);
}

.help-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(8, 73, 54, 0.28);
  border-radius: 50%;
  color: var(--felt-dark);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.help-button:hover {
  transform: translateY(-1px);
  border-color: rgba(8, 73, 54, 0.48);
  box-shadow: 0 8px 18px rgba(22, 34, 29, 0.12);
}

.title-scoreboard-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.title-scoreboard-link:hover {
  color: var(--felt-dark);
  border-color: rgba(8, 73, 54, 0.36);
}

.help-popover {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 32, 27, 0.42);
}

.help-card {
  position: relative;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid rgba(8, 73, 54, 0.18);
  border-radius: var(--radius);
  background: #fffdfa;
  box-shadow: 0 22px 60px rgba(22, 34, 29, 0.22);
}

.help-card h2 {
  margin: 0;
  color: var(--felt-dark);
  font-size: 24px;
  line-height: 1.15;
}

.help-card p:not(.eyebrow) {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 720;
  line-height: 1.58;
}

.help-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 720;
  line-height: 1.5;
}

.help-card li + li {
  margin-top: 6px;
}

.help-card .help-subhead {
  color: var(--ink);
  font-weight: 850;
}

.help-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  padding: 14px;
  background: rgba(23, 32, 27, 0.42);
}

.tutorial-overlay[hidden] {
  display: none;
}

.tutorial-card {
  position: relative;
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 16px;
  border: 1px solid rgba(8, 73, 54, 0.18);
  border-radius: 14px 14px 10px 10px;
  background: #fffdfa;
  box-shadow: 0 22px 60px rgba(22, 34, 29, 0.24);
  animation: tutorialSheetIn 220ms ease-out;
}

.tutorial-head {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tutorial-close {
  position: static;
  flex: 0 0 auto;
}

.tutorial-visual {
  min-height: 80px;
  display: grid;
  place-items: center;
  margin: 14px 0 12px;
  border: 1px solid rgba(101, 113, 104, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(15, 111, 86, 0.08), rgba(244, 199, 107, 0.1)),
    #fff;
}

.tutorial-card h2 {
  margin: 0;
  color: var(--felt-dark);
  font-size: 24px;
  line-height: 1.08;
}

.tutorial-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 760;
  line-height: 1.5;
}

.tutorial-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tutorial-mini-card {
  width: 46px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid #e2e6df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(22, 34, 29, 0.1);
  font-size: 18px;
  font-weight: 950;
}

.tutorial-mini-card.card-back {
  color: rgba(255, 255, 255, 0.9);
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.12) 0 6px,
      transparent 6px 12px
    ),
    var(--felt);
}

.tutorial-mini-card.hot {
  border-color: var(--gold);
  box-shadow:
    0 0 0 4px rgba(244, 199, 107, 0.28),
    0 10px 20px rgba(22, 34, 29, 0.12);
}

.tutorial-mini-card.red {
  color: #bf2e2e;
}

.tutorial-mini-arrow {
  color: var(--muted);
  font-size: 18px;
  font-weight: 950;
}

.tutorial-mini-depth-grid {
  gap: 0;
}

.tutorial-depth-grid {
  display: grid;
  grid-template-columns: repeat(3, 46px);
  gap: 5px 8px;
  justify-content: center;
}

.tutorial-depth-spacer {
  width: 46px;
  height: 62px;
}

.tutorial-mini-button,
.tutorial-mini-badge {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 13px;
  font-weight: 900;
}

.tutorial-mini-badge {
  color: var(--felt-dark);
  background: rgba(244, 199, 107, 0.14);
}

.tutorial-play-button-clone {
  width: min(340px, 100%);
  flex: 0 0 auto;
  pointer-events: none;
  cursor: default;
}

.tutorial-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 14px;
}

.tutorial-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(101, 113, 104, 0.32);
  cursor: pointer;
}

.tutorial-dot-active {
  width: 22px;
  border-radius: 999px;
  background: var(--felt);
}

.tutorial-actions {
  display: grid;
  grid-template-columns: minmax(86px, 0.35fr) 1fr;
  gap: 8px;
  margin-top: 14px;
}

.tutorial-back {
  min-height: 44px;
}

.tutorial-next {
  min-height: 44px;
}

.tutorial-back:disabled {
  color: #9aa29c;
  background: #eef1ec;
  cursor: not-allowed;
}

.tutorial-spotlight {
  --spotlight-x: 0px;
  --spotlight-y: 0px;
  --spotlight-w: 0px;
  --spotlight-h: 0px;
  position: fixed;
  left: var(--spotlight-x);
  top: var(--spotlight-y);
  width: var(--spotlight-w);
  height: var(--spotlight-h);
  z-index: 41;
  pointer-events: none;
  border: 3px solid var(--gold);
  border-radius: 12px;
  opacity: 0;
  box-shadow:
    0 0 0 9999px rgba(23, 32, 27, 0.52),
    0 0 0 7px rgba(244, 199, 107, 0.24);
  transition:
    left 180ms ease,
    top 180ms ease,
    width 180ms ease,
    height 180ms ease,
    opacity 160ms ease;
  animation: tutorialPulse 1400ms ease-in-out infinite;
}

.tutorial-spotlight-bar {
  display: none;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 42;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(244, 199, 107, 0.7);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.92);
  box-shadow: 0 12px 36px rgba(22, 34, 29, 0.2);
  backdrop-filter: blur(8px);
}

.tutorial-spotlight-copy {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 1px;
  padding-left: 6px;
}

.tutorial-spotlight-copy strong {
  overflow: hidden;
  color: var(--felt-dark);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tutorial-spotlight-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tutorial-spotlight-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
}

.tutorial-pill-button {
  min-width: 58px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.tutorial-pill-primary {
  border-color: var(--felt-dark);
  background: var(--felt);
  color: #fff;
}

.tutorial-pill-button:disabled {
  color: #9aa29c;
  background: #eef1ec;
  cursor: not-allowed;
}

.tutorial-overlay[data-mode="spotlight"] {
  background: transparent;
}

.tutorial-overlay[data-mode="spotlight"] .tutorial-card {
  display: none;
}

.tutorial-overlay[data-mode="spotlight"] .tutorial-spotlight-bar {
  display: flex;
}

.tutorial-overlay[data-mode="cards"] {
  align-items: center;
}

.tutorial-overlay[data-mode="cards"] .tutorial-card {
  border-color: rgba(244, 199, 107, 0.82);
  animation: tutorialCardIn 240ms ease-out;
}

.tutorial-overlay[data-mode="cards"] .tutorial-card::before,
.tutorial-overlay[data-mode="cards"] .tutorial-card::after {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: -1;
  border: 1px solid rgba(244, 199, 107, 0.38);
  border-radius: 14px;
  background: rgba(255, 253, 250, 0.82);
}

.tutorial-overlay[data-mode="cards"] .tutorial-card::before {
  transform: rotate(-2.2deg) translateY(5px);
}

.tutorial-overlay[data-mode="cards"] .tutorial-card::after {
  transform: rotate(2deg) translateY(10px);
}

.player-field {
  display: grid;
  gap: 7px;
}

.player-hint {
  min-height: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.player-field input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
}

.player-field input:focus {
  border-color: rgba(8, 73, 54, 0.5);
  box-shadow: 0 0 0 3px rgba(166, 227, 203, 0.32);
  outline: none;
}

.player-field input.input-warning {
  border-color: rgba(233, 95, 79, 0.52);
}

.player-field input.input-warning:focus {
  box-shadow: 0 0 0 3px rgba(233, 95, 79, 0.16);
}

.meter-stack {
  display: grid;
  gap: 10px;
}

.meter-row {
  gap: 10px;
  min-height: 22px;
}

.meter-row > span {
  width: 42px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.meter-row strong {
  width: 32px;
  text-align: right;
  font-size: 13px;
}

.meter-track {
  position: relative;
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e8ece6;
}

.meter-track span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--felt), var(--gold));
  transition: width 260ms ease;
}

.bonus-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.bonus-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bonus-header .field-label {
  margin: 0;
}

.bonus-header strong {
  color: var(--felt-dark);
  font-size: 18px;
}

.bonus-list {
  display: grid;
  gap: 6px;
}

.bonus-row {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) minmax(70px, auto) 36px;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 7px 8px;
  border: 1px solid #e4e8e2;
  border-radius: 6px;
  background: #f7f9f6;
  color: var(--muted);
}

.bonus-row span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.bonus-row small {
  font-size: 11px;
  font-weight: 750;
  text-align: right;
}

.bonus-row strong {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.bonus-row-active {
  border-color: rgba(244, 199, 107, 0.76);
  background: rgba(244, 199, 107, 0.15);
}

.bonus-row-active strong {
  color: var(--coral);
}

.decision-panel {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 276px;
  padding: 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(15, 111, 86, 0.09), rgba(244, 199, 107, 0.12)),
    #fff;
}

.decision-panel-active {
  border-color: rgba(244, 199, 107, 0.8);
  background:
    linear-gradient(90deg, rgba(244, 199, 107, 0.2), rgba(15, 111, 86, 0.09)),
    #fff;
  box-shadow: 0 10px 24px rgba(244, 199, 107, 0.18);
}

.decision-body {
  display: grid;
  justify-items: center;
  grid-template-rows: 16px var(--card-h) 42px 44px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.decision-body .field-label,
.decision-body .decision-text,
.decision-body .decision-actions {
  justify-self: stretch;
}

.decision-body .field-label {
  text-align: center;
}

.decision-text {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  margin: 0;
  color: var(--felt-dark);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
  text-align: center;
}

.decision-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  align-self: stretch;
}

.decision-use {
  border-color: var(--felt-dark);
  color: #fff;
  background: var(--felt);
}

.action-zone {
  display: grid;
  gap: 18px;
}

.deck-stack {
  position: relative;
  width: 82px;
  height: 102px;
  flex: 0 0 auto;
}

.deck-stack span {
  position: absolute;
  width: var(--card-w);
  height: var(--card-h);
  border: 1px solid rgba(8, 73, 54, 0.3);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.32), transparent 42%),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.22) 0 4px,
      transparent 4px 9px
    ),
    var(--felt);
  box-shadow: 0 8px 16px rgba(23, 32, 27, 0.18);
}

.deck-stack span:nth-child(1) {
  left: 12px;
  top: 8px;
  transform: rotate(5deg);
}

.deck-stack span:nth-child(2) {
  left: 7px;
  top: 5px;
  transform: rotate(1deg);
}

.deck-stack span:nth-child(3) {
  left: 2px;
  top: 2px;
  transform: rotate(-4deg);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 10px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid rgba(15, 111, 86, 0.22);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(15, 111, 86, 0.08), transparent 48%),
    #fff;
}

.button,
.icon-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 850;
}

.button .button-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}

.button-primary {
  min-height: 58px;
  border-color: var(--felt-dark);
  color: #fff;
  background: var(--felt);
  box-shadow: 0 10px 22px rgba(15, 111, 86, 0.24);
  font-size: 18px;
}

.button-stop {
  border-color: #922d25;
  background: var(--coral);
}

.icon-button {
  width: 52px;
  font-size: 22px;
  font-weight: 800;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(8, 73, 54, 0.42);
  box-shadow: 0 8px 18px rgba(22, 34, 29, 0.12);
}

.button:active,
.icon-button:active {
  transform: translateY(0);
}

.button:disabled {
  color: #8c948e;
  background: #eef1ec;
  border-color: #e1e5df;
  box-shadow: none;
  cursor: not-allowed;
}

.button-attention {
  animation: actionPulse 1300ms ease-in-out infinite;
}

.board-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.board-header {
  gap: 18px;
  align-items: flex-start;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
}

.score-map {
  width: min(360px, 44%);
  min-width: 220px;
  margin-top: 8px;
  margin-left: auto;
  display: grid;
  gap: 6px;
}

.score-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.score-map-chart {
  --score-map-current: 0%;
  --score-map-bins: 32;
  position: relative;
  height: 48px;
  padding: 5px 8px 13px;
  border: 1px solid rgba(101, 113, 104, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(247, 249, 246, 0.78)),
    #fff;
}

.score-map-bars {
  position: absolute;
  inset: 6px 8px 14px;
  display: grid;
  grid-template-columns: repeat(var(--score-map-bins), minmax(0, 1fr));
  align-items: end;
  gap: 2px;
}

.score-map-bar {
  min-width: 0;
  border-radius: 2px 2px 0 0;
  background: rgba(47, 122, 91, 0.28);
}

.score-map-marker {
  position: absolute;
  top: 4px;
  bottom: 10px;
  left: var(--score-map-current);
  width: 2px;
  border-radius: 999px;
  background: var(--coral);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.84),
    0 0 0 4px rgba(222, 95, 79, 0.14);
  transform: translateX(-1px);
}

.score-map-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
  transform: translateX(-50%);
}

.score-map-axis {
  position: absolute;
  right: 8px;
  bottom: 2px;
  left: 8px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.score-map-empty {
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(101, 113, 104, 0.18);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
  font-size: 11px;
  font-weight: 800;
}

.ladder-board {
  position: relative;
  flex: 1;
  min-height: 560px;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--felt);
}

.ladder-canvas {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-width: 100%;
  min-height: 100%;
  padding: 24px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.06)),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.08) 0 1px,
      transparent 1px var(--board-grid)
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.06) 0 1px,
      transparent 1px var(--board-grid)
    ),
    var(--felt);
}

.ladder-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 73, 54, 0), rgba(8, 73, 54, 0.22));
}

.ladder-canvas > * {
  position: relative;
  z-index: 1;
}

.empty-board {
  min-height: 420px;
  min-width: 100%;
  display: grid;
  place-items: center;
}

.ladder-row {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  min-width: 0;
  padding: 0 8px var(--board-row-gap) 46px;
}

.ladder-row::before {
  content: attr(data-depth);
  position: absolute;
  left: 0;
  top: 31px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  color: #fff;
  background: rgba(8, 73, 54, 0.88);
  font-size: 12px;
  font-weight: 850;
}

.ladder-row:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 64px;
  bottom: -10px;
  width: 2px;
  background: rgba(255, 255, 255, 0.36);
}

.card-wrap {
  position: relative;
  flex: 0 0 var(--card-step, 86px);
  width: var(--card-step, 86px);
  min-width: 0;
}

.card-wrap:last-child {
  flex-basis: var(--card-w);
  width: var(--card-w);
}

.card-wrap:not(:last-child)::after {
  display: none;
}

.playing-card {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: var(--radius);
  background: #fffdfa;
  box-shadow:
    0 10px 22px rgba(8, 73, 54, 0.2),
    inset 0 0 0 3px rgba(255, 255, 255, 0.72);
}

.playing-card.red {
  color: #bf2e2e;
}

.playing-card.black {
  color: #171c18;
}

.card-corner {
  position: absolute;
  top: 7px;
  left: 7px;
  display: grid;
  gap: 1px;
  line-height: 1;
  font-size: 15px;
  font-weight: 900;
}

.card-corner span {
  font-size: 14px;
}

.card-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 37px;
}

.card-rank {
  position: absolute;
  right: 8px;
  bottom: 7px;
  font-size: 16px;
  font-weight: 900;
  transform: rotate(180deg);
}

.card-back {
  display: grid;
  place-items: center;
  border-color: rgba(8, 73, 54, 0.28);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.32), transparent 40%),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.18) 0 5px,
      transparent 5px 10px
    ),
    var(--felt-dark);
  font-size: 28px;
  font-weight: 900;
}

.card-slot {
  min-width: var(--card-w);
  min-height: var(--card-h);
  display: grid;
  place-items: center;
}

.card-slot-compact {
  min-width: 72px;
}

.placeholder-card {
  display: grid;
  place-items: center;
  width: var(--card-w);
  height: var(--card-h);
  border: 1px dashed rgba(101, 113, 104, 0.42);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  font-weight: 800;
}

.card-new {
  animation: dealIn 340ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.card-latest {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.card-discarded {
  filter: grayscale(0.4);
  opacity: 0.76;
  transform: rotate(-4deg);
}

.side-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.used-block {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.used-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.used-header .field-label {
  margin: 0;
}

.used-header strong {
  color: var(--muted);
  font-size: 12px;
}

.used-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(21px, 1fr));
  gap: 4px;
  max-height: 310px;
  overflow: auto;
  padding: 2px 2px 4px;
  scrollbar-width: thin;
}

.used-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mini-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: center;
  justify-items: center;
  min-width: 0;
  height: 34px;
  padding: 3px 2px;
  border: 1px solid rgba(23, 32, 27, 0.14);
  border-radius: 5px;
  background: #fffdfa;
  box-shadow: 0 4px 8px rgba(22, 34, 29, 0.08);
  font-weight: 900;
  line-height: 1;
}

.mini-card.red {
  color: #bf2e2e;
}

.mini-card.black {
  color: #171c18;
}

.mini-card span:first-child {
  font-size: 9px;
}

.mini-card span:last-child {
  font-size: 13px;
}

.mini-card-muted {
  background: #f0f2ee;
  opacity: 0.66;
}

.mini-card-auto-skip {
  filter: grayscale(0.25);
}

.mini-card-manual-skip {
  border-color: rgba(206, 145, 34, 0.82);
  background:
    linear-gradient(135deg, rgba(244, 199, 107, 0.32), transparent 56%),
    #fffdfa;
  opacity: 0.94;
}

.mini-card-manual-skip::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 1px rgba(149, 94, 14, 0.34);
}

.mini-card-latest {
  border-color: var(--gold);
  box-shadow:
    0 4px 8px rgba(22, 34, 29, 0.08),
    0 0 0 2px rgba(244, 199, 107, 0.42);
}

.scoreboard-block {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.scoreboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.scoreboard-header .field-label {
  margin: 0;
}

.scoreboard-status,
.scoreboard-link {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.scoreboard-status {
  display: block;
  margin: -3px 0 8px;
}

.scoreboard-link {
  text-decoration: none;
}

.scoreboard-link:hover {
  color: var(--felt-dark);
}

.scoreboard-list {
  display: grid;
  gap: 7px;
}

.scoreboard-empty {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px;
  border: 1px solid #e4e8e2;
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.scoreboard-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px;
  border: 1px solid #e4e8e2;
  border-radius: 6px;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.scoreboard-row[href] {
  cursor: pointer;
}

.scoreboard-row[href]:hover {
  border-color: rgba(36, 76, 58, 0.32);
  background: rgba(47, 122, 91, 0.08);
}

.scoreboard-row[href]:focus-visible {
  outline: 3px solid rgba(244, 199, 107, 0.7);
  outline-offset: 2px;
}

.scoreboard-row-current {
  border-color: rgba(244, 199, 107, 0.78);
  background: rgba(244, 199, 107, 0.16);
}

.scoreboard-rank {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.scoreboard-player {
  min-width: 0;
}

.scoreboard-player strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scoreboard-player span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.scoreboard-score {
  color: var(--coral);
  font-size: 16px;
  font-weight: 950;
}

.scoreboard-page {
  width: min(1180px, calc(100vw - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  display: grid;
  align-content: start;
  gap: 14px;
}

.scoreboard-page-header,
.scoreboard-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 50px rgba(22, 34, 29, 0.1);
}

.scoreboard-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
}

.scoreboard-page-header h1 {
  font-size: 34px;
}

.scoreboard-page-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scoreboard-page-nav a,
.scoreboard-tab {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.scoreboard-page-nav a {
  padding: 0 12px;
}

.scoreboard-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.scoreboard-view-tab {
  min-width: 132px;
}

.scoreboard-section {
  padding: 18px;
}

.scoreboard-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.scoreboard-section-head h2 {
  font-size: 24px;
}

.scoreboard-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scoreboard-tab {
  padding: 0 14px;
  cursor: pointer;
}

.scoreboard-tab-active {
  border-color: var(--felt-dark);
  color: #fff;
  background: var(--felt);
}

.scoreboard-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.scoreboard-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.scoreboard-table th,
.scoreboard-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf0eb;
  text-align: left;
  white-space: nowrap;
}

.scoreboard-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.scoreboard-sort-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-transform: inherit;
}

.scoreboard-sort-button::after {
  content: "↓";
  opacity: 0;
}

.scoreboard-sort-button[aria-pressed="true"] {
  color: var(--felt-dark);
}

.scoreboard-sort-button[aria-pressed="true"]::after,
.scoreboard-sort-button:hover::after {
  opacity: 1;
}

.scoreboard-table td {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.scoreboard-table tr:last-child td {
  border-bottom: 0;
}

.scoreboard-table .rank-cell {
  width: 44px;
  color: var(--muted);
  font-weight: 900;
}

.scoreboard-table .score-cell {
  color: var(--coral);
  font-size: 18px;
  font-weight: 950;
}

.scoreboard-score-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 8px;
  border: 1px solid rgba(222, 98, 80, 0.28);
  border-radius: 8px;
  color: var(--coral);
  background: rgba(222, 98, 80, 0.08);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.scoreboard-score-link:hover {
  border-color: rgba(244, 199, 107, 0.9);
  background: rgba(244, 199, 107, 0.2);
}

.scoreboard-score-link-best {
  border-color: rgba(47, 122, 91, 0.32);
  color: var(--felt-dark);
  background: rgba(47, 122, 91, 0.08);
}

.scoreboard-score-link-best:hover {
  color: var(--felt-dark);
}

.scoreboard-score-link:focus-visible {
  outline: 3px solid rgba(244, 199, 107, 0.7);
  outline-offset: 2px;
}

.scoreboard-table .player-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scoreboard-table .hash-cell {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.scoreboard-table-empty {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stats-board {
  display: grid;
  gap: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.stats-card {
  min-height: 112px;
  padding: 14px;
  border: 1px solid #e4e8e2;
  border-radius: var(--radius);
  background: #fff;
}

.stats-card-primary {
  border-color: rgba(244, 199, 107, 0.72);
  background: rgba(244, 199, 107, 0.13);
}

.stats-card-label,
.stats-card-note {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.stats-card-value {
  display: block;
  margin-top: 8px;
  color: var(--felt-dark);
  font-size: 34px;
  font-weight: 950;
  line-height: 1;
}

.stats-card-note {
  margin-top: 8px;
  text-transform: none;
}

.stats-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.stats-depth-panel,
.stats-bonus-panel {
  padding: 14px;
  border: 1px solid #e4e8e2;
  border-radius: var(--radius);
  background: #fff;
}

.stats-depth-panel h3,
.stats-bonus-panel h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.stats-depth-list {
  display: grid;
  gap: 8px;
}

.stats-depth-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
}

.stats-depth-label,
.stats-depth-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.stats-depth-label {
  text-align: right;
}

.stats-depth-count {
  text-align: right;
}

.stats-depth-track {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: #e8ece6;
}

.stats-depth-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--felt), var(--gold));
}

.stats-bonus-list {
  display: grid;
  gap: 10px;
}

.stats-bonus-row {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
}

.stats-bonus-row strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.stats-bonus-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.stats-bonus-bar {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e8ece6;
}

.stats-bonus-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--felt), var(--gold));
}

.stats-chart-panel {
  padding: 14px;
  border: 1px solid #e4e8e2;
  border-radius: var(--radius);
  background: #fff;
}

.stats-chart-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.stats-chart-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.stats-chart-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.stats-chart-wrap {
  overflow-x: auto;
  padding-bottom: 2px;
}

.stats-chart {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: 170px 22px;
  gap: 6px 8px;
}

.stats-chart-y-label {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.stats-chart-bars {
  display: grid;
  grid-template-columns: repeat(var(--score-count), minmax(5px, 1fr));
  align-items: end;
  gap: 2px;
  min-height: 170px;
  padding: 8px 0 0;
  border-left: 1px solid #e4e8e2;
  border-bottom: 1px solid #e4e8e2;
}

.stats-chart-bar {
  display: block;
  min-width: 0;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--gold), var(--felt));
}

.stats-chart-x-axis {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

@media (max-width: 760px) {
  .scoreboard-page {
    width: 100%;
    min-height: 100svh;
    margin: 0;
    gap: 8px;
    padding: 8px;
  }

  .scoreboard-page-header {
    align-items: center;
    gap: 10px;
    padding: 14px;
  }

  .scoreboard-page-header h1 {
    font-size: 30px;
  }

  .scoreboard-page-nav a {
    min-height: 34px;
    padding: 0 11px;
  }

  .scoreboard-view-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .scoreboard-view-tab {
    min-width: 0;
    width: auto;
    flex: 0 0 auto;
    padding: 0 12px;
    font-size: 12px;
  }

  .scoreboard-section {
    padding: 12px;
  }

  .scoreboard-section-head {
    display: grid;
    gap: 10px;
    align-items: start;
    margin-bottom: 12px;
  }

  .scoreboard-section-head h2 {
    font-size: 19px;
    line-height: 1.15;
  }

  .scoreboard-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .scoreboard-tab {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .scoreboard-score-link {
    min-height: 30px;
    padding: 2px 9px;
  }

  .stats-detail-grid {
    grid-template-columns: 1fr;
  }
}

.pulse {
  animation: pulseText 300ms ease;
}

@keyframes dealIn {
  from {
    opacity: 0;
    transform: translateY(-18px) rotate(-5deg) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0) scale(1);
  }
}

@keyframes pulseText {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.035);
  }
}

@keyframes tutorialSheetIn {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tutorialCardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tutorialPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 9999px rgba(23, 32, 27, 0.52),
      0 0 0 7px rgba(244, 199, 107, 0.24);
  }
  50% {
    box-shadow:
      0 0 0 9999px rgba(23, 32, 27, 0.52),
      0 0 0 11px rgba(244, 199, 107, 0.34);
  }
}

@keyframes actionPulse {
  0%,
  100% {
    box-shadow: 0 10px 22px rgba(15, 111, 86, 0.24);
    transform: translateY(0);
  }
  50% {
    box-shadow:
      0 14px 28px rgba(15, 111, 86, 0.3),
      0 0 0 5px rgba(244, 199, 107, 0.28);
    transform: translateY(-1px);
  }
}

@media (max-width: 980px) {
  .screen-warning {
    display: none;
  }

  .score-map.score-map-mobile-result-hidden {
    display: none;
  }

  .game-shell {
    display: grid;
  }

  .screen-warning-card {
    width: min(420px, 100%);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 18px 50px rgba(22, 34, 29, 0.1);
  }

  .screen-warning-card h1 {
    font-size: 28px;
  }

  .screen-warning-card p:last-child {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 750;
    line-height: 1.55;
  }
}

@media (max-width: 980px) and (orientation: portrait) {
  :root {
    --card-w: 50px;
    --card-h: 72px;
    --board-grid: 28px;
    --board-row-h: 88px;
  }

  body {
    min-height: 100svh;
    overflow: auto;
  }

  .screen-warning {
    display: none;
  }

  .game-shell {
    width: 100%;
    min-height: 100svh;
    margin: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "brand"
      "board"
      "meters"
      "used"
      "bonus"
      "side";
    gap: 8px;
    padding: 8px 8px calc(180px + env(safe-area-inset-bottom));
  }

  .score-panel {
    display: contents;
  }

  .brand-line,
  .meter-stack,
  .bonus-panel,
  .board-panel,
  .side-panel,
  .action-zone {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 12px 32px rgba(22, 34, 29, 0.08);
  }

  .brand-line {
    grid-area: brand;
    min-height: 48px;
    padding: 8px 150px 8px 10px;
  }

  .title-row {
    gap: 6px;
  }

  h1 {
    font-size: 32px;
  }

  .help-button {
    width: 30px;
    height: 30px;
  }

  .title-scoreboard-link {
    min-height: 30px;
    padding: 0 8px;
    font-size: 11px;
  }

  .player-field {
    z-index: 2;
    grid-area: brand;
    align-self: center;
    justify-self: end;
    width: min(140px, 36vw);
    gap: 0;
    padding: 0 10px 0 0;
  }

  .player-hint {
    display: none;
  }

  .player-field input {
    min-height: 34px;
    padding: 0 8px;
    font-size: 12px;
  }

  .board-panel {
    grid-area: board;
    min-height: 0;
    overflow: hidden;
  }

  .board-header {
    gap: 8px;
    padding: 10px;
  }

  .board-score h2 {
    font-size: 38px;
  }

  .board-score-metrics {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .board-score-metric {
    min-width: 104px;
  }

  .best-possible-panel {
    min-width: 150px;
  }

  .best-possible-score {
    font-size: 38px;
  }

  .board-score p:last-child {
    font-size: 12px;
    line-height: 1.2;
  }

  .score-map {
    width: 46%;
    min-width: 136px;
    gap: 4px;
  }

  .score-map-head {
    font-size: 8px;
  }

  .score-map-chart {
    height: 38px;
    padding: 4px 6px 12px;
  }

  .score-map-bars {
    inset: 5px 6px 13px;
    gap: 1px;
  }

  .score-map-axis {
    right: 6px;
    left: 6px;
    font-size: 8px;
  }

  .ladder-board {
    flex: 0 0 auto;
    height: min(34.5svh, 315px);
    min-height: 225px;
    max-height: min(34.5svh, 315px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .ladder-canvas {
    padding: 14px 10px 64px;
  }

  .empty-board {
    min-height: 280px;
  }

  .ladder-row {
    padding: 0 4px var(--board-row-gap) 34px;
  }

  .ladder-row::before {
    top: 22px;
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .ladder-row:not(:last-child)::after {
    left: 11px;
    top: 50px;
  }

  .card-center {
    font-size: 27px;
  }

  .card-corner {
    top: 5px;
    left: 5px;
    font-size: 12px;
  }

  .card-corner span {
    font-size: 11px;
  }

  .card-rank {
    right: 6px;
    bottom: 5px;
    font-size: 12px;
  }

  .action-zone {
    position: fixed;
    z-index: 18;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    display: grid;
    gap: 8px;
    padding: 8px;
    background:
      linear-gradient(135deg, rgba(244, 199, 107, 0.14), transparent 58%),
      #fffdfa;
    box-shadow: 0 18px 46px rgba(22, 34, 29, 0.24);
  }

  .controls {
    grid-template-columns: 1fr 48px;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .button-primary {
    min-height: 48px;
    font-size: 18px;
  }

  .icon-button {
    width: 48px;
    min-height: 48px;
    font-size: 20px;
  }

  .decision-panel {
    grid-template-columns: 1fr;
    gap: 0;
    min-height: 0;
    padding: 8px;
  }

  .decision-panel .deck-stack {
    display: none;
  }

  .decision-body {
    grid-template-columns: calc(var(--card-w) + 8px) minmax(0, 1fr);
    grid-template-rows: 14px minmax(32px, auto) 42px;
    gap: 5px 8px;
  }

  .decision-body .field-label {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    text-align: left;
  }

  .decision-body .card-slot {
    grid-column: 1;
    grid-row: 1 / 4;
    justify-self: center;
  }

  .decision-text {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-start;
    font-size: 13px;
    line-height: 1.2;
    text-align: left;
  }

  .decision-actions {
    grid-column: 2;
    grid-row: 3;
    gap: 8px;
  }

  .button {
    min-height: 42px;
    padding: 0 10px;
  }

  .meter-stack {
    grid-area: meters;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    padding: 8px;
  }

  .meter-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px;
    min-height: 40px;
    align-content: center;
  }

  .meter-row > span {
    width: auto;
    font-size: 10px;
  }

  .meter-row strong {
    width: auto;
    font-size: 12px;
  }

  .meter-track {
    grid-column: 1 / -1;
    height: 6px;
  }

  .bonus-panel {
    grid-area: bonus;
    gap: 8px;
    padding: 9px;
  }

  .bonus-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .bonus-row {
    grid-template-columns: 1fr auto;
    gap: 4px 6px;
    min-height: 44px;
    padding: 6px;
  }

  .bonus-row span,
  .bonus-row strong {
    font-size: 11px;
  }

  .bonus-row small {
    grid-column: 1 / -1;
    font-size: 10px;
    text-align: left;
  }

  .last-card-block {
    display: none;
  }

  .side-panel {
    display: contents;
  }

  .used-block {
    grid-area: used;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 12px 32px rgba(22, 34, 29, 0.08);
  }

  .used-cards {
    grid-template-columns: repeat(auto-fill, minmax(16px, 1fr));
    gap: 3px;
    max-height: none;
    overflow: hidden;
  }

  .used-cards .mini-card {
    height: 24px;
    padding: 2px 1px;
    border-radius: 4px;
  }

  .used-cards .mini-card span:first-child {
    font-size: 7px;
  }

  .used-cards .mini-card span:last-child {
    font-size: 10px;
  }

  .scoreboard-block {
    grid-area: side;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 12px 32px rgba(22, 34, 29, 0.08);
  }
}

@media (max-width: 980px) and (orientation: landscape) and (min-width: 640px) {
  :root {
    --card-w: 54px;
    --card-h: 78px;
    --board-grid: 32px;
    --board-row-h: 96px;
  }

  body {
    overflow: auto;
  }

  .screen-warning {
    display: none;
  }

  .game-shell {
    width: calc(100vw - 12px);
    min-height: calc(100vh - 12px);
    margin: 6px auto;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-areas:
      "score board"
      "side board";
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
  }

  .score-panel {
    grid-area: score;
    gap: 10px;
    padding: 10px;
  }

  .board-panel {
    grid-area: board;
    min-height: calc(100vh - 12px);
    max-height: calc(100vh - 12px);
  }

  .side-panel {
    grid-area: side;
    gap: 10px;
    min-height: 0;
    padding: 10px;
    overflow: auto;
  }

  .brand-line {
    gap: 8px;
  }

  h1 {
    font-size: 30px;
  }

  .help-button {
    width: 28px;
    height: 28px;
  }

  .title-scoreboard-link {
    min-height: 28px;
    padding: 0 8px;
    font-size: 11px;
  }

  .player-field input {
    min-height: 36px;
    padding: 0 10px;
    font-size: 13px;
  }

  .controls {
    grid-template-columns: 1fr 46px;
    gap: 8px;
    padding: 8px;
  }

  .button-primary {
    min-height: 48px;
    font-size: 16px;
  }

  .icon-button {
    width: 46px;
    font-size: 20px;
  }

  .decision-panel {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
    min-height: 226px;
    padding: 10px;
  }

  .deck-stack {
    width: 62px;
    height: 82px;
  }

  .decision-text {
    font-size: 12px;
  }

  .decision-actions {
    gap: 6px;
  }

  .decision-body {
    grid-template-rows: 14px var(--card-h) 34px 38px;
    gap: 6px;
  }

  .button {
    min-height: 38px;
    padding: 0 10px;
  }

  .meter-stack {
    gap: 7px;
  }

  .meter-row {
    min-height: 18px;
  }

  .bonus-panel {
    gap: 8px;
    padding: 10px;
  }

  .bonus-list {
    gap: 5px;
  }

  .bonus-row {
    grid-template-columns: minmax(78px, 1fr) minmax(62px, auto) 34px;
    min-height: 28px;
    padding: 5px 7px;
  }

  .bonus-row span,
  .bonus-row strong {
    font-size: 11px;
  }

  .bonus-row small {
    font-size: 10px;
  }

  .board-header {
    gap: 10px;
    padding: 10px 12px;
  }

  .board-score h2 {
    font-size: 34px;
  }

  .board-score-metrics {
    gap: 18px;
  }

  .best-possible-score {
    font-size: 34px;
  }

  .board-score p:last-child {
    font-size: 12px;
  }

  .score-map {
    width: min(230px, 46%);
    min-width: 150px;
    gap: 4px;
  }

  .score-map-head {
    font-size: 9px;
  }

  .score-map-chart {
    height: 38px;
    padding: 4px 6px 12px;
  }

  .score-map-bars {
    inset: 5px 6px 13px;
    gap: 1px;
  }

  .score-map-axis {
    right: 6px;
    left: 6px;
    font-size: 8px;
  }

  .ladder-board {
    min-height: 0;
  }

  .ladder-canvas {
    padding: 16px;
  }

  .ladder-row {
    padding: 0 6px var(--board-row-gap) 40px;
  }

  .ladder-row::before {
    top: 25px;
    width: 26px;
    height: 26px;
    font-size: 11px;
  }

  .ladder-row:not(:last-child)::after {
    left: 12px;
    top: 55px;
  }

  .card-center {
    font-size: 30px;
  }

  .card-corner {
    top: 6px;
    left: 6px;
    font-size: 13px;
  }

  .card-corner span {
    font-size: 12px;
  }

  .card-rank {
    right: 7px;
    bottom: 6px;
    font-size: 13px;
  }

  .used-block {
    padding-bottom: 10px;
  }

  .used-cards {
    max-height: 126px;
  }

  .scoreboard-block {
    padding-top: 10px;
  }

  .scoreboard-list {
    gap: 5px;
  }

  .scoreboard-row {
    min-height: 36px;
    padding: 6px;
  }

  .scoreboard-empty {
    min-height: 36px;
    padding: 6px;
  }
}
