:root {
  --bg: #15110d;
  --felt: #1e2a23;
  --felt2: #16201a;
  --panel: #231d17;
  --panel2: #2d251d;
  --line: #4a3c2c;
  --text: #efe6d2;
  --muted: #a8977b;
  --gold: #e3b458;
  --gold2: #ffda85;
  --red: #e0533d;
  --blue: #4b9be6;
  --green: #4fb06a;
  --sel: #ffd54a;
  --target: #ff6a3d;
  --W: #efe9c9; --U: #2d6fb3; --B: #3f3838; --R: #c63b2a; --G: #2f7d46; --M: #c9a441; --A: #8a8f96; --L: #8a6d4a;
  --cardw: 92px; --cardh: 128px;
  --handw: 118px; --handh: 165px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.35 "Segoe UI", system-ui, sans-serif; }
body { overflow: hidden; }
button { font: inherit; color: var(--text); background: linear-gradient(#4a3a28, #33281c); border: 1px solid #6b5639; border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button:hover { border-color: var(--gold); color: var(--gold2); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: linear-gradient(#b8862f, #7f5a1c); border-color: #f0c46a; color: #fff6dd; font-weight: 600; }
button.primary:hover { color: #fff; filter: brightness(1.1); }
button.danger { background: linear-gradient(#7a2d22, #521c15); border-color: #b0493a; }
select, input[type=text], input[type=number], textarea { font: inherit; background: #120e0a; color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; margin: 0 0 .5em; }
.hidden { display: none !important; }
.screen { position: absolute; inset: 0; }

/* ---------- menu ---------- */
#menu { display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, #3a2c1c 0%, #15110d 70%); overflow: auto; }
.menu-box { width: min(560px, calc(100% - 32px)); background: rgba(35, 29, 23, .92); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.menu-box h1 { font-size: 34px; color: var(--gold2); text-align: center; letter-spacing: 1px; }
.menu-box .sub { text-align: center; color: var(--muted); margin: -6px 0 20px; }
.menu-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: center; margin: 10px 0; }
.menu-row select { width: 100%; }
.menu-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 20px; }
.menu-note { color: var(--muted); font-size: 12px; margin-top: 16px; text-align: center; }
.seg { display: flex; gap: 0; }
.seg button { border-radius: 0; flex: 1; }
.seg button:first-child { border-radius: 6px 0 0 6px; }
.seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button.on { background: linear-gradient(#b8862f, #7f5a1c); border-color: #f0c46a; }

/* ---------- game board ---------- */
#game { display: grid; grid-template-columns: 1fr 300px; background: var(--bg); }
#board { position: relative; display: grid; grid-template-rows: auto auto 1fr auto 1fr auto auto; background: radial-gradient(ellipse at center, var(--felt) 0%, var(--felt2) 80%); overflow: hidden; min-width: 0; }
.pbar { display: flex; align-items: center; gap: 14px; padding: 6px 12px; background: rgba(0,0,0,.35); border-bottom: 1px solid rgba(255,255,255,.05); min-height: 44px; }
.pbar.me { border-top: 1px solid rgba(255,255,255,.05); border-bottom: 0; }
.avatar { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 24px; background: rgba(0,0,0,.35); border: 2px solid transparent; }
.avatar .life { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 18px; background: radial-gradient(#6b2a20, #3b130e); border: 2px solid #b2553f; }
.avatar .pname { font-weight: 600; }
.avatar.active .pname::after { content: " ●"; color: var(--gold); }
.avatar.prio { box-shadow: 0 0 0 2px var(--gold) inset; }
.avatar.cand { border-color: var(--sel); cursor: pointer; box-shadow: 0 0 14px var(--sel); }
.zones { display: flex; gap: 8px; margin-left: auto; }
.pile { min-width: 54px; padding: 3px 8px; border-radius: 6px; background: rgba(0,0,0,.35); border: 1px solid var(--line); text-align: center; font-size: 12px; cursor: pointer; color: var(--muted); }
.pile b { display: block; color: var(--text); font-size: 15px; }
.pile:hover { border-color: var(--gold); }
.mana-pool { display: flex; gap: 4px; }
.mana-pool .pip { font-size: 12px; }
.opphand { display: flex; gap: 4px; padding: 4px 12px; min-height: 36px; justify-content: center; }
.cardback { width: 26px; height: 36px; border-radius: 3px; background: linear-gradient(135deg, #5b3a1e, #2b1a0c); border: 1px solid #8a6034; box-shadow: inset 0 0 0 2px #3b2410; }
.field { position: relative; display: flex; gap: 14px; padding: 8px 12px; min-height: 0; overflow: hidden; align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; align-content: center; flex: 1; min-width: 0; }
.row.lands { flex: 0 1 38%; justify-content: flex-end; gap: 4px; padding-left: 10px; border-left: 1px dashed rgba(255,255,255,.08); }
.midbar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: rgba(0,0,0,.45); border-top: 1px solid rgba(255,255,255,.06); border-bottom: 1px solid rgba(255,255,255,.06); min-height: 50px; flex-wrap: wrap; }
.phases { display: flex; gap: 2px; flex-wrap: wrap; }
.phase { font-size: 11px; padding: 2px 6px; border-radius: 4px; color: var(--muted); background: rgba(255,255,255,.04); }
.phase.on { background: var(--gold); color: #2a1c05; font-weight: 700; }
.prompt { flex: 1; min-width: 200px; color: var(--gold2); font-weight: 600; }
.prompt small { color: var(--muted); font-weight: 400; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.hand { display: flex; justify-content: center; gap: 0; padding: 6px 12px 10px; min-height: calc(var(--handh) * .55); }
.hand .card.handcard { margin: 0 -10px; transition: transform .12s, margin .12s; }
.hand .card.handcard:hover { transform: translateY(-22px) scale(1.08); z-index: 5; margin: 0 4px; }

/* ---------- cards ---------- */
.card { position: relative; width: var(--cardw); height: var(--cardh); border-radius: 7px; background: #222 center/cover no-repeat; border: 2px solid #111; box-shadow: 0 3px 8px rgba(0,0,0,.6); cursor: default; flex: none; user-select: none; transition: transform .15s, box-shadow .15s; }
.card.handcard { width: var(--handw); height: var(--handh); background-size: cover; }
.card.tapped { transform: rotate(90deg); margin: 0 calc((var(--cardh) - var(--cardw)) / 2); }
.card .frame { position: absolute; inset: 0; border-radius: 5px; overflow: hidden; display: flex; flex-direction: column; }
.card .art { flex: 1; background: #333 center/cover no-repeat; }
.card .nm { font-size: 10px; font-weight: 700; line-height: 1.15; padding: 3px 4px; color: #1a1208; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .ty { font-size: 9px; padding: 1px 4px 2px; color: #1a1208; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.col-W .nm, .card.col-W .ty { background: #efe9c9; }
.card.col-U .nm, .card.col-U .ty { background: #a9cdea; }
.card.col-B .nm, .card.col-B .ty { background: #b3a9a3; }
.card.col-R .nm, .card.col-R .ty { background: #eba88f; }
.card.col-G .nm, .card.col-G .ty { background: #a8d3a6; }
.card.col-M .nm, .card.col-M .ty { background: #e6cf84; }
.card.col-A .nm, .card.col-A .ty { background: #c6cad0; }
.card.col-L .nm, .card.col-L .ty { background: #d4c0a1; }
.card.col-W { border-color: #d7cfa8; } .card.col-U { border-color: #2d6fb3; } .card.col-B { border-color: #5a4f4f; }
.card.col-R { border-color: #c63b2a; } .card.col-G { border-color: #2f7d46; } .card.col-M { border-color: #c9a441; }
.card.col-A { border-color: #8a8f96; } .card.col-L { border-color: #8a6d4a; }
.card .pt { position: absolute; right: 3px; bottom: 3px; background: #f3ecd9; color: #1a1208; font-weight: 800; font-size: 12px; padding: 0 5px; border-radius: 4px; border: 1px solid #3a2d1a; }
.card .pt.up { background: #bff0c4; } .card .pt.down { background: #f6b7ad; }
.card .dmg { position: absolute; left: 3px; bottom: 3px; background: var(--red); color: #fff; font-weight: 800; font-size: 11px; padding: 0 5px; border-radius: 9px; }
.card .ctr { position: absolute; left: 3px; top: 3px; background: #222d; color: #fff; font-size: 10px; padding: 0 4px; border-radius: 6px; }
.card .sick { position: absolute; right: 3px; top: 3px; font-size: 11px; opacity: .9; }
.card .locked { position: absolute; right: 3px; bottom: 22px; background: #222d; font-size: 11px; padding: 0 3px; border-radius: 6px; }
.card .kw { position: absolute; left: 2px; right: 2px; top: 20px; display: flex; flex-wrap: wrap; gap: 2px; }
.card .kw span { font-size: 9px; background: rgba(0,0,0,.7); color: #fff; padding: 0 3px; border-radius: 3px; }
.card.textonly .fulltext { position: absolute; inset: 0; padding: 6px; font-size: 10px; background: linear-gradient(#3a3026, #1d1712); border-radius: 5px; overflow: hidden; }
.card.textonly .fulltext b { display: block; font-size: 11px; color: var(--gold2); }
.card.unsupported::after { content: "not implemented"; position: absolute; left: 0; right: 0; bottom: 38%; text-align: center; background: rgba(120,20,10,.85); color: #fff; font-size: 10px; padding: 2px 0; }
.card.cand, .card.playable { cursor: pointer; box-shadow: 0 0 0 2px var(--sel), 0 0 14px var(--sel); }
.card.chosen { box-shadow: 0 0 0 3px var(--target), 0 0 18px var(--target); }
.card.attacking { box-shadow: 0 0 0 3px #ff5a3a, 0 0 16px #ff5a3a; }
.field.me .card.attacking { transform: translateY(-14px); }
.field.opp .card.attacking { transform: translateY(14px); }
.card.attacking.tapped { transform: rotate(90deg); }
.card.blocking { box-shadow: 0 0 0 3px #4ba3ff, 0 0 16px #4ba3ff; }
.card .blk { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); background: #4ba3ff; color: #fff; font-size: 10px; padding: 0 5px; border-radius: 6px; white-space: nowrap; z-index: 2; }
.stackgroup { position: relative; flex: none; }
.stackgroup .card.aura { position: absolute; left: 0; z-index: 0; }
.stackgroup .card.host { position: relative; z-index: 1; }
/* lands are drawn at ~70% of the field's card size; the field size is set by UI.fitFields() */
.row.lands .card { width: calc(var(--cardw) * .72); height: calc(var(--cardh) * .72); }
.row.lands .card.tapped { margin: 0 calc((var(--cardh) - var(--cardw)) * .36); }
.row.lands .card .ty { display: none; }

/* ---------- side panel ---------- */
#side { display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
#preview { padding: 10px; border-bottom: 1px solid var(--line); min-height: 250px; }
#preview .pimg { width: 100%; max-width: 244px; aspect-ratio: 488/680; margin: 0 auto; border-radius: 10px; background: #111 center/cover no-repeat; box-shadow: 0 6px 20px rgba(0,0,0,.6); }
#preview .ptext { font-size: 12px; color: var(--muted); margin-top: 6px; white-space: pre-wrap; max-height: 120px; overflow: auto; }
#preview .ptext b { color: var(--text); }
#stackPanel { padding: 8px 10px; border-bottom: 1px solid var(--line); max-height: 30%; overflow: auto; }
#stackPanel h3, #logPanel h3 { font-size: 13px; color: var(--gold); margin: 0 0 6px; font-family: inherit; text-transform: uppercase; letter-spacing: 1px; }
.stackitem { display: flex; gap: 8px; align-items: center; padding: 4px; border-radius: 6px; background: rgba(0,0,0,.3); margin-bottom: 4px; font-size: 12px; border: 1px solid transparent; }
.stackitem .thumb { width: 36px; height: 36px; border-radius: 4px; background: #333 center/cover; flex: none; }
.stackitem.cand { border-color: var(--sel); cursor: pointer; box-shadow: 0 0 10px var(--sel); }
.stackitem .who { color: var(--muted); font-size: 11px; }
#logPanel { flex: 1; padding: 8px 10px; overflow: auto; min-height: 0; }
#log { font-size: 12px; color: var(--muted); }
#log div { padding: 1px 0; border-bottom: 1px solid rgba(255,255,255,.03); }
#log div.turn { color: var(--gold); margin-top: 6px; font-weight: 600; }
#sideToggle { display: none; }
#sideButtons { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
#sideButtons label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.7); }
.modal h2 { color: var(--gold2); font-size: 20px; }
.modal .cards { display: flex; flex-wrap: wrap; gap: 10px; overflow: auto; padding: 6px; justify-content: center; }
.modal .cards .card { cursor: pointer; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; align-items: center; }
.modal .foot .info { margin-right: auto; color: var(--muted); }
.modal .opts { display: flex; flex-wrap: wrap; gap: 6px; overflow: auto; }
#popup { position: fixed; z-index: 60; background: var(--panel2); border: 1px solid var(--gold); border-radius: 8px; padding: 4px; min-width: 200px; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
#popup button { display: block; width: 100%; text-align: left; margin: 2px 0; background: transparent; border-color: transparent; }
#popup button:hover { background: rgba(227,180,88,.15); }
#curtain { position: fixed; inset: 0; z-index: 70; background: radial-gradient(#3a2c1c, #0c0906); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; cursor: pointer; }
#curtain h1 { color: var(--gold2); }
.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); background: #3b1a14; border: 1px solid var(--red); padding: 8px 14px; border-radius: 8px; z-index: 80; }
.pip { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; font-size: 10px; font-weight: 800; color: #111; margin: 0 1px; vertical-align: -3px; border: 1px solid rgba(0,0,0,.4); }
.pip.W { background: #f8f3d6; } .pip.U { background: #aad4f5; } .pip.B { background: #b8aeab; } .pip.R { background: #f5a58d; } .pip.G { background: #9fd5ad; } .pip.C, .pip.N, .pip.X { background: #ccc6bc; }

/* ---------- deck builder ---------- */
#builder { display: grid; grid-template-columns: 1fr 340px; grid-template-rows: auto 1fr; background: var(--bg); }
#builder .top { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#builder .top h2 { margin: 0 12px 0 0; color: var(--gold2); font-size: 20px; }
#builder .filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.colorfilter { display: flex; gap: 3px; }
.colorfilter .pip { width: 24px; height: 24px; font-size: 12px; cursor: pointer; opacity: .35; }
.colorfilter .pip.on { opacity: 1; box-shadow: 0 0 0 2px var(--gold); }
#pool { overflow: auto; padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-content: start; }
.poolcard { position: relative; cursor: pointer; }
.poolcard .img { width: 100%; aspect-ratio: 488/680; border-radius: 8px; background: #222 center/cover no-repeat; box-shadow: 0 3px 8px rgba(0,0,0,.6); }
.poolcard.unsupported .img { filter: grayscale(.85) brightness(.55); }
.poolcard .cnt { position: absolute; top: 6px; right: 6px; background: var(--gold); color: #2a1c05; font-weight: 800; border-radius: 10px; padding: 0 7px; }
.poolcard .tag { position: absolute; left: 6px; bottom: 8px; right: 6px; background: rgba(120,20,10,.9); color: #fff; font-size: 11px; text-align: center; border-radius: 4px; }
.poolcard .fallback { position: absolute; inset: 0; padding: 8px; font-size: 11px; color: var(--text); overflow: hidden; pointer-events: none; }
#deckside { display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
#deckside .hdr { padding: 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
#deckside .hdr .line { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#decklist { flex: 1; overflow: auto; padding: 6px 10px; }
.dl-sec { color: var(--gold); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin: 8px 0 3px; }
.dl-row { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 4px; font-size: 13px; }
.dl-row:hover { background: rgba(255,255,255,.05); }
.dl-row .n { width: 22px; text-align: right; font-weight: 700; color: var(--gold2); }
.dl-row .name { flex: 1; cursor: default; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-row .name.bad { color: #f08a7a; }
.dl-row button { padding: 0 7px; font-size: 12px; }
.curve { display: flex; align-items: flex-end; gap: 4px; height: 60px; padding: 4px 10px; border-top: 1px solid var(--line); }
.curve div { flex: 1; background: var(--gold); border-radius: 3px 3px 0 0; position: relative; min-height: 2px; }
.curve div span { position: absolute; bottom: -16px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); }
.curve div em { position: absolute; top: -15px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--text); font-style: normal; }
#deckside .foot { padding: 18px 10px 10px; border-top: 1px solid var(--line); display: flex; gap: 6px; flex-wrap: wrap; }
#deckerrors { color: #f08a7a; font-size: 12px; padding: 0 10px; }
#bpreview { position: fixed; z-index: 40; width: 250px; aspect-ratio: 488/680; border-radius: 12px; background: #111 center/cover; pointer-events: none; box-shadow: 0 10px 40px rgba(0,0,0,.8); }

@media (max-width: 900px) {
  :root { --cardw: 64px; --cardh: 90px; --handw: 84px; --handh: 118px; }
  #game { grid-template-columns: 1fr; }
  #game, #board { grid-template-columns: minmax(0, 1fr); }
  /* the side panel becomes a drawer opened with the ☰ button */
  #side { display: none; }
  #game.side-open #side { display: flex; position: fixed; top: 0; right: 0; bottom: 0; width: min(320px, 88vw); z-index: 50; box-shadow: -10px 0 30px rgba(0,0,0,.6); }
  #sideToggle { display: block; position: fixed; top: 6px; right: 6px; z-index: 51; padding: 4px 10px; font-size: 18px; }
  #preview { min-height: 0; } #preview .pimg { max-width: 180px; }
  .pbar { gap: 6px; padding: 4px 48px 4px 6px; flex-wrap: wrap; }
  .pbar.me { padding-right: 6px; }
  .avatar { padding-right: 8px; } .zones { gap: 4px; }
  .pile { min-width: 0; padding: 2px 5px; font-size: 10px; } .pile b { font-size: 12px; }
  .field { flex-direction: column; align-items: stretch; gap: 4px; overflow-y: auto; }
  .row.lands { flex: 0 0 auto; justify-content: flex-start; border-left: 0; padding-left: 0; border-top: 1px dashed rgba(255,255,255,.08); padding-top: 4px; }
  .hand { justify-content: flex-start; overflow-x: auto; overflow-y: hidden; padding-top: 26px; min-height: calc(var(--handh) + 40px); box-sizing: border-box; }
  .menu-row > * { min-width: 0; } .menu-row input { width: 100%; box-sizing: border-box; }
  #builder { grid-template-columns: 1fr; grid-template-rows: auto 1fr 40%; }
  #deckside { border-left: 0; border-top: 1px solid var(--line); }
  .card .nm { font-size: 8px; } .card .ty { display: none; }
}

/* short screens (phones held sideways): let the board scroll instead of squeezing the battlefield */
@media (max-height: 560px) {
  #game { overflow-y: auto; }
  #board, #board.multi { grid-template-rows: none; overflow: visible; }
  .field { min-height: calc(var(--cardh) + 24px); }
}
/* touch screens: a tapped card stays "hovered", so don't lift and enlarge hand cards */
@media (hover: none) {
  .hand .card.handcard:hover { transform: none; margin: 0 -10px; }
}

.card.mini { width: 40px; height: 56px; border-radius: 4px; background-size: cover; border-width: 1px; cursor: pointer; }
.opphand.revealed { gap: 3px; }
.pile.playable-pile { border-color: var(--sel); box-shadow: 0 0 10px var(--sel); color: var(--gold2); }
/* small cards: hide the type line and shrink labels so the art and P/T stay readable */
.field.compact .card .ty { display: none; }
.field.compact .card .nm { font-size: 8px; padding: 2px 3px; }
.field.compact .card .pt { font-size: 10px; padding: 0 3px; }
.field.compact .card .kw { display: none; }
/* tokens have no card art: show a tinted token face instead */
.card .art.noart { display: grid; place-items: center; background: radial-gradient(circle, rgba(255,255,255,.18), rgba(0,0,0,.35)); }
.card .art.noart span { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: rgba(255,255,255,.75); }
.card.col-W .art.noart { background-color: #bdb58c; } .card.col-U .art.noart { background-color: #2d5f93; }
.card.col-B .art.noart { background-color: #3a3232; } .card.col-R .art.noart { background-color: #9c3322; }
.card.col-G .art.noart { background-color: #2f6d3e; } .card.col-A .art.noart { background-color: #6f747b; }

/* ---------- log & spotlight ---------- */
#log div.act { color: var(--text); font-weight: 600; }
#log div.fx { color: #cfe7c0; padding-left: 10px; }
#log .lc { color: var(--gold2); cursor: help; border-bottom: 1px dotted rgba(255,218,133,.5); }
.card.targeted { box-shadow: 0 0 0 3px var(--target), 0 0 22px var(--target); }
.card.targeted::before { content: "🎯"; position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: 26px; z-index: 3; filter: drop-shadow(0 0 4px #000); }
.avatar.targeted { border-color: var(--target); box-shadow: 0 0 16px var(--target); }
/* top-right of the board, below the opponent's bar; click-through so it never blocks the board */
#spotlight { position: fixed; right: 316px; top: 56px; transform: translateX(30px); opacity: 0; pointer-events: none; z-index: 45;
  display: flex; gap: 10px; width: 360px; padding: 10px; border-radius: 12px; background: rgba(28, 22, 16, .96); border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0,0,0,.7); transition: opacity .25s, transform .25s; }
#spotlight.show { opacity: .96; transform: translateX(0); }
#spotlight.theirs { border-color: var(--target); }
#spotlight.mine { border-color: var(--gold); }
#spotlight .sp-img { width: 110px; flex: none; aspect-ratio: 488/680; border-radius: 7px; background: #111 center/cover; }
#spotlight .sp-body { flex: 1; min-width: 0; font-size: 13px; }
#spotlight .sp-title { font-weight: 700; color: var(--gold2); margin-bottom: 4px; }
#spotlight .sp-text { color: var(--text); margin-bottom: 4px; }
#spotlight .sp-target { color: #ffb39c; margin-bottom: 4px; }
#spotlight .sp-lines div { color: #cfe7c0; font-size: 12px; margin-top: 2px; }
#spotlight .lc { color: var(--gold2); cursor: help; }
@media (max-width: 900px) { #spotlight { right: 12px; width: min(360px, calc(100vw - 24px)); } }

.ownerbadge { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 0; text-align: center; font-size: 11px; font-weight: 700; border-radius: 0 0 5px 5px; }
.ownerbadge.mine { background: rgba(40, 110, 60, .92); color: #eaffea; }
.ownerbadge.theirs { background: rgba(140, 40, 30, .92); color: #ffe9e4; }
#popup .popnote { font-size: 12px; color: var(--muted); padding: 6px 8px; max-width: 320px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

.online-status { min-height: 22px; margin: 8px 0; padding: 8px 10px; border-radius: 6px; background: rgba(0,0,0,.3); color: var(--gold2); font-size: 13px; }
.online-status:empty { display: none; }
.online-status b { font-size: 20px; letter-spacing: 3px; color: #fff; }

/* ---------- 3–4 player layout: opponents side by side across the top ---------- */
#board.multi { grid-template-rows: 1.15fr auto 1fr auto auto; }
.opps { display: grid; gap: 6px; padding: 4px 6px 0; min-height: 0; }
.opps.n2 { grid-template-columns: 1fr 1fr; }
.opps.n3 { grid-template-columns: 1fr 1fr 1fr; }
.opppanel { display: flex; flex-direction: column; min-height: 0; min-width: 0; border: 1px solid rgba(255,255,255,.06); border-radius: 8px; background: rgba(0,0,0,.12); overflow: hidden; }
.opppanel .pbar { padding: 4px 8px; min-height: 0; gap: 8px; flex-wrap: wrap; }
.opppanel .pbar .zones { gap: 4px; }
.opppanel .pbar .pile { min-width: 0; padding: 2px 5px; font-size: 10px; }
.opppanel .pbar .pile b { font-size: 12px; }
.opppanel .pbar .mana-pool:empty { display: none; }
.opppanel .opphand { min-height: 0; padding: 2px 8px; }
.opppanel .opphand .cardback { width: 14px; height: 20px; }
.opppanel .field { flex: 1; flex-direction: column; align-items: stretch; gap: 4px; }
.opppanel .field .row.lands { flex: 0 0 auto; justify-content: flex-start; border-left: 0; padding-left: 0; border-top: 1px dashed rgba(255,255,255,.08); padding-top: 4px; }
.opppanel.out { opacity: .4; filter: grayscale(.7); }
@media (max-width: 900px) {
  .opps .opppanel:last-child .pbar { padding-right: 48px; } /* top-right panel: keep its name clear of the ☰ button */
}
/* phones in portrait: opponents stack in one column you swipe through; your side of the board stays put */
@media (max-width: 600px) {
  .opps.n2, .opps.n3 { grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; overflow-y: auto; }
  .opps .opppanel { overflow: visible; }
  .opps .opppanel:last-child .pbar { padding-right: 8px; }
  .opps .opppanel:first-child .pbar { padding-right: 48px; }
}
.card .blk.atk { background: var(--target); }
.seatrow { display: flex; gap: 6px; align-items: center; }
.seatrow select, .seatrow input { min-width: 0; flex: 1; }
.seatrow .seatnote { color: var(--muted); font-size: 12px; flex: 2; }
/* cards you can see but not pick (e.g. the rest of a revealed hand) */
.modal .cards .card.dim { opacity: .35; filter: grayscale(.8); cursor: not-allowed; }
/* combat numbers so blockers can say exactly which attacker they block */
.card .atknum { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); background: #ff5a3a; color: #fff; font-size: 11px; font-weight: 800; padding: 0 6px; border-radius: 8px; z-index: 2; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.6); }
.card.linked { outline: 3px dashed #fff; outline-offset: 2px; }
