:root {
  --bg: #1f1e1c;
  --surface: #2b2a27;
  --surface-2: #363430;
  --text: #ecebe8;
  --muted: #a8a59f;
  --line: #45423d;
  --accent: #81b64c;
  --accent-ink: #1b2a0f;
  --felt: #2e6b3f;
  --felt-dark: #1d4a2a;
  --card: #fbfaf6;
  --card-ink: #1d1d1d;
  --red: #c8102e;
  --gold: #f0c24b;

  --c-best: #81b64c;
  --c-excellent: #96bc4b;
  --c-good: #7fa38a;
  --c-inaccuracy: #f7c631;
  --c-mistake: #ffa459;
  --c-blunder: #fa412d;

  /* Card width: nine overlapping cards must fit the screen width. */
  /* 9 cards overlapping by 28%, plus a small gap between up to 3 suit groups. */
  --cw: clamp(42px, calc((100vw - 32px - 24px) / 6.8), 84px);
  /* Cards on the table are a bit smaller so the four seats fit around them. */
  --tw: clamp(40px, calc((100vw - 32px) / 8), 78px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
h2 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; }
.brand-mark { background: var(--red); color: #fff; width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-size: 16px; flex: none; }
.brand-text { font-weight: 800; font-size: 18px; margin-left: 8px; }
.scoreline { display: flex; gap: 8px; align-items: baseline; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scoreline b { font-size: 19px; }
.scoreline .us { color: var(--accent); }
.scoreline .them { color: var(--gold); }
.scoreline .of { color: var(--muted); font-size: 12px; }
.mode-chip { display: flex; align-items: center; gap: 5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.mode-chip .sym { font-size: 17px; line-height: 1; }
.mode-chip .sym.red { color: #ff5a6e; }
.topbar-actions { display: flex; gap: 6px; margin-left: auto; }

.btn {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; font-weight: 600;
}
.btn:hover { border-color: #5a5650; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 3px 0 #5d8a32; }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #5d8a32; }
.icon-btn { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 16px; flex: none; display: grid; place-items: center; }
.icon-btn:disabled, .btn:disabled { opacity: .4; cursor: default; }

/* ---------- layout: phone first ---------- */
.layout { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.panel { display: none; }

/* ---------- table ---------- */
/* The table is always square: as large as the space around it allows. */
.table-area {
  margin: 10px 16px 0;
  height: max(300px, calc(100svh - 58px - var(--cw) * 1.45 - 150px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  container-type: size;
  display: grid;
  place-items: center;
  flex: none;
}
.table {
  position: relative;
  width: min(100cqw, 100cqh);
  aspect-ratio: 1;
  border-radius: 24px;
  overflow: hidden;
  background: radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-dark) 100%);
  box-shadow: inset 0 0 0 8px #3a2a1c, inset 0 0 0 10px #5a4028, 0 8px 24px rgba(0,0,0,.4);
  flex: none;
}
.seat { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 5px; z-index: 2; }
.seat-top { top: 16px; left: 50%; transform: translateX(-50%); }
.seat-left { left: 16px; top: 50%; transform: translateY(-50%); }
.seat-right { right: 16px; top: 50%; transform: translateY(-50%); }

.player { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.35); padding: 4px 10px 4px 4px; border-radius: 999px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: #4b6a8a; flex: none; }
.avatar.partner { background: #4f8a4b; }
.player.turn { box-shadow: 0 0 0 2px var(--gold); }
.player .tag { font-size: 11px; font-weight: 700; background: var(--gold); color: #3a2c00; padding: 0 6px; border-radius: 999px; }
/* Side seats are narrow on phones: avatar above name. */
.seat-left .player, .seat-right .player { flex-direction: column; padding: 5px 6px; border-radius: 14px; gap: 2px; font-size: 12px; }
.backs { display: flex; }
.backs .back { width: 12px; height: 18px; margin-left: -7px; border-radius: 2px; box-shadow: inset 0 0 0 1px #fff; }
.backs .back::after { content: none; }
.backs .back:first-child { margin-left: 0; }

/* Speech bubbles sit under the player and wrap instead of running off the table. */
.bubble {
  position: absolute; top: 100%; margin-top: 6px; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 140px; text-align: center;
  background: #fff; color: #222; font-weight: 700; font-size: 13px; padding: 5px 9px; border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,.3); animation: pop .25s ease-out; z-index: 4;
}
.seat-left .bubble { left: 0; transform: none; }
.seat-right .bubble { left: auto; right: 0; transform: none; }
.seat-bottom .bubble { top: auto; bottom: 100%; margin: 0 0 6px; }
@keyframes pop { from { opacity: 0; } to { opacity: 1; } }

/* trick area */
.trick { position: absolute; left: 50%; top: 50%; width: calc(var(--tw) * 2.9); height: calc(var(--tw) * 3.3); transform: translate(-50%, -46%); }
.trick .card { --cw: var(--tw); }
.slot { position: absolute; }
.slot-0 { bottom: 0; left: 50%; transform: translateX(-50%); }
.slot-2 { top: 0; left: 50%; transform: translateX(-50%); }
.slot-3 { left: 0; top: 50%; transform: translateY(-50%) rotate(-6deg); }
.slot-1 { right: 0; top: 50%; transform: translateY(-50%) rotate(6deg); }
.slot .card { animation: deal .2s ease-out; }
.slot .card.winner { box-shadow: 0 0 0 3px var(--gold), 0 6px 14px rgba(0,0,0,.35); }
@keyframes deal { from { opacity: 0; } to { opacity: 1; } }
.trick.sweep .card { transition: opacity .2s ease-in; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .slot .card, .bubble { animation: none; } }

.toast {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 5;
  max-width: calc(100% - 32px); width: max-content; text-align: center;
  background: rgba(0,0,0,.7); padding: 7px 14px; border-radius: 14px; font-weight: 600; font-size: 14px;
}

/* Trump choice: on the table, so your hand stays visible below. */
.declare {
  position: absolute; inset: 12px; z-index: 6;
  background: rgba(20, 30, 22, .94); border-radius: 18px;
  display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 14px;
}
.declare-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.declare-head h3 { margin: 0; font-size: 17px; }
.declare-head span { color: var(--muted); font-size: 13px; }

/* ---------- cards ---------- */
.card {
  width: var(--cw); height: calc(var(--cw) * 1.45); background: var(--card); color: var(--card-ink);
  border-radius: calc(var(--cw) * .11); position: relative; box-shadow: 0 2px 6px rgba(0,0,0,.35); user-select: none; -webkit-user-select: none;
  font-weight: 800; flex: none;
}
.card.red { color: var(--red); }
.card .corner { position: absolute; top: 4px; left: 5px; display: flex; flex-direction: column; align-items: center; line-height: 1; font-size: calc(var(--cw) * .24); }
.card .corner .s { font-size: calc(var(--cw) * .21); }
.card .corner.br { top: auto; left: auto; bottom: 4px; right: 5px; transform: rotate(180deg); }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--cw) * .5); padding-left: calc(var(--cw) * .1); }
.card .pip.face { font-size: calc(var(--cw) * .32); }
.card.trump::after { content: ""; position: absolute; inset: 2px; border-radius: calc(var(--cw) * .09); box-shadow: inset 0 0 0 2px rgba(240,194,75,.85); pointer-events: none; }
.back {
  width: var(--cw); height: calc(var(--cw) * 1.45); border-radius: 8px;
  background: var(--red);
  box-shadow: inset 0 0 0 2px #fff, 0 1px 3px rgba(0,0,0,.4);
  position: relative;
}
.back::after { content: "\271A"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 60%; }

/* ---------- my hand ---------- */
.me { padding: 0 16px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.seat-bottom { position: relative; display: flex; justify-content: center; margin-top: 10px; }
.hand { display: flex; justify-content: center; padding-top: 16px; min-height: calc(var(--cw) * 1.45 + 16px); max-width: 100%; }
.hand .card { margin-left: calc(var(--cw) * -.28); transition: transform .12s ease, filter .12s; cursor: default; }
.hand .card:first-child { margin-left: 0; }
.hand .card.suit-start { margin-left: calc(var(--cw) * -.28 + 8px); }
.hand .card.legal { cursor: pointer; }
.hand .card.legal:hover, .hand .card.legal:focus-visible { transform: translateY(-12px); outline: none; }
.hand .card.illegal { filter: brightness(.55) saturate(.6); }
.hand .card.hint { box-shadow: 0 0 0 3px var(--accent), 0 6px 14px rgba(0,0,0,.4); transform: translateY(-12px); }
.prompt { min-height: 22px; color: var(--muted); font-weight: 600; }
.round-mini { display: flex; gap: 14px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; padding-bottom: env(safe-area-inset-bottom, 0px); }
.round-mini b { color: var(--text); }
.prompt.you { color: var(--gold); }

/* ---------- side panel (wide screens only) ---------- */
.round-stats { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 12px; font-variant-numeric: tabular-nums; }
.round-stats .h { color: var(--muted); font-size: 12px; }
.log { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; font-size: 13px; }
.log li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.log li.sep { color: var(--muted); font-weight: 700; border-bottom: none; padding-top: 10px; }

@media (max-width: 420px) {
  .brand-text { display: none; }
  .scoreline .of { display: none; }
}

@media (min-width: 1000px) {
  :root { --cw: 84px; --tw: 76px; }
  body { height: 100%; }
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "table panel" "me panel";
  }
  .table-area { grid-area: table; height: auto; min-height: 420px; margin: 14px 16px 0; }
  .me { grid-area: me; }
  .round-mini { display: none; }
  .panel {
    grid-area: panel; display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow: hidden;
    background: var(--surface); border-left: 1px solid var(--line); padding: 14px;
  }
  .panel-block.grow { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .seat-left .player, .seat-right .player { flex-direction: row; padding: 4px 10px 4px 4px; border-radius: 999px; font-size: 14px; }
  .backs .back { width: 16px; height: 23px; margin-left: -9px; }
}

/* ---------- dialogs ---------- */
dialog.sheet {
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
dialog::backdrop { background: rgba(0,0,0,.55); }
fieldset { border: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 8px; }
legend { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); padding: 7px 12px; border-radius: 999px; cursor: pointer; }
.chip:has(input:checked) { border-color: var(--accent); background: #34402a; }
.chip input { accent-color: var(--accent); margin: 0; }
select { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px; font: inherit; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode-btn { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 14px; }
.mode-btn:hover { border-color: var(--accent); }
.mode-btn .sym { font-size: 28px; line-height: 1; }
.mode-btn .sym.red { color: #ff5a6e; }
.mode-btn .mult { font-size: 12px; color: var(--muted); }
.mode-btn.push { grid-column: 1 / -1; flex-direction: row; justify-content: center; gap: 10px; }
.mode-btn.hint { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.summary-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.summary-table td, .summary-table th { padding: 6px 4px; text-align: right; border-bottom: 1px solid var(--line); }
.summary-table td:first-child, .summary-table th:first-child { text-align: left; }
.big-result { font-size: 28px; font-weight: 800; margin: 4px 0 12px; }

/* ---------- review ---------- */
.review { position: fixed; inset: 0; background: var(--bg); z-index: 20; display: flex; flex-direction: column; }
.review-head {
  display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  background: var(--surface); border-bottom: 1px solid var(--line); flex: none;
}
.review-head h2 { margin: 0; font-size: 16px; color: var(--text); text-transform: none; letter-spacing: 0; white-space: nowrap; flex: 1; }
.progress { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.review-scroll { flex: 1; overflow-y: auto; padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
/* Phone: one column (summary, board, controls, explanation, moves, legend). The two wrappers
   only matter on wide screens, where the board and the explanation sit side by side. */
.rv-main, .rv-side { display: contents; }
.review-scroll > *, .rv-main > *, .rv-side > * { width: 100%; max-width: 640px; margin-inline: auto; flex: none; }
.rv-summary { order: 1; }
.rv-board { order: 2; }
.rv-controls { order: 3; }
.rv-explain { order: 4; }
.rv-moves { order: 5; }
.rv-legend { order: 6; }

.rv-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acc-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; }
.acc-card.you { border-color: #4b5d3a; }
.acc-card.opp { background: transparent; }
.acc-card.opp .acc { font-size: 22px; }
.acc-card .who { font-weight: 700; color: var(--muted); font-size: 13px; }
.acc-card .acc { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; grid-row: span 2; text-align: right; }
.acc-card .acc small { font-size: 14px; color: var(--muted); margin-left: 1px; }
.acc-card .counts { display: flex; flex-wrap: wrap; gap: 4px; }
.acc-card .counts .badge { height: 20px; font-size: 11px; }

/* board with open hands */
.rv-board { position: relative; background: radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-dark) 100%); border-radius: 18px; padding: 10px; display: grid; gap: 8px; box-shadow: inset 0 0 0 4px #3a2a1c; }
.rv-mid { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; }
.rv-hand { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.rv-name { font-size: 12px; font-weight: 700; color: #d9e6d8; padding: 1px 8px; border-radius: 999px; }
.rv-name.turn { background: var(--gold); color: #3a2c00; }
.rv-name em { font-style: normal; font-size: 10px; background: rgba(0,0,0,.35); border-radius: 999px; padding: 0 5px; margin-left: 3px; }
.rv-cards { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.rv-left .rv-cards, .rv-right .rv-cards { display: grid; grid-template-columns: repeat(3, auto); width: max-content; }
.rv-top .rv-cards, .rv-bottom .rv-cards { min-height: 38px; }
.rv-board .mc { width: 27px; height: 38px; }
.rv-board .mc b { font-size: 12px; }
.rv-board .mc i { font-size: 15px; }
.mc {
  width: 24px; height: 34px; border-radius: 4px; background: var(--card); color: var(--card-ink);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  font-size: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.4); flex: none;
}
.mc b { font-weight: 800; font-size: 11px; }
.mc i { font-style: normal; font-size: 14px; }
.mc.red { color: var(--red); }
.mc.trump { box-shadow: inset 0 0 0 2px rgba(240,194,75,.9), 0 1px 2px rgba(0,0,0,.4); }
.mc.best-ghost { outline: 2px dashed var(--c-best); outline-offset: 1px; }
.mc { position: relative; }
.mc.bock::after {
  content: "B"; position: absolute; top: -5px; right: -5px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--gold); color: #3a2c00; font: 800 9px/13px system-ui, sans-serif; text-align: center;
}
.rv-legend { margin-top: 0; margin-bottom: 0; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--muted); }
.rv-legend .mc { transform: scale(.8); }
.rv-trick { position: relative; height: 112px; min-width: 104px; }
.rv-slot { position: absolute; display: flex; align-items: center; gap: 2px; }
.rv-slot .mc { width: 34px; height: 47px; }
.rv-slot .mc b { font-size: 14px; }
.rv-slot .mc i { font-size: 18px; }
.rv-slot .mc.won { box-shadow: 0 0 0 3px var(--gold); }
.rv-slot .mc.now { transform: translateY(-2px); }
.rv-slot .badge { height: 18px; min-width: 20px; font-size: 10px; padding: 0 4px; }
.rv-slot-0 { bottom: 0; left: 50%; transform: translateX(-50%); }
.rv-slot-2 { top: 0; left: 50%; transform: translateX(-50%); }
.rv-slot-3 { left: 0; top: 50%; transform: translateY(-50%); }
.rv-slot-1 { right: 0; top: 50%; transform: translateY(-50%); flex-direction: row-reverse; }
.rv-mode { position: absolute; top: 8px; right: 10px; font-size: 12px; font-weight: 700; background: rgba(0,0,0,.35); border-radius: 999px; padding: 2px 8px; }
.rv-mode .red { color: #ff5a6e; }

.rv-controls { display: flex; align-items: center; justify-content: center; gap: 8px; }
.rv-controls .icon-btn { width: 44px; height: 40px; font-size: 16px; }
#rv-step { min-width: 108px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.rv-explain { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 96px; }
.rv-line { margin: 0 0 8px; font-weight: 600; }
.verdict { font-size: 16px; font-weight: 800; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.why { margin: 0 0 8px; padding-left: 18px; color: #d7d5d0; }
.why li { margin: 3px 0; }
.hindsight { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; margin: 0 0 10px; }
.hindsight h4 { margin: 0 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.hindsight p { margin: 0; font-size: 14px; color: #cfcdc8; }
.engine summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 700; }
.engine p { font-size: 13px; }
.opt { display: grid; grid-template-columns: 70px 1fr 44px; gap: 10px; align-items: center; padding: 3px 0; font-size: 14px; }
.opt .bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.opt .bar i { display: block; height: 100%; background: var(--muted); }
.opt.best .bar i { background: var(--c-best); }
.opt.chosen { font-weight: 800; }
.opt .v { text-align: right; font-variant-numeric: tabular-nums; }

.rv-moves { display: flex; flex-direction: column; gap: 6px; }
.rv-trickrow { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.rv-tno { width: 22px; color: var(--muted); font-size: 12px; font-weight: 700; text-align: right; flex: none; }
.rv-mv {
  display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 7px; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted);
}
.rv-mv.us { color: var(--text); }
.rv-mv em { font-style: normal; font-size: 10px; color: var(--muted); font-weight: 600; }
.rv-mv .badge { height: 16px; min-width: 16px; font-size: 9px; padding: 0 3px; }
.rv-mv.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }

.badge { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 800; color: #111; white-space: nowrap; }
.badge.best { background: var(--c-best); } .badge.excellent { background: var(--c-excellent); } .badge.good { background: var(--c-good); }
.badge.inaccuracy { background: var(--c-inaccuracy); } .badge.mistake { background: var(--c-mistake); } .badge.blunder { background: var(--c-blunder); color: #fff; }
.badge.pending { background: var(--line); color: var(--muted); }
@media (min-width: 1000px) {
  .review-scroll {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); gap: 20px;
    align-items: start; padding: 20px 24px 32px; max-width: 1320px; width: 100%; margin-inline: auto;
  }
  .rv-main, .rv-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  .rv-main > *, .rv-side > * { max-width: none; }
  /* The board stays in view while the explanation and move list scroll. */
  .rv-main { position: sticky; top: 0; }
  .rv-board { padding: 16px; gap: 14px; border-radius: 22px; box-shadow: inset 0 0 0 6px #3a2a1c, 0 8px 24px rgba(0,0,0,.35); }
  .rv-board .mc { width: 34px; height: 48px; border-radius: 5px; }
  .rv-board .mc b { font-size: 15px; }
  .rv-board .mc i { font-size: 19px; }
  .rv-top .rv-cards, .rv-bottom .rv-cards { min-height: 48px; gap: 4px; }
  .rv-left .rv-cards, .rv-right .rv-cards { gap: 4px; }
  .rv-name { font-size: 14px; }
  .rv-trick { height: 170px; min-width: 170px; }
  .rv-slot .mc { width: 50px; height: 70px; border-radius: 6px; }
  .rv-slot .mc b { font-size: 19px; }
  .rv-slot .mc i { font-size: 26px; }
  .rv-mode { top: 12px; right: 14px; font-size: 13px; }
  .rv-legend { justify-content: flex-start; }
  .rv-summary { gap: 8px; }
  .acc-card { padding: 8px 12px; }
  .acc-card .acc { font-size: 24px; }
  .acc-card.opp .acc { font-size: 20px; }
}

.log-text { width: 100%; height: 40vh; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: 12px/1.4 ui-monospace, monospace; }
