:root {
  --ink: #f7f1e4;
  --ink-soft: #dfe4dc;
  --muted: #a9b5ae;
  --felt: #155242;
  --felt-deep: #062a22;
  --panel: #0a3229;
  --panel-deep: #07271f;
  --line: rgba(226, 241, 232, 0.14);
  --line-strong: rgba(226, 241, 232, 0.24);
  --gold: #efd38f;
  --gold-soft: #f8e8bd;
  --bonus-blue: #8cb8e8;
  --coral: #ef8063;
  --mint: #76d6b3;
  --cream: #f3ead7;
  --shadow: 0 28px 80px rgba(0, 14, 11, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--felt-deep);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -5%, rgba(67, 158, 123, 0.34), transparent 34rem),
    radial-gradient(circle at 88% 16%, rgba(239, 211, 143, 0.09), transparent 28rem),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.025) 1px, transparent 0),
    linear-gradient(145deg, #124c3e, #05241d 72%);
  background-size: auto, auto, 10px 10px, auto;
}

button, select { font: inherit; }
button { color: inherit; }

.page-shell { width: min(1400px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 36px; }
.site-footer { margin-top: 26px; color: var(--muted); font-size: 0.68rem; font-variant-numeric: tabular-nums; letter-spacing: 0.12em; text-align: center; text-transform: uppercase; }
.site-footer [data-site-version] { color: var(--gold-soft); }
.eyebrow, .panel-kicker { margin: 0; color: var(--gold-soft); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.game-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-lockup > span:last-child { display: grid; gap: 1px; }
.brand-lockup strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.22rem; font-weight: 600; letter-spacing: -0.02em; }
.brand-lockup small { color: var(--muted); font-size: 0.61rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #14382e; background: var(--cream); box-shadow: inset 0 -3px 0 rgba(21, 82, 66, 0.14); font: 800 0.92rem/1 ui-sans-serif, system-ui, sans-serif; transform: rotate(-4deg); }
.top-controls { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.top-action { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--ink-soft); background: rgba(255, 255, 255, 0.045); font-size: 0.72rem; font-weight: 760; line-height: 1.2; text-decoration: none; cursor: pointer; transition: transform 140ms ease, border-color 140ms ease, background 140ms ease; }
.top-action:hover { border-color: var(--mint); background: rgba(133, 216, 185, 0.12); transform: translateY(-1px); }
.top-action:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; }
.new-game-dialog { width: min(420px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 18px; padding: 22px; color: var(--ink); background: #102f28; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45); }
.new-game-dialog::backdrop { background: rgba(2, 12, 10, 0.72); backdrop-filter: blur(4px); }
.new-game-dialog h3 { margin: 5px 0 0; font-family: Georgia, serif; font-size: 1.6rem; font-weight: 500; }
.new-game-options { display: grid; gap: 10px; margin-top: 20px; }
.mode-option { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: var(--ink); background: rgba(255, 255, 255, 0.05); text-align: left; cursor: pointer; }
.mode-option:hover:not(:disabled) { border-color: var(--mint); background: rgba(133, 216, 185, 0.12); }
.mode-option strong { font-size: 0.9rem; }
.mode-option span { color: var(--muted); font-size: 0.78rem; }
.mode-option:disabled { cursor: not-allowed; opacity: 0.42; }
.test-dice-option { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; color: var(--muted); font-size: 0.78rem; line-height: 1.35; }
.test-dice-option input { flex: 0 0 auto; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--mint); }
.test-dice-option span { display: grid; gap: 3px; }
.test-dice-option strong { color: var(--ink); font-size: 0.8rem; }
.test-dice-option small { color: var(--muted); font-size: inherit; }
.dialog-close { margin-top: 16px; }
select { border: 1px solid var(--line); border-radius: 12px; padding: 10px 36px 10px 12px; color: var(--ink); background: rgba(4, 24, 20, 0.76); }

.button { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 760; cursor: pointer; transition: transform 140ms ease, opacity 140ms ease, background 140ms ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: 0.42; }
.button-primary { min-width: 210px; min-height: 48px; color: #12382e; background: var(--gold); box-shadow: 0 12px 30px rgba(239, 211, 143, 0.18), inset 0 -3px 0 rgba(72, 55, 18, 0.16); font-size: 0.96rem; }
.button-secondary { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); }

.policy-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 9px 14px; margin-top: auto; }
.policy-status { display: flex; gap: 9px; align-items: center; width: fit-content; margin: 0; color: var(--muted); font-size: 0.8rem; }
.status-light { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 5px rgba(114, 209, 174, 0.12); animation: pulse 1.3s infinite; }
.policy-status.is-ready .status-light { background: var(--mint); box-shadow: 0 0 0 5px rgba(133, 216, 185, 0.12); animation: none; }
.policy-status.is-error .status-light { background: var(--coral); animation: none; }
@keyframes pulse { 50% { opacity: 0.4; } }

.game-layout { display: grid; grid-template-columns: minmax(270px, 340px) minmax(520px, 720px) minmax(270px, 340px); justify-content: center; gap: 18px; align-items: start; }
body[data-mode="solo"] .game-layout { grid-template-columns: minmax(280px, 350px) minmax(560px, 760px); }
.scorecard-panel, .table-panel { border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: var(--shadow); }
.scorecard-panel { overflow: hidden; }
.back-to-table, .scorecard-jump { display: none; }
.table-panel { position: sticky; top: 18px; display: flex; flex-direction: column; gap: 15px; padding: 20px; background: linear-gradient(160deg, #0b362c, #072920); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; min-height: 76px; padding: 13px 18px; background: rgba(255, 255, 255, 0.018); }
.panel-heading h2, .turn-copy h2, .hint-card h3 { margin: 4px 0 0; font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
.panel-heading h2 { font-size: 1.3rem; }
.score-total { display: grid; place-items: center; min-width: 58px; height: 46px; padding: 0 10px; border-radius: 14px; color: #17382f; background: var(--gold); box-shadow: inset 0 -3px 0 rgba(72, 55, 18, 0.14); font-size: 1.25rem; }

.scorecard { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.scorecard th, .scorecard td { border-top: 1px solid var(--line); padding: 8px 14px; text-align: left; }
.scorecard td { text-align: right; }
.scorecard td { width: 76px; font-variant-numeric: tabular-nums; }
.scorecard .scorecard-section th { border-top: 1px solid var(--line-strong); padding-top: 13px; padding-bottom: 5px; color: var(--gold-soft); font-size: 0.63rem; letter-spacing: 0.12em; text-transform: uppercase; }
.scorecard .scorecard-section:first-child th { border-top: 0; }
.scorecard .scorecard-summary th, .scorecard .scorecard-summary td { padding-top: 9px; padding-bottom: 9px; color: var(--muted); background: rgba(0, 0, 0, 0.08); font-size: 0.76rem; }
.scorecard .scorecard-summary th { padding-left: 22px; }
.scorecard .scorecard-summary td { color: var(--ink-soft); font-weight: 700; }
.scorecard .bonus-display { display: inline-grid; grid-template-columns: 32px 52px; align-items: center; column-gap: 8px; vertical-align: middle; }
.scorecard .bonus-indicator { width: 32px; font-variant-numeric: tabular-nums; font-weight: 750; line-height: 1; text-align: right; }
.scorecard .bonus-value { display: inline-grid; place-items: center; width: 52px; min-width: 52px; min-height: 34px; font-variant-numeric: tabular-nums; font-weight: 750; line-height: 1; }
.scorecard .bonus-summary td { white-space: nowrap; }
.scorecard tr.bonus-summary.is-possible th, .scorecard tr.bonus-summary.is-possible td { color: var(--bonus-blue); background: rgba(140, 184, 232, 0.1); }
.scorecard tr.bonus-summary.is-impossible th, .scorecard tr.bonus-summary.is-impossible td { color: var(--coral); background: rgba(240, 120, 92, 0.1); }
.scorecard tr.bonus-summary.is-obtained th, .scorecard tr.bonus-summary.is-obtained td { color: var(--mint); background: rgba(133, 216, 185, 0.1); }
.scorecard .bonus-summary th, .scorecard .bonus-summary td { font-size: inherit; }
.scorecard .bonus-summary th { padding-left: 14px; }
.scorecard tbody tr.is-open:not(.is-recommended) th { color: var(--ink-soft); }
.scorecard tbody tr.is-filled { color: var(--ink); }
.scorecard tbody tr.is-filled td { font-weight: 700; }
.score-slot { display: inline-grid; place-items: center; min-width: 52px; min-height: 34px; color: var(--ink); font-variant-numeric: tabular-nums; }
.score-slot.is-empty { color: #6f7c77; }
.score-slot.is-filled { font-weight: 750; }
.score-result { position: relative; display: inline-block; white-space: nowrap; vertical-align: middle; }
.yahtzee-bonus { position: absolute; top: 50%; right: calc(100% + 8px); color: var(--mint); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.02em; transform: translateY(-50%); }
.scorecard tbody tr.is-open:not(.is-recommended):hover { background: rgba(133, 216, 185, 0.06); }
.scorecard tr.is-recommended { background: rgba(133, 216, 185, 0.12); }
.scorecard tr.is-recommended th { position: relative; color: var(--mint); }
.scorecard tr.is-recommended th::before { position: absolute; top: 5px; bottom: 5px; left: 0; width: 3px; border-radius: 0 3px 3px 0; background: var(--mint); content: ""; }
.scorecard button { width: 52px; min-height: 34px; border: 1px solid rgba(118, 214, 179, 0.48); border-radius: 9px; padding: 5px 8px; color: var(--ink); background: rgba(118, 214, 179, 0.1); font-weight: 800; cursor: pointer; }
.scorecard button:hover:not(:disabled) { border-color: var(--mint); background: rgba(133, 216, 185, 0.2); }
.scorecard button:disabled { border-color: rgba(114, 209, 174, 0.16); color: #6f7c77; background: rgba(114, 209, 174, 0.04); cursor: default; }
.scorecard button.is-zero-score { border-color: rgba(240, 120, 92, 0.24); color: #c09b91; background: rgba(240, 120, 92, 0.045); }
.scorecard button.is-zero-score:hover:not(:disabled) { border-color: rgba(240, 120, 92, 0.42); background: rgba(240, 120, 92, 0.1); }
.scorecard tr.is-recommended button { border-color: var(--mint); color: var(--mint); background: rgba(133, 216, 185, 0.16); }
.play-surface { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 15px; border: 1px solid rgba(248, 232, 189, 0.16); border-radius: 22px; padding: 24px 20px 20px; background: radial-gradient(circle at 50% 42%, rgba(43, 123, 95, 0.45), transparent 58%), linear-gradient(145deg, #14513f, #0b3a2e); box-shadow: inset 0 0 44px rgba(0, 18, 14, 0.38); }
.play-surface::before { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.035) 1px, transparent 0); background-size: 8px 8px; content: ""; }
.play-surface > * { position: relative; z-index: 1; }
.turn-copy { text-align: center; }
.turn-copy h2 { margin-top: 5px; font-size: clamp(2.25rem, 4vw, 3.15rem); line-height: 1; letter-spacing: -0.035em; }
.turn-copy .panel-kicker { margin-top: 0; }
.turn-instruction { margin: 8px 0 0; color: #bdd0c7; font-size: 0.76rem; }
.dice-row { display: flex; align-items: center; justify-content: center; gap: clamp(8px, 1.2vw, 13px); min-height: 94px; padding: 0; }
.die {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: clamp(58px, 8vw, 76px);
  height: clamp(64px, 8vw, 82px);
  border: 3px solid transparent;
  border-radius: 17px;
  color: #173b31;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.8), transparent 34%),
    linear-gradient(145deg, #fffaf0, #e9dcc3);
  box-shadow: inset 0 -5px 0 #d5c5a8, 0 12px 24px rgba(0, 20, 15, 0.38);
  font-family: Georgia, serif;
  font-size: clamp(2.7rem, 6vw, 4rem);
  line-height: 1;
  cursor: pointer;
  transform-origin: center;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  will-change: transform;
}
.die > span { position: relative; z-index: 1; }
.die-face {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 72%;
  height: 72%;
}
.pip {
  align-self: center;
  justify-self: center;
  width: clamp(9px, 1.35vw, 14px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #17483a;
  box-shadow: inset 0 -1px 1px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(255, 255, 255, 0.35);
}
.pip-top-left { grid-area: 1 / 1; }
.pip-top-right { grid-area: 1 / 3; }
.pip-middle-left { grid-area: 2 / 1; }
.pip-center { grid-area: 2 / 2; }
.pip-middle-right { grid-area: 2 / 3; }
.pip-bottom-left { grid-area: 3 / 1; }
.pip-bottom-right { grid-area: 3 / 3; }
.die:hover:not(:disabled) {
  border-color: var(--gold);
  box-shadow: inset 0 -5px 0 #d5c5a8, 0 0 0 3px rgba(239, 211, 143, 0.18), 0 14px 26px rgba(0, 0, 0, 0.3);
}
.die:disabled { opacity: 1; cursor: default; }
.die.is-held {
  border-color: var(--gold);
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.85), transparent 32%),
    linear-gradient(145deg, #fff4cf, #e8ce8c);
  transform: translateY(-9px);
  box-shadow: inset 0 -5px 0 #cfb66f, 0 0 0 3px rgba(239, 211, 143, 0.24), 0 14px 26px rgba(0, 0, 0, 0.38);
}
.die.is-recommended { box-shadow: inset 0 -5px 0 #d5c5a8, 0 0 0 4px rgba(118, 214, 179, 0.72), 0 12px 25px rgba(0, 0, 0, 0.3); }
.dice-row.is-rolling .die:not(.is-held) { animation: roll-die 520ms cubic-bezier(0.22, 0.78, 0.28, 1) both; }
.dice-row.is-rolling .die:nth-child(2) { animation-delay: 45ms; }
.dice-row.is-rolling .die:nth-child(3) { animation-delay: 90ms; }
.dice-row.is-rolling .die:nth-child(4) { animation-delay: 135ms; }
.dice-row.is-rolling .die:nth-child(5) { animation-delay: 180ms; }
@keyframes roll-die {
  0% { opacity: 0.4; transform: translateY(12px) rotate(-18deg) scale(0.82); }
  35% { opacity: 1; transform: translateY(-17px) rotate(150deg) scale(1.08); }
  68% { transform: translateY(4px) rotate(300deg) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) rotate(360deg) scale(1); }
}
.die-empty { color: rgba(23, 72, 58, 0.38); background: linear-gradient(145deg, #f3ead7, #dbceb5); box-shadow: inset 0 -5px 0 #cab99a, 0 10px 18px rgba(0, 20, 15, 0.28); }
.roll-controls { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.hint-card { display: flex; min-height: 142px; flex-direction: column; gap: 10px; margin-top: 0; overflow: hidden; border: 1px solid rgba(118, 214, 179, 0.2); border-radius: 18px; padding: 10px; background: var(--panel-deep); }
.hint-toolbar { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding: 0 2px; }
.coach-heading { display: flex; align-items: center; gap: 9px; }
.coach-heading > div { display: grid; gap: 2px; }
.coach-icon { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid rgba(239, 211, 143, 0.24); border-radius: 9px; color: var(--gold); background: rgba(239, 211, 143, 0.08); }
.hint-mode-control { display: grid; flex: 0 0 auto; margin: 0 -10px 0 0; transform: translateY(-10px); }
.hint-mode-selector { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; min-width: 232px; border: 1px solid rgba(239, 211, 143, 0.2); border-top: 0; border-right: 0; border-radius: 0 0 0 12px; padding: 3px; background: rgba(255, 255, 255, 0.045); }
.hint-mode-option { position: relative; display: grid; min-width: 0; cursor: pointer; }
.hint-mode-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.hint-mode-option span { display: grid; min-height: 28px; place-items: center; border-radius: 8px; padding: 5px 8px; color: var(--muted); font-size: 0.65rem; font-weight: 750; line-height: 1.1; text-align: center; transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease; }
.hint-mode-option input:checked + span { color: #17382f; background: var(--gold); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18); }
.hint-mode-option:hover span { color: var(--ink); }
.hint-mode-option input:checked:hover + span { color: #17382f; }
.hint-mode-option input:focus-visible + span { outline: 2px solid var(--mint); outline-offset: 2px; }
.hint-pane-heading { display: flex; min-height: 30px; align-items: center; gap: 8px; text-align: left; }
.hint-pane-heading > div { min-width: 0; }
.hint-pane-heading .panel-kicker { margin: 0; font-size: 0.62rem; }
.hint-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.hint-pane { position: relative; min-inline-size: 0; display: flex; min-height: 0; flex-direction: column; gap: 6px; margin: 0; border: 1px solid rgba(118, 214, 179, 0.16); border-radius: 14px; padding: 9px 11px 8px; background: rgba(255, 255, 255, 0.025); }
.hint-pane-heading { width: max-content; max-width: 100%; margin-left: 0; padding: 0 7px; background: transparent; }
.dice-hint-pane .hint-pane-heading { padding-right: 7px; }
.score-choice-pane > .hint-toggle,
.dice-hint-pane > .hint-toggle { position: absolute; top: -15px; right: 11px; margin: 0; border-radius: 999px; padding: 3px 5px; background: var(--panel-deep); transform: translateY(-50%); }
.hint-card > .hint-columns,
.hint-card > .hint-output { flex: 1 1 auto; min-height: 0; }
.hint-pane-output,
.hint-pane .hint-output { display: flex; min-height: 38px; flex: 1 1 auto; align-items: center; justify-content: center; overflow: hidden; }
.hint-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.62rem; cursor: pointer; }
.hint-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.hint-toggle-track { display: inline-flex; order: 2; align-items: center; width: 32px; height: 18px; border: 1px solid rgba(133, 216, 185, 0.3); border-radius: 999px; padding: 2px; background: rgba(255, 255, 255, 0.08); transition: background 160ms ease, border-color 160ms ease; }
.hint-toggle-track span { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform 160ms ease, background 160ms ease; }
.hint-toggle input:checked + .hint-toggle-track { border-color: rgba(133, 216, 185, 0.64); background: rgba(133, 216, 185, 0.22); }
.hint-toggle input:checked + .hint-toggle-track span { background: var(--mint); transform: translateX(14px); }
.hint-toggle input:focus-visible + .hint-toggle-track { outline: 2px solid var(--gold); outline-offset: 3px; }
.expected-score { min-height: 1.45em; margin: 0; color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; text-align: center; }
.expected-score:empty { display: none; }
.hint-output { min-height: 42px; margin-top: 0; color: #c2cdc7; font-size: 0.76rem; line-height: 1.38; text-align: center; }
.hint-card > .hint-output { overflow: hidden; }
.hint-output p { margin: 0; }
.hint-placeholder { max-width: 220px; margin-inline: auto !important; color: #aebbb4; font-size: 0.69rem; }
.hint-feedback { display: grid; gap: 4px; font-weight: 800; }
.hint-feedback.is-optimal .hint-feedback-line { color: var(--mint); }
.hint-feedback.is-not-optimal .hint-feedback-line { color: var(--coral); }
.hint-feedback-line { margin: 0; border-radius: 999px; padding: 6px 12px; background: rgba(118, 214, 179, 0.08); font-size: 0.79rem; }
.hint-feedback.is-not-optimal .hint-feedback-line { background: rgba(239, 128, 99, 0.08); }
.hint-feedback-marker { display: inline-block; width: 1.15em; }
.continuous-hint-body { height: 100%; align-items: stretch; }
.continuous-hint-primary { text-align: center; }
.hint-output ul { margin: 0; padding: 0; list-style: none; }
.hint-pane-output > ul { width: max-content; max-width: 100%; }
.hint-output li { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 12px; align-items: baseline; padding: 3px 0; }
.hint-output li span { text-align: right; }
.hint-output li small { text-align: right; }
.hint-output small { color: var(--coral); font-variant-numeric: tabular-nums; }
.continuous-hint-secondary .hint-pane-output > ul { display: flex; width: 100%; max-width: none; flex-wrap: wrap; justify-content: center; gap: 6px; }
.continuous-hint-secondary .hint-pane-output > ul li { display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(118, 214, 179, 0.2); border-radius: 999px; padding: 6px 10px; color: var(--ink-soft); background: rgba(118, 214, 179, 0.06); }
.continuous-hint-secondary .hint-pane-output > ul li span { text-align: left; }
.continuous-hint-secondary .hint-pane-output > ul li small { text-align: right; }
.error-copy { color: #ff9c86; }

.rules-disclosure { position: relative; }
.rules-disclosure summary { cursor: pointer; list-style: none; }
.rules-disclosure summary::-webkit-details-marker { display: none; }
.rules-panel { position: absolute; z-index: 5; top: calc(100% + 12px); left: 50%; width: min(360px, calc(100vw - 40px)); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; color: var(--muted); background: #102f28; box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3); line-height: 1.45; transform: translateX(-50%); }
.rules-panel-title { margin: 0 !important; color: var(--ink); font-weight: 700; }
.rules-panel ul { margin: 8px 0 0; padding-left: 17px; }
.rules-panel li + li { margin-top: 5px; }
code { color: var(--mint); }
.is-hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.technical-article { width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 80px; }
.technical-article h1 { margin: 8px 0 20px; font-family: Georgia, serif; font-size: clamp(2.7rem, 7vw, 5rem); font-weight: 500; line-height: 1; letter-spacing: -0.045em; }
.technical-article h2 { margin: 38px 0 10px; font-family: Georgia, serif; font-size: 1.8rem; font-weight: 500; }
.technical-article p { color: #c6cbc6; font-size: 1rem; line-height: 1.75; }
.technical-article .article-lead { color: var(--ink); font-size: 1.25rem; }
.back-link { display: inline-block; margin-bottom: 48px; color: var(--gold-soft); text-decoration: none; }
.equation-card { overflow-x: auto; margin: 24px 0; border: 1px solid var(--line); border-radius: 16px; padding: 22px; background: rgba(0, 0, 0, 0.2); text-align: center; }
.equation-card mjx-container[display="true"] { margin: 0 !important; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.keep-example { overflow-x: auto; margin: 18px 0; border-left: 3px solid var(--mint); padding: 12px 16px; color: var(--gold-soft); background: rgba(0, 0, 0, 0.2); font: 0.9rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.article-cta { display: inline-block; margin-top: 30px; text-decoration: none; }
.technical-article .site-footer { margin-top: 54px; }

@media (min-width: 741px) and (max-height: 850px) {
  .scorecard-panel .panel-heading { padding: 10px 16px 8px; }
  .scorecard { font-size: 0.78rem; }
  .scorecard th, .scorecard td { padding: 6px 14px; }
  .scorecard .scorecard-section th { padding-top: 9px; padding-bottom: 3px; }
  .scorecard .scorecard-summary th, .scorecard .scorecard-summary td { padding-top: 6px; padding-bottom: 6px; }
  .scorecard .score-slot, .scorecard .bonus-value { min-height: 28px; }
  .scorecard button { min-height: 28px; padding-top: 3px; padding-bottom: 3px; }
}

@media (max-width: 1080px) {
  .game-layout { grid-template-columns: minmax(250px, 0.85fr) minmax(390px, 1.3fr); }
  body[data-mode="solo"] .game-layout { grid-template-columns: minmax(260px, 330px) minmax(500px, 680px); }
  #ai-panel { grid-column: 1; grid-row: 2; }
  .table-panel { grid-column: 2; grid-row: 1 / span 2; }
}

@media (max-width: 740px) {
  .page-shell { width: min(100% - 20px, 620px); padding-top: 18px; }
  .game-header { gap: 10px; }
  .brand-lockup small { display: none; }
  .brand-lockup strong { font-size: 1.05rem; }
  .brand-mark { width: 34px; height: 34px; }
  .top-controls { min-width: 0; flex: 1 1 auto; justify-content: flex-end; }
  .top-controls > * { flex: 1 1 0; }
  .top-action { width: 100%; min-height: 36px; padding-inline: 5px; font-size: 0.66rem; }
  .game-layout { display: flex; flex-direction: column; }
  .table-panel { position: static; order: -1; width: 100%; min-height: 0; gap: 12px; padding: 14px; scroll-margin-top: 10px; }
  .scorecard-panel { width: 100%; }
  .human-panel { scroll-margin-top: 10px; }
  .back-to-table { display: block; margin-top: 5px; color: var(--muted); font-size: 0.68rem; text-decoration: none; }
  .scorecard-jump { display: flex; align-items: center; justify-content: space-between; min-height: 46px; border: 1px solid var(--line); border-radius: 13px; padding: 0 14px; color: var(--ink); background: rgba(255, 255, 255, 0.04); font-size: 0.78rem; font-weight: 750; text-decoration: none; }
  .scorecard-jump strong { color: var(--gold-soft); font-variant-numeric: tabular-nums; }
  .play-surface { gap: 12px; padding: 20px 10px 16px; }
  .turn-copy h2 { font-size: 2.45rem; }
  .dice-row { gap: 6px; }
  .die { width: calc((100vw - 82px) / 5); max-width: 68px; height: 68px; border-radius: 13px; font-size: 2.7rem; }
  .button-primary { width: min(100%, 260px); }
  .hint-card { min-height: 0; padding: 10px; }
  .hint-card > .hint-output { flex: 0 0 auto; overflow: visible; }
  .continuous-hint-body { height: auto; }
  .continuous-hint-body .hint-pane-output { flex: 0 0 auto; overflow: visible; }
  .dice-hint-pane .hint-pane-heading { padding-right: 7px; }
  .hint-columns { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .policy-bar { margin-top: 2px; }
}

@media (max-width: 380px) {
  .game-header { flex-wrap: wrap; }
  .brand-lockup { width: 100%; }
  .top-controls { width: 100%; }
  .hint-toolbar { flex-wrap: wrap; }
  .hint-mode-control { width: 100%; margin-right: 0; transform: none; }
  .hint-mode-selector { width: 100%; border: 1px solid rgba(239, 211, 143, 0.2); border-radius: 12px; }
  .hint-columns { grid-template-columns: 1fr; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .dice-row.is-rolling .die:not(.is-held) {
    animation: none;
  }
}
