@charset "UTF-8";

/* Theme and shared controls */
:root {
  color-scheme: dark;
  --ink: #eee3c8;
  --muted: #b8a994;
  --gold: #d4ae65;
  --gold-light: #f2d69b;
  --line: #705638;
  --deep: #211a19;
  --green: #23483e;
  --card-w: 92px;
  --card-h: 132px;
  --font: "Avenir Next", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; width: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #191619;
  font-size: 14px;
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button { cursor: pointer; color: inherit; border: 0; }
button:disabled { cursor: default; opacity: .4; }
button, input, select, summary { touch-action: manipulation; }
button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
}
button:hover:not(:disabled) { filter: brightness(1.1); }
button:active:not(:disabled) { transform: translateY(1px); }
img { display: block; }
h1, h2, h3, p { margin-top: 0; }
h2 { font-size: 27px; }
h3 { font-size: 16px; }
p { line-height: 1.7; }
.scene, .scene-shade { position: fixed; inset: 0; pointer-events: none; }
.scene {
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
}
.scene-shade {
  background: linear-gradient(90deg, #171417a8, #17141740 55%, #17141772),
    linear-gradient(0deg, #1017199c, transparent 65%);
}
body[data-theme=garden] { --green: #345044; --line: #89754c; --gold: #d5bd83; }
body[data-theme=midnight] { --green: #283c49; --line: #706747; --gold: #c5b888; }
#app { position: relative; z-index: 1; min-height: 100svh; }
.boot { padding: 15vh 10vw; font-size: 35px; color: var(--gold); }

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4.5%;
  background: #191719ad;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  background: transparent;
  text-align: left;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 2px;
}
.brand small { display: block; font-size: 10px; letter-spacing: 2px; color: #bea476; margin-top: 3px; }
.brand-suit { width: 28px; height: 31px; color: var(--gold); }
.brand-suit svg { width: 100%; height: 100%; }
.header-tools { display: flex; align-items: center; gap: 12px; }
.button {
  min-height: 44px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background .15s, filter .15s, transform .12s;
}
.primary {
  background: linear-gradient(#e2c382, #c6a061);
  color: #342219;
  border-color: #e9ce94;
  box-shadow: 0 3px 0 #896330;
}
.secondary { background: #332c28; border-color: #8c724c; color: #ebd4a5; }
.quiet { background: transparent; color: #d5c7ad; font-weight: 500; padding: 9px 12px; min-height: 38px; }
.quiet:hover { background: #e0c89a0c; }
.text-button { background: none; color: var(--muted); font-size: 13px; padding: 10px 0; box-shadow: none; }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  line-height: 1;
  background: #1d181969;
  border: 1px solid #a98b5148;
  color: #e0cda6;
  font-size: 20px;
}
.header-tools .icon-button { font-size: 19px; }
.muted { font-size: 14px; color: var(--muted); }
.status-dot { display: inline-block; width: 5px; height: 5px; flex: 0 0 5px; background: #a8bd8e; }
.eyebrow { color: var(--gold); font-size: 11px; letter-spacing: 1.5px; }

/* Lobby: one title, three cards, and one focused start panel. */
.lobby {
  width: min(1040px, calc(100% - 80px));
  min-height: calc(100svh - 64px);
  margin: 0 auto;
  padding: 42px 0 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 100px;
  align-items: center;
}
.lobby-left { min-width: 0; }
.lobby-left h1 {
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: clamp(58px, 6.3vw, 80px);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: 7px;
  margin: 0 0 18px;
  text-shadow: 0 3px #16121b;
}
.intro { color: #d6c7ad; font-size: 17px; letter-spacing: 2px; margin-bottom: 24px; }
.hero-cards { position: relative; height: 208px; max-width: 360px; margin: 25px 0 0; pointer-events: none; }
.hero-cards .display-card {
  position: absolute;
  top: 14px;
  left: calc(50% - 48px);
  transform-origin: bottom center;
  filter: drop-shadow(3px 8px 5px #0006);
}
.hero-cards .card { --card-w: 104px; --card-h: 149px; }
.hero-cards .display-0 { top: 29px; transform: translateX(-73px) rotate(-19deg); }
.hero-cards .display-1 { transform: rotate(-3deg); z-index: 2; }
.hero-cards .display-2 { top: 23px; transform: translateX(71px) rotate(17deg); }
.lobby-right { width: 100%; min-width: 0; }
.start-panel {
  position: relative;
  background: #282320ed;
  border: 1px solid #a887514f;
  padding: 30px;
  box-shadow: 0 18px 55px #080a0d65;
}
.start-panel > h2 { font-size: 24px; font-weight: 500; margin: 0 0 27px; letter-spacing: 1px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.panel-heading h2 { font-size: 24px; font-weight: 500; margin: 0; letter-spacing: 1px; }
.options-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 20px 0; }
.options-row > span { font-size: 14px; color: #d1c1a5; }
.segmented { display: flex; padding: 3px; gap: 3px; background: #191719; border: 1px solid #7b65403d; }
.segmented button { background: transparent; color: #b8ab94; padding: 9px 13px; font-size: 13px; line-height: 1.4; }
.segmented button.chosen { background: #6b593c; color: #fff0cc; }
.seed-row { margin-top: 25px; padding-top: 22px; border-top: 1px solid #aa8a512b; }
.seed-row label { display: block; font-size: 14px; color: #d1c1a5; margin-bottom: 10px; }
.seed-input { display: flex; gap: 8px; }
.seed-input input {
  min-width: 0;
  width: 100%;
  min-height: 43px;
  background: #161719ad;
  border: 1px solid #8974486e;
  color: #ead8b0;
  font: 14px ui-monospace, monospace;
  padding: 10px 12px;
}
.seed-input .icon-button { flex: 0 0 43px; height: 43px; }
.seed-row p { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 10px 0 0; }
.start-button { display: flex; justify-content: center; align-items: center; width: 100%; min-height: 52px; font-size: 17px; margin-top: 27px; }
.start-button > span { font-size: 24px; font-weight: 400; }
.start-panel > .text-button { display: block; margin: 12px auto -8px; }

/* Original card faces, backs, and small cards used by dialogs. */
.card {
  width: var(--card-w);
  height: var(--card-h);
  position: relative;
  flex: 0 0 auto;
  border-radius: 4px;
  background: #f2e8ca;
  box-shadow: 0 2px 0 #a38e68, 0 4px 7px #050e1455;
  border: 1px solid #c4af80;
  user-select: none;
  vertical-align: middle;
  overflow: hidden;
}
.card.face { background: linear-gradient(110deg, #fff8e1, #f0e4c7); color: #293f3c; }
.card.red { color: #a44135; }
.card .suit-pixel { display: block; width: 100%; height: 100%; }
.card-corner { position: absolute; left: 7%; top: 5%; display: flex; flex-direction: column; align-items: center; width: 17%; gap: 1px; z-index: 1; line-height: 1; }
.card-corner b { font-family: Georgia, "Times New Roman", serif; font-size: calc(var(--card-w) * .235); font-weight: 700; letter-spacing: -1px; line-height: 1.05; }
.card-corner svg { width: 83%; height: auto; aspect-ratio: 1; }
.card-corner.bottom { left: auto; top: auto; right: 7%; bottom: 5%; transform: rotate(180deg); }
.pips { position: absolute; left: 28%; right: 28%; top: 13%; bottom: 13%; }
.pips > span { position: absolute; width: 42%; aspect-ratio: 1; transform: translate(-50%, -50%); }
.pips > span.inverted { transform: translate(-50%, -50%) rotate(180deg); }
.pips.ace > span { width: 95%; }
.court { position: absolute; left: 24%; top: 14%; width: 53%; height: 74%; }
.card-back { background: #274f47; padding: 6px; border-color: #c2a26c; }
.back-frame { height: 100%; border: 1px solid #c5ad7b; position: relative; display: grid; place-items: center; background: repeating-linear-gradient(45deg, #dfc58e14 0 1px, transparent 1px 7px), repeating-linear-gradient(-45deg, #dfc58e14 0 1px, transparent 1px 7px); outline: 1px solid #c4a36350; outline-offset: -5px; }
.back-frame::before, .back-frame::after { content: '◆'; position: absolute; font-size: 8px; color: #cfb784; left: calc(50% - 4px); }
.back-frame::before { top: 5px; }
.back-frame::after { bottom: 5px; }
.back-frame > span { font-size: 35px; color: #dcc18b; border: 1px solid #d3b46c; outline: 1px solid #d3b46c66; outline-offset: 4px; width: 35px; height: 47px; display: grid; place-items: center; background: #24463e; line-height: 1; }
.card.small { --card-w: 49px; --card-h: 71px; }
.card.small .back-frame > span { font-size: 18px; width: 18px; height: 25px; outline-offset: 2px; }
.card.small .back-frame::before, .card.small .back-frame::after { font-size: 4px; left: calc(50% - 2px); }
.card.small.card-back { padding: 4px; }
.meld-mark { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #759787; }
.meld-1 .meld-mark { background: #ad8a41; }
.meld-2 .meld-mark { background: #7a819f; }
.empty-card { background: transparent; border: 1px dashed #ccbd885c; box-shadow: none; display: grid; place-items: center; }
.empty-card::after { content: '◇'; font-size: 24px; color: #bcaf7738; }

/* Table and compact action panel */
.game-layout {
  width: min(1240px, calc(100% - 64px));
  margin: 0 auto;
  padding: 20px 0 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
  align-items: stretch;
}
.play-room { min-width: 0; display: flex; flex-direction: column; }
.matchbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 34px; flex-shrink: 0; padding: 0 12px; }
.matchbar > span { font-size: 13px; color: #cdbb9d; }
.match-meta { display: flex; align-items: center; gap: 16px; color: #e3d2b2; font-size: 13px; }
.match-meta small { color: #bcae97; font-size: 13px; }
.match-tools { display: flex; gap: 8px; align-items: center; }
.game-stage { position: relative; height: 520px; min-height: 520px; }
.table-shadow { position: absolute; inset: 90px 6% 80px; background: #080f10; filter: blur(18px); opacity: .6; border-radius: 30%; }
.table-rail {
  position: absolute;
  left: 3%;
  right: 3%;
  top: 81px;
  bottom: 74px;
  background: linear-gradient(140deg, #b39464 0%, #775636 15%, #49362b 42%, #8a6941 78%, #ae8a51 100%);
  clip-path: polygon(6% 0, 94% 0, 100% 15%, 100% 85%, 94% 100%, 6% 100%, 0 85%, 0 15%);
  padding: 10px;
}
.felt {
  height: 100%;
  position: relative;
  background: radial-gradient(ellipse at 50% 20%, #54706355, transparent 65%), repeating-linear-gradient(0deg, #00000007 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, #ffffff04 0 1px, transparent 1px 3px), var(--green);
  clip-path: polygon(5% 0, 95% 0, 100% 14%, 100% 86%, 95% 100%, 5% 100%, 0 86%, 0 14%);
  border: 2px solid #182e28;
  box-shadow: inset 0 0 40px #08151166;
}
.felt-border { position: absolute; inset: 12px; border: 1px solid #c0b07529; clip-path: polygon(5% 0, 95% 0, 100% 14%, 100% 86%, 95% 100%, 5% 100%, 0 86%, 0 14%); }
.opponent-seat { position: absolute; top: 3px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 11px; min-width: 150px; white-space: nowrap; }
.avatar { width: 46px; height: 46px; image-rendering: pixelated; background: #392a23; }
.opponent-seat strong { font-size: 14px; font-weight: 500; }
.opponent-seat small { display: block; margin-top: 3px; color: #c7b59a; font-size: 12px; }
.cpu-tag { color: #c8ae7d; font-size: 11px; margin-left: 6px; }
.thinking-dots { display: flex; gap: 4px; position: absolute; right: -20px; }
.thinking-dots i { width: 4px; height: 4px; background: var(--gold); animation: blink 1s infinite; }
.thinking-dots i:nth-child(2) { animation-delay: .15s; }
.thinking-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.opponent-hand { position: absolute; left: 50%; top: 63px; transform: translateX(-50%); display: flex; justify-content: center; filter: drop-shadow(0 4px 3px #0e171b55); }
.opponent-hand .card { --card-w: 48px; --card-h: 69px; }
.opponent-hand .card:not(:first-child) { margin-left: -22px; }
.opponent-hand.revealed .card:not(:first-child) { margin-left: -8px; }
.opponent-hand .new-card { margin-left: 7px !important; transform: rotate(5deg); }
.draw-zone { position: absolute; left: 50%; top: 172px; transform: translateX(-50%); display: flex; gap: 27px; align-items: flex-start; }
.pile-stack { display: flex; flex-direction: column; align-items: center; }
.pile { background: none; padding: 0; position: relative; opacity: 1 !important; transform: none !important; border-radius: 4px; transition: filter .15s; }
.pile .card { --card-w: 79px; --card-h: 113px; pointer-events: none; }
.stock-pile::before, .stock-pile::after { content: ''; position: absolute; inset: 0 0 2px; border-radius: 4px; background: #eee0b9; border: 1px solid #b29b74; transform: translate(-3px, -3px); z-index: -1; }
.stock-pile::after { transform: translate(-6px, -6px); }
.pile.playable { cursor: pointer; box-shadow: 0 0 0 3px #ddc28180; }
.pile.playable:hover, .pile.playable:focus-visible { box-shadow: 0 0 0 3px #f2d38be0, 0 0 22px #e2be5636; filter: brightness(1.08); }
.discard-target .pile:disabled { pointer-events: none; }
.discard-target.drop-ready .pile { outline: 1px dashed #ddc2818a; outline-offset: 6px; }
.discard-target.drag-over .pile { outline: 2px solid #ffe2a2; outline-offset: 7px; box-shadow: 0 0 24px #dfbc5550; }
.discard-target.drag-over .pile-caption { color: #ffe2a2; }
.draw-indicator { display: none; }
.table-divider { align-self: center; color: #c3b38466; font-size: 16px; padding-bottom: 36px; }
.pile-caption { display: block; text-align: center; color: #e8ddc0; font-size: 13px; margin-top: 12px; }
.pile-caption small { display: block; color: #b9bea9; font-size: 11px; margin-top: 4px; }
.hand-area { position: absolute; bottom: 7px; left: 14px; right: 14px; container-type: inline-size; }
.hand-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 9px; padding: 0 3px; }
.hand-toolbar > div { display: flex; align-items: center; gap: 8px; }
.hand-label { display: flex; align-items: center; gap: 18px; color: #e9dfc6; font-size: 14px; white-space: nowrap; }
.deadwood-inline { color: #bcba9f; font-size: 13px; display: inline-flex; gap: 7px; align-items: baseline; }
.deadwood-inline b { color: #f1d69b; font-size: 20px; font-weight: 500; }
.hand-toolbar .button { color: #e1d9bd; font-size: 13px; min-height: 34px; padding: 6px 10px; font-weight: 500; background: #14262473; }
.hand-toolbar .on { color: #f5d59c; }
.player-hand { display: flex; justify-content: center; align-items: flex-end; position: relative; isolation: isolate; padding-top: 10px; min-height: 128px; }
.player-hand .card { --card-w: clamp(58px, 8.5cqw, 80px); --card-h: calc(var(--card-w) * 1.43); padding: 0; transition: transform .12s ease-out, box-shadow .12s; }
.player-hand .card:not(:first-child) { margin-left: min(5px, calc((100cqw - var(--count) * var(--card-w)) / (var(--count) - 1))); }
.player-hand .card:disabled { opacity: 1; }
.player-hand .card[draggable=true] { cursor: grab; }
.player-hand .card[draggable=true]:active { cursor: grabbing; }
.player-hand .card:hover:not(:disabled) { transform: translateY(-9px); filter: none !important; z-index: 4; box-shadow: 0 2px 0 #a38e68, 0 8px 12px #07101470; }
.player-hand .card.selected { transform: translateY(-15px); outline: 2px solid #f0c96c; outline-offset: 2px; z-index: 5; box-shadow: 0 4px 0 #906d36, 0 10px 17px #0b141869; }
.player-hand .drawn:not(.selected) { box-shadow: 0 2px 0 #a38e68, 0 0 0 2px #c5b57988, 0 7px 15px #0007; }
.player-hand .dragging { opacity: .25; }
.player-hand .drop-target { outline: 2px solid #ede4aa; outline-offset: 2px; }
.turn-panel { min-width: 0; display: flex; flex-direction: column; padding: 25px 22px 22px; background: #24211eea; border: 1px solid #ac8c502b; }
.panel-score { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 24px; border-bottom: 1px solid #b3935930; }
.panel-score > span, .panel-score > div { display: flex; flex-direction: column; align-items: center; flex: 1; gap: 6px; font-size: 13px; color: #c7bca4; white-space: nowrap; }
.panel-score b, .panel-score strong { color: #f0d7a4; font-family: Georgia, serif; font-size: 35px; font-weight: 400; line-height: 1.2; }
.panel-score i { font-size: 20px; font-style: normal; color: #837354; }
.turn-state { margin-top: 30px; }
.turn-state h2 { font-size: 22px; line-height: 1.4; margin: 0 0 10px; font-weight: 500; color: #f2dfb6; }
.turn-state p { font-size: 14px; line-height: 1.7; color: #c9bca3; min-height: 72px; margin-bottom: 20px; }
.turn-actions { display: flex; flex-direction: column; gap: 12px; }
.turn-actions .button { width: 100%; min-height: 48px; font-size: 16px; }
.turn-actions .ready { border-color: #fff0bd; }
.turn-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 15px; }
.turn-tools .button { min-width: 0; min-height: 36px; padding: 7px 9px; color: #ded2b5; font-size: 13px; font-weight: 500; background: #161d1a70; border: 1px solid #a58d5633; }
.fairness-entry { display: flex; justify-content: center; align-items: center; gap: 9px; width: 100%; margin-top: 23px; min-height: 46px; background: #18382fde; color: #dac69b; border: 1px solid #74806677; font-size: 14px; font-weight: 500; }
.fairness-entry svg { width: 20px; height: 20px; flex: 0 0 20px; }
.last-play { margin-top: auto; padding-top: 24px; color: #bfb199; font-size: 13px; line-height: 1.7; min-height: 68px; }
.last-play p { margin: 0; }
.last-play:empty { display: none; }

/* Shared dialogs and settings */
dialog { width: min(530px, calc(100vw - 36px)); max-height: calc(100svh - 40px); padding: 0; background: #28231f; color: var(--ink); border: 1px solid #a68a56; box-shadow: 0 25px 80px #0009; overflow: auto; }
dialog::backdrop { background: #0b1015ba; backdrop-filter: blur(4px); }
dialog.wide { width: min(910px, calc(100vw - 40px)); }
.dialog-inner { padding: 32px; position: relative; }
.dialog-inner > .icon-button:first-child { position: absolute; right: 13px; top: 13px; width: 30px; height: 30px; background: none; border: 0; font-size: 25px; color: #cab184; }
.dialog-inner > .eyebrow { margin-bottom: 12px; }
.dialog-inner > h2 { margin-bottom: 25px; padding-right: 24px; font-family: Georgia, "Songti SC", serif; font-weight: 500; line-height: 1.4; }
.dialog-bottom { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 25px; flex-wrap: wrap; }
.dialog-bottom .button { font-size: 14px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 22px 0; font-size: 14px; color: #ddceb1; }
.setting-row input[type=range] { accent-color: var(--gold); width: 180px; }
.setting-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--gold); }
select { padding: 9px 12px; background: #1b181b; border: 1px solid #7e653f; color: var(--ink); min-width: 130px; }
.scene-picker { display: flex; gap: 10px; margin-top: 12px; }
.scene-choice { flex: 1; min-width: 0; background: #1e1c1b; border: 1px solid #7a624259; padding: 4px; text-align: left; position: relative; }
.scene-choice.chosen { border-color: var(--gold); }
.scene-thumb { display: block; aspect-ratio: 1.85; background-size: cover; image-rendering: pixelated; }
.scene-choice > span:last-child { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 10px 3px 5px; }
.scene-choice small { color: #b39b6e; font-size: 10px; }
.pause-actions { display: flex; flex-direction: column; gap: 14px; margin-top: 28px; }
.pause-actions .text-button { margin-top: 7px; }

/* Fairness: two steady columns, with space already reserved for the result. */
dialog.proof-dialog { width: min(1000px, calc(100vw - 40px)); }
.proof-dialog .dialog-inner { padding: 28px 30px; }
.proof-dialog .dialog-inner > h2 { margin-bottom: 22px; }
.proof-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 30px; align-items: stretch; }
.proof-input-column, .proof-math-column { min-width: 0; height: 440px; min-height: 440px; }
.proof-input-column { display: flex; flex-direction: column; }
.proof-math-column { border-left: 1px solid #aa8e5738; padding-left: 30px; overflow-y: auto; scrollbar-width: thin; }
.algorithm-name { color: #c4af86; margin-bottom: 19px; }
.proof-locked { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 244px; padding: 25px 20px; background: #192820; text-align: center; gap: 14px; }
.proof-locked svg { width: 35px; height: 35px; color: #c8b77f; }
.proof-locked strong { font-size: 18px; font-weight: 500; color: #e0cfaa; }
.proof-locked p { margin: 0; max-width: 260px; }
.sealed-seed { margin-top: 20px; }
.sealed-seed > span { display: block; color: #b6a68c; font-size: 13px; margin-bottom: 8px; }
.sealed-seed code { display: block; background: #181e1b; color: #d7c59d; padding: 11px 12px; font: 13px/1.7 ui-monospace, monospace; overflow-wrap: anywhere; }
.proof-layout h3 { margin: 0 0 14px; color: #ead9b8; font-size: 17px; font-weight: 500; }
.proof-layout p { font-size: 13px; line-height: 1.7; color: #c1b399; }
.proof-layout label { display: block; margin: 16px 0 8px; color: #d8c7a6; font-size: 13px; }
.proof-layout input { min-width: 0; width: 100%; padding: 11px 12px; border: 1px solid #8c764d80; background: #151b1b; color: var(--ink); font: 13px/1.5 ui-monospace, monospace; }
.proof-layout form { margin: 0; }
.proof-layout .button { min-height: 44px; font-size: 14px; }
.proof-input-column > .button, .proof-input-column form > .button { width: 100%; margin-top: 14px; }
.proof-input-column .seed-input .button { margin-top: 0; }
#proof-result { height: 180px; min-height: 180px; margin-top: 20px; overflow: auto; scrollbar-color: #806c47 #1c2220; }
.proof-empty { display: flex; flex-direction: column; justify-content: center; gap: 8px; min-height: 170px; padding: 20px; background: #1a2421; color: #baad92; font-size: 14px; line-height: 1.7; }
.proof-empty p { margin: 0; }
.proof-empty strong { font-size: 16px; font-weight: 500; color: #ddcca8; }
.proof-result-card { display: flex; flex-direction: column; gap: 8px; min-height: 75px; padding: 13px 15px; background: #192a22; border: 1px solid #6b825560; }
.proof-result-card > strong { font-size: 16px; line-height: 1.5; font-weight: 500; }
.proof-result-card > span { font-size: 12px; color: #c1b99c; line-height: 1.7; }
.proof-hand { margin-top: 12px; }
.proof-hand > span { font-size: 12px; color: #c1b399; }
.proof-result-card.fail { background: #33241f; border-color: #b2775359; }
.proof-result-card h3, .proof-result-card h4 { margin: 0 0 10px; font-size: 16px; font-weight: 500; color: #d8e1ba; }
.proof-result-card p { margin-bottom: 10px; font-size: 13px; }
.proof-result-card p:last-child { margin-bottom: 0; }
.fingerprint-pair { display: grid; gap: 10px; min-width: 0; }
.fingerprint-pair > div, .fingerprint-pair > section { min-width: 0; }
.fingerprint-pair span, .fingerprint-pair dt, .fingerprint-pair label { display: block; margin: 0 0 5px; color: #b8aa90; font-size: 12px; }
.fingerprint-pair dd { margin: 0; }
.fingerprint-pair code, .compactcode { display: block; padding: 10px 11px; background: #181e1b; color: #d7c59d; font: 12px/1.65 ui-monospace, monospace; overflow-wrap: anywhere; word-break: break-word; }
.proof-equation { margin: 17px 0; padding: 13px; background: #1a211e; color: #ddcba5; font: 13px/1.8 ui-monospace, monospace; overflow-wrap: anywhere; word-break: break-word; }
.proof-equation > span { display: block; font: 12px/1.7 var(--font); color: #bba988; margin-bottom: 5px; }
.proof-equation > strong { display: block; color: #e8d3a5; font-size: 17px; font-weight: 500; }
.proof-equation code { font: inherit; }
.proof-equation p { margin: 0; font: inherit; color: inherit; }
.proof-card-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 3px; margin-top: 11px; }
.proof-card-row > span { min-width: 28px; padding: 5px 6px; font-size: 13px; text-align: center; background: #e8dfc2; color: #293d34; border-radius: 2px; }
.proof-card-row > span.red { color: #a44135; }
.proof-card-row .card { --card-w: clamp(24px, 3.8vw, 34px); --card-h: calc(var(--card-w) * 1.43); }
.proof-layout details { margin-top: 16px; font-size: 13px; color: #bfae8d; }
.proof-layout summary { cursor: pointer; color: #d5c198; line-height: 1.7; }
.proof-layout details p { margin: 12px 0 0; }
.proof-layout details code { font-size: 12px; overflow-wrap: anywhere; }
.proof-record { margin-top: 22px; padding-top: 18px; border-top: 1px solid #aa8e5738; font-size: 13px; color: #c7b594; }
.proof-record summary { cursor: pointer; color: #d8c4a0; line-height: 1.7; }
.proof-record p { font-size: 13px; line-height: 1.8; }
.proof-dialog .dialog-bottom { margin-top: 22px; }

/* Teaching, result, and history dialogs */
.tutorial-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.tutorial-art { height: 100px; display: flex; align-items: center; justify-content: center; gap: 7px; background: #172d2780; margin-bottom: 22px; }
.tutorial-art .card { --card-w: 42px; --card-h: 61px; }
.draw-art > .card:first-child { transform: rotate(-12deg); }
.draw-art > .card:last-child { transform: rotate(12deg); margin-left: 12px; }
.meld-art > .card { margin-left: -8px; }
.discard-art > span { color: var(--gold); font-size: 21px; }
.tutorial-grid h3 { font-weight: 600; display: flex; gap: 12px; font-size: 16px; }
.tutorial-grid h3 > b { font-family: Georgia, serif; color: var(--gold); font-weight: 400; }
.tutorial-grid p { font-size: 14px; color: #c7b89e; line-height: 1.8; }
.teaching-note { font-size: 14px; color: #e0c391; border-left: 2px solid #b29051; padding: 12px 16px; background: #a3834111; margin-top: 15px; }
.controls-note { margin: 15px 0; font-size: 13px; line-height: 1.8; color: #c7b89e; }
.rules-details { border-top: 1px solid #a188522a; padding-top: 17px; font-size: 14px; color: #bba987; }
.rules-details summary { cursor: pointer; color: #d1bb8f; }
.rules-details p { margin-top: 16px; font-size: 14px; line-height: 1.9; }
.result-symbol { display: block; text-align: center; color: #e9cb88; font-size: 25px; line-height: 1; margin-bottom: 8px; }
.result-kicker { text-align: center; font-size: 12px; letter-spacing: 3px; color: #c6a767; margin-bottom: 10px; }
.result-kicker + h2 { text-align: center; margin-bottom: 12px; padding-right: 0; }
.result-score { display: flex; align-items: center; justify-content: center; gap: 28px; margin-bottom: 19px; }
.result-score > span { display: flex; align-items: center; gap: 15px; font-size: 14px; color: #c2b59c; }
.result-score b { font: 35px Georgia, serif; color: var(--gold-light); }
.result-score i { font: 25px Georgia, serif; color: #8d764f; }
.result-breakdown { display: flex; flex-direction: column; gap: 10px; }
.result-player { border: 1px solid #73604155; background: #171c1b70; padding: 10px 14px; }
.result-player.winner { border-color: #b294566e; }
.result-player-head { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.result-player-head img { width: 30px; height: 30px; image-rendering: pixelated; }
.result-player-head strong { font-weight: 500; }
.result-player-head > span { margin-left: auto; color: #c3b799; font-size: 12px; }
.result-player-head b { font: 23px Georgia, serif; margin-left: 12px; color: #f0dbaa; }
.result-cards { display: flex; gap: 13px; flex-wrap: wrap; margin-top: 19px; }
.mini-meld { display: flex; position: relative; }
.mini-meld .card { --card-w: 37px; --card-h: 53px; }
.mini-meld .card:not(:first-child) { margin-left: 3px; }
.numbered-meld::before { content: attr(data-group); position: absolute; left: 0; top: -14px; font: 11px ui-monospace, monospace; color: #c6b389; }
.deadwood-cards { opacity: .8; }
.layoff-cards .card { opacity: .6; transform: translateY(-2px); outline: 1px dashed #d2b171; }
.layoff-cards > span { font-size: 12px; color: var(--gold); align-self: flex-end; margin-left: 7px; }
.points-equation { display: flex; align-items: center; justify-content: center; gap: 22px; background: #ab884717; border-top: 1px solid #a287503d; border-bottom: 1px solid #a287503d; margin-top: 16px; padding: 11px 10px; }
.points-equation > span { font-size: 13px; color: #cbb996; display: flex; gap: 12px; align-items: center; }
.points-equation b { font: 21px Georgia, serif; color: #e8d4a2; }
.points-equation > strong { font: 29px Georgia, serif; color: #f3d591; }
.points-equation small { font: 12px var(--font); }
.points-equation > i { font-style: normal; font-size: 15px; color: #aa8c58; }
.result-explain { font-size: 13px; color: #c5b397; margin: 11px 0 0; }
dialog[data-kind=result] .dialog-inner { padding: 24px 30px; }
dialog[data-kind=result] .dialog-bottom { margin-top: 18px; }
.stats-row { display: flex; justify-content: space-around; margin: 20px 0; padding: 15px 0; border-top: 1px solid #a28b5c3b; border-bottom: 1px solid #a28b5c3b; }
.stats-row > span { display: flex; flex-direction: column; text-align: center; font-size: 13px; gap: 8px; color: #c3ae8a; }
.stats-row strong { font: 30px Georgia, serif; color: #e6c990; }
.records-list { max-height: 340px; overflow: auto; }
.record-row { display: flex; align-items: center; gap: 13px; width: 100%; padding: 14px 3px; background: none; border-bottom: 1px solid #9277442b; text-align: left; }
.record-icon { color: #aa9e86; font-size: 20px; width: 32px; text-align: center; }
.record-icon.won { color: #e1bd75; }
.record-row > span:nth-child(2) { flex: 1; }
.record-row strong { display: block; font-size: 14px; font-weight: 500; }
.record-row small { display: block; font-size: 12px; font-weight: 400; color: #b9a382; margin-top: 5px; }
.record-row > b { font: 23px Georgia, serif; color: #cdb17d; }
.record-row > b small { font: 12px var(--font); display: inline; }
.empty-records { padding: 40px 10px; text-align: center; color: #bdab8a; font-size: 14px; }

/* The imported-record audit remains available behind technical details. */
.audit-status { display: flex; align-items: center; gap: 16px; background: #1729206b; padding: 18px; margin-bottom: 20px; }
.audit-icon { font-size: 32px; color: #c3b783; }
.audit-status strong { font-size: 15px; font-weight: 500; }
.audit-status p { font-size: 13px; color: #b9bca2; margin: 5px 0 0; line-height: 1.6; }
.audit-fields { display: grid; grid-template-columns: 1fr; gap: 7px; }
.audit-fields dt { font-size: 12px; color: #c0aa84; margin-top: 11px; }
.audit-fields dd { margin: 0; font: 12px/1.8 ui-monospace, monospace; color: #d0bc92; overflow-wrap: anywhere; background: #14151a80; padding: 8px 10px; }
.audit-warning { font-size: 13px; margin-top: 20px; }
.audit-verdict { font-size: 16px; margin: 24px 0 15px; }
.pass { color: #b9d3a4; }
.fail { color: #e7a38d; }
.audit-check-list { list-style: none; margin: 0; padding: 0; }
.audit-check-list li { display: flex; gap: 12px; font-size: 13px; flex-wrap: wrap; line-height: 1.8; margin: 6px 0; }
.audit-check-list small { font-size: 12px; display: block; width: 100%; color: #d3ac91; }
.audit-check-list > li > span { width: 15px; }
.audit-events { margin-top: 19px; }
.audit-events ol { max-height: 220px; overflow: auto; padding: 8px 0; margin: 8px 0; list-style: none; counter-reset: move; }
.audit-events li { counter-increment: move; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid #9374432b; padding: 7px 0; font-size: 12px; }
.audit-events li::before { content: counter(move); width: 22px; color: #aa9676; }
.audit-events li > span:first-child { width: 65px; }
.audit-events li > span:nth-child(2) { flex: 1; }
.audit-events b { font-weight: 500; color: #e3c992; }
.revealed-seed { display: block; overflow-wrap: anywhere; font-size: 12px; line-height: 1.8; padding: 14px 0; }
#toast { position: fixed; z-index: 10; left: 50%; bottom: 28px; transform: translate(-50%, 8px); background: #191b1df2; border: 1px solid #b3955d; box-shadow: 0 6px 25px #0009; padding: 14px 23px; max-width: calc(100vw - 40px); font-size: 14px; color: #f0d9a9; text-align: center; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Responsive layout: cards fit their own container, actions stay in one place. */
@media (min-width: 1500px) and (min-height: 850px) {
  .lobby { max-width: 1120px; grid-template-columns: minmax(0, 1fr) 430px; gap: 130px; }
  .game-layout { padding-top: 35px; }
  .game-stage { height: 570px; min-height: 570px; }
  .draw-zone { top: 191px; }
  .table-rail { bottom: 86px; }
  .hand-area { bottom: 15px; }
}
@media (max-width: 1050px) {
  .lobby { width: calc(100% - 64px); grid-template-columns: minmax(0, 1fr) 370px; gap: 50px; }
  .lobby-left h1 { font-size: 60px; }
  .start-panel { padding: 26px; }
  .game-layout { width: calc(100% - 36px); grid-template-columns: minmax(0, 1fr) 230px; gap: 18px; }
  .turn-panel { padding: 24px 18px 20px; }
  .hand-label { gap: 12px; }
  .hand-toolbar .button { padding: 6px 8px; }
  .proof-layout { gap: 24px; }
  .proof-math-column { padding-left: 24px; }
}
@media (max-width: 850px) {
  .topbar { padding: 0 22px; }
  .lobby { width: min(610px, calc(100% - 44px)); min-height: auto; grid-template-columns: 1fr; gap: 12px; padding: 35px 0; }
  .lobby-left { text-align: center; }
  .lobby-left h1 { font-size: 56px; margin-bottom: 12px; }
  .intro { font-size: 16px; margin-bottom: 10px; }
  .hero-cards { height: 175px; margin: 12px auto 0; }
  .hero-cards .card { --card-w: 87px; --card-h: 124px; }
  .hero-cards .display-card { left: calc(50% - 43px); }
  .hero-cards .display-0 { transform: translateX(-63px) rotate(-19deg); }
  .hero-cards .display-2 { transform: translateX(61px) rotate(17deg); }
  .lobby-right { width: min(420px, 100%); margin: 0 auto; }
  .start-panel { padding: 25px; }
  .game-layout { width: calc(100% - 28px); padding: 12px 0 20px; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .matchbar { padding: 0 8px; height: 30px; }
  .game-stage { height: 430px; min-height: 430px; }
  .table-rail { left: 1%; right: 1%; top: 76px; bottom: 64px; padding: 9px; }
  .opponent-seat { top: 3px; }
  .opponent-seat .avatar { width: 41px; height: 41px; }
  .opponent-hand { top: 58px; }
  .draw-zone { top: 148px; gap: 24px; }
  .pile .card { --card-w: 74px; --card-h: 106px; }
  .pile-caption { font-size: 12px; margin-top: 10px; }
  .hand-area { left: 9px; right: 9px; bottom: 4px; }
  .player-hand { min-height: 118px; }
  .player-hand .card { --card-w: clamp(60px, 9cqw, 78px); }
  .turn-panel { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 14px 20px; padding: 18px 20px; }
  .panel-score { padding: 0 15px 0 0; border-bottom: 0; border-right: 1px solid #b3935930; align-self: center; }
  .panel-score > span, .panel-score > div { font-size: 12px; gap: 4px; }
  .panel-score strong, .panel-score b { font-size: 29px; }
  .turn-state { margin: 0; align-self: center; }
  .turn-state h2 { font-size: 19px; margin: 0 0 4px; }
  .turn-state p { min-height: 0; font-size: 13px; margin: 0; }
  .turn-actions { grid-column: 1 / -1; display: flex; flex-direction: row; gap: 12px; }
  .turn-actions .button { flex: 1; min-width: 0; min-height: 44px; font-size: 15px; }
  .turn-tools { grid-column: 1 / -1; margin-top: 0; }
  .fairness-entry { grid-column: 1 / -1; margin-top: 0; min-height: 43px; }
  .last-play { grid-column: 1 / -1; padding-top: 0; margin-top: 0; min-height: 0; font-size: 12px; }
  .proof-dialog .dialog-inner { padding: 27px 24px; }
  .proof-layout { gap: 20px; }
  .proof-math-column { padding-left: 20px; }
  .proof-layout h3 { font-size: 16px; }
  .tutorial-grid { gap: 18px; }
}
@media (max-width: 600px) {
  dialog.proof-dialog { width: calc(100vw - 24px); }
  .proof-layout { grid-template-columns: minmax(0, 1fr); gap: 25px; }
  .proof-input-column, .proof-math-column { height: auto; min-height: 0; }
  .proof-math-column { border-left: 0; border-top: 1px solid #aa8e5738; padding: 22px 0 0; }
  #proof-result { height: 170px; min-height: 170px; margin-top: 16px; }
  .proof-empty { min-height: 160px; }
  .proof-dialog .dialog-inner { padding: 27px 20px; }
  .tutorial-grid { grid-template-columns: 1fr; gap: 14px; }
  .tutorial-grid section { display: grid; grid-template-columns: 115px minmax(0, 1fr); grid-template-rows: auto auto; gap: 4px 16px; }
  .tutorial-art { grid-row: 1 / 3; height: 104px; margin: 0; }
  .tutorial-art .card { --card-w: 32px; --card-h: 47px; }
  .tutorial-grid h3 { margin: 6px 0 0; font-size: 15px; gap: 8px; }
  .tutorial-grid p { font-size: 13px; line-height: 1.7; margin: 3px 0; }
  .dialog-inner { padding: 29px 21px; }
  .dialog-inner > h2 { font-size: 24px; }
}
@media (max-width: 520px) {
  .topbar { height: 60px; padding: 0 17px; }
  .brand { font-size: 16px; gap: 8px; letter-spacing: 1px; }
  .brand small { font-size: 10px; }
  .brand-suit { width: 25px; height: 28px; }
  .header-tools { gap: 6px; }
  .header-tools .button { min-height: 36px; padding: 8px; font-size: 13px; }
  .header-tools .icon-button { width: 35px; height: 35px; }
  .lobby { width: calc(100% - 40px); padding-top: 29px; }
  .lobby-left h1 { font-size: 49px; letter-spacing: 5px; }
  .intro { font-size: 14px; }
  .hero-cards { height: 158px; }
  .hero-cards .card { --card-w: 79px; --card-h: 113px; }
  .hero-cards .display-card { left: calc(50% - 39px); }
  .hero-cards .display-0 { transform: translateX(-57px) rotate(-19deg); }
  .hero-cards .display-2 { transform: translateX(56px) rotate(17deg); }
  .start-panel { padding: 23px 21px; }
  .panel-heading { margin-bottom: 23px; }
  .panel-heading h2 { font-size: 23px; }
  .options-row { gap: 8px; }
  .options-row > span { font-size: 13px; }
  .segmented button { padding: 9px 10px; font-size: 13px; }
  .game-layout { width: calc(100% - 16px); padding-top: 8px; gap: 8px; }
  .matchbar { height: 31px; padding: 0 8px; }
  .match-meta, .match-meta small { font-size: 12px; }
  .match-meta { gap: 12px; }
  .game-stage { height: 436px; min-height: 436px; }
  .table-rail { top: 77px; bottom: 55px; padding: 7px; }
  .felt-border { inset: 8px; }
  .opponent-seat strong { font-size: 13px; }
  .opponent-seat small { font-size: 11px; }
  .opponent-hand .card { --card-w: 44px; --card-h: 63px; }
  .opponent-hand .card:not(:first-child) { margin-left: -21px; }
  .opponent-hand.revealed .card:not(:first-child) { margin-left: min(-8px, calc((100vw - 58px - var(--count) * 44px) / (var(--count) - 1))); }
  .opponent-hand .new-card { margin-left: 2px !important; }
  .draw-zone { top: 139px; gap: 20px; }
  .pile .card { --card-w: 67px; --card-h: 96px; }
  .pile-caption small { font-size: 11px; margin-top: 3px; }
  .hand-area { left: 8px; right: 8px; bottom: 5px; }
  .hand-toolbar { margin-bottom: 3px; gap: 6px; padding: 0; }
  .hand-toolbar > div { gap: 4px; }
  .hand-label { gap: 11px; font-size: 13px; }
  .deadwood-inline { font-size: 12px; gap: 4px; }
  .deadwood-inline b { font-size: 18px; }
  .hand-toolbar .button { min-height: 32px; font-size: 12px; padding: 6px 7px; }
  .player-hand { min-height: 104px; }
  .player-hand .card { --card-w: 60px; --card-h: 86px; }
  .player-hand .card-corner { left: 6%; top: 4%; width: 19%; }
  .player-hand .card-corner b { font-size: 16px; }
  .player-hand .card-corner svg { width: 11px; height: 11px; }
  .player-hand .card.selected { transform: translateY(-12px); }
  .turn-panel { grid-template-columns: 110px minmax(0, 1fr); gap: 12px 15px; padding: 16px; }
  .panel-score { padding-right: 12px; gap: 5px; }
  .panel-score > span, .panel-score > div { font-size: 12px; }
  .panel-score b, .panel-score strong { font-size: 27px; }
  .turn-state h2 { font-size: 18px; }
  .turn-state p { font-size: 13px; line-height: 1.6; }
  .turn-actions { gap: 10px; }
  .turn-actions .button { font-size: 14px; padding: 10px; }
  .scene-picker { gap: 6px; }
  .scene-choice > span:last-child { font-size: 11px; gap: 4px; }
  .scene-choice small { display: none; }
  .setting-row input[type=range] { width: 140px; }
  .result-score { gap: 18px; }
  .result-score b { font-size: 30px; }
  .result-score > span { font-size: 13px; gap: 10px; }
  .result-player-head { font-size: 13px; gap: 8px; }
  .result-player-head > span { font-size: 12px; }
  .result-cards { gap: 10px; }
  .mini-meld .card { --card-w: 31px; --card-h: 45px; }
  .mini-meld .card:not(:first-child) { margin-left: -3px; }
  .points-equation { gap: 10px; padding: 11px 6px; }
  .points-equation > span { font-size: 12px; gap: 6px; }
  .points-equation b { font-size: 20px; }
  .points-equation > strong { font-size: 26px; }
  .result-actions { gap: 8px; }
  .result-actions .button, .dialog-bottom .button { font-size: 13px; padding: 10px 12px; }
  dialog { max-height: calc(100svh - 28px); }
  dialog[data-kind=result] .dialog-inner { padding: 27px 17px; }
  dialog[data-kind=result] .result-player { padding: 10px; }
  #toast { bottom: 18px; padding: 12px 18px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
body[data-speed=fast] .thinking-dots i { animation: none; }
body[data-speed=fast] .card { transition-duration: .06s; }
