:root {
  --bg: #1a1d1b; --bg2: #232826; --panel: #2b302d; --line: #3d443f;
  --ink: #e8e6df; --ink2: #b7b5ad; --ink3: #858a84;
  --accent: #6fc2ab; --accent-ink: #0f2a23; --warn: #e07a6a; --gold: #e3c56a;
  --W: #e6dcae; --U: #6f9be0; --B: #8c7fa6; --R: #d5654a; --G: #5f9c4a; --M: #d9a441; --C: #9a9a92;
  --cw: 104px; --ch: 146px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif; }
h1, h2, h3 { font-family: Garamond, "EB Garamond", Georgia, serif; font-weight: 600; margin: 0 0 8px; line-height: 1.15; }
h1 { font-size: 54px; } h2 { font-size: 26px; } h3 { font-size: 19px; margin-top: 16px; }
p { margin: 0 0 10px; }
code { background: var(--bg2); padding: 1px 5px; border-radius: 3px; font-size: .9em; }
a { color: var(--accent); }
button { font: inherit; }
.small { font-size: 13px; color: var(--ink2); }
.btn { background: var(--panel); color: var(--ink); border: 1px solid var(--line); padding: 7px 14px; border-radius: 4px; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.tiny { padding: 1px 8px; font-size: 12px; line-height: 1.4; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.msg { background: #3a2a27; border: 1px solid var(--warn); color: #f1c9c1; padding: 8px 12px; border-radius: 4px; margin: 10px 0; font-size: 13.5px; }
.combat-nudge { background: #4a3410; border-color: #e6c14a; color: #f7e3ab; font-weight: 600; animation: nudgePulse 1.1s ease-in-out infinite; }
@keyframes nudgePulse { 0%,100% { box-shadow: 0 0 0 rgba(230,193,74,0); } 50% { box-shadow: 0 0 10px rgba(230,193,74,.6); } }
@media (prefers-reduced-motion: reduce) { .combat-nudge { animation: none; } }
.ok { color: var(--accent); margin: 10px 0; font-size: 13.5px; }
input, select, textarea { font: inherit; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; }
textarea { width: 100%; resize: vertical; font-family: Consolas, monospace; font-size: 13px; }
label { display: block; margin: 8px 0; }
label input:not([type=radio]), label select { display: block; width: 100%; margin-top: 4px; }
fieldset { border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; margin: 8px 0; }
legend { color: var(--ink2); font-size: 13px; padding: 0 4px; }
.radio { display: inline-flex; align-items: center; gap: 4px; margin: 2px 10px 2px 0; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(0,0,0,.4); margin-right: 3px; }
.dot.c-W { background: var(--W); } .dot.c-U { background: var(--U); } .dot.c-B { background: var(--B); } .dot.c-R { background: var(--R); } .dot.c-G { background: var(--G); } .dot.c-C { background: #b9b9b0; }

#topbar { display: flex; align-items: center; gap: 18px; padding: 8px 18px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.brand { font-family: Garamond, Georgia, serif; font-size: 22px; font-weight: 600; cursor: pointer; }
.brand span { font-size: 12px; color: var(--ink3); font-family: "Segoe UI", system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; margin-left: 4px; }
#topbar nav { display: flex; gap: 4px; }
.tab { background: transparent; border: 1px solid transparent; color: var(--ink2); padding: 5px 12px; border-radius: 4px; cursor: pointer; }
.tab.on { background: var(--panel); color: var(--ink); border-color: var(--line); }
.tab:disabled { opacity: .35; cursor: default; }
.stats { margin-left: auto; display: flex; gap: 16px; font-variant-numeric: tabular-nums; color: var(--ink2); }
.stats span:first-child { color: #f0a49a; } .stats span:nth-child(2) { color: var(--gold); }
#status { background: var(--accent); color: var(--accent-ink); padding: 5px 18px; font-size: 13px; font-weight: 600; }

#app { padding: 18px; max-width: 1400px; margin: 0 auto; }
#app.full { max-width: none; padding: 10px 14px; }
.screen { display: block; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px; margin-bottom: 16px; }
.box.center { text-align: center; max-width: 520px; margin: 48px auto; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols.wide { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .cols, .cols.wide { grid-template-columns: 1fr; } }
.title .lede { max-width: 70ch; color: var(--ink2); font-size: 17px; margin-bottom: 20px; }
.legal { font-size: 12px; color: var(--ink3); max-width: 80ch; margin-top: 24px; border-top: 1px solid var(--line); padding-top: 10px; }
.rowhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rowtools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg-b { background: transparent; border: 0; color: var(--ink2); padding: 4px 10px; cursor: pointer; font-size: 13px; }
.seg-b.on { background: var(--line); color: var(--ink); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--ink3); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
td.notes { color: var(--ink3); font-size: 12px; max-width: 320px; }
tr.st-unsupported td, tr.st-missing td { color: var(--ink3); }
tr.st-approx td:nth-child(7), tr.st-approx td:nth-child(3) { color: var(--gold); }
tr.st-unsupported td:nth-child(7), tr.st-unsupported td:nth-child(3), tr.st-missing td:nth-child(3) { color: var(--warn); }
.report { margin-top: 10px; max-height: 260px; overflow: auto; }
.coll { display: block; max-height: 60vh; overflow: auto; }
.coll tr { display: table; width: 100%; table-layout: fixed; }
.coll th:first-child, .coll td.thumb { width: 44px; }
.mini { width: 34px; height: 48px; border-radius: 3px; background: var(--bg) center / cover; border: 1px solid var(--line); }
.mini.own { outline: 2px solid var(--gold); }
.basics { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 8px 0; font-size: 13.5px; }
.innmsg { margin: 4px 0 10px; padding: 8px 12px; border-left: 3px solid var(--gold); border-radius: 0 6px 6px 0; background: color-mix(in srgb, var(--gold) 12%, transparent); color: var(--ink); font-style: italic; }
.mplobby .box { max-width: 560px; margin: 24px auto; }
.mplobby label { display: block; margin: 8px 0; }
.mplobby input, .mpdeck select, .mplobby select { padding: 6px 8px; }
.mplobby input[type=text], .mplobby #mp-name, .mplobby #mp-addr { width: 100%; box-sizing: border-box; }
.mp-code { font-family: ui-monospace, monospace; font-size: 40px; letter-spacing: 8px; text-align: center; color: var(--gold); background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 10px 0; }
.mp-rooms { list-style: none; padding: 0; margin: 10px 0; }
.mp-rooms li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin: 6px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); cursor: pointer; transition: border-color .12s, background .12s; }
.mp-rooms li:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg2)); }
.mp-game-name b { color: var(--ink); }
.mp-join-hint { color: var(--ink3); font-size: 13px; }
.mp-rooms li:hover .mp-join-hint { color: var(--accent); }
.mp-empty { color: var(--ink2); padding: 14px 12px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; }
.mp-lobbybar { align-items: center; gap: 8px; margin: 6px 0 4px; }
.mp-ok { color: var(--accent); }
.mp-hosting { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; margin: 8px 0; border: 1px solid var(--accent); border-radius: 8px; background: color-mix(in srgb, var(--accent) 8%, var(--bg2)); }
.mp-code.inline { display: inline; font-size: 18px; letter-spacing: 3px; padding: 1px 6px; margin: 0; vertical-align: baseline; }
.mp-decktext { width: 100%; box-sizing: border-box; font-family: ui-monospace, monospace; font-size: 13px; resize: vertical; background: var(--bg2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.baz-gold { font-weight: 700; color: var(--gold); align-self: center; margin-right: auto; }
.baz-filters { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.baz-frow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.baz-flabel { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink3); width: 52px; flex: none; }
.baz-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); color: var(--ink2); cursor: pointer; }
.baz-chip .dot { width: 10px; height: 10px; border-radius: 50%; }
.baz-chip:hover { border-color: var(--accent); }
.baz-chip.on { background: color-mix(in srgb, var(--gold) 22%, var(--bg2)); border-color: var(--gold); color: var(--ink); font-weight: 600; }
.baz-clear { color: var(--ink3); }
.bazaar .cost { color: var(--gold); font-weight: 700; }
.baz-g { font-size: .8em; opacity: .8; margin-left: 1px; }
.mpdeck .cols.wide { gap: 16px; }
.mp-quick { margin: 8px 0; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.mp-quick summary { cursor: pointer; color: var(--ink2); }
.mp-load-h { font-size: 12px; color: var(--ink3); margin: 8px 0 4px; }
.mp-deckpick { display: flex; flex-wrap: wrap; gap: 6px; }
.mp-deckpick .btn { flex: 0 1 auto; }
.mullhand { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mullcard { padding: 3px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg2); font-size: 13px; }
.mullcard .dot { width: 9px; height: 9px; vertical-align: 0; }
.hint.waiting { color: var(--gold); font-style: italic; animation: waitpulse 1.6s ease-in-out infinite; }
@keyframes waitpulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.basic { display: inline-flex; align-items: center; gap: 4px; }
.plain { list-style: none; padding: 0; }

/* map */
.mapscreen { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.map-help { margin: 4px 0 10px; }
.map-help > summary { cursor: pointer; color: var(--gold); font-size: 13px; list-style: none; }
.map-help > summary::-webkit-details-marker { display: none; }
.map-help > summary::before { content: '▸ '; }
.map-help[open] > summary::before { content: '▾ '; }
.map-help > summary:hover { text-decoration: underline; }
@media (max-width: 1100px) { .mapscreen { grid-template-columns: 1fr; } }
.mapwrap { background: #0f1210; border: 1px solid var(--line); border-radius: 6px; padding: 6px; overflow: hidden; }
#map { display: block; cursor: pointer; border-radius: 4px; image-rendering: pixelated; image-rendering: crisp-edges; margin: 0 auto; }
.mapwrap { background: #17120e; border: 8px solid #2c2622; outline: 2px solid #6e5637; box-shadow: inset 0 0 30px rgba(0,0,0,.8), 0 0 0 4px #14110e; }
.minimap { display: block; width: 100%; image-rendering: auto; border: 2px solid #6e5637; border-radius: 4px; margin-bottom: 10px; background: #0a0a0c; }

/* rules-core duel additions */
.stack { background: #2a2320; border: 1px solid #6a5a3a; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; width: max-content; max-width: 92vw; max-height: 82vh; overflow-y: auto; }
/* The stack floats over the middle of the board so casting doesn't inflate the divider and shove the zones.
   The container ignores clicks (so the board underneath stays interactive); the panel itself takes them. */
.stack-overlay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; pointer-events: none; max-width: 92%; }
.stack-title { display: flex; align-items: center; gap: 6px; }
.stack-entry { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border-radius: 8px; }
.stack-entry.next { background: rgba(227,197,106,.1); box-shadow: inset 0 0 0 1px rgba(227,197,106,.35); }
.stack-entry .card { flex: none; }
.stack-cap { font-size: 14px; color: var(--ink2); line-height: 1.4; text-align: center; }
.stack-cap b { color: var(--ink); }
.stack-nm { color: #ffe9a8; font-weight: 600; }
.stack-next { display: block; margin-top: 2px; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--gold); }
.stack-overlay .stack { pointer-events: auto; background: rgba(34, 28, 24, .95); border-color: #a07c48; box-shadow: 0 12px 34px rgba(0,0,0,.7), 0 0 0 1px rgba(0,0,0,.4); animation: stackIn .18s ease-out; }
@keyframes stackIn { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
.stack-title { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.stack-item { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; font-size: 13px; }
.stack-item span { color: var(--ink3); font-size: 11px; }
.stack-item.targetable { box-shadow: 0 0 0 2px #ff4b4b; cursor: pointer; }
.stack-tgt { font-size: 11px; color: var(--ink2); }
.pbox.thinking { border-color: var(--gold); }
.ppool { font-size: 12px; color: #9fe7ff; margin-top: 4px; }
.ppoison { color: #a4e07a; font-size: 13px; }
.card.usable { outline: 1px dashed rgba(255,255,255,.35); }
.card.pay-source, .pill.pay-source { outline: 2px solid #e6c14a; box-shadow: 0 0 12px rgba(230,193,74,.7); cursor: pointer; }
.card-counters { position: absolute; left: 3px; top: 20px; background: rgba(0,0,0,.75); color: #ffd27a; font-size: 9px; padding: 1px 4px; border-radius: 3px; }
.card-regen { position: absolute; right: 3px; top: 34px; background: rgba(20,80,20,.85); color: #cfc; font-size: 9px; padding: 1px 4px; border-radius: 3px; }
.card-shield { position: absolute; right: 3px; top: 48px; background: rgba(40,60,110,.9); color: #dde8ff; font-size: 9px; padding: 1px 4px; border-radius: 3px; }
.pshield { font-size: 12px; color: #cfe0ff; }
.card-attach { position: absolute; left: 0; right: 0; bottom: 18px; background: rgba(60,40,90,.85); color: #e8d8ff; font-size: 9px; padding: 1px 4px; text-align: center; }
.card-attachedto { position: absolute; left: 0; right: 0; bottom: 18px; background: rgba(0,0,0,.7); color: #ddd; font-size: 9px; padding: 1px 4px; text-align: center; }
.choices { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; }
.choice { font-size: 13px; display: flex; gap: 6px; align-items: center; }
.piles { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.pile { flex: 1; min-width: 160px; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: var(--bg2); }
.pile-head { font-weight: 600; margin-bottom: 6px; color: var(--gold); }
.pile-cards { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.pile-card { font-size: 13px; cursor: help; }
.pile-card:hover { color: var(--gold); }
.pile-empty { font-size: 13px; color: var(--ink3); }
.divlist { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.divrow { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 8px; font-size: 13px; }
.divrow .lth { color: var(--ink2); }
.divrow .stp { display: inline-flex; align-items: center; gap: 6px; }
.divrow .stp b { min-width: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.xrow { display: flex; gap: 6px; }
.xrow input { width: 70px; }
.modal.wide { max-width: 900px; }
.viewer { display: flex; flex-wrap: wrap; gap: 8px; max-height: 60vh; overflow: auto; margin: 10px 0; }
.pickmodal { max-width: min(94vw, 1000px); }
.pickrow { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 10px 2px 14px; margin: 8px 0; scrollbar-width: thin; }
.pickrow .card { flex: 0 0 auto; cursor: pointer; transition: transform .08s ease; }
.pickrow .card:hover { transform: translateY(-3px); }
.pickrow .card.chosen { outline: 3px solid #6fe08a; box-shadow: 0 0 14px rgba(111,224,138,.6); transform: translateY(-4px); }
.pickfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.link { cursor: pointer; text-decoration: underline dotted; }

/* big hover preview */
#bigcard { position: fixed; z-index: 60; width: 320px; pointer-events: none; background: #14120f; border: 1px solid #5a5244; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.7); overflow: hidden; }
#bigcard .bc-img { width: 320px; height: 446px; background: #24211c center / cover no-repeat; }
#bigcard .bc-img.none { display: grid; place-items: center; height: 120px; }
#bigcard .bc-fallback { text-align: center; color: var(--ink); }
#bigcard .bc-fallback span { display: block; font-size: 12px; color: var(--ink3); }
#bigcard .bc-text { padding: 10px 14px 12px; font-size: 14px; line-height: 1.45; color: var(--ink); background: #1c1a16; border-top: 1px solid #5a5244; }
#bigcard .bc-name { font-weight: 700; font-size: 16px; display: flex; justify-content: space-between; gap: 8px; }
#bigcard .bc-name span { color: var(--gold); font-weight: 600; }
#bigcard .bc-type { color: var(--ink3); font-size: 12.5px; margin-bottom: 6px; }
#bigcard .bc-oracle { white-space: pre-wrap; }
#bigcard .bc-pt { margin-top: 6px; font-weight: 700; }
#bigcard .bc-notes { padding: 6px 14px 9px; font-size: 12px; color: var(--gold); background: #1c1a16; border-top: 1px dashed #5a5244; }
.mappanel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.sw { display: inline-block; width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.4); }
.taunt { font-style: italic; color: var(--ink2); }
.onroad { color: #c9a367; }
.siegehud { border: 1px solid #7a3b1e; background: rgba(70,30,12,.35); border-radius: 6px; padding: 8px 10px; margin: 8px 0; }
.siegehud > b { color: #ffb46a; }
.siegehud ul { list-style: none; margin: 5px 0; padding: 0; }
.siegehud li { padding: 1px 0; font-size: 13px; }
.siegehud .bearing { color: var(--ink2); }
.siegehud .fallenmark { color: #ff8a8a; font-weight: 700; }
.dgnhud { border: 1px solid #4a4433; background: rgba(40,36,24,.35); border-radius: 6px; padding: 8px 10px; margin: 8px 0; }
.dgnhud > b { color: #d9c38a; }
.dgnhud ul { list-style: none; margin: 5px 0 0; padding: 0; }
.dgnhud li { padding: 3px 0; font-size: 13px; border-top: 1px solid rgba(255,255,255,.05); }
.dgnhud li:first-child { border-top: 0; }
.dgn-here { color: #ffce8a; }
.dgn-sensed { color: #c9a367; }
.dgn-lost, .dgn-cleared { color: var(--ink2); }
.dgn-clue { color: var(--ink2); }
.dgn-intel { color: var(--ink2); margin: 1px 0 0 17px; }
.dgn-prize { color: #b9c98a; margin: 1px 0 0 17px; }
.dgnhint { color: var(--ink2); font-style: italic; }
.warn { color: #e6a15a; }

/* modal / toast */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 20; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 20px 24px; max-width: 460px; width: 92%; }
.mbtns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--accent-ink); padding: 8px 16px; border-radius: 4px; font-weight: 600; z-index: 30; }

/* cards */
.card { position: relative; width: var(--cw); height: var(--ch); border-radius: 6px; background: var(--bg) center / cover no-repeat; border: 2px solid #111; box-shadow: 0 2px 6px rgba(0,0,0,.5); cursor: pointer; flex: none; overflow: hidden; transition: transform .15s, box-shadow .15s; user-select: none; }
.card.c-W { background-color: #cfc59a; } .card.c-U { background-color: #3f6cb0; } .card.c-B { background-color: #4a4058; } .card.c-R { background-color: #a94a33; } .card.c-G { background-color: #3f7530; } .card.c-M { background-color: #a07a2a; } .card.c-C { background-color: #6b6b64; }
.card-top { display: flex; justify-content: space-between; gap: 4px; background: rgba(0,0,0,.72); color: #fff; font-size: 10px; line-height: 1.2; padding: 3px 4px; }
.card-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-cost { flex: none; font-weight: 700; color: #ffe9a8; }
.card-body { padding: 4px; font-size: 9px; color: rgba(255,255,255,.85); text-shadow: 0 1px 2px #000; }
.card-pt { position: absolute; right: 3px; bottom: 3px; background: rgba(0,0,0,.78); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 3px; }
.card-pt.mod { color: #ffd27a; }
.card-badge { position: absolute; left: 3px; bottom: 3px; background: rgba(0,0,0,.7); color: #cfe9ff; font-size: 9px; padding: 1px 4px; border-radius: 3px; }
.card-own { position: absolute; right: 3px; top: 20px; color: var(--gold); font-size: 11px; text-shadow: 0 0 3px #000; }
.card-blocked { position: absolute; left: 0; right: 0; top: 50%; text-align: center; background: rgba(120,20,20,.8); color: #fff; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.card.tapped { transform: rotate(90deg) scale(.85); filter: brightness(.8); }   /* dim without going transparent, so the felt never shows through a tapped card */
.card.sick::after { content: 'zz'; position: absolute; left: 4px; top: 20px; color: #fff; font-size: 10px; opacity: .8; text-shadow: 0 0 3px #000; }
.card.castable { box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0,0,0,.5); }
.card.castable:hover { transform: translateY(-6px); }
.card.dead { opacity: .4; }
.card.can-attack { box-shadow: 0 0 0 2px #e3c56a; }
.card.can-block { box-shadow: 0 0 0 2px #8fd0ff; }
.card.attacking { box-shadow: 0 0 0 3px #ff6a3a; transform: translateY(-8px); }
.card.attacking.tapped { transform: rotate(90deg) scale(.85) translateX(-6px); }
.card.blocking { box-shadow: 0 0 0 3px #8fd0ff; transform: translateY(-8px); }
.card.selected { box-shadow: 0 0 0 3px #fff; transform: translateY(-8px); }
.card.targetable { box-shadow: 0 0 0 3px #ff4b4b; animation: pulse .9s infinite alternate; }
@keyframes pulse { from { filter: brightness(1); } to { filter: brightness(1.35); } }
.stall { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; margin: 6px 10px 6px 0; }
.stall.sold .card { opacity: .35; }
.market { display: flex; flex-wrap: wrap; }
.price { color: var(--gold); font-size: 13px; }

/* duel */
/* The duel sizes itself from the viewport: cards shrink on short screens, the table uses the full width. */
.duelscreen { --ch: clamp(96px, calc((100vh - 470px) / 3), 176px); --cw: calc(var(--ch) * 0.712); }
.duel { display: grid; grid-template-columns: 210px minmax(0, 1fr) 260px; gap: 12px; align-items: start; }
@media (max-width: 1000px) { .duel { grid-template-columns: 1fr; } .rail { position: static; } .rail .phases { display: none; } }
.rail { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; }
.phases { background: linear-gradient(180deg, #3a2f26, #221b16); border: 2px solid #6e5637; border-radius: 8px; padding: 8px 6px; display: flex; flex-direction: column; gap: 3px; box-shadow: inset 0 0 12px rgba(0,0,0,.6); }
.phases-who { font-family: Garamond, Georgia, serif; font-size: 13px; color: var(--gold); text-align: center; margin-bottom: 4px; border-bottom: 1px solid #6e5637; padding-bottom: 4px; }
.phase { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 4px; color: #8d8073; font-size: 11px; }
.phase.on { background: #6e5637; color: #ffe9a8; box-shadow: 0 0 8px rgba(255,220,120,.35); }
.ph-icon { width: 16px; text-align: center; font-size: 13px; }
.phases-step { margin-top: 6px; font-size: 10px; color: #b8a888; text-align: center; letter-spacing: .04em; }
/* combat broken out into its steps under the Combat entry while a turn is in combat */
.substeps { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px 10px; padding-left: 8px; border-left: 2px solid #6e5637; }
.substep { display: flex; align-items: center; gap: 5px; padding: 2px 5px; border-radius: 3px; font-size: 10px; color: #7d7064; }
.substep.done { color: #a89a86; }
.substep.done .ph-icon { color: #8fbf7a; }
.substep.on { background: #7a5f3c; color: #fff1c4; box-shadow: 0 0 6px rgba(255,220,120,.35); }
.substep.todo { opacity: .6; }
.phases.theirs .substep.on { background: #56384a; color: #f4d0dc; }
.phases.theirs .substeps { border-left-color: #6a4652; }
.phases.theirs .phase.on { background: #4a2f3a; color: #f0c4d0; }

.table { position: relative; border: 3px solid #6e5637; border-radius: 10px; box-shadow: 0 0 0 2px #2a2018, 0 10px 40px rgba(0,0,0,.6); overflow: hidden; display: flex; flex-direction: column; min-height: calc(100vh - 90px); background: #1c1a17; }
.zone { display: grid; grid-template-columns: clamp(170px, 13vw, 230px) minmax(0, 1fr) 170px; gap: 10px; padding: 10px 12px; flex: 1 0 auto; }
.zone.opp { background:
  repeating-linear-gradient(45deg, rgba(255,255,255,.025) 0 2px, transparent 2px 8px),
  repeating-linear-gradient(-45deg, rgba(0,0,0,.12) 0 2px, transparent 2px 8px),
  radial-gradient(ellipse at 50% 0%, #4a3a44 0%, #2d2430 55%, #1f1a22 100%); }
.zone.mine { background:
  repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 2px, transparent 2px 8px),
  repeating-linear-gradient(-45deg, rgba(0,0,0,.12) 0 2px, transparent 2px 8px),
  radial-gradient(ellipse at 50% 100%, #2f4a35 0%, #223626 55%, #192a1d 100%); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* An opaque mat so the felt crosshatch stays strictly behind the board and never shows around — or through
   a tapped/dim — card. Cards read as sitting on top of the surface, not embedded in it. */
.row { display: flex; flex-wrap: wrap; gap: 10px; min-height: calc(var(--ch) + 12px); padding: 6px; border-radius: 6px; background: rgba(0,0,0,.22); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.row.perms { min-height: 50px; --ch: 76px; --cw: 54px; }
.row.perms .card-top { font-size: 8px; padding: 2px 3px; }
.row.perms .card-body { display: none; }
.row:empty { display: none; }   /* an empty mat would float as a dark bar on the felt — show a mat only when it holds cards */
.lands { background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.06); border-radius: 6px; padding: 6px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px; }
.lands-title { width: 100%; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink3); margin-bottom: 2px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 7px 2px 4px; border-radius: 999px; background: #2a2622; border: 1px solid #4a433c; color: var(--ink); cursor: pointer; user-select: none; }
.pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--C); border: 1px solid rgba(0,0,0,.5); }
.pill.c-W i { background: var(--W); } .pill.c-U i { background: var(--U); } .pill.c-B i { background: var(--B); } .pill.c-R i { background: var(--R); } .pill.c-G i { background: var(--G); }
.pill b { color: var(--gold); font-weight: 600; }
.pill.tapped { opacity: .5; }
.pill.usable { border-color: rgba(255,255,255,.35); }
.pill.targetable { box-shadow: 0 0 0 2px #ff4b4b; animation: pulse .9s infinite alternate; }
.pbox { background: linear-gradient(180deg, #2b2622, #1b1815); border: 2px solid #6e5637; border-radius: 8px; padding: 8px; text-align: center; box-shadow: inset 0 0 14px rgba(0,0,0,.6); align-self: start; display: flex; align-items: center; gap: 8px; }
.pinfo { flex: 1; min-width: 0; }
.pbox:not(:has(.portrait)) { display: block; }
.pbox.active { border-color: var(--gold); }
.pbox.thinking { box-shadow: inset 0 0 14px rgba(0,0,0,.6), 0 0 10px rgba(227,197,106,.4); }
.pbox.targetable { box-shadow: 0 0 0 3px #ff4b4b; cursor: pointer; animation: pulse .9s infinite alternate; }
.pname { font-family: Garamond, Georgia, serif; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f0e6cf; }
.portrait { flex: none; image-rendering: pixelated; filter: drop-shadow(0 4px 4px rgba(0,0,0,.6)); }
.plife { font-family: Garamond, Georgia, serif; font-size: clamp(30px, 4vh, 44px); line-height: 1; margin: 4px 0 2px; color: #ffb3a5; text-shadow: 0 2px 6px rgba(0,0,0,.7); }
.pmeta { flex-wrap: wrap; display: flex; justify-content: center; gap: 10px; font-size: 12px; color: var(--ink2); margin-top: 6px; }
.gems { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; min-height: 22px; }
.gem { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 11px; font-weight: 700; color: #111; border: 1px solid rgba(0,0,0,.6); box-shadow: inset 0 -3px 4px rgba(0,0,0,.35), inset 0 2px 3px rgba(255,255,255,.4); }
.gem.g-W { background: var(--W); } .gem.g-U { background: var(--U); color: #fff; } .gem.g-B { background: var(--B); color: #fff; } .gem.g-R { background: var(--R); color: #fff; } .gem.g-G { background: var(--G); color: #fff; } .gem.g-C { background: #b9b9b0; }
.gem.g-avail { background: #3a3630; color: var(--ink2); border-style: dashed; box-shadow: none; }
.divider { display: flex; align-items: center; gap: 14px; padding: 6px 14px; background: linear-gradient(90deg, #3a2f26, #6e5637 30%, #6e5637 70%, #3a2f26); color: #f0e6cf; font-size: 13px; border-top: 1px solid #a07c48; border-bottom: 1px solid #a07c48; min-height: 34px; }
.div-turn { font-family: Garamond, Georgia, serif; font-size: 15px; font-weight: 600; }
.ante { margin-left: auto; color: #ffe9a8; }
.hand { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 10px 8px; background: linear-gradient(180deg, #1a1714, #221d18); border-top: 2px solid #6e5637; min-height: calc(var(--ch) + 24px); }
.panel { display: flex; flex-direction: column; gap: 10px; }
.controls { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.autopass { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #b8a888; cursor: pointer; margin-top: 2px; }
.autopass input { margin: 0; }
.hint { font-size: 13px; color: var(--ink2); }
.log { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; color: var(--ink2); max-height: max(140px, calc(100vh - 400px)); overflow: auto; }
.log div:last-child { color: var(--ink); }
.preview { display: none; }

/* combat animations: the table re-renders every tick, so classes are applied fresh after render */
.zone.mine { --lunge: -46px; } .zone.opp { --lunge: 46px; }
.fx-attack { animation: fxAttack .45s ease-out; }
@keyframes fxAttack { 0% { transform: translateY(0); } 40% { transform: translateY(calc(var(--lunge) * .5)) scale(1.08); } 100% { transform: translateY(-8px); } }
.card.tapped.fx-attack { animation: fxAttackTapped .45s ease-out; }
@keyframes fxAttackTapped { 0% { transform: rotate(0) scale(1); } 100% { transform: rotate(90deg) scale(.85) translateX(-6px); } }
.fx-block { animation: fxBlock .45s ease-out; }
@keyframes fxBlock { 0% { transform: translateY(0); } 50% { transform: translateY(calc(var(--lunge) * .35)) scale(1.06); } 100% { transform: translateY(-8px); } }
.fx-lunge { animation: fxLunge .6s cubic-bezier(.3,1.4,.5,1); z-index: 3; }
@keyframes fxLunge { 0% { transform: translateY(-8px); } 45% { transform: translateY(var(--lunge)) scale(1.1); } 100% { transform: translateY(-8px); } }
.card.tapped.fx-lunge { animation: fxLungeTapped .6s cubic-bezier(.3,1.4,.5,1); }
@keyframes fxLungeTapped { 0% { transform: rotate(90deg) scale(.85) translateX(-6px); } 45% { transform: rotate(90deg) scale(.95) translateX(var(--lunge)); } 100% { transform: rotate(90deg) scale(.85) translateX(-6px); } }
.fx-hit { animation: fxHit .5s ease-out; }
@keyframes fxHit { 0% { filter: brightness(1); box-shadow: 0 0 0 0 rgba(255,80,60,.9); } 30% { filter: brightness(1.8) saturate(1.4); box-shadow: 0 0 0 6px rgba(255,80,60,.6); } 100% { filter: brightness(1); box-shadow: 0 0 0 0 rgba(255,80,60,0); } }
.pbox.fx-hit { animation: fxShake .5s ease-out; }
@keyframes fxShake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.fx-cast { animation: fxCast .3s ease-out; }
@keyframes fxCast { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.fx-float { position: absolute; z-index: 10; pointer-events: none; transform: translate(-50%, -50%); font-family: Garamond, Georgia, serif; font-weight: 700; animation: fxFloat .9s ease-out forwards; text-shadow: 0 2px 4px #000, 0 0 10px #000; }
.fx-dmg { color: #ff6a4a; font-size: 34px; }
.fx-die { color: #d8d0c0; font-size: 16px; }
.fx-confetti { position: absolute; width: 9px; height: 13px; border-radius: 1px; pointer-events: none; z-index: 40; opacity: 1; box-shadow: 0 1px 2px rgba(0,0,0,.45); transition: transform 1s cubic-bezier(.2,.7,.3,1), opacity 1.05s ease-in; }
@keyframes fxFloat { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -130%) scale(1); } }
@media (prefers-reduced-motion: reduce) { .fx-attack, .fx-block, .fx-lunge, .fx-hit, .fx-cast, .fx-float, .pbox.fx-hit { animation: none; } .fx-confetti { transition: opacity .4s ease-in; } }


/* dungeons */
.eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }
.btnrow.center { justify-content: center; }
.dungeonbox { background: linear-gradient(180deg, #2a2320, #171412); border-color: #6e5637; }
.dungeonbox h2 { color: #f0e6cf; }
.stats .starving { color: var(--warn); font-weight: 700; }

/* stack tray and arrows */
.stack-title span { margin-left: auto; background: #6e5637; color: #ffe9a8; border-radius: 999px; padding: 0 8px; font-size: 11px; }
.stack-tray { display: flex; flex-direction: column; gap: 12px; --cw: 250px; --ch: 350px; }
.stack-tray .card { transition: none; border-radius: 12px; border-width: 3px; }
.stack-tray .card.top { box-shadow: 0 0 0 3px var(--gold), 0 6px 20px rgba(0,0,0,.65); }
.stack-tray .card.theirs { outline: 2px solid rgba(255,120,120,.6); }
.stack-tray .card .card-top { font-size: 15px; padding: 6px 9px; }
.stack-tray .card .card-pt { font-size: 17px; padding: 2px 8px; }
.stack-tray .card .card-body { display: block; font-size: 13px; padding: 8px; }
.stack-tray .card.targetable { box-shadow: 0 0 0 3px #ff4b4b; }
svg.arrows { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 6; overflow: visible; }

/* dungeon crawl */
.dungeonscreen { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; }
@media (max-width: 1100px) { .dungeonscreen { grid-template-columns: 1fr; } }
.dwrap { background: #050506; border: 6px solid #4a3323; outline: 2px solid #7a5a3a; padding: 4px; }
#dungeon { display: block; image-rendering: pixelated; image-rendering: crisp-edges; cursor: pointer; margin: 0 auto; }
.modal .mbtns .btn { max-width: 100%; }

/* ---- learn to play ---------------------------------------------------------------- */
.msg.notice { background: #253a33; border-color: var(--accent); color: var(--ink); }
.home .modes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .home .modes { grid-template-columns: 1fr; } }
.home .mode { position: relative; overflow: hidden; margin-bottom: 0; padding: 20px 22px 16px; border-top: 3px solid var(--line); }
.home .mode-adv { border-top-color: #7fb069; } .home .mode-con { border-top-color: var(--gold); }
.home .mode-k { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink3); margin-bottom: 6px; }
.home .mode h2 { margin-top: 0; font-size: 24px; }
.home .mode p { color: var(--ink2); max-width: 60ch; }
.home .mode .btnrow { margin: 14px 0 6px; }
.home .mode .small { color: var(--ink3); margin: 0; }
.home .gamelogs { margin-top: 8px; }
.adventure .rowhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.adventure .rowhead h1 { margin-bottom: 4px; }
.title .learn { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; border-color: var(--accent); }
.title .learn h2 { margin-top: 0; }
.title .learn p { margin: 0; color: var(--ink2); max-width: 70ch; }
.title .learn .btnrow { display: flex; gap: 8px; flex-shrink: 0; }
.lessonscreen { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; max-width: 1100px; margin: 0 auto; }
@media (max-width: 800px) { .lessonscreen { grid-template-columns: 1fr; } }
.lessonnav ol { padding-left: 22px; margin: 8px 0 14px; }
.lessonnav li { margin: 4px 0; color: var(--ink2); }
.lessonnav li.done { opacity: .7; }
.lessonnav li.on .linkbtn { color: var(--accent); font-weight: 600; }
.linkbtn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; text-align: left; }
.linkbtn:hover { text-decoration: underline; }
.lesson { font-size: 15px; line-height: 1.55; }
.lesson h2 { margin-top: 2px; }
.lesson ul, .lesson ol { padding-left: 22px; }
.lesson li { margin: 6px 0; }
.lesson .example { background: var(--bg2); border-left: 3px solid var(--accent); padding: 8px 12px; margin: 10px 0; border-radius: 0 4px 4px 0; }
.lessonbtns { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.tcard { color: #8fd18a; border-bottom: 1px dotted #8fd18a; cursor: help; }
.tutor { background: #223b26; border: 1px solid #4f8a52; border-radius: 6px; padding: 10px 12px; font-size: 13px; line-height: 1.45; color: #e8f3e6; }
.tutor b { display: block; color: #b7f0b0; margin-bottom: 3px; font-size: 14px; }
#topbar .audio { font-size: 15px; padding: 3px 9px; }
#topbar .audio.solo { margin-left: auto; }

/* ---- amulets ---------------------------------------------------------------------- */
.amurow { display: inline-flex; gap: 6px; align-items: center; vertical-align: middle; }
#topbar .amurow { margin-left: 14px; }
.amu { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink2); }
.amu i { width: 11px; height: 11px; border-radius: 2px; transform: rotate(45deg); box-shadow: inset 0 0 0 1px rgba(0,0,0,.4), 0 0 4px rgba(255,255,255,.25); display: inline-block; }
.amu.none { opacity: .38; }
.amu.sel i { outline: 1px solid var(--accent); }
.amu-chip { width: 10px; height: 10px; border-radius: 2px; transform: rotate(45deg); display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); vertical-align: middle; margin-right: 4px; }
.stall .price .amu-chip { margin-right: 3px; }

/* ---- amulet shop ------------------------------------------------------------------ */
.amushop h4 { margin: 14px 0 6px; display: flex; align-items: center; gap: 6px; }
.amushop-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--bg2); }
.amushop-row { display: grid; grid-template-columns: 34px minmax(0,1fr) auto auto; align-items: center; gap: 10px; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.amushop-row:last-child { border-bottom: 0; }
.amushop-row .mini { width: 30px; height: 30px; border-radius: 3px; background-size: cover; background-position: center 22%; background-color: #2a2620; }
.amushop-row .nm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amushop-row .nm i { color: var(--ink2); font-size: 11px; margin-left: 6px; font-style: normal; }
.amushop-row .cost { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 600; }
.nowrap { white-space: nowrap; }
.selllist { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--bg2); }
.sellrow { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 10px; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.sellrow:last-child { border-bottom: 0; }
.sellrow .nm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sellrow .qty { color: var(--ink2); font-variant-numeric: tabular-nums; }

/* ---- mana symbol pips ------------------------------------------------------------- */
.pip { display: inline-flex; align-items: center; justify-content: center; min-width: 15px; height: 15px; padding: 0 1px; border-radius: 50%; font-size: 10px; font-weight: 700; line-height: 1; margin-left: 1px; box-shadow: inset 0 -1px 1px rgba(0,0,0,.35), 0 0 0 1px rgba(0,0,0,.25); vertical-align: middle; font-family: system-ui, sans-serif; }
.pip-w { background: #f7f1de; color: #3a3320; }
.pip-u { background: #3d72a8; color: #eaf2fb; }
.pip-b { background: #3a3038; color: #e8dfe8; }
.pip-r { background: #c34231; color: #fbeae7; }
.pip-g { background: #3f8047; color: #eafbe9; }
.pip-c, .pip-x { background: #cabfa6; color: #3a3320; }
.pip-h { background: linear-gradient(135deg, #f7f1de 48%, #3d72a8 52%); color: #241d10; border-radius: 8px; padding: 0 4px; }

/* ---- power-tier badges + screen ---- */
:root { --pt-S:#d9a441; --pt-Sf:#2a1e06; --pt-A:#cf7d3c; --pt-B:#4f97a3; --pt-C:#5f9c4a; --pt-D:#8a7d6b; --pt-E:#6d6157; }
.ptb { display:inline-grid; place-items:center; width:26px; height:24px; border-radius:6px; font-weight:800; font-size:13px; color:#fff; border:1px solid transparent; font-family:Garamond, Georgia, serif; letter-spacing:.02em; flex:none; }
.ptb.tiny { width:18px; height:16px; font-size:11px; border-radius:4px; vertical-align:middle; }
.ptb.pt-S { background:var(--pt-S); color:var(--pt-Sf); } .ptb.pt-A { background:var(--pt-A); } .ptb.pt-B { background:var(--pt-B); } .ptb.pt-C { background:var(--pt-C); } .ptb.pt-D { background:var(--pt-D); } .ptb.pt-E { background:var(--pt-E); }
.pt-bg-S { background:var(--pt-S); } .pt-bg-A { background:var(--pt-A); } .pt-bg-B { background:var(--pt-B); } .pt-bg-C { background:var(--pt-C); } .pt-bg-D { background:var(--pt-D); } .pt-bg-E { background:var(--pt-E); }

.tierscreen { display:flex; flex-direction:column; gap:14px; }
.tsummary { display:grid; grid-template-columns:repeat(6,1fr); gap:8px; margin-top:10px; }
.tsum { display:flex; flex-direction:column; gap:7px; background:var(--bg2); border:1px solid var(--line); border-radius:9px; padding:9px 9px 10px; cursor:pointer; text-align:left; color:var(--ink); transition:.12s; }
.tsum:hover { border-color:var(--accent); }
.tsum.off { opacity:.4; }
.tsum .ptb { width:28px; height:26px; font-size:15px; }
.tsum-main { display:flex; flex-direction:column; line-height:1.15; } .tsum-main b { font-size:13.5px; } .tsum-main .small { color:var(--ink3); }
.tsum-n { font-variant-numeric:tabular-nums; font-weight:700; font-size:14px; } .tsum-n .small { color:var(--ink3); font-weight:400; }
.tsum-bar { height:5px; border-radius:3px; background:#00000030; overflow:hidden; } .tsum-bar i { display:block; height:100%; border-radius:3px; }
.tsum > .ptb, .tsum .tsum-main { }
.tsum { display:grid; grid-template-columns:auto 1fr auto; grid-template-areas:"b m n" "bar bar bar"; align-items:center; column-gap:8px; }
.tsum .ptb { grid-area:b; } .tsum-main { grid-area:m; } .tsum-n { grid-area:n; text-align:right; } .tsum-bar { grid-area:bar; margin-top:2px; }

.tctrls { display:flex; flex-wrap:wrap; gap:9px 12px; align-items:center; margin-bottom:10px; }
.tctrls input#tier-q { flex:1 1 200px; min-width:160px; background:var(--bg2); border:1px solid var(--line); color:var(--ink); border-radius:8px; padding:7px 11px; font:inherit; }
.tctrls select { background:var(--bg2); border:1px solid var(--line); color:var(--ink); border-radius:8px; padding:6px 9px; font:inherit; }
.tchk { display:inline-flex; align-items:center; gap:6px; font-size:13px; color:var(--ink2); cursor:pointer; }
.tchk input { accent-color:var(--accent); }
.tcount { color:var(--ink3); }
.tchanges { display:flex; align-items:center; gap:10px; flex-wrap:wrap; background:color-mix(in srgb, var(--gold) 12%, var(--bg2)); border:1px solid color-mix(in srgb, var(--gold) 40%, var(--line)); border-radius:8px; padding:8px 11px; margin-bottom:10px; font-size:13px; }

.tlist { border:1px solid var(--line); border-radius:9px; overflow:hidden; }
.trow { position:relative; display:grid; grid-template-columns:30px minmax(0,1fr) 150px 54px 74px; align-items:center; gap:10px; padding:5px 12px; border-bottom:1px solid var(--line); }
.trow:last-child { border-bottom:0; }
.trow:nth-child(even) { background:#ffffff06; }
.trow:hover { background:color-mix(in srgb, var(--accent) 8%, transparent); }
.trow .ptb { cursor:pointer; } .trow .ptb:hover { transform:translateY(-1px); }
.trow .ptb.moved { outline:2px solid var(--accent); outline-offset:1px; }
.trow-n { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer; }
.tstar { color:var(--pt-S); font-size:12px; }
.trow-t { color:var(--ink3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.trow-c { font-variant-numeric:tabular-nums; color:var(--ink2); text-align:center; }
.trow-r { text-transform:capitalize; color:var(--ink3); }
.trow-r.r-rare { color:var(--gold); } .trow-r.r-uncommon { color:#b9c4cf; }
.tpick { position:absolute; right:10px; top:50%; transform:translateY(-50%); display:flex; gap:4px; background:var(--panel); border:1px solid var(--line); border-radius:8px; padding:5px; box-shadow:0 6px 18px #000a; z-index:6; }
.tpick .ptb { cursor:pointer; } .tpick .ptb.cur { outline:2px solid var(--ink); outline-offset:1px; }
@media (max-width:760px){ .tsummary{ grid-template-columns:repeat(3,1fr);} .trow{ grid-template-columns:30px minmax(0,1fr) 48px 60px; } .trow-t{ display:none; } }

/* ---- deck mana curve ---- */
.deckstats { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 12px; }
.deckstats > * { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: color-mix(in srgb, var(--bg2) 55%, transparent); }
.deckstats > .curve { flex: 2 1 260px; }
.deckstats > .pie-box { flex: 1 1 232px; }
.statmsg { color: var(--ink3); margin: 8px 0 2px; }
.curve { margin: 0; }
.curve-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.curve-head > span:first-child { font-family: Garamond, Georgia, serif; font-size: 14px; color: var(--ink); }
.curve-head .small { color: var(--ink3); font-variant-numeric: tabular-nums; }
.curve-plot { position: relative; display: flex; align-items: flex-end; gap: 4px; height: 76px; padding: 0 1px; border-bottom: 1px solid var(--line); }
.curve-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.curve-n { font-size: 10px; color: var(--ink2); font-variant-numeric: tabular-nums; line-height: 1; margin-bottom: 2px; min-height: 10px; }
.curve-bar { width: 100%; max-width: 26px; min-height: 2px; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--bg2))); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); transition: background .12s; }
.curve-bar.empty { background: var(--line); box-shadow: none; opacity: .5; }
.curve-col:hover .curve-bar:not(.empty) { background: linear-gradient(180deg, var(--gold), color-mix(in srgb, var(--gold) 60%, var(--bg2))); }
.curve-avg { position: absolute; top: -2px; bottom: 0; width: 0; border-left: 1px dashed var(--gold); opacity: .7; pointer-events: none; z-index: 1; }
.curve-axis { display: flex; gap: 4px; padding: 3px 1px 0; }
.curve-axis span { flex: 1 1 0; text-align: center; font-size: 10px; color: var(--ink3); font-variant-numeric: tabular-nums; }
.pie-row { display: flex; align-items: center; gap: 11px; margin-top: 2px; }
.pie { flex: 0 0 auto; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.pie-hole { width: 42px; height: 42px; border-radius: 50%; background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; font-size: 15px; font-weight: 700; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.pie-hole small { font-size: 8.5px; font-weight: 400; color: var(--ink3); margin-top: 1px; }
.pie-legend { list-style: none; margin: 0; padding: 0; min-width: 0; flex: 1 1 auto; }
.pie-legend li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink2); padding: 1px 0; white-space: nowrap; }
.pie-legend .dot { width: 10px; height: 10px; flex: 0 0 auto; }
.pie-pct { margin-left: auto; color: var(--ink3); font-variant-numeric: tabular-nums; }
.deckadvice { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin: 0 0 12px; background: color-mix(in srgb, var(--bg2) 55%, transparent); }
.deckadvice ul { list-style: none; margin: 6px 0 0; padding: 0; }
.deckadvice li { position: relative; padding: 3px 0 3px 20px; font-size: 12.5px; color: var(--ink2); line-height: 1.4; }
.deckadvice li::before { position: absolute; left: 2px; top: 3px; font-size: 12px; }
.adv-warn::before { content: '▲'; color: var(--warn); }
.adv-tip::before { content: '›'; color: var(--gold); font-weight: 700; }
.adv-ok::before { content: '✓'; color: var(--accent); }

/* ---- world magic menu ---- */
.wmgrid { display: grid; gap: 6px; margin: 6px 0 4px; }
.btn.wm { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; text-align: left; padding: 7px 11px; }
.btn.wm b { grid-column: 1; font-family: Garamond, Georgia, serif; font-size: 14.5px; }
.btn.wm .wmd { grid-column: 1; grid-row: 2; font-size: 11.5px; color: var(--ink3); }
.btn.wm .wmcost { grid-column: 2; grid-row: 1 / span 2; display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.btn.wm:disabled .wmd { color: var(--ink3); }

/* ---- constructed Premodern deck builder ---- */
.brewscreen { max-width: 1200px; margin: 0 auto; padding: 12px; }
.bw-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.bw-head h2 { margin: 0; }
.bw-status { color: #cbb78a; font-size: 13px; }
.bw-ok { color: #8fd07a; font-weight: bold; }
.bw-bad { color: #e8927a; font-weight: bold; }
.bw-warn { color: #e8c87a; font-weight: bold; }
.bw-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.bw-issues { margin: 0 0 8px; padding: 8px 12px; list-style: none; background: rgba(0,0,0,.25); border: 1px solid #6e5637; border-radius: 6px; font-size: 12px; }
.bw-issues .err { color: #e8927a; } .bw-issues .warn { color: #e8c87a; }
.bw-importbox { margin-bottom: 8px; } .bw-importbox textarea { width: 100%; box-sizing: border-box; font-family: monospace; font-size: 12px; }
.btn.on { background: #6e5637; color: #ffe9a8; border-color: var(--gold); }
.bw-decksbox { margin-bottom: 10px; padding: 10px 12px; background: rgba(0,0,0,.22); border: 1px solid #6e5637; border-radius: 8px; }
.bw-decks-save { display: flex; gap: 6px; margin-bottom: 8px; }
.bw-decks-save input { flex: 1; min-width: 0; }
.bw-decklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bw-deckrow { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; background: rgba(255,255,255,.03); }
.bw-deckrow.active { outline: 1px solid var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.bw-deck-nm { font-weight: 600; cursor: pointer; }
.bw-deck-nm:hover { color: var(--gold); }
.bw-deck-ct { color: #b6a98c; margin-right: auto; }
.bw-deck-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.bw-preset-h { margin: 10px 0 5px; font-weight: 600; color: var(--gold); }
.bw-preset-h .small { color: #b6a98c; font-weight: 400; }
.bw-opp { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #cbb98f; }
.bw-opp select { font-size: 12px; padding: 2px 4px; max-width: 150px; }
.bw-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 900px) { .bw-cols { grid-template-columns: 1fr; } }
.bw-filters { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.bw-filters input { width: 100%; box-sizing: border-box; }
.bw-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.bw-chip { font-size: 11px; padding: 3px 8px; border-radius: 10px; border: 1px solid #6e5637; background: #2b221b; color: #cbb78a; cursor: pointer; }
.bw-chip.on { background: #6e5637; color: #ffe9a8; }
.bw-chip.ghost { opacity: .7; }
.bw-list { max-height: 62vh; overflow-y: auto; }
.bw-list.side { max-height: 20vh; }
.bw-row { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 4px; font-size: 13px; }
.bw-row:hover { background: rgba(255,220,120,.08); }
.bw-cmc, .bw-q { width: 18px; text-align: center; color: #b8a888; font-size: 12px; flex: none; }
.bw-nm { flex: 1; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bw-add { display: flex; gap: 3px; flex: none; }
.bw-b { font-weight: bold; margin-left: 2px; }
.bw-b.unsup { color: #e8927a; } .bw-b.approx { color: #e8c87a; }
.bw-grp-h { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #a8946a; border-bottom: 1px solid #4a3c2c; margin: 6px 0 2px; }
.bw-more { text-align: center; color: #a8946a; padding: 6px; }
.dot.c-gold { background: linear-gradient(135deg, #e8c060, #c88a30); }

.reqrefs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* ---- admin match log (admin.html) ---- */
.adminpage #app { max-width: 1200px; margin: 0 auto; padding: 18px 16px; }
.admin .ai { font-size: 10px; padding: 1px 4px; border: 1px solid var(--line); border-radius: 3px; color: #b6a98c; vertical-align: middle; }
.adm-src { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.adm-src label { display: inline-flex; align-items: center; gap: 6px; }
.adm-src input[type=password] { min-width: 260px; }
.adm-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.adm-filters input { flex: 1; min-width: 200px; }
.tablewrap { overflow-x: auto; }
.adm-table tr.adm-row { cursor: pointer; }
.adm-table tr.adm-row:hover td { background: rgba(255,255,255,.04); }
.adm-table tr.adm-row.open td { background: color-mix(in srgb, var(--gold) 12%, transparent); }
.adm-table tr.hot td:nth-child(8), .adm-table tr.hot td:nth-child(9) { color: var(--gold); font-weight: 700; }
.adm-detail h4 { margin: 14px 0 6px; color: var(--gold); }
.adm-flag { border-left: 3px solid var(--gold); padding: 6px 10px; margin: 6px 0; background: rgba(0,0,0,.2); border-radius: 0 6px 6px 0; }
.adm-flag pre { white-space: pre-wrap; margin: 4px 0 0; }
.adm-recent { margin: 4px 0; color: #b6a98c; }
.adm-board { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.adm-board .small + .small { margin-top: 2px; }
@media (max-width: 800px) { .adm-board { grid-template-columns: 1fr; } }
.adm-decks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 800px) { .adm-decks { grid-template-columns: 1fr; } }
.adm-log { max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13px; background: rgba(0,0,0,.2); }
.adm-turn-h { margin: 8px 0 3px; font-weight: 700; color: var(--gold); border-bottom: 1px solid var(--line); }
.adm-ev { display: flex; gap: 8px; padding: 1px 0; }
.adm-ev .step { flex: 0 0 84px; color: #8a7d6b; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.adm-ev .k { color: #8fb7c9; font-style: normal; margin-right: 4px; }
.adm-ev.k-act, .adm-ev.k-answer { color: #d9d2c0; }
.adm-ev.k-req { color: #b6a98c; }
.adm-ev.k-flag { background: color-mix(in srgb, var(--gold) 14%, transparent); }
.adm-ev .flag { color: var(--gold); }

/* ---- in-match problem report ---- */
.modal.repform { max-width: 560px; max-height: 92vh; overflow: auto; }   /* not ".report": that's the adventure summary panel */
.modal.repform label { display: block; margin: 10px 0 4px; font-size: 13px; }
.modal.repform select, .modal.repform textarea, .modal.repform input:not([type=radio]) { width: 100%; box-sizing: border-box; margin-top: 4px; }
.rep-kinds .radio input { width: auto; margin: 0; }
.modal.repform textarea { min-height: 150px; font-family: inherit; font-size: 14px; line-height: 1.4; }
.rep-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 8px 0; }
.rep-kinds .radio { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; }
@media (max-width: 520px) { .rep-kinds { grid-template-columns: 1fr; } }
.adm-cat { font-size: 11px; padding: 1px 6px; border-radius: 10px; background: color-mix(in srgb, var(--gold) 25%, transparent); color: var(--gold); }

.pill-counters { font-size: 11px; padding: 0 5px; border-radius: 8px; background: rgba(0,0,0,.35); color: #ffd27a; }
#bigcard .bc-counters { padding: 4px 14px 6px; font-size: 12px; color: #ffd27a; }
