:root {
  --bg: #ebe6dc;
  --ink: #111111;
  --paper: #fffdf7;
  --muted: #70695f;
  --line: #d9d0c3;
  --blue: #2458ff;
  --yellow: #ffbe0b;
  --red: #d82626;
  --green: #087f5b;
  --shadow: 8px 8px 0 var(--ink);
  --radius: 22px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 1120px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}
button, input { font: inherit; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:disabled:hover { transform: none; box-shadow: none; }

.app {
  --board-width: min(1240px, calc(100vw - 24px));
  --left-col: minmax(0, 1fr);
  --right-col: 500px;
  width: var(--board-width);
  margin: 0 auto;
  padding: 8px 0 24px;
}

.topbar, .panel, .team-public-card {
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "market title actions";
  align-items: center;
  gap: 12px;
  width: var(--board-width);
  margin: 0 auto 18px;
  padding: 10px 14px;
  border-radius: 24px;
  background: var(--paper);
}

.topbar > div:first-child {
  grid-area: title;
  text-align: center;
  justify-self: center;
}

.top-market-summary {
  grid-area: market;
  justify-self: start;
}

.top-actions {
  grid-area: actions;
  justify-self: end;
}

body[data-phase="setup"] .topbar {
  grid-template-columns: 1fr;
  grid-template-areas: "title";
}

body[data-phase="setup"] .top-market-summary,
body[data-phase="setup"] .top-actions {
  display: none;
}

h1, h2, h3, p { margin: 0; }
h1 {
  font-size: clamp(32px, 3.7vw, 50px);
  letter-spacing: -0.08em;
  line-height: 0.88;
}
h2 {
  font-size: 26px;
  line-height: 0.95;
  letter-spacing: -0.06em;
}
h3 {
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.055em;
}

.eyebrow, .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow { margin-bottom: 5px; }

.top-actions, .button-row, .choice-row, .setup-actions, .timer-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.header-settings {
  position: relative;
  z-index: 30;
}

.header-settings summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 950;
  cursor: pointer;
  list-style: none;
}

.header-settings summary::-webkit-details-marker {
  display: none;
}

.settings-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  min-width: 250px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: none;
  overflow: hidden;
}

.menu-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: none;
  border-bottom: 3px solid var(--ink);
}

.menu-check:last-child {
  border-bottom: 0;
}

.menu-check input {
  width: 22px;
  height: 22px;
  accent-color: var(--blue);
}

.top-market-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(78px, 1fr));
  gap: 7px;
  min-width: 360px;
}
.top-market-summary.is-empty {
  display: none;
}

.header-suit-chip {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: 0 7px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: white;
  padding: 7px 9px;
  line-height: 1;
  min-height: 62px;
}

.header-suit-chip > span:first-child {
  font-size: 24px;
  font-weight: 1000;
}

.header-suit-chip strong {
  font-size: 21px;
  font-weight: 1000;
}

.header-price {
  grid-column: 1 / -1;
  margin-top: 5px;
  border-top: 3px solid var(--ink);
  padding-top: 4px;
  color: var(--ink);
  font-size: 27px;
  font-weight: 1000;
  letter-spacing: -0.08em;
  text-align: center;
}

.top-market-summary.counts-hidden .header-suit-chip {
  grid-template-columns: 1fr;
}

.top-market-summary.counts-hidden .header-suit-chip > span:first-child {
  text-align: center;
}

.top-market-summary.prices-hidden .header-suit-chip {
  min-height: 48px;
}

.is-active-toggle {
  background: var(--yellow);
}

.button, .choice-button, .step-button {
  appearance: none;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 950;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.button { padding: 10px 14px; }
.button-small { padding: 7px 11px; font-size: 13px; }
.button:hover, .choice-button:hover, .step-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 0 var(--ink);
}
.button:active, .choice-button:active, .step-button:active {
  transform: translateY(2px);
  box-shadow: none;
}
.button-primary { background: var(--blue); color: white; }
.button-secondary { background: var(--yellow); }
.button-danger { background: var(--red); color: white; }
.button-ghost { background: transparent; color: inherit; }

.screen { display: none; }
.screen.is-active { display: grid; gap: 12px; }

.panel {
  border-radius: var(--radius);
  background: var(--paper);
  padding: 16px;
}
.panel-black {
  background: var(--ink);
  color: var(--paper);
}
.panel-black .eyebrow, .panel-black .label { color: #c9c3b8; }
.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.compact-title-row { margin-bottom: 14px; }

.setup-card {
  width: var(--board-width);
  margin: 0 auto;
  padding: 22px;
}
.setup-title { margin-bottom: 14px; }

.primary-setup-actions {
  margin-bottom: 16px;
}

.settings-details {
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: #fff;
  padding: 0;
}

.settings-details summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 1000;
  letter-spacing: -0.02em;
  list-style-position: inside;
}

.settings-details[open] summary {
  border-bottom: 3px solid var(--ink);
}

.settings-details .setup-grid {
  padding: 16px;
}
.setup-title h2 { font-size: clamp(38px, 5vw, 60px); }
.setup-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 0;
}
.field-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.field-label input[type="number"] {
  height: 58px;
  min-height: 58px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 26px;
  font-weight: 950;
}
.field-label input:disabled {
  background: #d6d0c6;
  color: #7c746b;
  border-color: #7c746b;
}
.checkbox-line {
  height: 58px;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 18px;
  letter-spacing: 0;
  text-transform: none;
}
.checkbox-line input { width: 24px; height: 24px; accent-color: var(--blue); }

.is-hidden { display: none !important; }

.setup-hands-panel {
  width: var(--board-width);
  margin: 0 auto;
}

.setup-hands-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.setup-hand-card {
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: #fff;
  padding: 14px;
}

.setup-hand-card[data-team="A"] { background: #fff8d7; }
.setup-hand-card[data-team="B"] { background: #e9f1ff; }
.setup-hand-card[data-team="C"] { background: #e8fff3; }
.setup-hand-card[data-team="D"] { background: #fff0ee; }

.setup-hand-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.setup-hand-top strong {
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: white;
  padding: 5px 10px;
  font-size: 18px;
  line-height: 1;
}

.suit-count-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.suit-count-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 3px solid var(--ink);
  border-radius: 15px;
  background: var(--paper);
  padding: 9px 10px;
  font-weight: 1000;
}

.suit-count-box span {
  font-size: 24px;
}

.suit-count-box strong {
  font-size: 24px;
  line-height: 1;
}

.live-board {
  display: grid;
  grid-template-columns: var(--left-col) var(--right-col);
  width: var(--board-width);
  margin: 0 auto;
  justify-content: stretch;
  align-items: stretch;
  gap: 16px;
}
.live-board.timer-hidden {
  grid-template-columns: var(--left-col) var(--right-col);
}
.team-score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.team-public-card {
  min-height: 166px;
  border-radius: 20px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}
.team-public-card[data-team="A"] { background: #fff8d7; }
.team-public-card[data-team="B"] { background: #e9f1ff; }
.team-public-card[data-team="C"] { background: #e8fff3; }
.team-public-card[data-team="D"] { background: #fff0ee; }
.team-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.team-score-line {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.team-score-value {
  font-size: clamp(42px, 5.2vw, 62px);
  font-weight: 1000;
  letter-spacing: -0.09em;
  line-height: 0.82;
}

.points-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-count-pill {
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: white;
  padding: 7px 10px;
  font-size: 15px;
  font-weight: 1000;
  white-space: nowrap;
}

.team-card-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
}

.revealed-strip {
  margin-top: 10px;
  margin-bottom: 4px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  padding: 12px 10px;
}

.mini-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.revealed-suits {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.revealed-suits span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: white;
  padding: 8px 6px;
  font-size: 14px;
  font-weight: 1000;
}

.revealed-suits b {
  font-size: 17px;
}

.control-stack {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}
.timer-panel.is-hidden { display: none; }
.control-stack:has(.timer-panel.is-hidden) {
  grid-template-rows: 1fr;
}
.control-stack:has(.timer-panel.is-hidden) .trade-panel {
  min-height: 100%;
}
.timer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.timer {
  font-size: 46px;
  font-weight: 1000;
  line-height: 0.86;
  letter-spacing: -0.08em;
}
.timer-buttons {
  justify-content: flex-end;
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 8px;
}
.trade-panel { min-height: 392px; }
.trade-form { display: grid; gap: 9px; }
.selector-block { display: grid; gap: 7px; }
.choice-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.choice-button {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
}
.choice-button.is-selected { background: var(--blue); color: white; }
.suit-choice { min-width: 0; }
.suit-red { color: var(--red); }
.suit-black { color: var(--ink); }
.choice-button.is-selected .suit-red,
.choice-button.is-selected .suit-black { color: white; }

.price-stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr) minmax(78px, 1.05fr) repeat(3, 1fr);
  gap: 6px;
  align-items: center;
}
.step-button {
  min-height: 46px;
  padding: 8px 8px;
  font-size: 14px;
}
.price-stepper output {
  min-height: 50px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: white;
  font-size: 31px;
  font-weight: 1000;
  letter-spacing: -0.06em;
}
.trade-submit {
  width: 100%;
  min-height: 56px;
  font-size: 18px;
}

.bottom-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: var(--board-width);
  margin: 0 auto;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.stat-card, .metric-tile, .reveal-grid div {
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: #fff;
  padding: 14px;
}
.stat-card strong, .metric-tile strong, .reveal-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  letter-spacing: -0.05em;
}
.stat-card span, .metric-tile span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.stat-card.wide { grid-column: span 3; }
.team-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  list-style: none;
  margin: 0;
  padding: 0;
}
.log-list li {
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: white;
  padding: 10px 12px;
  font-weight: 800;
}
.log-list time {
  margin-right: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.results-hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}
.reveal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
}
.winner-card {
  margin-top: 12px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--yellow);
  padding: 24px;
  font-size: 38px;
  font-weight: 1000;
  letter-spacing: -0.06em;
}
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}
.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.10em;
  text-align: left;
  text-transform: uppercase;
}
.data-table td {
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  background: white;
  padding: 10px 12px;
  font-weight: 800;
}
.data-table td:first-child { border-left: 3px solid var(--ink); border-radius: 14px 0 0 14px; }
.data-table td:last-child { border-right: 3px solid var(--ink); border-radius: 0 14px 14px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 200;
  transform: translateX(-50%);
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: white;
  padding: 12px 18px;
  font-weight: 950;
  box-shadow: none;
}
.toast.error { background: var(--red); }

@media (max-width: 1260px) {
  html { min-width: 0; }
  .app { width: min(100vw - 24px, 1100px); }
  .topbar { grid-template-columns: 1fr; }
  .top-market-summary { min-width: 0; }
  .settings-menu { left: 0; right: auto; }
  .setup-grid, .live-board, .bottom-board, .results-hero, .combined-info-grid { grid-template-columns: 1fr; }
  .setup-hands-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-stack { grid-template-rows: auto; }
}

@media (max-width: 800px) {
  .topbar { align-items: stretch; }
  .top-market-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .team-score-grid, .stats-grid, .team-detail-stats, .setup-hands-grid { grid-template-columns: 1fr; }
  .price-stepper { grid-template-columns: repeat(3, 1fr); }
  .price-stepper output { grid-column: 1 / -1; grid-row: 2; }
}

.top-actions .button {
  font-size: 14px;
}

.control-stack.no-timer {
  grid-template-rows: 1fr;
}

.control-stack.no-timer .trade-panel {
  min-height: 100%;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.team-card-actions {
  display: flex;
  gap: 7px;
  margin-top: auto;
  padding-top: 12px;
}

.team-card-actions .button {
  flex: 1;
  padding: 7px 9px;
  font-size: 12px;
}

.suit-trade-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.suit-trade-tile b {
  font-size: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(17, 17, 17, 0.42);
  padding: 24px;
}

.team-modal-card {
  width: min(920px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-section {
  display: grid;
  gap: 12px;
}

.modal-suit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.modal-suit-row {
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: white;
  padding: 14px;
}

.modal-suit-row span {
  display: block;
  font-weight: 1000;
}

.modal-suit-row strong {
  display: block;
  margin-top: 6px;
  font-size: 38px;
  font-weight: 1000;
  letter-spacing: -0.08em;
}

.modal-note {
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--yellow);
  padding: 12px 14px;
  font-weight: 950;
  margin-bottom: 12px;
}

.fair-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.fair-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.10em;
  text-align: left;
  text-transform: uppercase;
}

.fair-table td {
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  background: white;
  padding: 10px 12px;
  vertical-align: top;
}

.fair-table td:first-child {
  border-left: 3px solid var(--ink);
  border-radius: 14px 0 0 14px;
  font-weight: 950;
}

.fair-table td:last-child {
  border-right: 3px solid var(--ink);
  border-radius: 0 14px 14px 0;
}

.fair-table strong {
  display: block;
  margin-bottom: 4px;
  font-size: 30px;
  line-height: 1;
}

.fair-table span {
  display: block;
  font-size: 13px;
  font-weight: 850;
}

.phase-label-hidden {
  display: none;
}

.team-modal-card .eyebrow:empty {
  display: none;
}


.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.danger-note {
  background: #ffe9e9;
}

.collapsible-panel {
  padding: 0;
  overflow: hidden;
}

.collapsible-panel summary {
  cursor: pointer;
  padding: 16px;
  color: var(--ink);
  font-size: 26px;
  line-height: 0.95;
  font-weight: 1000;
  letter-spacing: -0.06em;
  list-style-position: inside;
}

.collapsible-panel[open] summary {
  border-bottom: 3px solid var(--ink);
}

.collapsible-content {
  padding: 16px;
}

.log-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.topbar {
  width: 100%;
}

.combined-info-panel {
  width: 100%;
}

.combined-info-grid {
  display: grid;
  grid-template-columns: var(--left-col) var(--right-col);
  gap: 16px;
}

.combined-info-grid h2 {
  margin-bottom: 12px;
}

.reveal-grid div {
  color: var(--ink);
}

.collapsible-panel summary {
  user-select: none;
}

body[data-phase="setup"] .bottom-board {
  display: none;
}

.rules-details {
  margin-bottom: 12px;
}

.rules-prose {
  padding: 16px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
}

.rules-prose p {
  margin: 0 0 10px;
}

.rules-prose ul {
  margin: 0;
  padding-left: 22px;
}

.rules-prose li {
  margin: 6px 0;
}

.hand-history-panel {
  width: var(--board-width);
  margin: 0 auto;
}

.history-label {
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: white;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-weight: 950;
}

.history-hands-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.history-hand-card {
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: white;
  padding: 14px;
}

.history-hand-card[data-team="A"] { background: #fff8d7; }
.history-hand-card[data-team="B"] { background: #e9f1ff; }
.history-hand-card[data-team="C"] { background: #e8fff3; }
.history-hand-card[data-team="D"] { background: #fff0ee; }

.modal-history-grid {
  margin-top: 10px;
}

.log-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.log-list li > span {
  min-width: 0;
}

.log-hand-btn {
  flex: 0 0 auto;
}

.results-hero,
.resultsScreen .panel,
#resultsScreen > .panel {
  width: var(--board-width);
  margin-left: auto;
  margin-right: auto;
}

#resultsScreen .results-hero,
#resultsScreen > article.panel {
  width: var(--board-width);
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 1260px) {
  .history-hands-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .history-hands-grid { grid-template-columns: 1fr; }
}

.setup-hand-card.is-editing .suit-count-grid {
  grid-template-columns: 1fr;
}

.editable-suit-count {
  display: grid;
  grid-template-columns: 34px 42px 1fr 42px;
  gap: 8px;
  align-items: center;
}

.editable-suit-count span {
  justify-self: center;
}

.mini-step {
  width: 42px;
  height: 38px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-size: 20px;
  font-weight: 1000;
  line-height: 1;
  cursor: pointer;
}

.mini-step:hover {
  background: var(--yellow);
}

.editable-suit-count strong {
  justify-self: center;
  font-size: 26px;
}

body:not([data-phase="play"]):not([data-phase="results"]) .top-market-summary,
body:not([data-phase="play"]):not([data-phase="results"]) .top-actions {
  display: none;
}

.timer-combo {
  height: 58px;
  display: grid;
  grid-template-columns: 1.2fr 90px auto;
  align-items: center;
  gap: 8px;
}

.compact-checkbox-line {
  height: 58px;
}

.timer-combo input[type="number"] {
  height: 58px;
  min-height: 58px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: white;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 26px;
  font-weight: 950;
}

.timer-unit {
  font-size: 16px;
  font-weight: 950;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.combined-info-grid > section {
  display: flex;
  flex-direction: column;
  min-height: 360px;
}

.combined-info-grid .log-list {
  flex: 1;
  max-height: none;
  min-height: 260px;
}

.trade-end-game-button {
  display: none;
}

.control-stack.no-timer .trade-end-game-button {
  display: inline-flex;
}

.control-stack.no-timer .trade-panel {
  min-height: 100%;
}

/* v18 refinements */
.rules-prose {
  display: block;
  padding: 16px;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.4;
}
.rules-prose p {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  margin: 0 0 10px 0;
}
.rules-prose ul {
  margin: 0;
  padding-left: 22px;
}
.rules-prose li {
  margin: 7px 0;
}
.timer-combo input[type="number"]:disabled {
  background: #e5e2dc;
  color: var(--muted);
  opacity: 0.65;
}
.bottom-board {
  margin-top: 28px;
}
.summary-stats-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.summary-stat {
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: white;
  padding: 12px 14px;
}
.summary-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.summary-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 30px;
  letter-spacing: -0.06em;
}
.combined-info-grid > section:last-child {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.combined-info-grid .log-list {
  flex: 1 1 auto;
  height: 100%;
  max-height: none;
  overflow: auto;
}
.log-list {
  max-height: none;
}
.reveal-grid {
  grid-template-columns: 0.8fr 1.2fr;
}
.reveal-grid div:last-child {
  background: var(--yellow);
  transform: scale(1.03);
}
.reveal-grid div:last-child strong {
  font-size: 34px;
}
.reveal-grid div:first-child {
  opacity: 0.78;
}
.winner-card {
  line-height: 1.05;
}
.winner-card span {
  display: block;
  margin-top: 8px;
  font-size: 34px;
}
.total-cell strong {
  display: inline-block;
  border-radius: 10px;
  background: var(--yellow);
  color: var(--ink);
  padding: 6px 10px;
}
body[data-phase="play"] .log-hand-btn {
  display: inline-flex;
}

body[data-phase="results"] .top-market-summary,
body[data-phase="results"] .top-actions {
  display: none;
}

body[data-phase="results"] .topbar {
  grid-template-columns: 1fr;
  grid-template-areas: "title";
}

.history-analysis {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.history-analysis-card {
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: white;
  padding: 14px;
}

.history-analysis-card h3 {
  margin-bottom: 8px;
}

.history-analysis-card p {
  margin: 8px 0;
  font-weight: 800;
  line-height: 1.3;
}

.recommendation-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
}

.recommendation-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.10em;
  text-align: left;
  text-transform: uppercase;
}

.recommendation-table td {
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  padding: 8px 10px;
  font-weight: 850;
}

.recommendation-table td:first-child {
  border-left: 2px solid var(--ink);
  border-radius: 12px 0 0 12px;
}

.recommendation-table td:last-child {
  border-right: 2px solid var(--ink);
  border-radius: 0 12px 12px 0;
}

.setup-actions-card,
.setup-info-card {
  width: var(--board-width);
  margin: 0 auto;
}

.setup-actions-card {
  align-self: start;
  padding: 14px 16px;
}

.preset-actions {
  margin-top: 10px;
}

.preset-button {
  min-width: 110px;
}

.rules-prose {
  font-weight: 500;
  line-height: 1.35;
}

.rules-prose p,
.rules-prose li {
  font-weight: 500;
}

.history-label.visually-hidden {
  display: none;
}

.log-entry-card {
  flex: 1;
  display: flex;
  min-height: 100%;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: white;
  padding: 12px;
}

.log-entry-card .log-list {
  flex: 1;
  max-height: none;
  min-height: 0;
}

.combined-info-grid > section {
  min-height: 100%;
}

.combined-info-grid > section:last-child {
  display: flex;
  flex-direction: column;
}

.reveal-grid .label {
  color: var(--ink) !important;
}

.reveal-grid strong {
  color: var(--ink);
  font-size: 28px !important;
}

.fair-price-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-button {
  width: 24px;
  height: 24px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 13px;
  font-weight: 1000;
  line-height: 1;
  cursor: pointer;
}

.calc-steps {
  display: grid;
  gap: 10px;
}

.calc-steps p {
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: white;
  padding: 10px 12px;
  margin: 0;
  font-weight: 800;
}

.data-table th,
.data-table td {
  text-align: center;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
  text-align: left;
}

/* v21 layout refinements */
.setup-actions-card {
  align-self: start;
  padding: 14px 16px;
}

.primary-setup-actions {
  margin-bottom: 0;
}

.primary-setup-actions .preset-button {
  min-width: 100px;
}

.combined-info-grid {
  align-items: stretch;
}

.combined-info-grid > section {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.combined-info-grid > section > h2,
.combined-info-grid .panel-title-row {
  min-height: 46px;
  align-items: center;
  margin-bottom: 12px;
}

.combined-info-grid > section:last-child {
  min-height: 0;
}

.log-entry-card {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.log-entry-card .log-list {
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  min-height: 0;
}

.reveal-grid {
  grid-template-columns: minmax(0, 1fr) 230px !important;
  align-items: stretch;
}

.reveal-grid div:first-child {
  background: var(--yellow) !important;
  opacity: 1 !important;
  transform: scale(1.03);
}

.reveal-grid div:last-child {
  background: #d9f0e9 !important;
  opacity: 0.9 !important;
  transform: none !important;
}

.reveal-grid div:first-child strong,
.reveal-grid div:last-child strong {
  font-size: 32px !important;
}

.team-badge {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--ink);
  font-weight: 1000;
  white-space: nowrap;
}

.team-badge.team-A,
.team-row-A td {
  background: #fff8d7 !important;
}

.team-badge.team-B,
.team-row-B td {
  background: #e9f1ff !important;
}

.team-badge.team-C,
.team-row-C td {
  background: #e8fff3 !important;
}

.team-badge.team-D,
.team-row-D td {
  background: #fff0ee !important;
}

.recommendation-table {
  table-layout: fixed;
}

.recommendation-table th,
.recommendation-table td {
  width: auto;
}

.recommendation-table .fair-price-line {
  justify-content: center;
}

.recommendation-table td {
  vertical-align: middle;
}

.starting-recommendation-table th,
.starting-recommendation-table td {
  text-align: center;
}

.history-analysis-card .team-badge {
  margin: 0 2px;
}

.history-analysis-card p {
  font-size: 16px;
}

#historyEndBtn {
  background: var(--paper);
  color: var(--ink);
}

#historyEndBtn:disabled {
  opacity: 0.45;
}

/* v22 refinements */
.collapsible-content.combined-info-grid {
  height: 550px;
  max-height: 550px;
  overflow: hidden;
}

.combined-info-grid > section {
  min-height: 0;
  height: 100%;
}

.log-entry-card {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.log-entry-card .log-list {
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
}

.reveal-header-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.reveal-header-row h2 {
  justify-self: center;
}

.reveal-header-row #backToPlayBtn {
  justify-self: start;
  background: var(--paper);
  color: var(--ink);
}

.reveal-header-row #newFromResultsBtn {
  justify-self: end;
}

.reveal-grid {
  grid-template-columns: minmax(0, 1fr) 230px !important;
  align-items: stretch;
}

.reveal-grid div:first-child {
  background: var(--yellow) !important;
  opacity: 1 !important;
  transform: scale(1.03);
}

.reveal-grid div:last-child {
  background: #e7e4dc !important;
  opacity: 0.95 !important;
  transform: none !important;
}

.reveal-grid div:first-child strong,
.reveal-grid div:last-child strong {
  font-size: 32px !important;
}

.suit-pill {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: white;
  padding: 2px 8px;
  font-weight: 1000;
  white-space: nowrap;
}

.info-button-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.recommendation-table {
  table-layout: fixed;
  width: 100%;
}

.recommendation-table th,
.recommendation-table td {
  text-align: center;
}

.recommendation-table td:first-child,
.recommendation-table th:first-child {
  text-align: left;
}

.recommendation-table .info-button {
  margin: 0 auto;
}

body[data-phase="setup"] .topbar,
body[data-phase="play"] .topbar,
body[data-phase="results"] .topbar,
.setup-actions-card,
.setup-hands-panel,
.setup-info-card,
.live-board,
.bottom-board,
#resultsScreen .results-hero,
#resultsScreen > article.panel {
  max-width: 100%;
}

@media (max-width: 1260px) {
  .app {
    --board-width: calc(100vw - 24px);
    --right-col: minmax(0, 1fr);
  }

  .topbar,
  .setup-actions-card,
  .setup-hands-panel,
  .setup-info-card,
  .live-board,
  .bottom-board,
  #resultsScreen .results-hero,
  #resultsScreen > article.panel {
    width: 100%;
    max-width: 100%;
  }

  .collapsible-content.combined-info-grid {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .log-entry-card {
    height: 360px;
  }

  .reveal-grid {
    grid-template-columns: 1fr !important;
  }
}

/* v23 refinements */
#clearLogBtn {
  display: none !important;
}

.results-header-actions {
  display: none;
  align-items: center;
  gap: 8px;
}

body[data-phase="results"] .top-actions > .header-settings,
body[data-phase="results"] .top-actions > #undoBtn,
body[data-phase="results"] .top-actions > #redoBtn,
body[data-phase="results"] .top-actions > #resetBtn {
  display: none !important;
}

body[data-phase="results"] .top-actions {
  display: flex !important;
}

body[data-phase="results"] .results-header-actions {
  display: flex;
}

body[data-phase="results"] .topbar {
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "market title actions";
}

body[data-phase="results"] .top-market-summary {
  display: none !important;
}

.reveal-panel {
  padding-top: 22px;
}

.suit-pill {
  color: var(--ink);
}

.suit-pill .suit-red {
  color: var(--red);
}

.suit-pill .suit-black {
  color: var(--ink);
}

.price-pill {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  padding: 1px 8px;
  color: var(--ink);
  font-weight: 1000;
  white-space: nowrap;
}

.log-list li .team-badge,
.log-list li .suit-pill,
.log-list li .price-pill {
  margin: 0 2px;
}

/* v24 refinements */
#playBtn {
  flex: 1 1 220px;
  min-width: 180px;
}

.results-header-actions #backToPlayBtn {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
}

body[data-phase="results"] .topbar {
  position: relative;
}

.reveal-panel {
  background: var(--yellow) !important;
  display: flex;
  align-items: stretch;
}

.results-hero {
  align-items: stretch;
}

.results-hero > article.panel {
  display: flex;
  align-items: stretch;
}

.reveal-grid {
  flex: 1;
  margin: 0;
}

.reveal-grid div {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.winner-card {
  margin-top: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.reveal-grid div:first-child {
  transform: none !important;
}

.reveal-grid div:last-child {
  background: #e0ded6 !important;
}

.log-list li time {
  display: none;
}

.log-list li .price-pill,
.history-analysis-card .price-pill {
  margin: 0 2px;
}

.recommendation-table .is-relevant-price {
  box-shadow: inset 0 0 0 4px var(--yellow);
}

@media (max-width: 1260px) {
  .results-header-actions #backToPlayBtn {
    position: static;
    transform: none;
  }

  .reveal-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .reveal-grid div {
    width: 100%;
    transform: none !important;
  }
}

@media (max-width: 800px) {
  .reveal-grid {
    grid-template-columns: 1fr !important;
  }
}

/* v26 refinements */
body[data-phase="results"] .results-header-actions #backToPlayBtn {
  position: absolute !important;
  left: 14px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: var(--paper);
  color: var(--ink);
}

.reveal-panel {
  background: var(--paper) !important;
}

.recommendation-table .is-relevant-price {
  box-shadow: none !important;
}

.log-list {
  gap: 12px;
}

.log-list li {
  line-height: 1.45;
}

.log-list time {
  display: inline !important;
  margin-right: 10px;
  color: var(--muted);
  font-size: inherit;
  font-weight: 950;
}

.combined-info-grid > section > h2,
.combined-info-grid .panel-title-row {
  margin-bottom: 6px;
  min-height: 34px;
}

.combined-info-grid .panel-title-row h2 {
  margin: 0;
}

@media (max-width: 1260px) {
  body[data-phase="results"] .results-header-actions #backToPlayBtn {
    position: absolute !important;
    left: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
  }
}

/* v27 log spacing / scrollbar refinements */
.log-list {
  gap: 14px !important;
  padding-right: 14px !important;
  scrollbar-gutter: stable;
}

.log-list li {
  line-height: 1.75 !important;
  padding: 12px 14px !important;
}

.log-entry-card {
  padding-right: 6px !important;
  overflow: hidden;
}

.log-entry-card .log-list {
  overflow-y: auto;
}

.log-list time {
  margin-right: 12px !important;
}

/* v28 refinements */
.winner-card {
  background: var(--ink) !important;
  color: white !important;
}

.winner-card span {
  color: white !important;
}

.log-entry-card {
  padding: 12px 8px 12px 18px !important;
}

.log-entry-card .log-list {
  padding-left: 0 !important;
  padding-right: 18px !important;
  scrollbar-gutter: stable;
}

.log-list {
  gap: 8px !important;
}

.log-list li {
  line-height: 1.35 !important;
  padding: 10px 12px !important;
}

.log-list li .team-badge,
.log-list li .suit-pill,
.log-list li .price-pill {
  margin: 0 !important;
}

@media (max-width: 1260px) {
  .collapsible-content.combined-info-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .combined-info-grid > section:first-child {
    order: 1;
  }

  .combined-info-grid > section:last-child {
    order: 2;
  }

  .log-entry-card {
    height: 360px;
  }
}

/* v29 refinements */
.log-suit {
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
}

.log-suit .suit-red {
  color: var(--red);
}

.log-suit .suit-black {
  color: var(--ink);
}

.log-entry-card {
  padding: 18px 8px 18px 18px !important;
}

.log-entry-card .log-list {
  padding-right: 18px !important;
}

.suit-pill {
  gap: 6px;
}

.suit-trade-tile > span {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 18px !important;
  line-height: 1;
  letter-spacing: -0.02em !important;
  text-transform: none !important;
  color: var(--ink) !important;
}

.suit-trade-tile b {
  font-size: 18px !important;
  line-height: 1;
}

@media (max-width: 520px) {
  h1 {
    white-space: normal;
    max-width: 9ch;
    text-align: center;
    line-height: 0.9;
    justify-self: center;
  }
}

/* v30 refinements */
.suit-trade-tile > span {
  justify-content: flex-start !important;
  text-align: left !important;
}

.log-suit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.log-entry-card {
  padding-top: 18px !important;
  padding-bottom: 18px !important;
}

/* v31 refinements */
.log-entry-card {
  padding-left: 24px !important;
  padding-right: 10px !important;
}

.log-entry-card .log-list {
  padding-right: 20px !important;
}

.history-analysis-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.history-analysis-row:has(.history-analysis-card:only-child) {
  grid-template-columns: 1fr;
}

.history-analysis-row-wide {
  align-items: start;
}

@media (max-width: 900px) {
  .history-analysis-row,
  .history-analysis-row-wide {
    grid-template-columns: 1fr;
  }
}

/* v32 refinements */
.log-suit {
  gap: 3px;
}

.modal-prices-table {
  table-layout: fixed;
}

.history-team-info-btn {
  margin: 0 auto;
}

/* v34 trade-note and suggestion-table refinements */
.trade-note-list {
  margin: 8px 0 0;
  padding-left: 22px;
  display: grid;
  gap: 10px;
  line-height: 1.65;
  font-weight: 800;
}

.trade-note-list li {
  padding-left: 2px;
}

.trade-note-list .team-badge,
.trade-note-list .suit-pill,
.trade-note-list .price-pill {
  vertical-align: middle;
}

.recommendation-table th {
  font-size: 14px !important;
}

.recommendation-table th .suit-red,
.recommendation-table th .suit-black {
  font-size: 22px !important;
  line-height: 1;
}

/* v35 refinements */
.trade-note-list {
  gap: 12px !important;
  line-height: 1.82 !important;
}

.log-suit {
  white-space: nowrap;
}

/* v36 refinements */
.trade-note-list {
  gap: 18px !important;
  line-height: 2.25 !important;
}

.trade-note-list li {
  padding-top: 4px !important;
  padding-bottom: 4px !important;
}

.trade-note-list .team-badge,
.trade-note-list .suit-pill,
.trade-note-list .price-pill {
  vertical-align: baseline;
}

/* v37 pill sizing / spacing refinements */
.team-badge,
.suit-pill,
.price-pill {
  line-height: 1 !important;
  min-height: 0 !important;
}

.trade-note-list {
  gap: 14px !important;
  line-height: 1.5 !important;
}

.trade-note-list li {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

.metric-tile span {
  line-height: 1.25;
}

/* v38 wrapped-line spacing and cash notation refinements */
.trade-note-list {
  gap: 8px !important;
  line-height: 1.18 !important;
}

.trade-note-list li {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

.trade-note-list li .team-badge,
.trade-note-list li .suit-pill,
.trade-note-list li .price-pill {
  display: inline-flex;
  margin-top: 2px;
  margin-bottom: 2px;
}

/* v40 refinements */
.log-entry-card {
  padding-top: 24px !important;
  padding-bottom: 24px !important;
  padding-left: 24px !important;
}

.recommendation-table td span {
  display: block;
  margin-top: 5px;
}

/* v41 activity-log spacing refinements */
.log-entry-card {
  box-sizing: border-box;
  padding: 28px !important;
}

.log-entry-card .log-list {
  box-sizing: border-box;
  padding: 0 12px 0 0 !important;
  margin: 0 !important;
  scrollbar-gutter: stable;
}

.log-list li {
  box-sizing: border-box;
  margin: 0 !important;
}

/* v42 activity-log padding */
.log-entry-card {
  padding: 14px 2px 14px 14px !important;
}

/* v43 reveal-all-cards setting */
.full-hand-strip {
  background: rgba(255, 255, 255, 0.70);
}

.full-hand-strip .mini-label {
  color: var(--ink);
}

/* v44 quote recorder + simplified public information */
.hidden-public-setting,
#headerRevealAllCardsInput,
#headerFairPricesInput,
#revealAllCardsInput,
#showFairPricesInput {
  display: none !important;
}
#headerRevealAllCardsInput + span,
#headerFairPricesInput + span,
#revealAllCardsInput + span,
#showFairPricesInput + span {
  opacity: 0.45;
}
.quote-tools {
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: 12px;
  margin-bottom: 14px;
  background: rgba(255,255,255,0.55);
}
.quote-tools.is-hidden { display: none; }
.quote-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.quote-tile {
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: white;
  padding: 8px;
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 900;
}
.quote-form { display: grid; gap: 10px; }
.quote-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}
.quote-input-label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.quote-input-label input {
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 18px;
  font-weight: 950;
}
@media (max-width: 1260px) {
  .quote-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quote-input-row { grid-template-columns: 1fr; }
}

#headerRevealAllCardsInput, #headerFairPricesInput,
#revealAllCardsInput, #showFairPricesInput { pointer-events: none; }
/* Hide removed public-count/public-price controls */
label:has(#headerRevealAllCardsInput),
label:has(#headerFairPricesInput),
label:has(#revealAllCardsInput),
label:has(#showFairPricesInput) {
  display: none !important;
}
.removed-public-setting { display: none !important; }

/* v46 quote recorder replaces trade recorder */
.manual-trade-tools.is-hidden {
  display: none !important;
}

.quote-tools {
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  display: grid;
  gap: 12px;
}

.quote-tools.is-hidden {
  display: none !important;
}

.quote-section {
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.quote-section h3 {
  margin: 0;
  font-size: 20px;
}

.quote-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quote-stepper-block {
  display: grid;
  gap: 6px;
}

.quote-stepper {
  display: grid;
  grid-template-columns: repeat(2, 1fr) minmax(72px, 1.2fr) repeat(2, 1fr);
  gap: 5px;
}

.quote-stepper output {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: white;
  font-size: 20px;
  font-weight: 1000;
}

.quote-step-button,
.quote-clear-button {
  min-height: 40px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: white;
  font-weight: 1000;
  cursor: pointer;
}

.quote-clear-button {
  grid-column: 1 / -1;
  min-height: 36px;
}

.quote-submit {
  width: 100%;
}

.quote-accept-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quote-tile strong {
  line-height: 1.2;
}

/* v47 public/private signals + compact quote recorder */
.trade-title-actions {
  justify-content: flex-end;
}

.quote-tools {
  gap: 10px !important;
}

.quote-section {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  gap: 8px !important;
}

.quote-section + .quote-section {
  border-top: 3px solid var(--ink) !important;
  padding-top: 10px !important;
}

.quote-input-row {
  grid-template-columns: 1fr !important;
  gap: 8px !important;
}

.quote-stepper {
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(70px, 1.1fr) repeat(3, minmax(0, 1fr)) !important;
  gap: 4px !important;
}

.quote-step-button,
.quote-clear-button {
  min-height: 36px !important;
  padding: 5px 6px;
  font-size: 12px;
}

.quote-stepper output {
  min-height: 38px !important;
  font-size: 18px !important;
}

.quote-accept-row {
  grid-template-columns: 1fr !important;
}

.team-card-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.team-modal-card {
  width: min(1120px, calc(100vw - 48px));
}

.signal-assumptions {
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--yellow);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-weight: 900;
}

.signal-stack {
  display: grid;
  gap: 14px;
}

.signal-card {
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px;
}

.signal-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.signal-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.signal-badges span {
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: white;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.signal-meaning {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 850;
}

.signal-table-wrap {
  margin-top: 6px;
}

.signal-table th,
.signal-table td {
  font-size: 12px;
  padding: 8px 9px;
  vertical-align: top;
}

.signal-table td:first-child {
  min-width: 130px;
}

@media (max-width: 1260px) {
  .team-card-actions,
  .trade-title-actions {
    grid-template-columns: 1fr;
  }
}

/* v48 header signal entry point, modal suggestions, show-hands, and quote-mode layout */
.top-left-header {
  grid-area: market;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.top-left-header .button {
  white-space: nowrap;
}

.top-left-header .top-market-summary {
  grid-area: auto;
  justify-self: auto;
}

body[data-phase="setup"] .top-left-header {
  display: none;
}

.signal-suggestions {
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--yellow);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.signal-suggestions-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 5px;
}

.signal-suggestions-head h3 {
  font-size: 22px;
}

.signal-suggestions-head span {
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: white;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.signal-suggestions p {
  margin: 0;
  font-weight: 900;
}

.signal-suggestions .signal-table-wrap {
  margin-top: 9px;
}

.signal-suggestions .data-table th,
.signal-suggestions .data-table td {
  background: rgba(255, 255, 255, 0.82);
}

.signal-assumptions {
  border: 2px dashed var(--ink) !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.68) !important;
  padding: 10px 12px !important;
  margin-bottom: 12px !important;
  font-size: 12px;
  line-height: 1.35;
}

.public-hand-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 8px;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 1000;
}

.public-hand-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 7px;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid var(--ink);
  border-radius: 999px;
  white-space: nowrap;
}

.public-hand-strip b {
  font-size: 15px;
}

.quote-market-section {
  display: grid;
  gap: 10px;
}

body[data-record-quotes="true"] .app {
  --board-width: min(1400px, calc(100vw - 18px));
  --right-col: minmax(0, 1fr);
  padding-top: 6px;
}

body[data-record-quotes="true"] .topbar {
  margin-bottom: 10px;
  padding: 8px 12px;
}

body[data-record-quotes="true"] h1 {
  font-size: clamp(28px, 3vw, 42px);
}

body[data-record-quotes="true"] .live-board,
body[data-record-quotes="true"] .live-board.timer-hidden {
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}

body[data-record-quotes="true"] .team-score-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

body[data-record-quotes="true"] .team-public-card {
  min-height: 0;
  padding: 9px 10px;
  border-radius: 18px;
}

body[data-record-quotes="true"] .team-card-top h3 {
  font-size: 20px;
}

body[data-record-quotes="true"] .team-score-line {
  margin-top: 5px;
}

body[data-record-quotes="true"] .team-score-value {
  font-size: clamp(28px, 3vw, 40px);
  letter-spacing: -0.07em;
}

body[data-record-quotes="true"] .team-card-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 6px;
  margin-top: 8px;
  padding-top: 0;
}

body[data-record-quotes="true"] .team-card-actions .button {
  padding: 6px 7px;
  font-size: 11px;
}

body[data-record-quotes="true"] .public-hand-strip {
  margin-top: 6px;
  gap: 4px;
}

body[data-record-quotes="true"] .public-hand-item {
  font-size: 12px;
}

body[data-record-quotes="true"] .control-stack {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1.58fr);
  grid-template-rows: auto;
  align-items: stretch;
  gap: 10px;
}

body[data-record-quotes="true"] .control-stack.no-timer {
  grid-template-columns: 1fr;
}

body[data-record-quotes="true"] .timer-panel,
body[data-record-quotes="true"] .trade-panel {
  min-height: 0 !important;
}

body[data-record-quotes="true"] .trade-panel {
  padding: 10px;
}

body[data-record-quotes="true"] .timer-row {
  align-items: flex-start;
  flex-direction: column;
}

body[data-record-quotes="true"] .timer-buttons {
  grid-template-columns: 1fr;
  width: 100%;
}

body[data-record-quotes="true"] .trade-panel .panel-title-row {
  margin-bottom: 8px;
}

body[data-record-quotes="true"] .quote-tools {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 10px !important;
}

body[data-record-quotes="true"] .quote-record-section,
body[data-record-quotes="true"] .quote-market-section {
  border: 3px solid var(--ink) !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, 0.58) !important;
  padding: 10px !important;
}

body[data-record-quotes="true"] .quote-record-section,
body[data-record-quotes="true"] .quote-accept-section {
  display: grid;
  gap: 7px !important;
}

body[data-record-quotes="true"] .quote-market-section {
  grid-template-rows: auto auto;
}

body[data-record-quotes="true"] .quote-board {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 0;
}

body[data-record-quotes="true"] .quote-tile {
  padding: 7px;
  font-size: 12px;
  gap: 3px;
}

body[data-record-quotes="true"] .quote-section + .quote-section {
  border-top: 0 !important;
  padding-top: 0 !important;
}

body[data-record-quotes="true"] .quote-section h3 {
  font-size: 18px;
}

body[data-record-quotes="true"] .selector-block {
  gap: 5px;
}

body[data-record-quotes="true"] .choice-button {
  min-height: 34px;
  padding: 5px 6px;
  font-size: 12px;
}

body[data-record-quotes="true"] .quote-stepper {
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(64px, 1.05fr) repeat(3, minmax(0, 1fr)) !important;
}

body[data-record-quotes="true"] .quote-step-button,
body[data-record-quotes="true"] .quote-clear-button {
  min-height: 32px !important;
  padding: 4px 5px;
  font-size: 11px;
}

body[data-record-quotes="true"] .quote-stepper output {
  min-height: 34px !important;
  font-size: 16px !important;
}

body[data-record-quotes="true"] .quote-submit,
body[data-record-quotes="true"] .quote-accept-row .button {
  min-height: 38px;
}


/* v49 analysis labels, header end button, and tighter team cards */
.header-end-button {
  display: none;
}

body[data-phase="play"] .header-end-button {
  display: inline-flex;
}

body[data-phase="play"] #endGameBtn,
body[data-phase="play"] .trade-end-game-button {
  display: none !important;
}

body[data-phase="play"] .team-card-actions {
  grid-template-columns: 1fr;
}

body[data-record-quotes="true"] .team-card-actions {
  grid-template-columns: 1fr;
}

body[data-record-quotes="true"] .header-end-button {
  padding-inline: 10px;
}

.signal-suggestions .signal-table td,
.signal-suggestions .signal-table th {
  white-space: nowrap;
}

@media (max-width: 1260px) {
  .signal-suggestions .signal-table td,
  .signal-suggestions .signal-table th {
    white-space: normal;
  }
}

/* v50 subtler analysis buttons, editable assumptions, and signal-button setting */
.button-analysis {
  background: rgba(36, 88, 255, 0.10);
  color: var(--ink);
}

.button-analysis:hover {
  background: rgba(36, 88, 255, 0.18);
}

body[data-show-signal-buttons="false"] #publicSignalsBtn,
body[data-show-signal-buttons="false"] .private-signals-btn {
  display: none !important;
}

.signal-assumptions-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 8px;
}

.signal-assumptions-head span {
  color: var(--muted);
  font-weight: 800;
}

.assumption-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.assumption-field {
  display: grid;
  gap: 4px;
  font-weight: 900;
}

.assumption-field input[type="number"] {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: white;
  padding: 7px 9px;
  font-weight: 900;
}

.assumption-check {
  align-content: start;
}

.assumption-check input {
  justify-self: start;
  width: 22px;
  height: 22px;
}

.signal-assumptions p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.label small,
.button small {
  font-size: 0.82em;
  font-weight: 950;
}

/* v51 show-card-count setting and clearer public trade evidence */
body[data-record-quotes="true"] .team-card-count {
  min-width: 0;
  padding: 4px 7px;
  font-size: 11px;
}

.signal-card .signal-meaning + .table-wrap {
  margin-top: 8px;
}

/* v53: compact timer placement and wording cleanup */
body[data-record-quotes="true"] .live-board:not(.timer-hidden) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 180px);
  grid-template-areas:
    "teams timer"
    "trade trade";
  gap: 10px;
  align-items: stretch;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .team-score-grid {
  grid-area: teams;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .control-stack {
  display: contents;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .timer-panel {
  grid-area: timer;
  padding: 8px;
  border-radius: 18px;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .trade-panel {
  grid-area: trade;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .team-public-card {
  padding: 7px 8px;
  min-height: 0;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .team-card-top {
  gap: 6px;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .team-card-top h3 {
  font-size: 18px;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .team-card-count {
  min-width: 52px;
  padding: 5px 7px;
  font-size: 12px;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .team-score-line {
  margin-top: 4px;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .team-score-value {
  font-size: clamp(24px, 2.5vw, 34px);
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .public-hand-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .public-hand-item {
  padding: 3px 5px;
  font-size: 11px;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .timer-row {
  height: 100%;
  justify-content: space-between;
  align-items: stretch;
  gap: 8px;
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .timer {
  font-size: clamp(30px, 3vw, 38px);
}

body[data-record-quotes="true"] .live-board:not(.timer-hidden) .timer-buttons .button {
  min-height: 34px;
  padding: 5px 8px;
  font-size: 12px;
}

/* v54 history suggestions and results header cleanup */
body[data-phase="results"] #publicSignalsBtn {
  display: none !important;
}

.history-title-row {
  gap: 12px;
  align-items: center;
}

.history-header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.history-method-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.history-method-control select {
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: white;
  font: inherit;
  font-size: 12px;
  padding: 6px 8px;
  text-transform: none;
  letter-spacing: 0;
}

.history-method-note {
  font-size: 12px;
  color: var(--muted);
}

.recommendation-table td strong + span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
}

@media (max-width: 800px) {
  .history-title-row,
  .history-header-controls {
    align-items: stretch;
  }

  .history-header-controls,
  .history-method-control {
    width: 100%;
  }

  .history-method-control select {
    flex: 1;
  }
}

/* v55: simplified history suggestions, private summary, and responsive header/quote layouts */
.recommendation-table th:last-child,
.recommendation-table td:last-child {
  text-align: center;
}

@media (max-width: 1040px) {
  body[data-phase="play"] .topbar,
  body[data-phase="results"] .topbar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "market"
      "actions";
    align-items: stretch;
    gap: 10px;
  }

  body[data-phase="play"] .topbar > div:first-child,
  body[data-phase="results"] .topbar > div:first-child {
    justify-self: stretch;
    text-align: center;
  }

  body[data-phase="play"] .top-left-header,
  body[data-phase="results"] .top-left-header,
  body[data-phase="play"] .top-actions,
  body[data-phase="results"] .top-actions,
  body[data-phase="results"] .results-header-actions {
    justify-self: stretch;
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 7px;
  }

  body[data-phase="play"] .top-actions > .button,
  body[data-phase="play"] .top-actions .header-settings,
  body[data-phase="play"] .header-settings summary,
  body[data-phase="play"] #publicSignalsBtn,
  body[data-phase="results"] .top-actions > .button,
  body[data-phase="results"] .top-actions .header-settings,
  body[data-phase="results"] .header-settings summary,
  body[data-phase="results"] .results-header-actions .button {
    width: 100%;
  }

  body[data-phase="play"] .top-market-summary,
  body[data-phase="results"] .top-market-summary {
    width: 100%;
    justify-self: stretch;
  }
}

@media (max-width: 1180px) {
  body[data-record-quotes="true"] .team-score-grid,
  body[data-record-quotes="true"] .live-board:not(.timer-hidden) .team-score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-record-quotes="true"] .live-board:not(.timer-hidden) {
    grid-template-columns: 1fr;
    grid-template-areas:
      "teams"
      "timer"
      "trade";
  }

  body[data-record-quotes="true"] .live-board:not(.timer-hidden) .timer-row {
    flex-direction: row;
    align-items: center;
  }

  body[data-record-quotes="true"] .live-board:not(.timer-hidden) .timer-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-record-quotes="true"] .quote-tools {
    grid-template-columns: 1fr !important;
  }

  body[data-record-quotes="true"] .quote-market-section {
    grid-template-rows: auto auto;
  }
}

@media (max-width: 720px) {
  body[data-record-quotes="true"] .team-score-grid,
  body[data-record-quotes="true"] .live-board:not(.timer-hidden) .team-score-grid {
    grid-template-columns: 1fr;
  }

  body[data-record-quotes="true"] .live-board:not(.timer-hidden) .timer-row {
    flex-direction: column;
    align-items: stretch;
  }

  body[data-record-quotes="true"] .live-board:not(.timer-hidden) .timer-buttons {
    grid-template-columns: 1fr;
  }

  body[data-record-quotes="true"] .quote-board,
  body[data-record-quotes="true"] .quote-accept-row {
    grid-template-columns: 1fr;
  }
}

/* v56: header no-wrap title, centred End button, and public/private formula summaries */
html {
  min-width: 0;
}

h1 {
  white-space: nowrap;
  max-width: none;
  font-size: clamp(28px, 4.2vw, 50px);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
}

.header-end-button {
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  min-width: 58px;
}

.signal-suggestions p {
  line-height: 1.35;
}

.signal-table small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}

@media (max-width: 1040px) {
  body[data-phase="play"] h1,
  body[data-phase="results"] h1 {
    white-space: nowrap;
    max-width: none;
    font-size: clamp(30px, 8.5vw, 46px);
    line-height: 0.9;
  }

  body[data-phase="play"] .topbar,
  body[data-phase="results"] .topbar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "market"
      "actions";
  }

  body[data-phase="play"] .topbar > div:first-child,
  body[data-phase="results"] .topbar > div:first-child {
    min-width: 0;
    overflow: visible;
  }
}

@media (max-width: 520px) {
  h1,
  body[data-phase="play"] h1,
  body[data-phase="results"] h1 {
    white-space: nowrap;
    max-width: none;
    font-size: clamp(25px, 9.8vw, 36px);
    letter-spacing: -0.075em;
  }

  .topbar {
    padding-inline: 10px;
  }
}

/* v57: earlier quote-recorder stacking and formula-first analysis summaries */
.signal-suggestions .signal-table-wrap {
  margin-top: 8px;
  margin-bottom: 10px;
}

.signal-suggestions-description {
  display: grid;
  gap: 9px;
  font-weight: 900;
  line-height: 1.35;
}

.signal-suggestions-description p {
  margin: 0;
}

.formula-note {
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  padding: 9px 10px;
  font-weight: 850;
}

.formula-note-compact {
  display: block;
}

.formula-key span {
  display: inline-block;
  margin-right: 5px;
}

.formula-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.formula-grid > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.formula-grid strong {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.math-display {
  overflow-x: auto;
  padding: 2px 0;
}

@media (max-width: 1500px) {
  body[data-record-quotes="true"] .quote-tools {
    grid-template-columns: 1fr !important;
  }

  body[data-record-quotes="true"] .quote-record-section,
  body[data-record-quotes="true"] .quote-market-section,
  body[data-record-quotes="true"] .quote-accept-section {
    min-width: 0;
  }
}

@media (max-width: 980px) {
  .formula-grid {
    grid-template-columns: 1fr;
  }
}

/* v58: dropdown signal notes, assumptions, and cards */
.signal-assumptions-dropdown,
.signal-card-dropdown,
.formula-note-dropdown {
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.signal-assumptions-dropdown {
  border-style: dashed;
  margin-bottom: 12px;
}

.signal-assumptions-dropdown > summary,
.signal-card-summary,
.formula-note-dropdown > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.signal-assumptions-dropdown > summary::-webkit-details-marker,
.signal-card-summary::-webkit-details-marker,
.formula-note-dropdown > summary::-webkit-details-marker {
  display: none;
}

.signal-assumptions-dropdown > summary,
.formula-note-dropdown > summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 11px 13px;
  font-weight: 1000;
}

.signal-assumptions-dropdown > summary::after,
.signal-card-summary::after,
.formula-note-dropdown > summary::after {
  content: "▾";
  flex: 0 0 auto;
  font-weight: 1000;
  transition: transform 0.15s ease;
}

.signal-assumptions-dropdown[open] > summary::after,
.signal-card-dropdown[open] > .signal-card-summary::after,
.formula-note-dropdown[open] > summary::after {
  transform: rotate(180deg);
}

.signal-assumptions-dropdown .signal-assumptions {
  border: 0 !important;
  border-top: 2px dashed var(--ink) !important;
  border-radius: 0 !important;
  background: rgba(255, 255, 255, 0.54) !important;
  margin: 0 !important;
  padding: 12px 13px !important;
}

.signal-card-dropdown {
  padding: 0 !important;
}

.signal-card-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
}

.signal-card-title {
  font-size: 17px;
  font-weight: 1000;
  line-height: 1.15;
}

.signal-card-body {
  border-top: 2px solid var(--ink);
  padding: 12px 14px 14px;
}

.formula-note-dropdown {
  padding: 0 !important;
}

.formula-note-body {
  display: grid;
  gap: 12px;
  border-top: 2px solid var(--ink);
  padding: 10px 12px 12px;
}

.formula-note-body section {
  display: grid;
  gap: 6px;
}

.formula-note-body section > strong {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.formula-bullets {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 5px;
}

.formula-bullets li {
  margin: 0;
}

@media (max-width: 760px) {
  .signal-card-summary {
    grid-template-columns: 1fr auto;
  }

  .signal-card-summary .signal-badges {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

/* v60: results controls and no results End button */
body[data-phase="results"] #headerEndGameBtn {
  display: none !important;
}

body[data-phase="results"] .topbar {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "actions title market";
}

body[data-phase="results"] .top-actions {
  justify-self: start;
}

body[data-phase="results"] .results-header-actions {
  justify-content: flex-start;
}

body[data-phase="results"] .results-header-actions #backToPlayBtn {
  position: static;
  transform: none;
  left: auto;
  top: auto;
}

@media (max-width: 760px) {
  body[data-phase="results"] .topbar {
    grid-template-columns: 1fr;
    grid-template-areas: "title" "actions";
  }
}

/* v61 results header and analysis refinements */
h1 {
  white-space: nowrap;
}

body[data-phase="results"] .topbar {
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  grid-template-areas: "market title actions" !important;
  align-items: center;
}

body[data-phase="results"] .top-actions {
  display: block !important;
  grid-area: actions;
  justify-self: stretch;
  width: 100%;
}

body[data-phase="results"] .top-actions > #headerEndGameBtn {
  display: none !important;
}

body[data-phase="results"] .results-header-actions {
  display: flex !important;
  align-items: center;
  gap: 8px;
  position: absolute !important;
  left: 14px;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  pointer-events: none;
  z-index: 6;
}

body[data-phase="results"] .results-header-actions .button {
  pointer-events: auto;
}

body[data-phase="results"] .results-header-actions #backToPlayBtn,
body[data-phase="results"] .results-header-actions #exportXlsxBtn {
  position: static !important;
  transform: none !important;
  left: auto !important;
  top: auto !important;
}

body[data-phase="results"] .results-header-actions #newRoundBtn {
  margin-left: auto;
}

.formula-note-compact .formula-bullets {
  margin: 0;
}

@media (max-width: 1040px) {
  body[data-phase="results"] .topbar {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "title"
      "actions" !important;
    align-items: stretch;
  }

  body[data-phase="results"] .results-header-actions {
    position: static !important;
    transform: none !important;
    display: grid !important;
    grid-template-columns: 1fr;
    width: 100%;
    pointer-events: auto;
  }

  body[data-phase="results"] .results-header-actions #newRoundBtn {
    margin-left: 0;
  }

  body[data-phase="results"] .results-header-actions .button {
    width: 100%;
  }
}

/* v64 new-round modal table and contribution stepper */
.new-round-score-wrap {
  margin: 10px 0 14px;
}

.new-round-score-table {
  margin: 0;
}

.new-round-score-table th,
.new-round-score-table td {
  white-space: nowrap;
}

.new-round-contribution-label {
  display: grid;
  gap: 8px;
}

.new-round-contribution-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(52px, 1fr)) minmax(86px, 1.15fr) repeat(3, minmax(52px, 1fr));
  gap: 6px;
  align-items: stretch;
}

.new-round-contribution-control input {
  width: 100%;
  min-height: 46px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  text-align: center;
  font-size: 22px;
  font-weight: 1000;
  letter-spacing: -0.04em;
}

.new-round-step-button {
  min-height: 46px;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 1000;
}

@media (max-width: 640px) {
  .new-round-contribution-control {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .new-round-contribution-control input {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* v65: narrower start-new-round modal and centred equal-width table columns */
.modal-backdrop.new-round-modal-open {
  padding: 18px;
}

.modal-backdrop.new-round-modal-open .team-modal-card {
  width: min(560px, calc(100vw - 36px));
  padding: 16px;
}

.new-round-score-table {
  width: 100%;
  table-layout: fixed;
}

.new-round-score-table th,
.new-round-score-table td {
  width: 50%;
  text-align: center;
  vertical-align: middle;
}

@media (max-width: 520px) {
  .modal-backdrop.new-round-modal-open {
    padding: 12px;
  }

  .modal-backdrop.new-round-modal-open .team-modal-card {
    width: calc(100vw - 24px);
    padding: 12px;
  }
}

/* v66: centre carried-across points column in start-new-round modal */
.data-table.new-round-score-table th:nth-child(2),
.data-table.new-round-score-table td:nth-child(2) {
  text-align: center;
}

/* v67: hide number spinner controls only in the new-round contribution stepper */
#newRoundContributionInput::-webkit-outer-spin-button,
#newRoundContributionInput::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#newRoundContributionInput {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* v68: add breathing room above new-round contribution validation message */
#newRoundContributionError {
  margin-top: 14px;
}

#newRoundContributionError:not(.is-hidden) {
  display: block;
}
