:root {
  --bg: #12161b; --felt: #18241f; --panel: #1d232b; --panel2: #252c36; --line: #333c48; --text: #e6e1d6; --muted: #8d96a3;
  --gold: #c9a04e; --green: #4fc07a; --red: #e05d5d; --blue: #4f8fe0; --yellow: #f0d060;
  --cw: 92px; --ow: 62px; --hw: 110px; --radius: 6px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: radial-gradient(ellipse at 50% 40%, #1d2c26 0%, var(--bg) 75%); color: var(--text); font-size: 14px; overflow: hidden; }
button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--gold); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: linear-gradient(#3b6b4f, #2b5a3f); border-color: #4a8a63; font-weight: 600; }
button.danger { background: #5a2b2b; border-color: #8a4a4a; }
button.ghost { background: transparent; }
button.big { padding: 10px 20px; font-size: 16px; }
button.on { border-color: var(--gold); color: var(--gold); }
input, select, textarea { font: inherit; color: var(--text); background: #11151a; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
textarea { width: 100%; min-height: 220px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
kbd { font-size: 10px; border: 1px solid var(--line); border-radius: 3px; padding: 0 3px; opacity: .7; margin-left: 4px; }
h2 { margin: 0 0 10px; font-size: 17px; color: var(--gold); } h3 { margin: 12px 0 6px; font-size: 14px; } h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; } .gap { gap: 8px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 120px; } .spacer { flex: 1; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.badge { font-size: 11px; background: var(--gold); color: #111; border-radius: 10px; padding: 1px 8px; vertical-align: middle; }
.conn { position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 99; background: #5a2b2b; padding: 4px 12px; border-radius: 12px; font-size: 12px; }
.conn.ok { display: none; }
.screen { height: calc(100vh / var(--z, 1)); display: flex; flex-direction: column; }

/* ---------- lobby ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.25); }
.brand { font-weight: 800; font-size: 18px; color: var(--gold); letter-spacing: .03em; }
.namebox { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.lobby-grid { flex: 1; display: grid; grid-template-columns: minmax(380px, 1fr) 1.4fr; gap: 14px; padding: 14px; overflow: hidden; }
.panel { background: rgba(29,35,43,.85); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow: auto; }
.seats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seat { border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 8px; padding: 8px; background: var(--panel2); display: flex; flex-direction: column; gap: 6px; min-height: 96px; }
.seat.closed { opacity: .5; }
.seat .who { font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.seat select { width: 100%; }
.seat .deckpick { display: flex; gap: 6px; align-items: center; }
.seat .deckpick .dn { flex: 1; font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rules { margin: 12px 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; font-size: 13px; }
.invite { margin-top: 10px; border-top: 1px solid var(--line); }
.joinurl { display: flex; gap: 6px; align-items: center; margin: 3px 0; font-family: ui-monospace, monospace; font-size: 13px; }
.deckgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 10px; }
.deck { position: relative; border-radius: 8px; overflow: hidden; background: var(--panel2); border: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; }
.deck:hover { border-color: var(--gold); transform: translateY(-1px); }
.deck .art { height: 96px; background: #222 center 22% / cover no-repeat; position: relative; }
.deck .art .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 30px; opacity: .3; }
.deck .info { padding: 6px 8px; } .deck .nm { font-weight: 600; font-size: 13px; line-height: 1.2; } .deck .cmd { font-size: 11px; color: var(--muted); }
.deck .br { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.7); border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.deck .warn { position: absolute; top: 6px; left: 6px; background: #7a3a1a; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.deck.sel { outline: 2px solid var(--green); }
.pips { display: inline-flex; gap: 2px; vertical-align: middle; }
.pip, .ms { display: inline-block; width: 14px; height: 14px; border-radius: 50%; font-size: 9px; line-height: 14px; text-align: center; font-weight: 700; color: #111; background: #bbb; vertical-align: -2px; margin: 0 1px; }
.pip-W, .ms-W { background: #f3ecd0; } .pip-U, .ms-U { background: #8ec3ee; } .pip-B, .ms-B { background: #a99aa0; } .pip-R, .ms-R { background: #f0957a; } .pip-G, .ms-G { background: #8fcf98; } .pip-C, .ms-C { background: #ccc; }
.colorfilter { display: flex; gap: 6px; margin-top: 8px; } .colorfilter .pip { width: 22px; height: 22px; line-height: 22px; font-size: 11px; cursor: pointer; opacity: .4; } .colorfilter .pip.on { opacity: 1; outline: 2px solid var(--gold); }
.chatbox { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; } .chatlog { max-height: 140px; overflow: auto; font-size: 12px; } .chatlog b { color: var(--gold); }

/* ---------- game ---------- */
.gamebar { display: flex; align-items: center; gap: 8px; padding: 5px 10px; background: rgba(0,0,0,.35); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.turninfo { font-weight: 700; min-width: 150px; }
.phases { display: flex; gap: 2px; }
.phases span { font-size: 11px; padding: 3px 6px; border-radius: 4px; background: #1a1f26; color: var(--muted); cursor: help; }
.phases span.on { background: var(--gold); color: #111; font-weight: 700; }
.phases span.sep { background: none; padding: 0 2px; }
.waiting { font-size: 12px; color: var(--yellow); min-width: 120px; text-align: right; }
.waiting.mine { color: var(--green); font-weight: 700; }
.table { flex: 1; display: grid; grid-template-columns: 1fr 310px; overflow: hidden; }
.board { display: grid; grid-template-rows: minmax(0, 1fr) minmax(0, 1.25fr) auto; overflow: hidden; }
.opponents { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 6px; padding: 6px; overflow: auto; }
.me { padding: 6px; overflow: auto; border-top: 1px dashed #2c3a33; }
.pp { background: rgba(20,26,32,.75); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 8px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.pp.active { box-shadow: 0 0 0 1px var(--gold), 0 0 12px rgba(201,160,78,.35); }
.pp.lost { opacity: .4; filter: grayscale(1); }
.pp.tgt { outline: 3px solid var(--yellow); cursor: crosshair; animation: pulse 1s infinite; }
.pp.tgt.picked { outline-color: var(--green); }
.ph { display: flex; align-items: center; gap: 8px; padding: 4px 8px; background: rgba(0,0,0,.25); font-size: 12px; flex-wrap: wrap; }
.ph .nm { font-weight: 700; font-size: 13px; }
.life { font-size: 20px; font-weight: 800; min-width: 44px; text-align: center; cursor: pointer; border-radius: 6px; padding: 0 4px; }
.life:hover { background: rgba(255,255,255,.07); }
.stat { display: inline-flex; align-items: center; gap: 2px; cursor: pointer; padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,.05); }
.stat:hover { background: rgba(255,255,255,.12); }
.stat.poison { color: #9ad16a; } .stat.cmdd { color: var(--red); }
.pbody { display: flex; gap: 6px; padding: 6px; flex: 1; min-height: 0; overflow: auto; }
.cmdzone { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.cmdzone .tax { font-size: 10px; color: var(--muted); }
.bfrows { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bfrow { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-end; min-height: 10px; }
.bfrow.lands { opacity: .95; }
.me .pp { height: 100%; }

/* cards */
.card { --w: var(--cw); width: var(--w); height: calc(var(--w) * 1.395); border-radius: calc(var(--w) * .05); position: relative; flex: none; background: #2a2f36; box-shadow: 0 2px 4px rgba(0,0,0,.5); transition: transform .15s, box-shadow .15s; cursor: pointer; user-select: none; }
.opp .card { --w: var(--ow); }
.card img { width: 100%; height: 100%; border-radius: inherit; display: block; pointer-events: none; }
.card.tapped { transform: rotate(90deg); margin: 0 calc(var(--w) * .2); }
.card.tapped:hover { transform: rotate(90deg) scale(1.04); }
.card:hover { box-shadow: 0 0 0 2px var(--gold); z-index: 5; }
.card.playable { box-shadow: 0 0 0 2px var(--green), 0 0 10px var(--green); }
.card.tgt { box-shadow: 0 0 0 3px var(--yellow), 0 0 14px var(--yellow); animation: pulse 1s infinite; cursor: crosshair; }
.card.picked { box-shadow: 0 0 0 3px var(--green), 0 0 16px var(--green) !important; animation: none; }
.card.atk { box-shadow: 0 0 0 3px var(--red), 0 0 12px var(--red); }
.card.blk { box-shadow: 0 0 0 3px var(--blue), 0 0 12px var(--blue); }
.card.sick img { filter: saturate(.55) brightness(.85); }
.card .frame { position: absolute; inset: 0; border-radius: inherit; padding: 4px; font-size: calc(var(--w) * .085); line-height: 1.15; display: flex; flex-direction: column; overflow: hidden; border: 2px solid #555; background: linear-gradient(#3a3f47, #262a30); }
.card .frame.c-W { background: linear-gradient(#e9e2c8, #c9c0a0); color: #222; } .card .frame.c-U { background: linear-gradient(#a9cbe8, #6f9dc6); color: #111; }
.card .frame.c-B { background: linear-gradient(#5c5458, #3a3336); } .card .frame.c-R { background: linear-gradient(#e7a080, #c0644a); color: #111; }
.card .frame.c-G { background: linear-gradient(#9fd0a3, #5d9c66); color: #111; } .card .frame.c-M { background: linear-gradient(#e6cf86, #b99a45); color: #111; }
.card .frame .fn { font-weight: 700; } .card .frame .ft { font-size: .85em; opacity: .85; border-bottom: 1px solid rgba(0,0,0,.25); margin: 1px 0 2px; }
.card .frame .fx { flex: 1; overflow: hidden; font-size: .82em; } .card .frame .fpt { align-self: flex-end; font-weight: 800; }
.ov { position: absolute; inset: 0; pointer-events: none; }
.ov .pt { position: absolute; right: -3px; bottom: -3px; background: #111d; border: 1px solid #666; border-radius: 5px; padding: 0 4px; font-weight: 800; font-size: calc(var(--w) * .16); line-height: 1.2; }
.ov .pt.mod { color: var(--green); border-color: var(--green); } .ov .pt.hurt { color: #ffb3b3; }
.ov .ctrs { position: absolute; left: -3px; top: 18%; display: flex; flex-direction: column; gap: 2px; }
.ov .ctr { background: #1c4a2b; border: 1px solid #4fc07a; border-radius: 9px; font-size: 10px; padding: 0 5px; font-weight: 700; white-space: nowrap; }
.ov .ctr.neg { background: #4a1c1c; border-color: var(--red); } .ov .ctr.loy { background: #2b2b4a; border-color: #9a9aff; font-size: 13px; }
.ov .dmg { position: absolute; right: -4px; top: 30%; background: var(--red); color: #fff; border-radius: 50%; width: 20px; height: 20px; font-size: 11px; line-height: 20px; text-align: center; font-weight: 800; }
.ov .flag { position: absolute; left: 2px; top: 2px; font-size: 12px; text-shadow: 0 0 3px #000; }
.ov .auto { position: absolute; right: 2px; top: 2px; font-size: 11px; background: #7a5a10; border-radius: 50%; width: 16px; height: 16px; text-align: center; line-height: 16px; }
.ov .cnt { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); background: #000c; border-radius: 10px; padding: 0 7px; font-weight: 800; font-size: 13px; }
.ov .lbl { position: absolute; left: 0; right: 0; bottom: 18%; text-align: center; font-size: 10px; background: #000b; color: var(--yellow); font-weight: 700; }
.ov .kw { position: absolute; left: 2px; bottom: calc(var(--w) * .235); font-size: 9px; line-height: 1.25; background: #000c; color: #f3e6c4; border: 1px solid #c9a04e88; border-radius: 3px; padding: 0 4px; max-width: calc(100% - 4px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.ov .lbl { bottom: 42%; }
.attachgroup { display: flex; position: relative; }
.attachgroup .card.attached { margin-left: calc(var(--w) * -.72); margin-top: calc(var(--w) * -.25); z-index: 0; }
.attachgroup .card.host { z-index: 1; }

.hand { display: flex; justify-content: center; padding: 6px 10px 8px; gap: 0; min-height: calc(var(--hw) * 1.4 + 14px); background: linear-gradient(transparent, rgba(0,0,0,.35)); overflow-x: auto; overflow-y: visible; }
.hand .card { --w: var(--hw); margin: 0 -8px; }
.hand .card:hover { transform: translateY(-14px) scale(1.06); z-index: 10; }
.zonebtn { font-size: 11px; padding: 2px 6px; }
.pool { font-size: 12px; } .pool .ms { width: 16px; height: 16px; line-height: 16px; }

/* side */
.side { border-left: 1px solid var(--line); background: rgba(16,20,25,.85); display: flex; flex-direction: column; overflow: hidden; }
.prompt { padding: 10px; background: #2a2412; border-bottom: 2px solid var(--gold); max-height: calc(55vh / var(--z, 1)); overflow: auto; }
.prompt .q { font-weight: 700; margin-bottom: 8px; line-height: 1.35; }
.prompt .err { color: #ff9b9b; margin-bottom: 6px; font-size: 12px; }
.prompt .btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.prompt .opt { display: block; width: 100%; text-align: left; margin: 3px 0; }
.prompt .list { display: flex; flex-wrap: wrap; gap: 4px; }
.prompt .list .card { --w: 70px; }
.hint { padding: 8px 10px; font-size: 12px; color: #b9c4b5; border-bottom: 1px solid var(--line); line-height: 1.4; }
.hint:empty { display: none; }
.stackwrap { padding: 8px 10px; border-bottom: 1px solid var(--line); max-height: calc(30vh / var(--z, 1)); overflow: auto; }
.stack .si { display: flex; gap: 6px; align-items: center; padding: 4px; border-radius: 6px; background: var(--panel2); margin-bottom: 4px; font-size: 12px; border-left: 3px solid var(--c); }
.stack .si.tgt { outline: 2px solid var(--yellow); cursor: crosshair; } .stack .si.picked { outline-color: var(--green); }
.stack .si .card { --w: 40px; }
.stack:empty::after { content: 'empty'; color: var(--muted); font-size: 12px; }
.tabs { display: flex; } .tabs button { flex: 1; border-radius: 0; border-width: 0 0 2px; background: none; } .tabs button.on { border-color: var(--gold); }
.log { flex: 1; overflow: auto; padding: 6px 10px; font-size: 12px; line-height: 1.45; }
.log div { border-bottom: 1px solid rgba(255,255,255,.03); }
.log .turn { color: var(--gold); font-weight: 700; margin-top: 6px; } .log .big { color: var(--yellow); font-weight: 700; } .log .warn { color: #ff9b9b; }
.log .manual { color: #e0b060; } .log .combat { color: #f0a0a0; } .log .cast { color: #a8d0ff; } .log .dice { color: #c0a0ff; } .log .trig { color: #b0e0b0; } .log .sys { color: var(--muted); }
#chat { flex: 1; padding: 6px 10px; margin: 0; } #chat .chatlog { flex: 1; max-height: none; }

/* zoom */
.zoom { position: fixed; z-index: 87; display: flex; gap: 10px; pointer-events: none; background: rgba(10,12,15,.92); border: 1px solid var(--gold); border-radius: 12px; padding: 10px; max-width: 720px; box-shadow: 0 10px 40px #000; }
.zoom img, .zoom .bigframe { width: 336px; height: 468px; border-radius: 16px; }
.zoom .bigframe { position: relative; } .zoom .bigframe .card { --w: 336px; }
.zoom .zt { width: 300px; font-size: 13px; line-height: 1.45; overflow: hidden; }
.zoom .zt .zn { font-size: 16px; font-weight: 800; color: var(--gold); }
.zoom .zt .zx { white-space: pre-wrap; margin: 6px 0; }
.zoom .zt .kwx { font-size: 12px; color: #c9d4c3; margin: 3px 0; } .zoom .zt .kwx b { color: var(--yellow); }
.zoom .zt .auto { font-size: 12px; padding: 4px 6px; border-radius: 6px; margin-top: 6px; }
.zoom .zt .auto.full { background: #1c3a26; } .zoom .zt .auto.partial { background: #3a3110; } .zoom .zt .auto.manual { background: #3a1c1c; }

/* menu, modal, toasts */
.menu { position: fixed; z-index: 88; background: #1b2027; border: 1px solid var(--gold); border-radius: 8px; padding: 4px; min-width: 210px; max-width: 360px; box-shadow: 0 8px 24px #000; max-height: calc(80vh / var(--z, 1)); overflow: auto; }
.menu .mi { padding: 6px 10px; border-radius: 5px; cursor: pointer; font-size: 13px; }
.menu .mi:hover { background: #2c3440; } .menu .mi.dis { opacity: .45; cursor: help; } .menu .mi .why { display: block; font-size: 11px; color: #ff9b9b; }
.menu .mh { padding: 6px 10px 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.menu .sep { height: 1px; background: var(--line); margin: 4px 0; }
.menu .mrow { display: flex; gap: 4px; padding: 3px 8px; align-items: center; font-size: 12px; } .menu .mrow button { padding: 2px 8px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 80; display: flex; align-items: center; justify-content: center; }
.modal-box { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; width: min(900px, calc(94vw / var(--z, 1))); max-height: calc(90vh / var(--z, 1)); overflow: auto; }
.modal-x { position: absolute; right: 10px; top: 10px; }
.zonegrid { display: flex; flex-wrap: wrap; gap: 6px; } .zonegrid .card { --w: 100px; }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: #2b1f1f; border: 1px solid var(--red); padding: 8px 14px; border-radius: 8px; max-width: 560px; box-shadow: 0 4px 16px #000; }
.toast.info { background: #1f2b22; border-color: var(--green); }
.tokgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.formgrid { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; }
.tabbar { display: flex; gap: 6px; margin-bottom: 10px; }
.cardlist { columns: 3 200px; font-size: 12px; } .cardlist div { break-inside: avoid; }
.dicegrid { display: flex; flex-wrap: wrap; gap: 6px; }
.dicegrid button { min-width: 64px; font-size: 16px; }
.winner { font-size: 26px; font-weight: 800; color: var(--gold); text-align: center; margin: 10px 0; }
@keyframes pulse { 50% { filter: brightness(1.25); } }
@media (max-width: 1100px) { .table { grid-template-columns: 1fr 250px; } :root { --cw: 76px; --ow: 52px; --hw: 92px; } .lobby-grid { grid-template-columns: 1fr; overflow: auto; } }

.autoscroll { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); padding: 0 8px; white-space: nowrap; cursor: pointer; }
.decklist { columns: 3 220px; column-gap: 18px; font-size: 12px; }
.decklist .typegroup { break-inside: avoid; margin-bottom: 10px; }
.decklist h4 { margin: 0 0 3px; color: var(--gold); text-transform: none; letter-spacing: 0; font-size: 13px; }
.decklist .ms { width: 12px; height: 12px; line-height: 12px; font-size: 8px; }

/* v1.3 board layout */
.board { grid-template-rows: minmax(0, 1fr) minmax(0, 1.25fr) auto; }
.handrow { display: flex; align-items: flex-end; gap: 10px; padding: 0 10px; background: linear-gradient(transparent, rgba(0,0,0,.35)); }
.handrow .hand { flex: 1; background: none; padding-left: 0; padding-right: 0; justify-content: flex-start; }
.mycmd-wrap { flex: none; display: flex; flex-direction: column; align-items: center; padding: 4px 8px 8px; border: 1px dashed #6b5a2e; border-radius: 10px; background: rgba(201,160,78,.08); margin-bottom: 6px; }
.mycmd-wrap .zlabel, .cmdzone:not(.mine)::before { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); opacity: .8; margin-bottom: 3px; }
.cmdzone.mine .card { --w: var(--hw); }
.cmdzone:not(.mine) { border: 1px dashed #6b5a2e; border-radius: 8px; padding: 3px; background: rgba(201,160,78,.07); align-self: flex-start; }
.cmdzone:not(.mine)::before { content: 'Command'; }
.cmdzone.empty:not(.mine) { display: none; }
.bfrows { gap: 8px; }
.bfrow.cre { min-height: calc(var(--w, var(--cw)) * 1.4); }
.lower { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: flex-end; padding-top: 6px; border-top: 1px dashed rgba(255,255,255,.07); }
.lower .bfrow { gap: 3px; }
.lower .card { --w: calc(var(--cw) * .72); }
.opp .lower .card { --w: calc(var(--ow) * .78); }
.lower .bfrow.oth:empty { display: none; }
/* attachments peek out above their host instead of covering it */
.bfrow.withatt { padding-top: calc(var(--cw) * .45); }
.opp .bfrow.withatt { padding-top: calc(var(--ow) * .45); }
.card.attached { z-index: 1; transform: translateY(calc(-24% - var(--k, 0) * 12%)); margin: 0; }
.card.attached.attnext, .card.hasatt { margin-left: calc(var(--w) * -.86); }
.card.hasatt { z-index: 3; }
.card.attached:hover { z-index: 6; }
/* combat pairing */
.card.atk { box-shadow: 0 0 0 3px var(--pc, var(--red)), 0 0 14px var(--pc, var(--red)); }
.card.blk { box-shadow: 0 0 0 3px var(--pc, var(--blue)), 0 0 14px var(--pc, var(--blue)); }
.ov .lbl.pair { background: var(--pc, #000c); color: #111; font-weight: 800; text-shadow: none; border-top: 1px solid #000; border-bottom: 1px solid #000; }
.pairdot { display: inline-block; min-width: 16px; height: 16px; border-radius: 8px; color: #111; font-weight: 800; font-size: 11px; text-align: center; line-height: 16px; margin-right: 3px; }
.arrows { position: fixed; inset: 0; width: calc(100vw / var(--z, 1)); height: calc(100vh / var(--z, 1)); pointer-events: none; z-index: 40; }
/* deck list hover preview */
.dl-card { cursor: default; border-radius: 3px; padding: 0 2px; }
.dl-card:hover { background: rgba(201,160,78,.15); }
.cardtip { position: fixed; z-index: 95; pointer-events: none; filter: drop-shadow(0 8px 24px #000); }
.cardtip img { width: 260px; border-radius: 12px; display: block; }
.cardtip .tiptext { background: #111; border: 1px solid var(--gold); padding: 8px 12px; border-radius: 8px; max-width: 260px; }
.cardtip .bigframe .card { height: 349px; }

.stat.castable { background: rgba(79,192,122,.25); outline: 1px solid var(--green); color: #c8f5d6; }

/* ---------- v1.4 ---------- */
/* scrollbars that blend into the UI */
* { scrollbar-width: thin; scrollbar-color: #3a4452 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333c48; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #6b5a2e; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }
/* deck automation badges */
.deck .autob { position: absolute; top: 30px; right: 6px; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.deck .autob.full { background: #1f6b3d; color: #d9ffe6; border: 1px solid #4fc07a; }
.deck .autob.low { background: #6b3a14; color: #ffe2c4; border: 1px solid #e0904a; font-weight: 600; }
/* hand never slides over the command zone */
.handrow { position: relative; }
.mycmd-wrap { position: relative; z-index: 12; }
.handrow .hand { min-width: 0; padding-left: 14px; isolation: isolate; }
/* floating mana pool */
.mypool { flex: none; align-self: flex-end; margin-bottom: 8px; padding: 4px 10px 6px; border: 1px solid #4a6a8a; border-radius: 10px; background: rgba(79,143,224,.12); font-size: 13px; text-align: center; }
.mypool .zlabel { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #8ec3ee; margin-bottom: 2px; }
.mypool .ms { width: 18px; height: 18px; line-height: 18px; font-size: 10px; } .mypool b { margin: 0 6px 0 1px; }
body.manualmana .pp:not(.opp) .lands .card:not(.tapped) { box-shadow: 0 0 0 1px #8ec3ee88; }
/* connection banner */
.conn button { margin-left: 8px; padding: 1px 8px; font-size: 11px; }
/* first-player reel */
.reel-ov { position: fixed; inset: 0; z-index: 85; background: rgba(5,8,10,.72); display: flex; align-items: center; justify-content: center; transition: opacity .5s; cursor: pointer; }
.reel-ov.fade { opacity: 0; }
.reel-box { width: min(760px, calc(92vw / var(--z, 1))); text-align: center; }
.reel-title { font-size: 22px; font-weight: 800; color: var(--gold); margin-bottom: 12px; letter-spacing: .04em; }
.reel { position: relative; height: 96px; overflow: hidden; border: 2px solid #6b5a2e; border-radius: 12px; background: linear-gradient(90deg, #0b0e12, #1a2028 20%, #1a2028 80%, #0b0e12); box-shadow: inset 0 0 30px #000; }
.reel-strip { display: flex; height: 100%; will-change: transform; }
.reel-item { flex: none; width: 166px; margin: 8px 2px; border-radius: 8px; background: linear-gradient(#2a323d, #1c222a); border-bottom: 4px solid var(--c); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; color: #eee; text-shadow: 0 1px 2px #000; overflow: hidden; white-space: nowrap; }
.reel-item small { font-size: 11px; opacity: .7; }
.reel-item.win { background: linear-gradient(var(--c), #1c222a); box-shadow: 0 0 18px var(--c); }
.reel-mark { position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; transform: translateX(-50%); background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.reel-mark::before, .reel-mark::after { content: ''; position: absolute; left: 50%; transform: translateX(-50%); border: 9px solid transparent; }
.reel-mark::before { top: 0; border-top-color: var(--gold); } .reel-mark::after { bottom: 0; border-bottom-color: var(--gold); }
.reel-result { font-size: 22px; margin: 14px 0 6px; min-height: 30px; }

/* v1.5.0 */
.logcard { color: #e9d9a6; border-bottom: 1px dotted rgba(233,217,166,.45); cursor: help; }
.logcard:hover { color: #fff; border-bottom-color: var(--gold); }
#stack .si { cursor: help; }
.saverow { margin: 6px 0; align-items: center; }
.grow { flex: 1; min-width: 0; }
.rchip { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 9px; border: 1px solid var(--rc); color: var(--rc); white-space: nowrap; }
.rlist { max-height: calc(60vh / var(--z, 1)); overflow: auto; margin-top: 8px; }
.rcard { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 0 0 8px; background: rgba(255,255,255,.02); }
.rcard .rtext { white-space: pre-wrap; margin: 6px 0; }
.rcard textarea { width: 100%; min-height: 44px; font: inherit; font-size: 12px; box-sizing: border-box; }
.rcard select { font-size: 12px; }
.idlepop { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); z-index: 90; background: #2a2412; border: 2px solid var(--gold); border-radius: 12px; padding: 14px 18px; box-shadow: 0 10px 40px rgba(0,0,0,.6); min-width: 320px; max-width: 520px; text-align: center; animation: ipIn .25s ease-out; }
.idlepop .ip-t { font-size: 17px; font-weight: 700; color: var(--gold); margin-bottom: 6px; }
.idlepop .ip-m { margin-bottom: 10px; }
.idlepop .btns { justify-content: center; margin-bottom: 6px; }
@keyframes ipIn { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.pp.opp.tgt { cursor: crosshair; }
.atksum { margin: 6px 0; padding: 4px 8px; border-left: 3px solid var(--gold); background: rgba(255,255,255,.03); }
.de-list { max-height: calc(48vh / var(--z, 1)); overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.de-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.de-row input[type=number] { width: 48px; }
.de-results { max-height: 220px; overflow: auto; border: 1px solid var(--gold); border-radius: 8px; margin-top: 4px; background: #14181d; }
.de-res { padding: 4px 8px; cursor: pointer; } .de-res:hover { background: rgba(212,175,55,.12); }
/* v1.8: board rows keep their height (scroll instead of overlapping); wrapped rows leave room for attachments */
.bfrows > * { flex-shrink: 0; }
.bfrow.withatt { row-gap: calc(var(--cw) * .5); }
.opp .bfrow.withatt { row-gap: calc(var(--ow) * .5); }
/* v1.8: priority pop-up */
.prio-pop { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 89; background: #16202b; border: 2px solid #6aa9ff; border-radius: 12px; padding: 12px 18px; min-width: 300px; max-width: 480px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.6); animation: ppIn .18s ease-out; }
.prio-pop .pp-t { font-size: 16px; font-weight: 700; color: #8ec3ff; margin-bottom: 4px; }
.prio-pop .pp-m { margin-bottom: 4px; }
.prio-pop .btns { justify-content: center; margin-top: 8px; }
@keyframes ppIn { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
/* usable ability on a permanent (e.g. Maze of Ith during combat) */
.card.actable { box-shadow: 0 0 0 2px #6aa9ff, 0 0 10px #6aa9ff; }
/* v1.8: victory */
.win-ov { position: fixed; inset: 0; z-index: 96; background: radial-gradient(ellipse at center, rgba(20,16,4,.55), rgba(0,0,0,.75)); display: flex; align-items: center; justify-content: center; cursor: pointer; animation: winIn .4s ease-out; overflow: hidden; }
.win-ov.fade { opacity: 0; transition: opacity .6s; }
.win-box { text-align: center; animation: winPop .7s cubic-bezier(.2,1.6,.4,1); }
.win-crown { font-size: 84px; filter: drop-shadow(0 0 24px rgba(232,181,74,.8)); animation: winBob 2s ease-in-out infinite; }
.win-t { font-size: 56px; font-weight: 900; letter-spacing: .02em; text-shadow: 0 0 30px rgba(232,181,74,.6), 0 4px 0 rgba(0,0,0,.5); }
.win-s { font-size: 18px; margin: 6px 0 14px; color: #e9d9a6; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -20px; height: 14px; border-radius: 2px; opacity: .95; animation-name: confFall; animation-timing-function: cubic-bezier(.3,.7,.5,1); animation-fill-mode: forwards; }
@keyframes confFall { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(calc(110vh / var(--z, 1))) rotate(var(--r)); opacity: .8; } }
@keyframes winIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes winPop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes winBob { 50% { transform: translateY(-10px) rotate(-4deg); } }
/* v1.8.2: planeswalkers sit at the right end of the top row; double-faced card viewer */
.toprow { display: flex; align-items: flex-end; gap: 10px; min-width: 0; }
.toprow .bfrow.cre { flex: 1; min-width: 0; }
.bfrow.pw { flex: 0 1 auto; justify-content: flex-end; margin-left: auto; padding-left: 8px; border-left: 1px dashed rgba(255,255,255,.08); }
.bfrow.pw:empty { display: none; }
.faces2 { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.faces2 > div { flex: 1 1 260px; max-width: 340px; }
.faceview img { width: 100%; border-radius: 12px; display: block; margin-bottom: 6px; }
.otherface { margin-top: 8px; padding-top: 6px; border-top: 1px dashed rgba(255,255,255,.15); }
/* v1.8.3: piles of identical tokens (Treasure, Food, Clue…) */
.card.pile { box-shadow: 3px -3px 0 -1px #2a313b, 3px -3px 0 0 rgba(255,255,255,.18), 6px -6px 0 -1px #222831, 6px -6px 0 0 rgba(255,255,255,.12); margin-right: 6px; }
/* v2.0: big hands overlap to fit (and scroll with the wheel), never hide the first cards */
.hand { justify-content: safe center; }
.handrow .hand { justify-content: flex-start; }
.hand .card { margin: 0 var(--hm, -8px); }
.xplay { flex: none; align-self: flex-end; margin-bottom: 6px; padding: 3px 6px 6px; border: 1px dashed #c9a640; border-radius: 10px; background: rgba(201,166,64,.08); }
.xplay .zlabel { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #e6c35c; margin-bottom: 2px; }
.xplay .xcards { display: flex; gap: 3px; }
.xplay .card { --w: calc(var(--hw) * .78); }

/* ---------- v2.0: sign-in, tables, sharing, admin ---------- */
#auth { align-items: center; justify-content: center; }
.authbox { width: min(420px, 92vw); background: rgba(29,35,43,.95); border: 1px solid var(--line); border-radius: 14px; padding: 26px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.authbox .brand.big { font-size: 26px; color: var(--gold); font-weight: 700; margin-bottom: 16px; text-align: center; }
.authbox form { display: flex; flex-direction: column; gap: 12px; }
.authbox label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.authbox input { font-size: 15px; padding: 9px 10px; }
.authbox .tabbar button { flex: 1; }
.autherr { color: #ff9b9b; min-height: 1.2em; margin-top: 10px; font-size: 13px; }
.acctbtn { white-space: nowrap; }
.tablelist { display: flex; flex-direction: column; gap: 8px; }
.trow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); }
.trow.mine { border-color: #6a5a30; }
.deckgroup { grid-column: 1 / -1; margin: 10px 0 0; padding-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--gold); font-weight: 600; }
.deck .own { font-size: 10.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invcode { font: 700 34px ui-monospace, Consolas, monospace; letter-spacing: 6px; text-align: center; padding: 12px; background: #11151a; border: 1px dashed var(--gold); border-radius: 10px; color: var(--gold); }
.sharelist { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 12px; max-height: 320px; overflow: auto; }
.anntext { line-height: 1.5; max-height: 60vh; overflow: auto; }
.rfollow { border-left: 3px solid var(--line); padding: 3px 8px; margin: 4px 0; }
.admbody { flex: 1; overflow: auto; padding: 14px; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { background: rgba(29,35,43,.85); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kpi .sv { font-size: 24px; font-weight: 700; color: var(--gold); } .kpi .sl { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.admcols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 1100px) { .admcols { grid-template-columns: 1fr; } }
.atable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.atable th { text-align: left; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 5px 6px; }
.atable td { border-bottom: 1px solid rgba(51,60,72,.5); padding: 5px 6px; vertical-align: top; }
.atable tr.bad td { background: rgba(224,93,93,.08); } .atable tr.off td { opacity: .55; } .atable tr.live td:first-child { box-shadow: inset 3px 0 var(--green); }
.atable button { margin: 1px 2px; }
.mono { font-family: ui-monospace, Consolas, monospace; } .nowrap { white-space: nowrap; }
.abars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 4px 0 18px; }
.abar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.abar div { background: linear-gradient(var(--gold), #8a6a2a); border-radius: 3px 3px 0 0; min-height: 2px; }
.abar span { position: absolute; bottom: -16px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); }
/* v2.0.1: select decks to move */
.selbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; padding: 6px 10px; border: 1px solid var(--gold); border-radius: 8px; background: rgba(201,160,78,.08); }
.deck.pickable { opacity: .8; } .deck.picked { outline: 2px solid var(--gold); opacity: 1; }
.deck .pickbox { position: absolute; left: 6px; top: 30px; z-index: 3; font-size: 18px; background: rgba(0,0,0,.6); border-radius: 4px; padding: 0 3px; line-height: 1.2; }
