:root {
  --bg: #eaeef3;
  --bg2: #ffffff;
  --panel: #ffffff;
  --panel2: #f2f5f9;
  --line: #d9dfe8;
  --text: #1e2530;
  --muted: #6c7686;
  --accent: #c58a2c;
  --accent2: #3b6fd4;
  --good: #2f9d5b;
  --bad: #d5453b;
  /* card color pips */
  --w: #e9dfae; --u: #6fa8e0; --b: #8a76a8; --r: #dd7a5f; --g: #5aa877;
  /* seat accents + battlefield tints */
  --seat-a: #3b6fd4; --seat-b: #d98029; --seat-c: #379a63; --seat-d: #855fc0;
  --cardbg: #cfd6e0;
  --shadow: 0 3px 14px rgba(35, 50, 75, 0.10);
  --card-ratio: 1.396;
}
/* seat accents; tint (--st) blends the accent into the current panel colour so
   it adapts to every theme */
.seat-a { --sa: var(--seat-a); }
.seat-b { --sa: var(--seat-b); }
.seat-c { --sa: var(--seat-c); }
.seat-d { --sa: var(--seat-d); }
.seat-a, .seat-b, .seat-c, .seat-d { --st: color-mix(in srgb, var(--sa) 13%, var(--panel)); }

/* ---- themes ---- */
[data-theme="slate"] {
  --bg: #0e1116; --bg2: #161b22; --panel: #1b212c; --panel2: #232b38; --line: #303a4a;
  --text: #e6edf3; --muted: #8b98ad; --accent: #d4a24e; --accent2: #6ea8fe;
  --good: #4ec97a; --bad: #e5534b; --cardbg: #2a313d;
  --shadow: 0 4px 16px rgba(0,0,0,0.45);
}
[data-theme="midnight"] {
  --bg: #0b1022; --bg2: #101832; --panel: #151d38; --panel2: #1d2749; --line: #2a3560;
  --text: #e7ecfb; --muted: #97a3c8; --accent: #f0c24a; --accent2: #7fb0ff;
  --good: #4bd0a0; --bad: #f0616b; --cardbg: #232d4e;
  --shadow: 0 4px 18px rgba(0,0,0,0.5);
}
[data-theme="forest"] {
  --bg: #0f1712; --bg2: #14201a; --panel: #182a1f; --panel2: #20362a; --line: #2c4636;
  --text: #e6f0e8; --muted: #93ad9b; --accent: #d9b04e; --accent2: #79c08a;
  --good: #6fd08a; --bad: #e0736a; --cardbg: #26382c;
  --shadow: 0 4px 16px rgba(0,0,0,0.42);
}
[data-theme="parchment"] {
  --bg: #e5d9bf; --bg2: #fbf6ea; --panel: #fbf6ea; --panel2: #f1e7cf; --line: #d8c9a6;
  --text: #3a3120; --muted: #7d6f52; --accent: #9c6b2f; --accent2: #4b74a8;
  --good: #4e8a4a; --bad: #b64a3b; --cardbg: #ddd0b4;
  --shadow: 0 3px 14px rgba(90, 70, 30, 0.16);
}
[data-theme="ocean"] {
  --bg: #071a24; --bg2: #0c2734; --panel: #0e2c3b; --panel2: #143b4c; --line: #1e4a5d;
  --text: #dbeef2; --muted: #82adb9; --accent: #48c9c1; --accent2: #4bb3d6;
  --good: #4bd0a0; --bad: #ef6b6b; --cardbg: #173e4d;
  --shadow: 0 4px 16px rgba(0,0,0,0.5);
}
[data-theme="crimson"] {
  --bg: #170b0e; --bg2: #241318; --panel: #26141a; --panel2: #331b23; --line: #4a2730;
  --text: #f2dde1; --muted: #b78f97; --accent: #e0566a; --accent2: #d98a5a;
  --good: #5bc98a; --bad: #ff6b6b; --cardbg: #3a2027;
  --shadow: 0 4px 16px rgba(0,0,0,0.5);
}
[data-theme="sunset"] {
  --bg: #20121a; --bg2: #301d28; --panel: #33202b; --panel2: #432b38; --line: #5a3a49;
  --text: #f6e6dc; --muted: #c4a08f; --accent: #ff9e6d; --accent2: #e06b9c;
  --good: #6fd0a0; --bad: #ff6f6f; --cardbg: #472e3b;
  --shadow: 0 4px 16px rgba(0,0,0,0.5);
}
[data-theme="mono"] {
  --bg: #141618; --bg2: #1e2124; --panel: #212427; --panel2: #2b2f33; --line: #3a3f44;
  --text: #e4e7ea; --muted: #9aa0a6; --accent: #c7ccd2; --accent2: #8fb0d6;
  --good: #7fc79a; --bad: #e08a8a; --cardbg: #31363b;
  --shadow: 0 4px 16px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
/* slim, unobtrusive scrollbars everywhere — OS scrollbars break the immersion */
* { scrollbar-width: thin; scrollbar-color: rgba(150,180,230,0.30) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(150,180,230,0.26); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(150,180,230,0.5); }
::-webkit-scrollbar-corner { background: transparent; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}
#app { height: 100vh; width: 100vw; }
button {
  font-family: inherit; cursor: pointer;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; font-size: 14px;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
}
button:hover { background: var(--panel2); border-color: #c2cad6; }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); color: #241a08; border-color: #b07f28; font-weight: 600; }
button.primary:hover { filter: brightness(1.05); }
button.ghost { background: transparent; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
input, select {
  font-family: inherit; font-size: 15px; color: var(--text);
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; outline: none;
}
input:focus, select:focus { border-color: var(--accent2); }
textarea { font-family: ui-monospace, "Consolas", monospace; font-size: 13px; color: var(--text); background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none; resize: vertical; width: 100%; }
textarea:focus { border-color: var(--accent2); }
.deck-textarea { min-height: 200px; line-height: 1.5; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1, h2, h3 { font-weight: 650; }
a { color: var(--accent2); }

/* ================= pre-game "menu" presentation ========================== */
/* animated backdrop: arcane glows, a hex weave and rising embers */
.scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 110%, #17213b 0%, #0a0d18 55%, #05070d 100%); }
body:not(.pregame) .scene { display: none; }
.scene-glow { position: absolute; width: 60vw; aspect-ratio: 1; border-radius: 50%; filter: blur(90px); opacity: 0.42; }
.scene-glow.g1 { background: #3f7fd1; top: -22%; left: -14%; animation: matDrift1 30s ease-in-out infinite alternate; }
.scene-glow.g2 { background: #c9852e; bottom: -26%; right: -12%; animation: matDrift2 38s ease-in-out infinite alternate; }
.scene-hex { position: absolute; inset: 0; opacity: 0.13;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='96'%3E%3Cpath d='M28 0L56 16M28 0L0 16 0 48 28 64 56 48M28 64V96' fill='none' stroke='%237fa8dd' stroke-width='2'/%3E%3C/svg%3E");
  background-size: 24px 41px; animation: hexPan 90s linear infinite;
  -webkit-mask-image: radial-gradient(130% 100% at 50% 40%, #000 20%, transparent 82%);
  mask-image: radial-gradient(130% 100% at 50% 40%, #000 20%, transparent 82%); }
.scene-embers { position: absolute; inset: 0; }
.ember { position: absolute; bottom: -20px; width: var(--sz, 3px); height: var(--sz, 3px); border-radius: 50%;
  background: #ffcf7a; box-shadow: 0 0 8px 2px rgba(255, 190, 110, 0.65);
  animation: emberRise var(--dur, 15s) linear infinite; animation-delay: var(--delay, 0s); }
@keyframes emberRise {
  0% { transform: translate(0, 0) scale(0.7); opacity: 0; }
  12% { opacity: 0.9; }
  85% { opacity: 0.5; }
  100% { transform: translate(var(--drift, 30px), -104vh) scale(1.1); opacity: 0; }
}
/* ---------------- centered screens (name / deck / room / lobby) ---------- */
.screen { position: relative; z-index: 1; height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.card-panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow);
  width: 100%; max-width: 460px; padding: 28px;
}
.card-panel.wide { max-width: 980px; }
/* the panels become dark glass slabs with glowing corner brackets */
body.pregame .card-panel {
  position: relative; background: linear-gradient(165deg, rgba(20,27,44,0.93), rgba(9,12,20,0.96));
  border: 1px solid rgba(150,180,230,0.28); border-radius: 4px; padding: 34px 36px;
  box-shadow: 0 28px 70px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: panelIn 0.45s cubic-bezier(.2,.9,.3,1); backdrop-filter: blur(2px);
}
body.pregame .card-panel::before, body.pregame .card-panel::after {
  content: ''; position: absolute; width: 26px; height: 26px; pointer-events: none;
  border-color: var(--accent); border-style: solid; border-width: 0;
}
body.pregame .card-panel::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
body.pregame .card-panel::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
@keyframes panelIn { from { opacity: 0; transform: translateY(18px) scale(0.985); } to { opacity: 1; transform: none; } }
/* title treatment */
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #8a6420);
  display: grid; place-items: center; font-weight: 800; color: #fff;
}
body.pregame .brand { gap: 16px; margin-bottom: 18px; }
body.pregame .brand .logo { width: 54px; height: 54px; font-size: 26px; border-radius: 3px;
  background: linear-gradient(150deg, #f5cf7d, var(--accent) 45%, #7a5312);
  box-shadow: 0 0 22px rgba(240,194,74,0.4), inset 0 1px 0 rgba(255,255,255,0.45);
  animation: sigilPulse 3.6s ease-in-out infinite; }
@keyframes sigilPulse { 50% { box-shadow: 0 0 34px rgba(240,194,74,0.7), inset 0 1px 0 rgba(255,255,255,0.45); } }
.game-title { margin: 0; font-size: 27px; font-weight: 800; letter-spacing: 0.14em; line-height: 1;
  color: #f3f6fc; text-shadow: 0 2px 18px rgba(120,170,255,0.35); }
.game-title span { display: block; font-size: 27px; letter-spacing: 0.3em; color: var(--accent);
  text-shadow: 0 2px 20px rgba(240,194,74,0.45); }
.brand-sub { margin-top: 7px; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: #8fa3c4; font-weight: 700; }
/* chunky game buttons + inputs, menus only */
body.pregame button { border-radius: 3px; text-transform: uppercase; letter-spacing: 0.09em;
  font-weight: 750; font-size: 12px; padding: 11px 20px; transition: transform 0.09s, box-shadow 0.15s, filter 0.15s; }
body.pregame button:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.5); }
body.pregame button:active { transform: translateY(1px); }
body.pregame button.primary { box-shadow: 0 0 20px rgba(240,194,74,0.35), inset 0 1px 0 rgba(255,255,255,0.4); }
body.pregame button.primary:hover { box-shadow: 0 0 30px rgba(240,194,74,0.6), 0 8px 20px rgba(0,0,0,0.5); }
body.pregame input, body.pregame textarea, body.pregame select {
  border-radius: 3px; background: rgba(5,8,14,0.7); border: 1px solid rgba(150,180,230,0.3);
  padding: 11px 13px; font-size: 14px; transition: border-color 0.15s, box-shadow 0.15s; }
body.pregame input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240,194,74,0.16); outline: none; }
body.pregame .field label { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 750; color: #8fa3c4; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 16px 0; }
.field label { font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 10px; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* ---------------- deck picker ---------------- */
.deck-search { position: sticky; top: 0; }
.deck-list {
  margin-top: 12px; max-height: 54vh; overflow: hidden auto;
  display: flex; flex-direction: column; gap: 6px; padding-right: 4px;
}
.deck-item {
  text-align: left; padding: 7px 10px; border-radius: 9px;
  background: var(--panel2); border: 1px solid var(--line);
  display: flex; flex-direction: row; align-items: center; gap: 10px; cursor: pointer;
}
.deck-item:hover { border-color: var(--accent2); }
.deck-item.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
/* deck picker as a character-select: tiles slide out and light up on pick */
body.pregame .deck-list { padding-right: 10px; } /* room for the hover/select slide, so no h-scrollbar and no clipped edge */
body.pregame .deck-item { border-radius: 3px; padding: 10px 13px; background: rgba(12,17,28,0.75);
  border: 1px solid rgba(150,180,230,0.2); border-left: 3px solid transparent;
  transition: transform 0.12s, border-color 0.15s, background 0.15s, box-shadow 0.15s; }
body.pregame .deck-item:hover { transform: translateX(5px); background: rgba(30,42,66,0.9);
  border-left-color: var(--accent2); box-shadow: -4px 0 16px rgba(110,168,254,0.2); }
body.pregame .deck-item.selected { background: linear-gradient(90deg, rgba(240,194,74,0.16), rgba(12,17,28,0.8));
  border-color: var(--accent); border-left-color: var(--accent); transform: translateX(5px);
  box-shadow: -5px 0 22px rgba(240,194,74,0.28); }
body.pregame .deck-item.selected .dn::after { content: ' ✦'; color: var(--accent); }
body.pregame .deck-item .dn { font-weight: 700; letter-spacing: 0.02em; }
body.pregame .deck-item .dm { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
/* lobby seats read as a party roster */
body.pregame .lobby-seat, body.pregame .seat-row {
  border-radius: 3px; border-left: 3px solid var(--sa, var(--line)); background: rgba(12,17,28,0.8);
  transition: box-shadow 0.15s, transform 0.12s; }
body.pregame .lobby-seat:hover { transform: translateX(3px); }
body.pregame .ready-badge, body.pregame .rdy {
  text-transform: uppercase; letter-spacing: 0.12em; font-size: 9px; font-weight: 800; }
.deck-item .di-main { min-width: 0; flex: 1; }
.deck-item .dn { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-item .dm { font-size: 11px; color: var(--muted); }
.deck-item .di-prev { flex: 0 0 auto; padding: 3px 8px; font-size: 13px; }

/* color filter chips */
.color-filter { display: flex; align-items: center; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.cf-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; margin-right: 2px; }
.cf-btn { width: 24px; height: 24px; border-radius: 50%; padding: 0; border: 1px solid rgba(0,0,0,0.25); cursor: pointer; opacity: 0.45; transition: opacity 0.12s; }
.cf-btn:not(:disabled):hover { opacity: 0.85; }
.cf-btn.on { opacity: 1; outline: 2px solid var(--accent); outline-offset: 2px; }
.cf-btn:disabled { cursor: default; }

/* color pips */
.pips { display: inline-flex; gap: 3px; flex: 0 0 auto; }
.pip { width: 13px; height: 13px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.25); box-shadow: inset 0 0 2px rgba(0,0,0,0.15); }

/* deck preview modal */
.pv-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; max-width: 780px; }
.pv-cat { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.pv-h { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); margin-bottom: 6px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.pv-row { display: flex; align-items: baseline; gap: 6px; padding: 2px; border-radius: 5px; font-size: 13px; }
.pv-row:hover { background: var(--panel2); }
.pv-count { color: var(--muted); min-width: 22px; font-size: 12px; }
.pv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-cost { color: var(--muted); font-size: 11px; }

/* badges + share */
.share { display: flex; gap: 8px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.share code { color: var(--accent); font-weight: 700; letter-spacing: 0.05em; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 20px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.badge.ready { color: var(--good); border-color: var(--good); }
.badge.host { color: var(--accent); border-color: var(--accent); }
.badge.spec { color: var(--accent2); border-color: var(--accent2); }
.badge.pub { color: var(--good); border-color: var(--good); }
.badge.priv { color: var(--muted); }

/* public game browse list */
.pub-list { display: flex; flex-direction: column; gap: 6px; max-height: 34vh; overflow: auto; margin-top: 6px; }
.pub-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; }
.pub-row .pub-host { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pub-row button { flex: 0 0 auto; padding: 5px 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.dot.off { background: var(--bad); }

/* ======================= GAME TABLE ======================= */
.gametable {
  height: 100vh; display: grid;
  grid-template-rows: auto minmax(0, 0.92fr) 142px minmax(0, 1.4fr);
  gap: 8px; padding: 8px;
}
/* focus mode (Q): opponents hidden, the whole table goes to your side; the console strip
   (phase + step buttons, timer, game log, last played) stays visible */
body.focus-mode .opp-row { display: none; }
body.focus-mode .gametable { grid-template-rows: auto 142px minmax(0, 1fr); }

/* --- slim top banner --- */
.top-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 4px; }
.tb-brand { font-weight: 800; font-size: 15px; letter-spacing: 0.02em; color: var(--accent); text-decoration: none; }
.tb-brand:hover { text-decoration: underline; }
.tb-actions { display: flex; gap: 6px; align-items: center; }
.tb-actions button { padding: 3px 11px; font-size: 12px; }
/* voice chat: who's connected + my mic controls */
.voice-bar { display: flex; gap: 6px; align-items: center; flex: 1; justify-content: center; min-width: 0; overflow: hidden; }
.voice-chip { font-size: 11px; font-weight: 650; color: #9be3ae; background: rgba(60,150,90,0.16); border: 1px solid rgba(87,217,138,0.4);
  border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.voice-chip.me { border-color: rgba(87,217,138,0.8); }
.vc-btn.vc-muted { background: rgba(160,35,40,0.3); border-color: #b91c1c; color: #ffd9d9; }

/* --- opponents row (top) --- */
.opp-row { display: grid; gap: 8px; min-height: 0; }
.opp-row.n1 { grid-template-columns: 1fr; }
.opp-row.n2 { grid-template-columns: 1fr 1fr; }
.opp-row.n3 { grid-template-columns: 1fr 1fr 1fr; }

.oppseat {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line);
  border-top: 3px solid var(--sa); border-radius: 12px; box-shadow: var(--shadow);
}
.oppseat.active { box-shadow: 0 0 0 2px var(--sa), var(--shadow); }
.oppseat.dead { opacity: 0.55; }
.oppseat-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--panel2); }
.seat-accent { width: 10px; height: 10px; border-radius: 3px; background: var(--sa); flex: 0 0 auto; }
.oppseat-id { display: flex; flex-direction: column; min-width: 0; }
.oppseat-name { font-weight: 650; font-size: 13px; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.oppseat-sub { font-size: 11px; color: var(--muted); }
.mini-stats { display: flex; gap: 4px; }
.mini-stat { font-size: 11px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1px 6px; }
.zone-counts { display: flex; gap: 4px; margin-left: auto; }
.zc-item { font-size: 11px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 2px 5px; cursor: default; white-space: nowrap; }
.zc-item:hover { color: var(--text); }
.oppseat-life { display: flex; flex-direction: column; align-items: center; line-height: 1; margin-left: 2px; }
.oppseat-life b { font-size: 22px; color: var(--sa); font-weight: 800; }
.oppseat-life span { font-size: 8px; letter-spacing: 0.08em; color: var(--muted); }
.oppseat-life.low b { color: var(--bad); }
.oppseat-bf { position: relative; flex: 1; min-height: 0; overflow: hidden; background-color: var(--st); background-size: cover; background-position: center; cursor: grab; }
.oppseat-bf.panning { cursor: grabbing; }
.bf-pan { position: absolute; inset: 0; transform-origin: 0 0; }

/* placement-zone guide, shown while moving a card: creatures front, land + else in back */
.zone-guide { position: absolute; inset: 0; z-index: 0; display: flex; flex-direction: column; pointer-events: none; opacity: 0; transition: opacity 0.12s; }
.zone-guide.on { opacity: 1; }
.zone-guide > .zg-band, .zg-row2, .zg-row2 > .zg-band { flex: 1 1 0; min-height: 0; min-width: 0; }
.zg-row2 { display: flex; border-top: 2px dashed rgba(140,140,150,0.5); }
.zg-row2 > .zg-band + .zg-band { border-left: 2px dashed rgba(140,140,150,0.5); }
.zg-band { display: flex; align-items: center; justify-content: center; box-sizing: border-box; }
.zg-band span { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #fff; background: rgba(18,24,36,0.6); padding: 3px 12px; border-radius: 10px; }
.zg-creature { background: rgba(76,161,110,0.16); }
.zg-land { background: rgba(196,152,78,0.17); }
.zg-other { background: rgba(120,132,155,0.12); }
.desig-badge { font-size: 11px; }

/* --- center console --- */
.console { display: flex; gap: 8px; align-items: stretch; min-height: 0; }
.con-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.con-turn { min-width: 232px; }
.con-turnline { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 6px; }
.turn-n b { font-size: 16px; color: var(--accent); }
.turn-active { font-weight: 650; }
.con-h { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 6px; }
.con-log { flex: 1; min-width: 0; }
.con-log-h { display: flex; justify-content: space-between; align-items: center; }
.con-lastplayed { width: auto; flex: 0 0 auto; padding: 6px; align-items: center; justify-content: center; }
.con-timer { width: 108px; flex: 0 0 auto; align-items: center; text-align: center; }
.turn-timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 26px; line-height: 1.1; margin: 4px 0 8px; color: var(--text); }
.turn-timer.warn { color: #e0a52e; }
.turn-timer.over { color: #d1495b; }
.bell-btn { width: 100%; padding: 6px 4px; font-size: 12px; font-weight: 700; white-space: nowrap; }
/* the last-played card fits its box exactly (box shrinks to the card, widening the log) */
.lp-card { height: 100%; width: auto; aspect-ratio: 1 / var(--card-ratio); min-height: 0; border-radius: 7px; background: var(--cardbg) center/cover no-repeat; border: 1px solid rgba(0,0,0,0.3); box-shadow: 0 2px 6px rgba(0,0,0,0.22); cursor: pointer; }
.lp-card.empty { opacity: 0.3; cursor: default; }
.phase-track { display: flex; gap: 3px; flex-wrap: wrap; }
.ph { padding: 2px 6px; border-radius: 5px; font-size: 10px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); cursor: pointer; }
.ph.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.desig-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.desig-label { font-size: 12px; width: 74px; }
.desig-btns { display: flex; gap: 3px; }
.desig-b { width: 22px; height: 22px; padding: 0; font-size: 12px; border-radius: 6px; }
.desig-b.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.con-box:has(.rand-btns) { min-width: 158px; }
.rand-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.rand-btns .die { padding: 6px 2px; font-size: 12px; font-weight: 700; color: #fff; border: none; }
.rand-btns .die:hover { filter: brightness(1.12); }
.die-coin { background: #c8952e; } .die-4 { background: #d1495b; } .die-6 { background: #e07a3f; }
.die-8 { background: #3fa35b; } .die-10 { background: #2a9d8f; } .die-12 { background: #3b6fd4; }
.die-20 { background: #7b5cc4; } .die-100 { background: #c74f9c; }
.switch-btns { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; min-height: 0; }
.switch-btns button { padding: 3px 8px; font-size: 11px; flex: 0 0 auto; }
.lb { flex: 1; overflow: auto; font-size: 12px; display: flex; flex-direction: column; gap: 2px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-height: 30px; cursor: default; scrollbar-width: none; }
.lb::-webkit-scrollbar { display: none; }
.le { color: var(--muted); }
.le.chat { color: var(--text); }
.le-name { font-weight: 700; }
.log-full { min-width: min(560px, 84vw); max-height: 70vh; overflow: auto; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.log-full .le { color: var(--text); }
.log-input { display: flex; gap: 6px; margin-top: 6px; }
.log-input input { flex: 1; padding: 5px 8px; font-size: 13px; }
.log-input .lb-expand { padding: 5px 9px; font-size: 13px; flex: 0 0 auto; }

/* --- your playmat (bottom) --- */
/* rail (info) · board · commander panel. The commander column also balances the rail so
   the board + hand sit centered on screen, like the opponents' full-width boards above. */
.me-area { display: grid; grid-template-columns: 252px minmax(0, 1fr) 252px; gap: 8px; min-height: 0; }
.me-area.spectating { grid-template-columns: 1fr; place-items: center; }

/* --- commander showcase card (right column) — themed with the rest of the app --- */
.cmd-panel { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.cmd-card {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden; border: 2px solid transparent; color: var(--text);
  background: var(--panel) padding-box, var(--glow, linear-gradient(140deg, #c9a24b, #8a6d2f)) border-box;
  box-shadow: var(--shadow);
}
/* the badge sits over the (dark) art, so it stays dark+gold in both themes */
.cmd-badge { position: absolute; top: 9px; left: 9px; z-index: 3; padding: 3px 10px; border-radius: 20px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em; color: #f2d489;
  background: rgba(8,10,15,0.72); border: 1px solid rgba(201,162,75,0.55); }
.cmd-art { flex: 0 0 auto; aspect-ratio: 626 / 457; background: var(--cardbg) center/cover no-repeat; }
.cmd-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 11px 13px 12px; gap: 5px; background: var(--panel); }
.cmd-headrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cmd-card .cmd-name { font-weight: 700; font-size: 18px; line-height: 1.12; color: var(--text); }
.cmd-mana { flex: 0 0 auto; padding-top: 2px; }
.cmd-mana .mana-cost { gap: 3px; }
.cmd-type { font-size: 12px; color: var(--accent2); font-weight: 600; }
.cmd-div { height: 1px; background: var(--line); margin: 3px 0; flex: 0 0 auto; }
.cmd-text { flex: 1; min-height: 0; overflow-y: auto; font-size: 12px; line-height: 1.42; color: var(--text); scrollbar-width: thin; }
.cmd-reminder { color: var(--muted); font-style: italic; }
.cmd-ptrow { display: flex; justify-content: flex-end; flex: 0 0 auto; }
.cmd-pt { padding: 2px 12px; border-radius: 8px; font-weight: 800; font-size: 14px; color: var(--text); background: var(--panel2); border: 1px solid var(--line); }
.cmd-footrow { display: flex; align-items: center; justify-content: space-between; font-size: 12px; flex: 0 0 auto; }
.cmd-owner { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.cmd-zone { font-size: 10px; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; }
.cmd-actions { display: flex; gap: 8px; margin-top: 4px; flex: 0 0 auto; }
.cmd-actions button { flex: 1; padding: 9px 6px; font-size: 13px; font-weight: 700; border-radius: 9px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--text); cursor: pointer; transition: filter 0.12s, opacity 0.12s; }
.cmd-actions button:hover:not(:disabled) { border-color: var(--accent2); }
.cmd-actions .cmd-cast { background: var(--accent); border-color: var(--accent); color: #fff; }
.cmd-actions .cmd-cast:hover:not(:disabled) { filter: brightness(1.08); }
.cmd-actions button:disabled { opacity: 0.4; cursor: default; }
/* two commanders share the column — trim the art + type sizes to fit */
.cmd-card.compact .cmd-art { aspect-ratio: auto; height: 72px; background-position: center 28%; }
.cmd-card.compact .cmd-name { font-size: 15px; }
.cmd-card.compact .cmd-text { font-size: 11px; line-height: 1.36; }
.cmd-card.compact .cmd-actions button { padding: 7px 6px; }
.me-rail {
  background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--sa);
  border-radius: 12px; padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow);
}
.me-seat-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
.me-life { display: flex; align-items: center; justify-content: space-between; background: var(--st); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.me-life-num { display: flex; flex-direction: column; line-height: 1; }
.me-life-num b { font-size: 34px; font-weight: 800; color: var(--sa); }
.me-life-num span { font-size: 9px; letter-spacing: 0.1em; color: var(--muted); }
.me-life-num.low b { color: var(--bad); }
.me-life-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.me-life-btns button { padding: 4px 10px; font-size: 12px; }
.me-counters { display: flex; flex-direction: column; gap: 4px; }
.me-counter { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.mc-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: var(--sa, #99a); }
.mc-dot.pois { background: #6f9a5c; } .mc-dot.exp { background: #c58a2c; } .mc-dot.enr { background: #3b8fd4; }
.mc-label { flex: 1; }
.mc-val { min-width: 22px; text-align: center; font-weight: 700; }
.me-counter button, .me-cmd-row button { padding: 1px 8px; font-size: 13px; }
.me-cmd { display: flex; flex-direction: column; gap: 4px; }
.me-cmd-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.me-cmd-row.lethal .mc-val { color: var(--bad); }
.cmd-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zone-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
/* untapped-mana tracker (under the zone buttons) */
.mana-track { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; display: flex; flex-direction: column; gap: 5px; }
.mt-head { display: flex; align-items: baseline; gap: 7px; }
.mt-head b { font-size: 20px; line-height: 1; color: var(--accent); font-weight: 800; }
.mt-head span { font-size: 9px; letter-spacing: 0.08em; color: var(--muted); font-weight: 650; }
.mt-land { margin-left: auto; font-size: 10px; font-weight: 700; color: var(--good, #3f9d6a); }
.mt-land.used { color: var(--muted); }
.mt-pips { display: flex; flex-wrap: wrap; gap: 7px; }
.mt-pip { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; }
.mt-pip b { font-weight: 750; }
.zb { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px; text-align: center; font-size: 11px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.zb b { font-size: 15px; color: var(--sa); }
.zb:hover { border-color: var(--sa); }

/* your playmat spans the whole board (battlefield + hand); with none, the page background shows
   through. The battlefield and hand are transparent so the playmat is visible behind both. */
.me-main { position: relative; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); min-height: 0; background-color: transparent; background-size: cover; background-position: center; background-repeat: no-repeat; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.me-bf-head { display: flex; justify-content: space-between; align-items: center; padding: 5px 10px; border-bottom: 1px solid var(--line); background: var(--panel2); font-size: 11px; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.battlefield.mine { position: relative; min-height: 0; overflow: hidden; background-color: transparent; background-size: cover; background-position: center; }
.battlefield.mine.panning { cursor: grabbing; }

/* --- cards on a battlefield --- */
.battlefield { position: relative; overflow: hidden; }
.bf-card {
  position: absolute; width: var(--cw, 78px); aspect-ratio: 1 / var(--card-ratio);
  border-radius: 5px; background: var(--cardbg) center/cover no-repeat;
  border: var(--sleeve-w, 1px) solid var(--sleeve, rgba(0,0,0,0.3)); box-shadow: 0 1px 4px rgba(0,0,0,0.22);
  cursor: pointer; transition: transform 0.19s cubic-bezier(0.34, 1.42, 0.64, 1), box-shadow 0.12s; user-select: none;
}
.bf-card.tapped { transform: rotate(90deg); } /* the transition above gives tap/untap a springy turn */
.bf-card.mine:hover { box-shadow: 0 0 0 2px var(--accent2), 0 3px 8px rgba(0,0,0,0.3); z-index: 5; }
.bf-card.facedown { background-image: none !important; background: repeating-linear-gradient(45deg, #c9b393, #c9b393 6px, #bda380 6px, #bda380 12px); border-color: #8a7350; }
.bf-card.selected { outline: 2px solid var(--accent2); outline-offset: 1px; box-shadow: 0 0 0 2px var(--accent2), 0 3px 8px rgba(0,0,0,0.3); z-index: 6;
  animation: selPulse 1.1s ease-in-out infinite; }
@keyframes selPulse {
  0%, 100% { outline-color: var(--accent2); box-shadow: 0 0 0 2px var(--accent2), 0 3px 8px rgba(0,0,0,0.3); }
  50% { outline-color: #fff; box-shadow: 0 0 12px 5px var(--accent2), 0 3px 8px rgba(0,0,0,0.3); }
}
/* instants & sorceries shine while they sit on the battlefield */
.bf-card.spell-glow { animation: spellPulse 1.7s ease-in-out infinite; }
.bf-card.spell-glow::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3;
  background: linear-gradient(115deg, transparent 38%, rgba(255,240,180,0.38) 50%, transparent 62%) no-repeat; background-size: 230% 100%;
  animation: spellSheen 2.3s linear infinite; }
@keyframes spellPulse { 0%, 100% { box-shadow: 0 0 6px 2px rgba(255,213,88,0.45); } 50% { box-shadow: 0 0 18px 6px rgba(255,213,88,0.85); } }
@keyframes spellSheen { from { background-position: -130% 0; } to { background-position: 230% 0; } }
/* a selected spell: the selection pulse wins (it's the one you're acting on) */
.bf-card.spell-glow.selected { animation: selPulse 1.1s ease-in-out infinite; }
/* arena-style auto-tap preview: while dragging a spell, the producers that will pay it glow gold */
.bf-card.will-tap { outline: 2.5px solid #ffc65c; outline-offset: 1px; z-index: 7; animation: willTap 0.85s ease-in-out infinite; }
@keyframes willTap { 0%, 100% { box-shadow: 0 0 4px 1px rgba(255,198,92,0.5); } 50% { box-shadow: 0 0 15px 5px rgba(255,198,92,0.9); } }
/* payment drop boxes shown while dragging a card with a cost */
.drop-boxes { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; z-index: 90; pointer-events: none; }
.drop-box { display: flex; align-items: center; gap: 9px; padding: 13px 20px; border: 2px dashed rgba(255,255,255,0.4); border-radius: 12px;
  background: rgba(14,17,25,0.85); color: #eef2f8; font-weight: 700; font-size: 13px; transition: transform 0.1s, border-color 0.1s; }
.drop-box b { font-size: 19px; }
.drop-box.hot { border-color: #ffc65c; background: rgba(42,50,68,0.95); transform: scale(1.08); }
.db-override { border-color: rgba(255,122,92,0.6); }
.db-override.hot { border-color: #ff7a5c; }
/* --- generated commander playmats (default when no custom playmat is set) --- */
/* Opponents' small boards show the commander art directly (downscaled = sharp). YOUR big board
   is a clean colour mat in the commander's identity: colour fields, drifting glows, slow aurora. */
.mat-default { position: relative; background-size: cover; background-position: center 25%; }
/* everything real sits above the mat layers */
.mat-default > * { position: relative; z-index: 1; }
.mat-default > .bf-pan, .mat-default > .hand-panel, .mat-default > .bf-empty, .mat-default > .zone-guide { position: absolute; }
.mat-default > .mat-layer { position: absolute; z-index: 0; pointer-events: none; }
/* drifting colour glows in the commander's identity */
.mat-glow { width: 58%; aspect-ratio: 1; border-radius: 50%; filter: blur(70px); opacity: 0.30; }
.mat-glow.g1 { background: var(--mata, #3f7fd1); top: -18%; left: -12%; animation: matDrift1 26s ease-in-out infinite alternate; }
.mat-glow.g2 { background: var(--matb, #d1552f); bottom: -22%; right: -12%; animation: matDrift2 34s ease-in-out infinite alternate; }
@keyframes matDrift1 { to { transform: translate(30%, 24%) scale(1.18); } }
@keyframes matDrift2 { to { transform: translate(-26%, -20%) scale(1.22); } }
/* a slow aurora band in the second colour breathing across your mat */
.mat-aurora { inset: -20%; background: linear-gradient(115deg, transparent 32%, var(--matb, #3f7fd1) 50%, transparent 68%);
  opacity: 0.10; filter: blur(42px); animation: matAurora 24s ease-in-out infinite alternate; }
@keyframes matAurora { from { transform: translateX(-12%) rotate(-2deg); } to { transform: translateX(12%) rotate(2deg); } }
/* faint hex-grid texture: strongest mid-board, fading at the edges; drifts one tile per 90s */
.mat-hex { inset: 0; background-size: 21px 36px; opacity: 0.15;
  -webkit-mask-image: radial-gradient(125% 95% at 50% 55%, #000 28%, transparent 86%);
  mask-image: radial-gradient(125% 95% at 50% 55%, #000 28%, transparent 86%);
  animation: hexPan 90s linear infinite; }
@keyframes hexPan { to { background-position: 21px 36px; } }

/* --- pre-game setup: dice roll + mulligan --- */
.setup-overlay { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center;
  background: rgba(4,6,11,0.82); backdrop-filter: blur(3px); }
.setup-box { background: linear-gradient(170deg, #141a26, #0b0e16); border: 1px solid rgba(150,165,200,0.35);
  border-radius: 18px; padding: 26px 34px; text-align: center; box-shadow: 0 20px 70px rgba(0,0,0,0.7);
  max-width: min(1180px, 96vw); max-height: 92vh; overflow-y: auto; animation: setupIn 0.3s ease; }
@keyframes setupIn { from { transform: scale(0.94) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.setup-title { font-size: 24px; font-weight: 800; color: #ffe9b0; }
.setup-sub { font-size: 12px; color: var(--muted); margin-top: 4px; letter-spacing: 0.03em; }
.setup-hand-note { font-size: 14px; font-weight: 650; margin: 14px 0 4px; }
.setup-wait { font-size: 13px; color: var(--muted); margin-top: 16px; font-style: italic; }
.setup-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.setup-btn { margin-top: 18px; padding: 10px 22px; font-size: 14px; font-weight: 700; }
.setup-actions .setup-btn { margin-top: 0; }
/* the dice */
.dice-row { display: flex; gap: 22px; justify-content: center; margin: 22px 0 6px; flex-wrap: wrap; }
.dice-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dice-name { font-size: 12px; font-weight: 700; }
.dice-state { font-size: 10px; color: var(--muted); }
.dice-cell.mine .dice-name { color: var(--accent); }
.setup-box .die { width: 74px; height: 74px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(150deg, #2b3446, #161c28); border: 2px solid rgba(160,175,210,0.45);
  font-size: 30px; font-weight: 800; color: #fff; box-shadow: 0 8px 22px rgba(0,0,0,0.5), inset 0 2px 6px rgba(255,255,255,0.08); }
.setup-box .die.tumbling { animation: dieTumble 0.65s ease-in-out infinite; color: #7d8798; }
.setup-box .die.landed { animation: dieLand 0.5s cubic-bezier(.2,1.5,.4,1); border-color: #ffc65c; color: #ffe9b0;
  box-shadow: 0 0 20px 5px rgba(255,198,92,0.45), 0 8px 22px rgba(0,0,0,0.5); }
@keyframes dieTumble {
  0% { transform: rotate(0) scale(1); } 25% { transform: rotate(-18deg) scale(1.06) translateY(-5px); }
  50% { transform: rotate(14deg) scale(0.97); } 75% { transform: rotate(-8deg) scale(1.04) translateY(-3px); }
  100% { transform: rotate(0) scale(1); }
}
@keyframes dieLand { from { transform: scale(1.45) rotate(-16deg); } to { transform: none; } }
/* your opening hand, fanned out big enough to actually read */
.mull-hand { display: flex; justify-content: center; align-items: flex-end; padding: 34px 26px 14px; min-height: 250px; }
.mull-card { position: relative; width: 152px; aspect-ratio: 1 / var(--card-ratio); flex: 0 0 auto;
  border-radius: 9px; background: #202531 center/cover no-repeat; border: 2px solid rgba(150,160,190,0.4);
  box-shadow: 0 10px 26px rgba(0,0,0,0.6); display: flex; align-items: flex-end; overflow: hidden;
  transform-origin: bottom center; transform: rotate(var(--rot, 0deg)) translateY(var(--lift, 0));
  margin-left: -46px; transition: transform 0.14s ease, box-shadow 0.14s ease; }
.mull-card:first-child { margin-left: 0; }
.mull-hand.picking .mull-card { cursor: pointer; }
.mull-card:hover { transform: rotate(0deg) translateY(-26px) scale(1.1); z-index: 60 !important;
  box-shadow: 0 20px 40px rgba(0,0,0,0.7); border-color: rgba(255,255,255,0.5); }
.mull-card.picked { border-color: #e5484d; box-shadow: 0 0 16px 4px rgba(229,72,77,0.6), 0 10px 26px rgba(0,0,0,0.6); }
.mull-card.picked::before { content: '↓ BOTTOM'; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  font-size: 10px; font-weight: 800; letter-spacing: 0.06em; color: #fff; background: rgba(180,30,36,0.95);
  padding: 3px 8px; border-radius: 5px; z-index: 2; white-space: nowrap; }
.mull-card.picked::after { content: ''; position: absolute; inset: 0; background: rgba(120,15,20,0.35); }
.mull-nm { position: relative; z-index: 1; font-size: 10px; font-weight: 700; color: #fff;
  background: linear-gradient(transparent, rgba(6,8,13,0.95) 45%); width: 100%; padding: 12px 5px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- trigger reminders --- */
.trigger-tray { position: fixed; top: 52px; right: 272px; z-index: 85; display: flex; flex-direction: column; gap: 8px; max-width: 330px; }
.trig-item { background: rgba(22,17,32,0.96); border: 1px solid rgba(185,140,255,0.55); border-left: 4px solid #b98cff;
  border-radius: 10px; padding: 8px 12px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,0.5); animation: trigIn 0.25s ease; }
.trig-item:hover { background: rgba(34,26,50,0.97); }
.trig-cat { font-size: 9px; letter-spacing: 0.08em; color: #c9a8ff; font-weight: 800; }
.trig-name { font-weight: 750; font-size: 13px; margin: 1px 0; }
.trig-text { font-size: 11px; color: var(--muted); line-height: 1.35; }
@keyframes trigIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- game over / eliminations --- */
.oppseat.eliminated { opacity: 0.45; filter: grayscale(0.9); position: relative; }
.oppseat.eliminated .oppseat-name::after { content: ' ☠ eliminated'; color: #e5484d; font-size: 11px; }
.win-banner { position: fixed; top: 34%; left: 50%; transform: translateX(-50%); z-index: 120; text-align: center;
  background: rgba(14,17,25,0.96); border: 2px solid #ffc65c; border-radius: 16px; padding: 26px 44px;
  font-size: 28px; font-weight: 800; color: #ffe9b0; box-shadow: 0 12px 48px rgba(0,0,0,0.65), 0 0 40px 6px rgba(255,198,92,0.35); }
.win-banner .wb-sub { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.elim-banner { position: fixed; top: 48px; left: 50%; transform: translateX(-50%); z-index: 110;
  background: rgba(60,16,18,0.94); border: 1px solid #e5484d; border-radius: 10px; padding: 8px 18px;
  font-size: 14px; font-weight: 700; color: #ffd9d9; }
/* --- the stack --- */
.stack-strip { position: fixed; top: 46px; left: 50%; transform: translateX(-50%); z-index: 70;
  background: rgba(12,15,22,0.92); border: 1px solid rgba(150,160,190,0.35); border-radius: 12px; padding: 8px 12px 10px;
  box-shadow: 0 8px 26px rgba(0,0,0,0.5); display: flex; flex-direction: column; gap: 6px; }
.ss-title { font-size: 10px; letter-spacing: 0.08em; color: #9fb0d0; font-weight: 750; text-align: center; }
.ss-row { display: flex; gap: 8px; align-items: flex-end; }
.ss-item { position: relative; width: 74px; height: 103px; border-radius: 6px; background: #202531 center/cover no-repeat;
  border: 2px solid rgba(150,160,190,0.4); display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.ss-item.top { border-color: #ffc65c; box-shadow: 0 0 12px 2px rgba(255,198,92,0.5); width: 88px; height: 123px; }
.ss-name { font-size: 9px; font-weight: 700; color: #fff; background: rgba(10,13,20,0.85); padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-by { font-size: 8px; color: #aeb9cd; background: rgba(10,13,20,0.85); padding: 0 4px 2px; }
.ss-resolve { position: absolute; top: 3px; left: 50%; transform: translateX(-50%); padding: 2px 8px; font-size: 11px; }
/* --- combat --- */
.bf-card.attacking { outline: 3px solid #e5484d; outline-offset: 1px; z-index: 6; box-shadow: 0 0 12px 3px rgba(229,72,77,0.55); }
.bf-card.blocking { outline: 3px solid #3b82f6; outline-offset: 1px; z-index: 6; box-shadow: 0 0 12px 3px rgba(59,130,246,0.5); }
.bf-card.can-block { cursor: crosshair; }
.sick-badge { position: absolute; top: 2px; left: 2px; z-index: 3; font-size: 13px; pointer-events: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6)); }
.combat-controls { display: flex; gap: 6px; align-items: center; }
.combat-controls .atk-btn { padding: 2px 9px; font-size: 12px; background: rgba(160,35,40,0.35); border: 1px solid #b91c1c; color: #ffd9d9; font-weight: 700; }
.combat-controls .resolve-btn { padding: 2px 9px; font-size: 12px; background: rgba(180,120,20,0.35); border: 1px solid #d97706; color: #ffe9c7; font-weight: 700; }
.combat-controls .block-hint { font-size: 12px; color: #9fc3ff; font-weight: 650; }
.bf-card .ctr { position: absolute; top: 50%; left: 2px; right: 2px; transform: translateY(-50%); display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; z-index: 3; }
.bf-card .ctr span { font-size: 10px; background: rgba(15,20,30,0.88); border: 1px solid var(--accent); color: #ffe9b8; border-radius: 8px; padding: 1px 5px; font-weight: 800; }

/* mana cost (top-right) + power/toughness (bottom-right) overlays */
.mana-cost { position: absolute; top: 2px; right: 2px; display: flex; gap: 1px; z-index: 2; }
.mana-pip { width: 14px; height: 14px; border-radius: 50%; font-size: 9px; font-weight: 800; display: grid; place-items: center; color: #1a1410; border: 1px solid rgba(0,0,0,0.45); box-shadow: 0 1px 2px rgba(0,0,0,0.45); }
.mana-pip.w { background: #f4ecd0; } .mana-pip.u { background: #a6c8e8; } .mana-pip.b { background: #b7a9c9; }
.mana-pip.r { background: #e6a08a; } .mana-pip.g { background: #9fd0ab; }
.mana-pip.c, .mana-pip.gen { background: #cdd2da; } .mana-pip.hy { background: linear-gradient(135deg, #f4ecd0, #a6c8e8); }
/* mana symbols embedded in rules text — sized to the surrounding font, nudged up to sit on the text line */
.mana-inline { display: inline-grid; width: 1.78em; height: 1.78em; font-size: 0.82em; vertical-align: -0.12em; margin: 0 0.06em; border-width: 0.06em; box-shadow: none; }
.pt-badge { position: absolute; bottom: 2px; right: 2px; background: rgba(15,20,30,0.88); color: #fff; font-size: 10px; font-weight: 800; line-height: 1.3; padding: 0 4px; border-radius: 5px; border: 1px solid rgba(255,255,255,0.28); z-index: 2; }

/* cards are draggable objects — never let a drag start selecting the overlay text */
.bf-card, .hand .hcard, .co, .drag-ghost, .cmd-card { user-select: none; -webkit-user-select: none; }
/* while ANY card is being dragged, nothing on the page is selectable (catch-all) */
body.dragging, body.dragging * { user-select: none !important; -webkit-user-select: none !important; }
/* --- readable text overlays on your OWN cards (name / type / rules box) --- */
/* the card is a query container so the overlay text scales with it (cqw = 1% of card width) */
.bf-card.mine, .hand .hcard { container-type: inline-size; }
.co { position: absolute; z-index: 1; pointer-events: none; overflow: hidden; box-sizing: border-box; border-radius: 1.5cqw; }
/* fully generated card: the frame IS the card background — only the art window shows the original */
.co-card { background: var(--frame, #1b1f27) !important; }
.co-art { top: 11.4%; left: 4%; right: 4%; height: 40.6%; background-color: #202531; background-size: cover; background-position: center; border-radius: 0.8cqw; }
/* basic lands: a single big mana symbol fills the text box, like the real card */
.co-text.co-bigmana { display: grid; place-items: center; }
.co-bigpip { width: 34cqw; height: 34cqw; border-radius: 50%; display: grid; place-items: center; font-size: 16cqw; font-weight: 800;
  color: rgba(20,16,10,0.55); border: 1.2cqw solid rgba(0,0,0,0.3); box-shadow: inset 0 -2cqw 4cqw rgba(0,0,0,0.18); }
/* title bar: card name (left, ellipsis) + mana cost (right); coloured to match the card's frame */
.co-name { top: 3.6%; left: 4%; right: 4%; height: 7.8%; display: flex; align-items: center; gap: 1.5cqw; padding: 0 2.6cqw;
  background: linear-gradient(180deg, rgba(0,0,0,0.12), rgba(0,0,0,0.4)), var(--frame, #1b1f27); border: 0.4cqw solid rgba(255,255,255,0.16); }
.co-nm { flex: 1 1 auto; min-width: 0; font-size: 8.2cqw; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0.4cqw 0.6cqw rgba(0,0,0,0.6); }
.co-name .co-mana { position: static; flex: 0 0 auto; display: flex; align-items: center; gap: 0.7cqw; }
.co-name .co-mana .mana-pip { width: 8cqw; height: 8cqw; font-size: 5.6cqw; border-width: 0.4cqw; }
.co-type { top: 52%; left: 4%; right: 4%; height: 6.6%; display: flex; align-items: center; padding: 0 2.8cqw;
  background: linear-gradient(180deg, rgba(0,0,0,0.14), rgba(0,0,0,0.44)), var(--frame, #1b1f27); border: 0.4cqw solid rgba(255,255,255,0.1); }
.co-type span { font-size: 6cqw; font-weight: 600; color: #f2f5fa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0.3cqw 0.5cqw rgba(0,0,0,0.55); }
/* rules box: extends to the bottom border; pale tint of the card's colour; text auto-fits (see fitCardText) */
.co-text { top: 58.7%; left: 4%; right: 4%; bottom: 2.4%; padding: 2.2cqw 2.8cqw;
  background: var(--frame-lt, #f4f0e7); color: #16191e; font-size: 5.4cqw; line-height: 1.16; font-weight: 500; }
.co-text .cmd-reminder { color: rgba(20,25,30,0.6); font-style: italic; }
/* bigger P/T that actually covers the card's printed power/toughness (your cards only) */
.bf-card.mine .pt-badge, .hand .hcard .pt-badge { bottom: 2.6%; right: 3%; font-size: 8.6cqw; line-height: 1.2;
  padding: 0.4cqw 2.4cqw; min-width: 12%; text-align: center; border-radius: 1.6cqw; border-width: 0.4cqw; background: rgba(10,14,20,0.94); }

.bf-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa6b4; font-size: 12px; pointer-events: none; }
.marquee { position: absolute; border: 1px solid var(--accent2); background: rgba(59,111,212,0.12); border-radius: 3px; z-index: 7; pointer-events: none; }
.drag-ghost { position: fixed; z-index: 1300; pointer-events: none; width: 92px; aspect-ratio: 1 / var(--card-ratio); border-radius: 6px; background: var(--cardbg) center/cover no-repeat; border: 1px solid rgba(0,0,0,0.4); box-shadow: 0 8px 22px rgba(0,0,0,0.35); transform: translate(-50%, -60%); opacity: 0.92; }
.drag-ghost.over { outline: 2px solid var(--good); box-shadow: 0 0 0 2px var(--good), 0 8px 22px rgba(0,0,0,0.35); }

/* --- hand (resizable) --- */
/* transparent so the playmat (on .me-main) shows behind the hand */
/* the hand floats over the bottom of the (full-height) battlefield instead of taking its own row */
.hand-panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; height: var(--hand-h, 200px); display: flex; flex-direction: column; min-height: 0; background: transparent; }
/* soft ambient shadow the hand casts on the board, so it clearly reads as being in front */
.hand-panel::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 88%; z-index: -1; pointer-events: none;
  background: radial-gradient(130% 100% at 50% 100%, rgba(0,0,0,0.5), rgba(0,0,0,0.24) 40%, transparent 72%); }
/* while dragging a card out of the hand — or when the hand is toggled off (H) — collapse it so
   the board gets the whole space. Shrink the GRID ROW (not just the item) or the auto track keeps
   reserving space. */
/* dragging a card out, or pressing H, hides the hand overlay (the board is already full-size
   underneath, so nothing needs to move) */
body.placing .hand-panel, body.hand-hidden .hand-panel { visibility: hidden; }
.hand-resize { height: 11px; flex: 0 0 auto; cursor: ns-resize; display: grid; place-items: center; background: transparent; }
.hand-resize .grip { width: 46px; height: 4px; border-radius: 3px; background: var(--line); transition: background 0.12s; }
.hand-resize:hover .grip { background: var(--muted); }
/* cards fan in an arc, overlapping; edges lift so it curves. overflow visible lets the fanned
   tops rise over the board a little (fine — the hand collapses while you're placing a card). */
.hand {
  flex: 1; min-height: 0; display: flex; gap: 0;
  padding: 26px 30px 4px;
  overflow: visible;
  align-items: flex-end; justify-content: center; background: transparent;
}
.hand .hcard {
  position: relative; height: calc(var(--hand-h) - 31px); aspect-ratio: 1 / var(--card-ratio); flex: 0 0 auto;
  border-radius: 6px; background: var(--cardbg) center/cover no-repeat;
  border: var(--sleeve-w, 1px) solid var(--sleeve, rgba(0,0,0,0.28)); cursor: pointer;
  box-shadow: 0 10px 22px rgba(0,0,0,0.55), 0 3px 7px rgba(0,0,0,0.45); transition: transform 0.13s ease, box-shadow 0.13s ease;
  transform-origin: bottom center; transform: translateY(var(--liftY, 0)) rotate(var(--rot, 0deg));
  margin-left: calc((var(--hand-h, 200px) - 31px) * -0.30); /* overlap the previous card */
}
.hand .hcard:first-child { margin-left: 0; }
.hand .hcard:hover { transform: translateY(-30px) rotate(0deg) scale(1.06); z-index: 50; box-shadow: 0 14px 30px rgba(0,0,0,0.5); }
/* a card you can play RIGHT NOW (timing + mana) breathes with a green aura — outside the sleeve border */
.hand .hcard.playable { animation: playablePulse 1.9s ease-in-out infinite; }
.hand .hcard.playable:hover { animation: none;
  box-shadow: 0 0 0 2px rgba(87,217,138,0.95), 0 0 18px 5px rgba(87,217,138,0.55), 0 14px 30px rgba(0,0,0,0.5); }
@keyframes playablePulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(87,217,138,0.65), 0 0 9px 2px rgba(87,217,138,0.32), 0 10px 22px rgba(0,0,0,0.55), 0 3px 7px rgba(0,0,0,0.45); }
  50% { box-shadow: 0 0 0 2px rgba(87,217,138,0.95), 0 0 20px 6px rgba(87,217,138,0.58), 0 10px 22px rgba(0,0,0,0.55), 0 3px 7px rgba(0,0,0,0.45); }
}

/* --- entrance animations --- */
/* cards deal into the hand one at a time (staggered via inline animation-delay); the final
   frame reuses the fan vars so it settles seamlessly into place */
@keyframes deal {
  0% { opacity: 0; transform: translateY(150px) rotate(0deg) scale(0.62); }
  55% { opacity: 1; }
  100% { opacity: 1; transform: translateY(var(--liftY, 0)) rotate(var(--rot, 0deg)) scale(1); }
}
.hand .hcard.dealing { animation: deal 0.42s cubic-bezier(0.2, 0.75, 0.25, 1) backwards; }
/* cards pop onto the battlefield when played */
@keyframes bfEnter {
  0% { opacity: 0; transform: scale(0.5) translateY(14px); }
  60% { opacity: 1; transform: scale(1.08) translateY(0); }
  100% { opacity: 1; transform: none; }
}
.bf-card.bf-enter { animation: bfEnter 0.34s cubic-bezier(0.2, 0.8, 0.3, 1) backwards; }
@media (prefers-reduced-motion: reduce) { .hand .hcard.dealing, .bf-card.bf-enter { animation: none; } }
.hand-empty { color: var(--muted); align-self: center; font-size: 13px; padding: 18px; }

/* opponents' cards can be dragged around locally (view only) */
.bf-card.oppmove { cursor: grab; }
.bf-card.oppmove:active { cursor: grabbing; }

/* ---------------- floating: menu / modal / preview / toast ---------------- */
.menu { position: fixed; z-index: 1000; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 180px; font-size: 14px; }
.menu .mi { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.menu .mi:hover { background: var(--panel2); }
.menu .sep { height: 1px; background: var(--line); margin: 4px 2px; }
.menu .title { padding: 4px 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

#modal-root .backdrop { position: fixed; inset: 0; background: rgba(20,28,40,0.45); z-index: 900; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 50px rgba(20,30,50,0.3); max-width: 92vw; max-height: 88vh; overflow: auto; padding: 18px; }
.modal h3 { margin: 0 0 12px; }
.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; max-width: 760px; }
.zone-grid .zc { border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--cardbg); cursor: pointer; }
.zone-grid .zc img { width: 100%; display: block; }
.zone-grid .zc:hover { outline: 2px solid var(--accent2); }
.zone-grid .zc.sel-bottom { outline: 3px solid var(--bad); box-shadow: 0 0 0 3px var(--bad); opacity: 0.6; }
.cmdr-grid { display: grid; gap: 10px; }
.cmdr-row { display: flex; align-items: center; gap: 10px; }
.cmdr-row .cn { flex: 1; }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper .v { min-width: 28px; text-align: center; font-weight: 700; font-size: 18px; }

.preview { position: fixed; z-index: 1200; pointer-events: none; width: 260px; aspect-ratio: 1 / var(--card-ratio); border-radius: 12px; background: var(--cardbg) center/cover no-repeat; box-shadow: 0 12px 34px rgba(20,30,50,0.4); border: 1px solid rgba(0,0,0,0.3); }

#toast-root { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 1500; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel); border: 1px solid var(--accent); color: var(--text); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; }
.toast.bad { border-color: var(--bad); }

/* corner toolbar (options + draw) */
.corner-toolbar { position: fixed; left: 12px; bottom: 12px; z-index: 850; display: flex; align-items: center; gap: 8px; }
.tb-btn { height: 42px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }
.tb-btn:not(.draw) { width: 42px; padding: 0; justify-content: center; font-size: 18px; }
.tb-btn.draw {
  height: 42px; padding: 0 28px; min-width: 128px; justify-content: center; font-weight: 700; font-size: 16px;
  background: var(--accent2); color: #fff; border-color: color-mix(in srgb, var(--accent2) 70%, #000);
}
.tb-btn.draw:hover { filter: brightness(1.08); background: var(--accent2); }
.tb-btn:not(.draw):hover { background: var(--panel2); }

/* hotkey reference (Options) */
.hk-grid { display: grid; grid-template-columns: 1fr; gap: 5px; }
.hk-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.hk-row kbd { flex: none; min-width: 30px; text-align: center; padding: 3px 8px; border-radius: 6px; background: var(--panel2);
  border: 1px solid var(--line); border-bottom-width: 2px; font: 600 12px/1 ui-monospace, Menlo, Consolas, monospace; color: var(--fg); }
.hk-row kbd.wide { min-width: 74px; }
.hk-row span { color: var(--muted); }

/* first-game walkthrough */
.tour-backdrop { position: fixed; inset: 0; z-index: 1600; background: rgba(15,22,34,0.62); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 20px; animation: tour-fade 0.18s ease; }
@keyframes tour-fade { from { opacity: 0; } to { opacity: 1; } }
.tour-card { position: relative; width: min(440px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 20px 60px rgba(10,16,28,0.5); padding: 26px 26px 20px; text-align: center; }
.tour-skip { position: absolute; top: 12px; right: 12px; background: transparent; border: 0; color: var(--muted);
  font-size: 12px; padding: 4px 6px; cursor: pointer; }
.tour-skip:hover { color: var(--fg); }
.tour-icon { font-size: 42px; line-height: 1; margin: 4px 0 12px; }
.tour-title { margin: 0 0 8px; font-size: 20px; }
.tour-body { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.tour-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; }
.tour-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background 0.15s, transform 0.15s; }
.tour-dot.on { background: var(--accent2); transform: scale(1.25); }
.tour-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tour-nav button { min-width: 96px; }

/* deck picker commander art */
.deck-art { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 7px; background: var(--cardbg) center/cover no-repeat; border: 1px solid var(--line); }

/* targeting arrows */
.target-lines { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 700; }
.target-lines .tline { stroke: var(--bad); stroke-width: 4; stroke-dasharray: 9 5; stroke-linecap: round; opacity: 1; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6)); }
body.targeting { cursor: crosshair; }
body.targeting .bf-card { cursor: crosshair; }
body.targeting [data-pid] { cursor: crosshair; }
body.targeting [data-pid]:hover { outline: 2px solid var(--bad); outline-offset: 2px; border-radius: 4px; }
.bf-card.to-hand { outline: 2px dashed var(--good); }

/* dice / coin roll animation */
.roll-overlay { position: fixed; inset: 0; z-index: 1400; display: grid; place-items: center; pointer-events: none; }
.roll-label { position: absolute; bottom: 34%; width: 100%; text-align: center; font-weight: 700; color: var(--text); text-shadow: 0 1px 3px var(--bg); }
.die3d {
  width: 92px; height: 92px; border-radius: 16px; display: grid; place-items: center;
  font-size: 46px; font-weight: 800; color: #fff;
  background: linear-gradient(145deg, var(--accent2), #24406f);
  box-shadow: 0 12px 34px rgba(0,0,0,0.5); animation: dieTumble 0.9s cubic-bezier(.2,.8,.2,1);
}
@keyframes dieTumble {
  0% { transform: rotate(-220deg) scale(0.3); opacity: 0; }
  60% { transform: rotate(20deg) scale(1.15); opacity: 1; }
  100% { transform: rotate(0) scale(1); opacity: 1; }
}
.coin3d { width: 92px; height: 92px; position: relative; transform-style: preserve-3d; animation: coinFlip 1s ease-out; }
.coin3d.land-t { animation: coinFlipT 1s ease-out; }
.coin-face { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font-size: 40px; font-weight: 800; color: #3a2c08; backface-visibility: hidden; box-shadow: 0 12px 34px rgba(0,0,0,0.5); }
.coin-face.h { background: radial-gradient(circle at 35% 30%, #f7dd8a, var(--accent)); }
.coin-face.t { background: radial-gradient(circle at 35% 30%, #dfe6ee, #9aa7b6); transform: rotateY(180deg); }
@keyframes coinFlip { 0% { transform: rotateY(0) scale(0.4); opacity: 0; } 30% { opacity: 1; } 100% { transform: rotateY(1440deg) scale(1); opacity: 1; } }
@keyframes coinFlipT { 0% { transform: rotateY(0) scale(0.4); opacity: 0; } 30% { opacity: 1; } 100% { transform: rotateY(1620deg) scale(1); opacity: 1; } }

/* token picker */
.token-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; max-height: 62vh; overflow: auto; }
.token-tile { cursor: pointer; display: flex; flex-direction: column; gap: 4px; border-radius: 8px; }
.token-img { width: 100%; aspect-ratio: 1 / var(--card-ratio); border-radius: 7px; background: var(--cardbg) center/cover no-repeat; border: 1px solid var(--line); }
.token-tile:hover .token-img { outline: 2px solid var(--accent2); }
.token-name { font-size: 11px; text-align: center; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* commander name lines */
.oppseat-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-cmdr { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -2px; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.theme-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); font-size: 13px; }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.theme-sw { display: flex; border-radius: 6px; overflow: hidden; border: 1px solid rgba(0,0,0,0.2); }
.theme-sw span { width: 22px; height: 22px; display: block; }
.sleeve-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.sleeve-sw { width: 28px; height: 28px; padding: 0; border-radius: 7px; border: 2px solid var(--line); }
.sleeve-sw.on { outline: 2px solid var(--text); outline-offset: 1px; }
.sleeve-sw.none { background: var(--panel2); color: var(--muted); font-size: 14px; }
input[type="color"] { width: 40px; height: 32px; padding: 2px; border-radius: 7px; cursor: pointer; }

@media (max-width: 820px) {
  .me-area { grid-template-columns: 1fr; }
  .console { flex-wrap: wrap; }
  .opp-row.n2, .opp-row.n3 { grid-template-columns: 1fr; }
}
