/* MTG practice table. Layout v2 (docs/design/ui.md): our own flat CSS, no third-party assets. */
:root {
  --bg: #15171c; --panel: #1e2129; --panel2: #262a34; --line: #343946; --text: #e6e8ee; --muted: #8b93a5;
  --accent: #5aa0ff; --good: #4cc38a; --bad: #ff6b6b; --warn: #f2b84b; --sel: #ffd84d; --ref: #b58cff;
  --felt-opp: #2a2f38; --felt-me: #313844; --act: #9fd3ff; --tgt: #ffa64d; --atk: #ff4d4d; --blk: #4da3ff;
  --cw: 80px; --ch: 112px; --hw: 140px; --hh: 196px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; }
body.at-table { overflow: hidden; }
button { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 4px 9px; cursor: pointer; font: inherit; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: #2c5fa8; border-color: #3d74c4; }
button.nav-you { background: #24344d; border-color: #46689c; }
button.danger { background: #5a2328; border-color: #8a3a41; }
button.small { font-size: 11px; padding: 2px 7px; }
input, select { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px; font: inherit; }
table { border-collapse: collapse; }
th, td { text-align: left; padding: 3px 8px; border-bottom: 1px solid var(--line); }
.muted { color: var(--muted); }
pre { white-space: pre-wrap; margin: 4px 0; font: 12px/1.3 ui-monospace, monospace; }

#top { display: flex; align-items: center; gap: 16px; padding: 4px 12px; height: 33px; background: #0f1115; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .02em; }
#top button.nav { padding: 2px 9px; }
#status-line { margin-left: auto; color: var(--warn); }
#errors { position: fixed; top: 36px; left: 50%; transform: translateX(-50%); width: min(900px, 90vw); z-index: 200; }
.error-banner { background: #3a1517; border: 1px solid var(--bad); color: #ffd7d7; padding: 6px 10px; margin: 4px 8px; border-radius: 5px; max-height: 40vh; overflow: auto; }
.error-banner.inline { margin: 6px 0; }
.error-banner .close { float: right; }
.engine-line { font-size: 12px; opacity: 0.85; margin: 4px 0; padding: 3px 8px; border-left: 3px solid var(--accent, #6a8caf); }
.result-banner { background: #1c3326ee; border: 1px solid var(--good); padding: 8px 12px; margin: 6px 0; border-radius: 5px; font-size: 15px; }

/* ---------------------------------------------------------------- lobby */
.lobby { display: grid; grid-template-columns: 1fr 360px; gap: 12px; padding: 12px; }
.lobby-main { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.picker, .settings { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.picker h3, .settings h3 { margin: 0 0 8px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.qbtn { font-weight: 600; padding: 6px 12px; }
.qbtn.on { background: #2c5fa8; border-color: var(--accent); }
.filters { display: flex; gap: 6px; margin-bottom: 6px; }
.filters input { flex: 1; }
.selected-deck { margin: 6px 0; }
.deck-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 4px; }
.deck-list tr { cursor: pointer; }
.deck-list tr:hover { background: var(--panel2); }
.deck-list tr.on { background: #2a3b57; }
.deck-preview { margin-top: 8px; }
.preview-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.preview-cols h4 { margin: 6px 0 4px; }
.pv-line { cursor: default; padding: 1px 0; }
.pv-line:hover .pv-name { color: var(--sel); }
.settings label { display: block; margin: 6px 0; }
.settings label[hidden] { display: none; }
.settings button.primary { margin-top: 8px; font-size: 15px; padding: 7px 16px; }
.lobby-side { display: flex; flex-direction: column; gap: 12px; }

/* ---------------------------------------------------------------- table v2 */
#app { min-height: 0; }
body.at-table #app { height: calc(100vh - 33px); }
.tablev2 { position: relative; display: grid; grid-template-columns: 236px minmax(0, 1fr) 320px; height: 100%; min-height: 0; background: #0d0f13; }
.review { display: flex; flex-direction: column; height: 100%; }
.review > .tablev2 { flex: 1 1 0; height: auto; }

/* left column: player panels, zones, prompt box, toolbar */
.lcol { display: flex; flex-direction: column; gap: 4px; padding: 4px; min-height: 0; border-right: 1px solid var(--line); }
.ppanel { background: linear-gradient(#232833, #1b1f27); border: 2px solid #2d3340; border-radius: 8px; padding: 5px 7px; flex: none; cursor: default; }
.ppanel.active { border-color: #4a7bd0; box-shadow: 0 0 0 1px #4a7bd0 inset; }
.ppanel.can-act { cursor: pointer; }
.ppanel.is-target { border-color: var(--tgt); box-shadow: 0 0 10px 2px #ff8c0088; }
.pp-top { display: flex; align-items: center; gap: 6px; }
.pp-clock { font: 600 12px/1 ui-monospace, monospace; background: #0f1d33; border: 1px solid #2f5596; color: #bcd6ff; border-radius: 9px; padding: 2px 7px; }
.pp-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.pp-turn { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: #9cc3ff; }
.pp-mid { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.pp-life { font: 800 34px/1 system-ui, sans-serif; min-width: 52px; text-align: center; color: #fff; text-shadow: 0 1px 0 #000; }
.pp-sub { color: var(--muted); font-size: 11px; line-height: 1.25; }
.pp-counts { display: flex; flex-wrap: wrap; gap: 3px 8px; font-size: 11px; color: var(--muted); }
.pp-counts b { color: var(--text); }
.pp-counts .poison b { color: var(--good); }
.pp-pool { margin-top: 3px; font-size: 11px; color: var(--muted); display: flex; gap: 2px; align-items: center; }
.zones { flex: 1 1 0; min-height: 34px; overflow: auto; background: #14171d; border: 1px solid #262b35; border-radius: 6px; padding: 3px; }
.zsec + .zsec { margin-top: 4px; }
.zlabel { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 1px 2px; }
.zlist { display: flex; flex-direction: column; gap: 2px; }
.zempty { color: #5d6474; font-size: 11px; padding: 2px 4px; }
.promptbox { flex: 0 1 auto; max-height: 46%; overflow: auto; background: #e9edf3; color: #1b1f27; border: 2px solid #9aa6b8; border-radius: 6px; padding: 6px 7px; }
.promptbox.yours { border-color: #4a90ff; box-shadow: 0 0 0 2px #4a90ff55; }
.pr-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: #56607a; margin-bottom: 3px; font-weight: 700; }
.pr-text { font-size: 13px; margin-bottom: 4px; }
.pr-text.muted { color: #6a7286; }
.pr-hint { font-size: 11px; color: #4b5570; font-style: italic; margin-bottom: 4px; }
.promptbox .oref { color: #1d4fa8; border-bottom-color: #8fa9d8; }
.promptbox .oid { color: #7c859a; }
.pr-buttons { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.pr-btn { background: #fff; color: #1b1f27; border: 1px solid #8d99ad; padding: 4px 9px; font-size: 12px; }
.pr-btn:hover { border-color: #2c5fa8; background: #f1f6ff; }
.pr-btn.main { background: #2c5fa8; color: #fff; border-color: #1f4a89; font-weight: 700; min-width: 72px; }
.pr-btn.main:hover { background: #3a70c0; }
.pr-btn .kbd { font-size: 9px; opacity: .75; margin-left: 6px; border: 1px solid currentColor; border-radius: 3px; padding: 0 3px; }
.pr-all { margin-top: 4px; font-size: 12px; }
.pr-all summary { cursor: pointer; color: #4b5570; font-size: 11px; }
.pr-all .opt { background: #fff; color: #1b1f27; border-color: #b8c1d0; }
.pr-all .opt.hl { background: #fff4c2; border-color: #c9a400; }
.promptbox .subject { margin-bottom: 4px; display: flex; gap: 6px; align-items: center; font-size: 11px; }
.undo-bar { display: flex; gap: 5px; margin-top: 6px; }
.undo-btn { flex: 1; font-size: 13px; font-weight: 700; padding: 5px 6px; background: #3a3220; color: #ffe2a6; border: 1px solid #a2803d; }
.undo-btn:hover:not(:disabled) { background: #4d4126; border-color: #e0b050; }
.toolbar { flex: none; display: flex; flex-direction: column; gap: 3px; background: #14171d; border: 1px solid #262b35; border-radius: 6px; padding: 4px; }
.tb-row { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; font-size: 11px; }
.tb-mode.active { background: #23452f; border-color: var(--good); }
.tb-id { margin-left: auto; font-size: 9.5px; }
.undo-count { color: #e0b050; font-size: 11px; }

/* centre: battlefield, phase bar, hand */
.center { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto clamp(140px, 27vh, 280px); min-width: 0; min-height: 0; }
.field { position: relative; display: grid; grid-template-rows: 1fr 1fr; min-height: 0; overflow: hidden; }
.half { display: flex; flex-direction: column; justify-content: space-between; gap: 4px; padding: 6px 10px; min-height: 0; overflow: auto; }
.half.opp { background: radial-gradient(ellipse at 50% 120%, #39404c, var(--felt-opp) 70%); border-bottom: 2px solid #0b0d11; }
.half.me { background: radial-gradient(ellipse at 50% -20%, #424a58, var(--felt-me) 70%); }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; min-height: calc(var(--ch) + 4px); }
.half.opp .row { align-items: flex-start; }
.row.front { justify-content: center; }
.row.back { justify-content: space-between; }
.grp { display: flex; flex-wrap: wrap; gap: 6px; align-items: inherit; }
.revealed { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; background: #0008; border-radius: 4px; padding: 2px 4px; }
.revealed .card.sz-mini { width: 150px; }
.banners { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 22; max-width: 80%; }
.banners:empty { display: none; }

/* permanents: slot = layout box, tapped turns the card 90 degrees */
.slot { position: relative; flex: none; width: var(--cw); height: var(--ch); transition: transform .12s; }
.slot.tapped { width: var(--ch); }
.slot > .card { position: absolute; left: 0; top: 0; }
.slot.tapped > .card { left: calc((var(--ch) - var(--cw)) / 2); transform: rotate(90deg); }
.half.me .slot.atk { transform: translateY(-14px); }
.half.opp .slot.atk { transform: translateY(14px); }
.slot.has-att { margin-bottom: 18px; }
.att-strip { position: absolute; left: 0; right: 0; top: calc(100% + 1px); display: flex; flex-direction: column; gap: 1px; z-index: 2; }
.att-strip .card.sz-mini { height: 16px; font-size: 9.5px; }
.pile { display: flex; align-items: inherit; }
.pile.multi > .slot + .slot { margin-left: calc(var(--cw) * -0.62); }
.pile.multi > .slot.tapped + .slot.tapped { margin-left: calc(var(--ch) * -0.66); }
.pile.multi > .slot:hover { z-index: 5; }

/* stack and chooser windows */
.stackwin, .chooser { position: absolute; z-index: 20; display: none; background: #12151bf2; border: 1px solid #4b5568; border-radius: 6px; box-shadow: 0 6px 24px #000a; }
.stackwin.open, .chooser.open { display: block; }
.stackwin { left: 8px; top: 8px; max-width: calc(100% - 16px); padding: 4px 6px 6px; }
.win-title { font-weight: 700; color: #a9c6ff; font-size: 12px; margin: 0 0 4px; }
.st-items { display: flex; gap: 8px; overflow-x: auto; align-items: flex-start; }
.st-item { display: flex; flex-direction: column; gap: 2px; width: 128px; flex: none; }
.st-item.top .card { box-shadow: 0 0 0 2px #a9c6ff; }
.st-label { font-size: 10px; color: var(--muted); }
.st-item.top .st-label { color: #a9c6ff; font-weight: 700; }
.st-tg, .st-x { font-size: 11px; color: var(--tgt); }
.st-ab { font-size: 11px; color: var(--muted); max-width: 220px; line-height: 1.25; }
.chooser { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, 90%); max-height: 80%; display: none; flex-direction: column; padding: 8px; }
.chooser.open { display: flex; }
.ch-filter { margin-bottom: 6px; }
.ch-list { overflow: auto; display: flex; flex-direction: column; gap: 3px; }

/* phase bar */
.phasebar2 { display: flex; align-items: center; gap: 10px; padding: 2px 8px; background: linear-gradient(#20242d, #171a21); border-top: 1px solid #3a4150; border-bottom: 1px solid #3a4150; min-height: 40px; }
.pb-turn { font-weight: 700; white-space: nowrap; min-width: 128px; }
.pb-turn.mine { color: var(--good); }
.pb-turn.theirs { color: var(--warn); }
.pb-steps { display: flex; flex: 1; justify-content: space-between; gap: 2px; min-width: 0; overflow: hidden; }
.pb-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 2px; min-width: 0; }
.pb-step { font-size: 11px; color: #aab2c3; padding: 1px 5px; border-radius: 10px; border: 1px solid transparent; white-space: nowrap; }
.pb-cell.np .pb-step { color: #6c7486; }
.my-turn .pb-cell.cur .pb-step { border-color: var(--good); background: #1f3a2b; color: #d8ffe9; font-weight: 700; }
.their-turn .pb-cell.cur .pb-step { border-color: var(--warn); background: #3d311a; color: #ffe9c2; font-weight: 700; }
.pb-stop { display: block; width: 16px; height: 5px; padding: 0; border-radius: 3px; border: 1px solid #4c5568; background: transparent; cursor: pointer; }
.pb-stop.none { border-color: transparent; cursor: default; }
.pb-stop.on.opp { background: var(--warn); border-color: var(--warn); }
.pb-stop.on.me { background: var(--good); border-color: var(--good); }
.pb-stop:hover:not(.none) { border-color: #fff; }
.pb-legend { font-size: 11px; color: var(--muted); cursor: help; border: 1px solid var(--line); border-radius: 50%; width: 17px; height: 17px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.pb-act { font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--panel2); white-space: nowrap; font-size: 12px; }
.pb-act.mine { color: var(--good); }
.pb-act.theirs { color: var(--warn); }

/* hand */
.handrow { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 6px 10px 4px; background: #101318; overflow-x: auto; overflow-y: hidden; min-height: 0; }
.hslot { flex: none; transition: transform .1s; position: relative; }
.hslot + .hslot { margin-left: var(--hover, 0px); }
.hslot:hover { transform: translateY(-6px); z-index: 5; }

/* right column */
.rcol { display: flex; flex-direction: column; gap: 6px; padding: 6px; min-height: 0; border-left: 1px solid var(--line); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.panel-title, .insp-title { font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .05em; margin-bottom: 6px; }
.rcol .inspector { overflow: auto; flex: 3 1 0; min-height: 160px; }
.rcol .logpanel { flex: 2 1 0; overflow: auto; min-height: 100px; }
.rcol #decision { flex: 0 1 auto; max-height: 40%; overflow: auto; }
#log, #timeline { font-size: 12px; }
.logline { padding: 1px 0; border-bottom: 1px dotted #2a2e38; }
.logline.step { color: var(--muted); }
.logline.turn { color: #a9c6ff; font-weight: 700; border-top: 1px solid #3a4150; margin-top: 3px; }
.logline.over { color: var(--warn); font-weight: 700; }

/* arrows (SVG overlay) and the action menu */
.arrows { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; overflow: visible; }
.arrow { fill: none; stroke-width: 4; stroke-linecap: round; opacity: .9; }
.arrow.attack { stroke: var(--atk); }
.arrow.block { stroke: var(--blk); }
.arrow.target { stroke: var(--tgt); stroke-dasharray: 9 5; }
.ah.attack, .arrow-dot.attack { fill: var(--atk); }
.ah.block, .arrow-dot.block { fill: var(--blk); }
.ah.target, .arrow-dot.target { fill: var(--tgt); }
.menu { position: fixed; z-index: 150; background: #f3f5f9; color: #1b1f27; border: 1px solid #7e8aa0; border-radius: 6px; box-shadow: 0 6px 20px #000b; padding: 3px; display: flex; flex-direction: column; min-width: 180px; max-width: 360px; max-height: 60vh; overflow: auto; }
.menu-item { background: transparent; color: inherit; border: 0; border-radius: 4px; text-align: left; padding: 5px 8px; }
.menu-item:hover { background: #dce8ff; }
.menu-item.cancel { color: #6a7286; border-top: 1px solid #cfd5e0; border-radius: 0; }
.menu .oref { color: #1d4fa8; }

/* ---------------------------------------------------------------- cards (our own tiles) */
.card { position: relative; background: #1d2129; border: 2px solid var(--frame, #6b7280); border-radius: 6px; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; user-select: none; }
.fr-w { --frame: #d8d2b4; --bar: #4a4635; } .fr-u { --frame: #4f8fd6; --bar: #1f3757; } .fr-b { --frame: #8c7f8f; --bar: #2c2530; }
.fr-r { --frame: #d9634a; --bar: #4f2219; } .fr-g { --frame: #4fa86a; --bar: #1d3d27; } .fr-multi { --frame: #d4b14a; --bar: #4a3d16; }
.fr-c { --frame: #9aa3b2; --bar: #33373f; } .fr-land { --frame: #a08a6a; --bar: #3a3126; }
.card:hover { filter: brightness(1.12); }
.card.back { background: repeating-linear-gradient(45deg, #2b2440, #2b2440 6px, #231d36 6px, #231d36 12px); border-color: #4d4470; }
.back-face { color: #8a7cc0; text-align: center; font-size: 10px; padding: 2px; }
.c-head { display: flex; justify-content: space-between; gap: 3px; align-items: center; background: var(--bar, #333); padding: 1px 4px; flex: none; }
.c-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.c-art { width: 100%; object-fit: cover; display: block; min-height: 0; flex: 1 1 0; background: #0b0d10; }
.c-noart { display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: 10px; padding: 2px; }
.c-type { font-size: 9.5px; color: #c4cad6; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; background: var(--bar, #333); padding: 0 4px; flex: none; }
.c-text { font-size: 10px; line-height: 1.2; padding: 2px 4px; color: #dfe3ea; overflow: hidden; flex: 1 1 0; }
.c-text p { margin: 0 0 2px; }
.c-text .ms { min-width: 11px; height: 11px; line-height: 11px; font-size: 7.5px; }
.c-badges { position: absolute; left: 2px; top: 20px; display: flex; flex-direction: column; gap: 1px; align-items: flex-start; pointer-events: none; }
.badge { font-size: 9px; background: #000c; border-radius: 3px; padding: 0 3px; color: #e6e8ee; }
.badge.counter { background: #2f5f45ee; }
.badge.kw { background: #29344acc; }
.c-pt { position: absolute; right: 2px; bottom: 2px; font-weight: 800; font-size: 13px; background: #0d0f13e6; border: 1px solid var(--frame); padding: 0 4px; border-radius: 4px; }
.c-pt.damaged { color: var(--bad); }

.card.sz-bf { width: var(--cw); height: var(--ch); font-size: 10px; }
.card.sz-bf .c-name { font-size: clamp(9px, calc(var(--cw) / 9), 12px); }
.card.sz-hand { width: var(--hw); height: var(--hh); font-size: 11px; }
.card.sz-hand .c-name { font-size: 12px; }
.card.sz-hand .c-art { flex: 0 0 34%; }
.card.sz-stack { width: 128px; height: 178px; font-size: 11px; }
.card.sz-stack .c-art { flex: 0 0 34%; }
.card.sz-mini { flex-direction: row; align-items: center; gap: 4px; height: 20px; padding: 0 4px; border-width: 1px; border-left-width: 4px; font-size: 11px; background: var(--bar, #262a34); }
.card.sz-mini .c-name { font-weight: 600; flex: 1; }
.card.sz-mini .ms { min-width: 12px; height: 12px; line-height: 12px; font-size: 8px; }
.card.sick .c-art { filter: saturate(.45) brightness(.8); }
.card.attacking { border-color: var(--atk); box-shadow: 0 0 0 2px #ff4d4d88, 0 0 12px #ff4d4d88; }
.card.blocking { border-color: var(--blk); box-shadow: 0 0 0 2px #4da3ff88; }
.card.can-act { box-shadow: 0 0 0 2px var(--act), 0 0 12px 3px #5aa0ffaa; }
.card.is-target { box-shadow: 0 0 0 2px var(--tgt), 0 0 14px 4px #ff8c00aa; }
.card.is-subject { outline: 2px solid var(--sel); outline-offset: 1px; }
.card.selected { outline: 3px solid var(--sel); outline-offset: 1px; }
.card.opt-ref { outline: 3px solid var(--ref); outline-offset: 1px; }
.card.lookup-error { border-color: var(--bad); }
.handrow .card.can-act { transform: translateY(-4px); }

/* mana symbols */
.cost { display: inline-flex; gap: 1px; flex-shrink: 0; }
.ms { display: inline-block; min-width: 15px; height: 15px; line-height: 15px; border-radius: 50%; text-align: center; font-size: 9.5px; font-weight: 700; color: #111; background: #cbc2bf; padding: 0 2px; }
.ms-w { background: #f8f6d8; } .ms-u { background: #9ec5ea; } .ms-b { background: #b0a6a0; } .ms-r { background: #ef9a7a; } .ms-g { background: #9cc796; } .ms-c { background: #d4cfcd; }
.ms-hy { background: linear-gradient(135deg, #9ec5ea 50%, #ef9a7a 50%); }

/* inspector */
.insp-img { width: 100%; max-width: 300px; border-radius: 10px; display: block; margin: 0 auto 6px; }
.insp-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.insp-name { font-weight: 700; font-size: 15px; }
.insp-type { color: var(--muted); margin: 2px 0 4px; }
.insp-oracle p { margin: 3px 0; }
.insp-otherface { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 4px; }
.insp-pt { font-weight: 700; }
.insp-state { margin-top: 6px; width: 100%; font-size: 12px; }
.insp-state th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.insp-engine summary { color: var(--muted); cursor: pointer; margin-top: 6px; }
.insp-empty { color: var(--muted); }
.insp-empty.error, .error { color: var(--bad); }
.lobby-side .inspector { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px; }

/* option lists (prompt box "All options", chooser, review) */
.prompt { margin-bottom: 6px; font-size: 13.5px; }
.options { display: flex; flex-direction: column; gap: 3px; }
.opt { text-align: left; padding: 4px 8px; }
.opt.hl { border-color: var(--sel); background: #4a4320; }
.opt-i { color: var(--muted); font-size: 10px; display: inline-block; min-width: 14px; }
.oref { color: #cfe1ff; border-bottom: 1px dotted #6c8bc4; }
.oref-pin { cursor: pointer; }
.oid { color: var(--muted); font-size: 9.5px; }
.review-opt { cursor: default; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.review-opt.chosen { border-color: var(--good); }
.opt-meta { margin-left: auto; display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 6px; align-items: center; }
.chosen-mark, .top-mark, .best-mark { white-space: nowrap; }
.pbar-wrap { flex: none; }
.chosen-mark { color: var(--good); font-weight: 700; }
.top-mark { color: var(--sel); font-weight: 700; }
.pbar-wrap { position: relative; display: inline-block; width: 90px; height: 13px; background: #2a2e38; border-radius: 3px; overflow: hidden; }
.pbar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #3d74c4; }
.pbar-num { position: relative; font-size: 10px; padding-left: 3px; }
.model-value { margin: 4px 0 8px; }

/* review / saved games */
.review-head { padding: 4px 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.stepper { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.stepper input[type=range] { flex: 1; min-width: 200px; }
.tl { padding: 2px 4px; cursor: pointer; border-bottom: 1px dotted #2a2e38; }
.tl:hover { background: var(--panel2); }
.tl.cur { background: #2a3b57; }
.tl.model .tl-t { color: var(--warn); }
.tl.mine .tl-t { color: var(--good); }
.tl-v { color: var(--muted); }
.games { padding: 12px; }
.outcome.won { color: var(--good); } .outcome.lost { color: var(--bad); } .outcome.error { color: var(--bad); font-weight: 700; }

/* smaller screens */
@media (max-width: 1300px) {
  .tablev2 { grid-template-columns: 210px minmax(0, 1fr) 260px; }
  .pb-legend { display: none; }
}
@media (max-width: 1000px) {
  .tablev2 { grid-template-columns: 190px minmax(0, 1fr); }
  .rcol { display: none; }
}
.tablev2.narrow .pb-step { padding: 1px 3px; font-size: 10px; }
.c-pt .dmg { font-size: 10px; color: var(--bad); }
.pb-short { display: none; }
.pb-compact .pb-long, .pb-compact .pb-legend { display: none; }
.pb-compact .pb-short { display: inline; }
.pb-compact .pb-turn { min-width: 0; }
.pb-compact .pb-step { padding: 1px 4px; }
.chooser { z-index: 40; }

/* ================================================================ Ergonomics v3: the client's look
   Reproduced with our own CSS from the reference frames (docs/design/ui.md "Ergonomics v3"): square
   panels and windows, near-square cards with a thin dark rim, flat grey battlefield halves (the
   opponent's darker), black side columns / phase bar / hand row, serif labels, white stop triangles,
   the current step in a gold-rimmed black pill, a grey prompt box with rectangular blue buttons, the
   game log on a light panel above the card preview. Tested in ui/tests/test_ui_browser.py. */
:root { --serif: Georgia, "Times New Roman", "DejaVu Serif", serif; }
.tablev2 { background: #050506; grid-template-columns: 228px minmax(0, 1fr) 300px; }
.lcol, .rcol { background: #0a0a0b; gap: 3px; padding: 3px; border-color: #26272a; }
.ppanel, .zones, .promptbox, .toolbar, .panel, .stackwin, .chooser, .menu, .revealed, .error-banner, .result-banner { border-radius: 0; }
.ppanel { background: #121214; border: 1px solid #34363b; padding: 4px 6px; }
.ppanel.active { border-color: #3a74d8; box-shadow: none; }
.pp-clock { border-radius: 3px; background: #1d4fae; border-color: #5d8be0; color: #fff; }
.pp-life { font: 700 34px/1 var(--serif); }
.pp-name { font-family: var(--serif); }
.zones { background: #0e0e10; border: 1px solid #26272a; }
.zlabel { font-family: var(--serif); text-transform: none; letter-spacing: 0; font-size: 11px; }
.promptbox { background: #c9ccd1; color: #15161a; border: 1px solid #6d7178; padding: 5px 6px; }
.promptbox.yours { border-color: #2f6fe0; box-shadow: inset 0 0 0 1px #2f6fe0; }
.pr-title { color: #3b3e45; text-transform: none; letter-spacing: 0; font-family: var(--serif); font-size: 12px; }
.pr-text.muted { color: #3b3e45; }
.pr-buttons { justify-content: flex-end; }
.pr-btn, .undo-btn, .menu-item { border-radius: 0; }
.pr-btn { background: #e9eaec; border-color: #6d7178; }
.pr-btn.main { background: linear-gradient(#3d7be0, #1f54b4); border-color: #163f8a; }
.undo-btn { border-radius: 0; }
.toolbar { background: #0e0e10; border: 1px solid #26272a; }
.toolbar button, .tb-mode { border-radius: 0; }
.half.opp { background: #3e4146; border-bottom: 2px solid #050506; }
.half.me { background: #8d939b; }
.half { padding: 5px 8px; }
.card { border-radius: 2px; border-width: 1px; border-color: #050506; box-shadow: inset 0 0 0 1px var(--frame, #6b7280); }
.c-name, .insp-name, .win-title { font-family: var(--serif); }
.c-pt { border-radius: 0; }
.badge { border-radius: 0; }
.card.can-act { box-shadow: inset 0 0 0 1px var(--frame, #6b7280), 0 0 0 2px #7fb6ff, 0 0 9px 2px #5aa0ffaa; }
.card.is-target { box-shadow: inset 0 0 0 1px var(--frame, #6b7280), 0 0 0 2px var(--tgt), 0 0 12px 3px #ff8c00aa; }
.card.attacking { border-color: var(--atk); }
.handrow { background: #050506; }
.stackwin { background: #0c0c0eee; border: 1px solid #5a5d63; }
.stackwin .win-title { color: #e8e2c8; font-size: 14px; }
.phasebar2 { background: #0b0b0c; border-top: 1px solid #3a3b3f; border-bottom: 1px solid #3a3b3f; min-height: 36px; gap: 8px; }
.pb-turn, .pb-turn.mine, .pb-turn.theirs { color: #f2f2f2; font-family: var(--serif); }
.pb-step { font-family: var(--serif); font-size: 12px; color: #a7a8ab; border-radius: 0; }
.pb-cell.np .pb-step { color: #74767b; }
.my-turn .pb-cell.cur .pb-step, .their-turn .pb-cell.cur .pb-step { background: #000; color: #fff; border: 2px solid #c08a2c; border-radius: 12px; font-weight: 700; }
.pb-cell { cursor: context-menu; }
.pb-cell.np { cursor: default; }
.pb-stop { width: 0; height: 0; padding: 0; border-radius: 0; border-style: solid; background: transparent; cursor: pointer; }
.pb-stop.opp { border-width: 6px 7px 0 7px; border-color: #55575c transparent transparent transparent; }
.pb-stop.me { border-width: 0 7px 6px 7px; border-color: transparent transparent #55575c transparent; }
.pb-stop.on.opp { background: transparent; border-color: #fff transparent transparent transparent; }
.pb-stop.on.me { background: transparent; border-color: transparent transparent #fff transparent; }
.pb-stop.opp:hover:not(.none) { border-top-color: #c08a2c; }
.pb-stop.me:hover:not(.none) { border-bottom-color: #c08a2c; }
.pb-stop.none { border-width: 0; width: 14px; height: 6px; cursor: default; }
.pb-act { border-radius: 0; background: transparent; font-family: var(--serif); }
.pb-legend { border-radius: 0; }
/* right column: game log (light) above the card preview, as in the reference */
.rcol .logpanel { order: 1; background: #e4e4e2; color: #1a1b1f; border: 1px solid #8b8d91; }
.rcol .logpanel .panel-title { color: #45474c; }
.rcol .logpanel .logline { border-bottom: 0; }
.rcol .logpanel .logline.step { color: #6b6d72; }
.rcol .logpanel .logline.turn { color: #1d4fae; border-top-color: #b9bbbf; }
.rcol .logpanel .oref { color: #1d4fae; border-bottom-color: #8fa9d8; }
.rcol .logpanel .oid { color: #7c7e83; }
.rcol #decision { order: 0; }
.rcol .inspector { order: 2; background: #0e0e10; border: 1px solid #26272a; }
.insp-img { border-radius: 4.5% / 3.2%; }
/* menus and the shortcut legend */
.menu-head { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: #56607a; padding: 5px 8px 2px; font-weight: 700; }
.menu-check { display: inline-block; width: 18px; }
.tb-check { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--text); cursor: pointer; }
.tb-check input { margin: 0; }
.tb-keys { font-size: 10.5px; color: var(--muted); }
.tb-keys summary { cursor: pointer; }
.tb-keys table { width: 100%; }
.tb-keys th, .tb-keys td { padding: 1px 3px; border: 0; font-size: 10.5px; }
.tb-keys th { color: var(--text); white-space: nowrap; font-weight: 600; }
.toolbar .kbd { font-size: 9px; border: 1px solid currentColor; padding: 0 3px; }


/* multi-pick set choices: selected in any order, then OK (attackers step forward with a red rim, as in the client) */
.card.picked { outline: 2px solid #ffd84d; outline-offset: 1px; }
.card.pick-attack { outline-color: var(--atk); }
.card.pick-block { outline-color: var(--blk); }
.half.me .slot.pick-attack { transform: translateY(-14px); }
.opt.picked, .menu-item.picked { background: #fff4c2; border-color: #c9a400; }
.chooser .opt.picked { background: #4a4320; border-color: var(--sel); }

/* review: seat toggle, move EV (post-game analysis; docs/design/ui.md "Move EV and leaks") */
.seg { display: inline-flex; align-items: center; gap: 0; }
.seg .seg-b { border-radius: 0; margin-left: -1px; padding: 2px 8px; }
.seg .seg-b.on { background: #2c5fa8; border-color: #3d74c4; color: #fff; }
.seg.small .seg-b { font-size: 10.5px; padding: 1px 6px; }
.seg .kbd { font-size: 9px; border: 1px solid currentColor; padding: 0 3px; margin-left: 5px; color: var(--muted); }
.evbox { margin: 4px 0 6px; padding: 5px 6px; background: #14161b; border: 1px solid #2f3440; font-size: 12px; }
.ev-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 3px; }
.ev-sum { line-height: 1.45; }
.ev-gap { font-weight: 700; color: var(--warn); }
.ev-gap.bad, .tl-ev.bad, .ev-chip.bad, .bad { color: var(--bad); }
.ev-ok { color: var(--good); }
.ev-flag { margin-top: 3px; color: var(--warn); font-size: 11.5px; }
.ev-flag.bad { color: var(--bad); }
.ev-note { margin-top: 4px; font-size: 10.5px; }
.ev-pos { margin-top: 3px; font-size: 11.5px; }
.ev-chip { font-size: 10.5px; color: #cfe1ff; white-space: nowrap; }
.ev-d { color: var(--muted); }
.best-mark { color: #7fe0b0; font-weight: 700; }
.ev-foot { margin-top: 6px; font-size: 11px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tl-ev { color: var(--muted); font-weight: 600; }
.tl-ev.lost { opacity: .55; }
.rcol .logpanel .tl-ev.bad { color: #c0262d; }
/* leak report page */
.leaks { padding: 12px 16px; max-width: 1200px; }
.leak-disclaimer { background: #2b2414; border: 1px solid #6d5a2a; padding: 6px 10px; margin: 6px 0 10px; }
.leak-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.leak-controls .num { width: 64px; }
.leak-totals { margin: 8px 0; }
.leak-table { margin: 8px 0 14px; }
.leak-bucket { margin: 10px 0 16px; }
.leak-bucket h3 { margin: 4px 0; font-family: var(--serif); }
.leak-sub { color: var(--muted); text-transform: uppercase; font-size: 10.5px; letter-spacing: .05em; margin: 6px 0 2px; }
.leak-item { padding: 5px 8px; border-left: 3px solid var(--bad); background: var(--panel); margin: 3px 0; }
.leak-item.disagree { border-left-color: var(--warn); }
.leak-item a { color: var(--accent); }
.in-review .rcol #decision { max-height: 58%; }
/* sign-out (security fixes A, L11): lobby / admin footer only, never on the play or review table */
#site-foot { padding: 8px 12px; text-align: right; }
#site-foot #signout[hidden], body.at-table #site-foot { display: none; }
