/* ============================================================
   ManaTable — design system
   Ported from the CatchPoint stylesheet (same class contract so
   later pages drop in cleanly), re-themed for the play table.
   ============================================================ */

/* ====== Tokens ====== */
:root{
  --bg: #0b0a0d;          /* page background (near-black, faint violet) */
  --card: #17151b;        /* surfaces/cards */
  --card-2:#100f14;       /* alt surface */
  --text:#ece8f0;         /* primary text */
  --muted:#9c96a8;        /* secondary text */
  --line:#2a2732;         /* borders/dividers */
  --accent:#8ab4ff;       /* links / info accent (blue) */
  --accent-2:#34d399;     /* success */
  --warn:#f59e0b;         /* warning */
  --danger:#ef4444;       /* danger */
  /* Brand — warm mana gold */
  --brand:#d9a441;
  --brand-2:#f0c46a;
  --brand-strong:#b9852b;
  --on-brand:#241a06;     /* text on gold */
  --radius:18px;
  --radius-sm:12px;
  --shadow: 0 10px 34px rgba(0,0,0,.5);
  --shadow-sm: 0 4px 18px rgba(0,0,0,.34);
  --focus: 0 0 0 3px rgba(217,164,65,.32);
}

*{box-sizing:border-box}
html,body{height:100%}
html{ -webkit-text-size-adjust:100%; }   /* don't inflate text on orientation change */
body{
  margin:0;
  color:var(--text);
  background: radial-gradient(1200px 800px at 8% -12%, #1a1226 0%, transparent 55%),
              radial-gradient(1300px 900px at 112% -18%, #171420 0%, transparent 60%),
              var(--bg);
  font: 16px/1.45 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji";
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
  overflow-x:hidden;   /* mobile: nothing should force a sideways scroll */
}
/* Media never overflows its container on small screens. */
img,svg,video,canvas{ max-width:100%; }
/* Inputs inherit the 16px base so iOS Safari doesn't zoom on focus. */
input,select,textarea{ font-family:inherit; font-size:16px; }

/* ====== Layout ====== */
.container{max-width:1100px;margin:0 auto;padding:20px}

.card{
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:18px;
}
.section{
  background:rgba(255,255,255,.02);
  border:1px dashed var(--line);
  border-radius:var(--radius-sm);
  padding:12px;
}

/* ====== Top bar ====== */
.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 16px; backdrop-filter:saturate(140%) blur(6px);
  background:linear-gradient(180deg, rgba(23,21,27,.88), rgba(23,21,27,.55));
  border-bottom:1px solid var(--line);
}
.topbar-left{display:flex;gap:12px;align-items:center; min-width:0}
.topbar-user{display:flex;flex-direction:column; min-width:0}
.topbar-name{font-weight:700; letter-spacing:.2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.topbar-username{color:var(--muted); font-size:.925rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.topbar-avatar{
  width:42px;height:42px;border-radius:50%;
  background:#100f14; object-fit:cover;
  border:1px solid var(--line);
}
.topbar-actions{display:flex;gap:8px;align-items:center}

/* ====== Headings & text ====== */
h1,h2,h3{margin:0 0 8px; letter-spacing:.2px; line-height:1.25}
h1{font-size:1.55rem; font-weight:800}
h2{font-size:1.15rem; font-weight:700; color:var(--text)}
.muted{color:var(--muted)}
.small{font-size:.9rem;color:var(--muted)}

/* ====== Buttons ====== */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 16px; border-radius:var(--radius-sm);
  border:1px solid var(--brand-strong);
  background:linear-gradient(180deg,var(--brand-2),var(--brand));
  color:var(--on-brand); font-weight:700; letter-spacing:.2px;
  text-decoration:none; cursor:pointer; user-select:none;
  box-shadow:0 6px 16px rgba(217,164,65,.18); font:inherit; appearance:none;
  transition:transform .06s ease, box-shadow .15s ease, background .2s ease, border-color .2s ease, opacity .2s ease;
}
.btn:hover{transform:translateY(-1px); box-shadow:0 10px 26px rgba(217,164,65,.30); border-color:var(--brand-strong)}
.btn:active{transform:translateY(0)}
.btn:focus-visible{outline:none; box-shadow:var(--focus)}

.btn-ghost{
  background:rgba(255,255,255,.04); border-color:var(--line); box-shadow:none;
  color:var(--text); font-weight:600;
}
.btn-ghost:hover{background:rgba(255,255,255,.08); border-color:#413c4c}

.btn-danger{
  background:linear-gradient(180deg, #2a0d12, #20080b);
  border-color:#3a1118; color:#ffd7db; box-shadow:none;
}
.btn-danger:hover{border-color:#5c1721; background:linear-gradient(180deg,#3a1218,#25090e)}

.btn-block{ width:100%; }
.btn-disabled{ pointer-events:none; opacity:.55; }

/* Compact back button in the topbar (icon-only, sits before the avatar). */
.btn-back{
  padding:0; width:38px; height:38px; flex:none;
  font-size:1.2rem; line-height:1; border-radius:50%;
}

/* ====== Inputs & forms ====== */
input, textarea, select{
  width:100%; color:var(--text);
  background:linear-gradient(180deg,#151318,#0f0e13);
  border:1px solid var(--line); border-radius:12px;
  padding:10px 12px; outline:none;
  transition:border-color .15s ease, box-shadow .15s ease, background .2s ease;
}
textarea{resize:vertical}
input:focus, textarea:focus, select:focus{ border-color:#4a4336; box-shadow:var(--focus) }
select option{ background:var(--card); color:var(--text) }
label{display:grid; gap:6px; font-weight:600; color:#dad6e2}
input[type="file"]{ padding:10px; cursor:pointer; background:linear-gradient(180deg,#151318,#0e0d12); }

.form{ display:grid; gap:14px; }
.form > div{ display:grid; gap:6px; }

/* ====== Banner (inline alerts) ====== */
.banner{
  display:block; margin:0 0 12px; padding:10px 12px;
  border-radius:12px; border:1px solid #2c2934;
  background:linear-gradient(180deg,#16151b,#0d0d10);
  color:#e6e2ee; font-weight:600;
}
.banner.err{
  border-color:#3a1118;
  background:linear-gradient(180deg,#2a0d12,#20080b);
  color:#ffd7db;
}

/* ====== Links ====== */
a{color:var(--accent); text-decoration:none}
a:hover{text-decoration:underline}
.link{ color:var(--accent); font-weight:600; }
.link:hover{ text-decoration:underline; }

/* ====== Rows / utilities ====== */
.row{ display:flex; gap:10px; align-items:center }
.center{display:grid;place-items:center}
.hidden{display:none}
hr{ border:none; border-top:1px solid var(--line); margin:16px 0; }

/* ====== Brand lockup ====== */
.brand{ display:inline-flex; align-items:center; gap:11px; text-decoration:none; }
.brand-name{
  font-weight:800; font-size:1.25rem; letter-spacing:.3px; line-height:1;
  background:linear-gradient(180deg, var(--brand-2), var(--brand-strong));
  -webkit-background-clip:text; background-clip:text; color:transparent;
}
.brand:hover{ text-decoration:none; }
.auth-brand{ margin:2px 0 18px; }

/* Branded backdrop — a soft arcane glow on auth / home pages (no image asset). */
.brand-bg::before{
  content:""; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:
    radial-gradient(60vmin 60vmin at 50% 8%, rgba(217,164,65,.10) 0%, transparent 60%),
    radial-gradient(70vmin 70vmin at 85% 100%, rgba(138,180,255,.06) 0%, transparent 60%);
}

/* Center standalone auth cards on desktop; full-width on mobile. */
body > .card{ max-width:520px; margin:24px auto; }

/* Login "how it works" intro */
.intro-card h1{ font-size:1.5rem; }
.steps{ display:grid; gap:14px; margin-top:16px; }
.step{ display:flex; gap:12px; align-items:flex-start; }
.step-num{
  flex:none; width:28px; height:28px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background:linear-gradient(180deg,var(--brand-2),var(--brand));
  color:var(--on-brand); font-weight:800; font-size:.9rem;
}
.step strong{ display:block; }

/* Header block (avatar + title) on signup */
.header{ display:flex; align-items:center; gap:14px; margin-bottom:8px; }
.avatarPreview{
  width:64px; height:64px; border-radius:14px; object-fit:cover;
  background:#0d0d10; border:1px solid var(--line); flex:0 0 auto;
}

/* ====== Hide number-input spin buttons ====== */
input[type=number]{ -moz-appearance:textfield; appearance:textfield; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button{ -webkit-appearance:none; margin:0; }

/* ====== Scrollbars ====== */
*::-webkit-scrollbar{width:10px;height:10px}
*::-webkit-scrollbar-track{background:transparent}
*::-webkit-scrollbar-thumb{
  background:#2a2732; border:2px solid transparent; background-clip:padding-box; border-radius:999px;
}
*::-webkit-scrollbar-thumb:hover{background:#413c4c}

/* ====== Motion on mount ====== */
.card{ animation:fadeUp .25s ease both; }
@keyframes fadeUp{
  from{opacity:0; transform:translateY(4px)}
  to{opacity:1; transform:translateY(0)}
}

/* ====== Lobby (MT-03) ====== */
.lobby-actions{
  display:grid; gap:14px;
  grid-template-columns:repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.games-list{ display:grid; gap:12px; margin-top:6px; }

.game-card{
  background:linear-gradient(180deg, #1a1720, #131118);
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  padding:14px; box-shadow:var(--shadow-sm);
  display:grid; gap:10px;
  transition:transform .08s ease, box-shadow .2s ease, border-color .2s ease;
  animation:fadeUp .25s ease both;
}
.game-card:hover{ transform:translateY(-1px); box-shadow:0 12px 28px rgba(0,0,0,.42); border-color:#413c4c; }
/* Click an active/finished game card to enter it (MT-43). */
.game-card-enter{ cursor:pointer; }
.game-card-enter:hover{ border-color:var(--brand-strong); }
.game-enter-hint{ color:var(--brand-2); font-weight:800; font-size:.9rem; }

/* Collapsible create / join cards (MT-43): a "+" header that expands the form. */
.lobby-card > summary{
  cursor:pointer; list-style:none; user-select:none;
  font-size:1.1rem; font-weight:700; color:var(--text);
  display:flex; align-items:center; gap:8px;
}
.lobby-card > summary::-webkit-details-marker{ display:none; }
.lobby-card[open] > summary{ margin-bottom:8px; }
.lobby-plus{
  color:var(--brand-2); font-weight:800; font-size:1.25rem; line-height:1;
  display:inline-block; transition:transform .15s ease;
}
.lobby-card[open] .lobby-plus{ transform:rotate(45deg); }   /* + turns into a close cue */
/* A collapsed <details> should hide its content, but an author display (grid/flex)
   on a child can leak past the UA rule — force-hide non-summary children. */
.lobby-card:not([open]) > *:not(summary){ display:none; }
.log-panel:not([open]) > .move-log{ display:none; }
.install-btn{ margin-top:12px; }
/* Condensed game top panel (MT-35): tighter padding, badges wrap, help tucked
   into a collapsed disclosure so the panel isn't aggressively tall. */
.game-panel{ padding:12px 16px; }
.game-panel > .game-head{ flex-wrap:wrap; }
.game-panel > #turnInfo{ margin:6px 0 0; }
.game-panel > .game-hint{ margin-top:8px; }
.game-hint > summary{
  cursor:pointer; width:max-content; list-style:none;
  color:var(--muted); font-size:.82rem; font-weight:600;
  padding:2px 0; user-select:none;
}
.game-hint > summary::-webkit-details-marker{ display:none; }
.game-hint > summary::before{ content:"▸ "; }
.game-hint[open] > summary::before{ content:"▾ "; }
.game-hint > p{ margin:4px 0 0; }

.game-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.game-head #gameName{ margin-right:auto; }   /* badges group on the right */
.game-panel #gameName{ font-size:1.05rem; }
.sync-state{
  font-size:.72rem; font-weight:800; letter-spacing:.2px;
  padding:2px 10px; border-radius:999px; border:1px solid var(--line);
}
.sync-live{ color:#8ee6b5; border-color:#1c4a34; background:rgba(52,211,153,.08); }
.sync-down{ color:#f0c46a; border-color:#4a3a1a; background:rgba(217,164,65,.08); }
.game-title{ font-weight:800; letter-spacing:.2px; }
.game-meta{ color:var(--muted); font-size:.925rem; }
.game-meta code{
  color:var(--brand-2); font-weight:700; letter-spacing:.5px;
  background:rgba(217,164,65,.08); padding:1px 6px; border-radius:6px;
}
.seats{ display:flex; flex-wrap:wrap; gap:8px; }
.seat{
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 10px; border-radius:999px;
  background:linear-gradient(180deg,#191620,#141119);
  border:1px solid var(--line); font-weight:600; font-size:.9rem;
}
.game-actions{ display:flex; gap:10px; flex-wrap:wrap; }
.game-actions:empty{ display:none; }

.seat-ready{ color:var(--accent-2); font-weight:800; }
.seat-wait{ color:var(--muted); font-weight:800; letter-spacing:1px; }
.your-deck{ display:grid; gap:6px; max-width:340px; }
.your-deck > .small{ color:var(--muted); }
.your-deck-empty{ margin:2px 0 0; }
/* Multi-deck picker (MT-47): checkboxes for one-or-more of your decks. */
.deck-choices{ display:flex; flex-wrap:wrap; gap:6px; }
.deck-choice{
  display:inline-flex; align-items:center; gap:6px;
  padding:5px 10px; border-radius:999px; cursor:pointer;
  border:1px solid var(--line); background:rgba(255,255,255,.03);
  font-size:.9rem; max-width:100%;
}
.deck-choice:hover{ border-color:#413c4c; }
.deck-choice input{ accent-color:var(--brand); flex:none; margin:0; }
.deck-choice span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.deck-choice:has(input:checked){ border-color:var(--brand-strong); background:rgba(217,164,65,.1); }
.deck-picked-count{ font-size:.8rem; font-weight:700; color:var(--brand-strong); }
.deck-picked-count.muted{ color:var(--muted); font-weight:400; }

.status-badge{
  text-transform:capitalize; font-size:.8rem; font-weight:700;
  padding:2px 10px; border-radius:999px; border:1px solid var(--line);
  color:var(--muted); background:rgba(255,255,255,.03);
}
.status-lobby{ color:#f0c46a; border-color:#4a3a1a; background:rgba(217,164,65,.08); }
.status-active{ color:#8ee6b5; border-color:#1c4a34; background:rgba(52,211,153,.08); }
.status-finished{ color:var(--muted); }
/* Game-type label on a game card (MT-46). */
.type-badge{
  font-size:.75rem; font-weight:800; letter-spacing:.2px;
  padding:2px 10px; border-radius:999px;
  color:var(--brand-2); border:1px solid #4a3a1a; background:rgba(217,164,65,.08);
}

/* Attention signals (MT-22): turn pill, per-game badges, "new" log pip */
.turn-pill{
  font-size:.78rem; font-weight:800; letter-spacing:.2px;
  padding:2px 12px; border-radius:999px; border:1px solid var(--line);
}
.turn-pill.turn-you{
  color:var(--on-brand); background:linear-gradient(180deg,var(--brand),var(--brand-strong));
  border-color:var(--brand-strong); animation:attnPulse 2s ease-in-out infinite;
}
.turn-pill.turn-wait{ color:var(--muted); background:rgba(255,255,255,.03); }

.attn-badge{
  font-size:.74rem; font-weight:800; letter-spacing:.2px;
  padding:2px 10px; border-radius:999px; border:1px solid var(--line);
}
.attn-turn{
  color:var(--on-brand); background:linear-gradient(180deg,var(--brand),var(--brand-strong));
  border-color:var(--brand-strong);
}
.attn-confirm{
  color:#241a06; background:linear-gradient(180deg,#f0c46a,#d9a441);
  border-color:#b9852b; animation:attnPulse 2s ease-in-out infinite;
}
.attn-passed{
  color:#241a06; background:linear-gradient(180deg,#f0c46a,#d9a441);
  border-color:#b9852b; animation:attnPulse 2s ease-in-out infinite;
}
.attn-passed::before{ content:"▶ "; }
.attn-new{ color:var(--accent); border-color:#26405e; background:rgba(138,180,255,.1); }
.attn-new::before{ content:"● "; }

.log-new{
  font-size:.66rem; font-weight:800; letter-spacing:.3px; text-transform:uppercase;
  color:var(--accent); border:1px solid #26405e; background:rgba(138,180,255,.1);
  padding:1px 7px; border-radius:999px; vertical-align:middle;
}
@keyframes attnPulse{ 0%,100%{ opacity:1; } 50%{ opacity:.62; } }
@media (prefers-reduced-motion: reduce){
  .turn-pill.turn-you, .attn-confirm{ animation:none; }
}

/* ====== Deck library (MT-06) ====== */
.decks-groups{ display:grid; gap:20px; margin-top:6px; }
.deck-group{ display:grid; gap:10px; }
.deck-group-head{
  display:flex; align-items:baseline; gap:10px;
  padding-bottom:4px; border-bottom:1px solid var(--line);
}
.deck-group-tag{
  font-weight:800; letter-spacing:.3px; color:var(--brand-2);
}
.decks-list{
  display:grid; gap:12px;
  grid-template-columns:repeat(auto-fill, minmax(300px, 1fr));
}
.deck-card{
  background:linear-gradient(180deg, #1a1720, #131118);
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  padding:14px; box-shadow:var(--shadow-sm);
  display:grid; gap:10px; align-content:start;
  transition:transform .08s ease, box-shadow .2s ease, border-color .2s ease;
  animation:fadeUp .25s ease both;
}
.deck-card:hover{ transform:translateY(-1px); box-shadow:0 12px 28px rgba(0,0,0,.42); border-color:#413c4c; }
.deck-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.deck-title{ font-weight:800; letter-spacing:.2px; }
.deck-count{
  flex:none; font-size:.8rem; font-weight:700; color:var(--muted);
  padding:2px 10px; border-radius:999px;
  border:1px solid var(--line); background:rgba(255,255,255,.03);
}
.deck-meta{ color:var(--muted); font-size:.9rem; }
.deck-card .game-actions .btn{ padding:7px 12px; font-size:.9rem; }

/* ====== Deck editor (MT-07) ====== */
.deck-editor-head{
  display:grid; gap:14px;
  grid-template-columns:repeat(auto-fit, minmax(240px, 1fr));
}
.deck-editor-head label{ font-weight:600; color:#dad6e2; }
.deck-add-row{ display:flex; gap:10px; align-items:stretch; }
.deck-add-row .card-search{ flex:1 1 auto; }
.deck-add-row #addBoard{ flex:0 0 auto; width:auto; }

.boards{
  display:grid; gap:16px; margin-top:16px;
  /* min(100%, 320px) so a narrow phone doesn't force a 320px track and overflow */
  grid-template-columns:repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  align-items:start;
}
.board{
  background:linear-gradient(180deg, #17151b, #100f14);
  border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow-sm); padding:14px; min-width:0;
}
.board-head{
  display:flex; align-items:baseline; justify-content:space-between; gap:10px;
  margin-bottom:10px; padding-bottom:8px; border-bottom:1px solid var(--line);
}
.board-head h2{ margin:0; }
.board-count{
  font-size:.8rem; font-weight:700; color:var(--muted);
  padding:2px 10px; border-radius:999px;
  border:1px solid var(--line); background:rgba(255,255,255,.03);
}
.deck-cards{ display:grid; gap:6px; grid-template-columns:minmax(0,1fr); }

.dc-row{
  display:flex; align-items:center; gap:8px;
  padding:4px 8px; border-radius:10px;
  border:1px solid transparent; transition:background .12s ease, border-color .12s ease;
}
.dc-row:hover{ background:rgba(255,255,255,.03); border-color:var(--line); }

.dc-qty{ display:inline-flex; align-items:center; gap:2px; flex:none; }
.dc-step{
  width:26px; height:26px; padding:0; border-radius:8px;
  display:inline-flex; align-items:center; justify-content:center;
  background:rgba(255,255,255,.05); border:1px solid var(--line);
  color:var(--text); font-weight:700; font-size:1rem; cursor:pointer; line-height:1;
}
.dc-step:hover{ background:rgba(217,164,65,.16); border-color:var(--brand-strong); }
.dc-n{ min-width:22px; text-align:center; font-weight:700; }

.dc-body{ display:flex; flex-direction:column; min-width:0; flex:1 1 auto; }
.dc-name{ font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dc-meta{ color:var(--muted); font-size:.82rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.dc-actions{ display:flex; align-items:center; gap:6px; flex:none; }
.dc-move{
  width:26px; height:26px; padding:0; border-radius:8px; flex:none;
  display:inline-flex; align-items:center; justify-content:center;
  background:rgba(255,255,255,.05); border:1px solid var(--line);
  color:var(--muted); font-size:1rem; line-height:1; cursor:pointer;
}
.dc-move:hover{ color:var(--text); border-color:var(--brand-strong); background:rgba(217,164,65,.14); }
.dc-x{
  width:26px; height:26px; padding:0; border-radius:8px; flex:none;
  display:inline-flex; align-items:center; justify-content:center;
  background:transparent; border:1px solid var(--line);
  color:var(--muted); font-size:1.1rem; line-height:1; cursor:pointer;
}
.dc-x:hover{ color:#ffd7db; border-color:#5c1721; background:rgba(239,68,68,.08); }

.board-empty{ margin:6px 2px 0; }

/* Floating card image preview */
.dc-body{ cursor:default; }

/* Paste-a-decklist import */
.import-panel{ margin-top:14px; border-top:1px solid var(--line); padding-top:12px; }
.import-panel > summary{
  cursor:pointer; font-weight:700; color:var(--brand-2);
  list-style:none; width:fit-content;
}
.import-panel > summary::-webkit-details-marker{ display:none; }
.import-panel > summary::before{ content:"＋ "; }
.import-panel[open] > summary::before{ content:"－ "; }
.import-panel code{
  background:rgba(217,164,65,.08); color:var(--brand-2);
  padding:1px 5px; border-radius:6px; font-size:.85em;
}
.import-panel textarea{ margin-top:8px; font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:.9rem; }
.import-actions{ display:flex; gap:10px; margin-top:10px; }
.import-result{ margin-top:10px; }
.import-result p{ margin:6px 0; }
.import-ok{ color:var(--accent-2); }
.import-warn{ color:var(--warn); }
.import-unresolved{
  margin:4px 0 0; padding-left:20px; color:var(--warn);
  max-height:160px; overflow-y:auto;
}
.import-unresolved li{ font-size:.9rem; }

/* ====== Visual board — N seats (MT-10) ====== */
:root{ --mini-w:66px; }   /* one mini card's width; height follows 5:7 */

/* Board + turn-log layout (MT-14): stacked on mobile, log as a right rail on
   wide screens. */
.game-layout{ display:grid; gap:16px; margin-top:16px; grid-template-columns:1fr; }
.game-layout .game-seats{ margin-top:0; }
.game-side{ display:grid; gap:16px; align-content:start; }
.log-panel{ align-content:start; }
/* Turn log is a collapsed disclosure by default (MT-41) so it isn't always big. */
.log-panel > summary{
  cursor:pointer; list-style:none; user-select:none;
  font-size:1.15rem; font-weight:700; color:var(--text);
  display:flex; align-items:center; gap:8px;
}
.log-panel > summary::-webkit-details-marker{ display:none; }
.log-panel > summary::before{ content:"▸"; color:var(--muted); font-size:.85em; }
.log-panel[open] > summary::before{ content:"▾"; }
.log-panel > summary + .move-log,
.log-panel[open] > .move-log{ margin-top:10px; }
.move-log{
  list-style:none; margin:0; padding:0; display:grid; gap:2px;
  max-height:60vh; overflow-y:auto;
}
.log-entry{
  display:flex; align-items:center; gap:8px;
  font-size:.9rem; line-height:1.4; padding:5px 4px;
  border-bottom:1px solid rgba(255,255,255,.04);
}
.log-entry:last-child{ border-bottom:none; }
.log-entry strong{ color:var(--brand-2); font-weight:800; }
.log-text{ flex:1 1 auto; min-width:0; }
.log-actions{ flex:none; display:inline-flex; gap:2px; opacity:0; transition:opacity .12s ease; }
.log-entry:hover .log-actions, .log-actions:focus-within{ opacity:1; }
@media (hover:none){ .log-actions{ opacity:1; } }   /* touch: no hover to reveal */
.log-btn{
  width:22px; height:22px; padding:0; border-radius:6px;
  display:inline-flex; align-items:center; justify-content:center;
  background:rgba(255,255,255,.04); border:1px solid var(--line);
  color:var(--muted); font-size:.8rem; line-height:1; cursor:pointer;
}
.log-btn:hover{ background:rgba(217,164,65,.16); border-color:var(--brand-strong); color:var(--text); }
.log-btn:disabled{ opacity:.3; cursor:default; }
.log-btn.log-del:hover{ color:#ffd7db; border-color:#5c1721; background:rgba(239,68,68,.1); }
.log-empty{ color:var(--muted); font-size:.9rem; padding:4px; }
/* Commit handshake (MT-18) */
.commit-bar{
  display:flex; flex-wrap:wrap; align-items:center; gap:10px;
  margin-top:12px; padding-top:12px; border-top:1px solid var(--line);
}
.submit-roster{ display:flex; flex-wrap:wrap; gap:6px; }
.roster-chip{
  display:inline-flex; align-items:center; gap:4px;
  font-size:.8rem; font-weight:700; padding:3px 10px; border-radius:999px;
  border:1px solid var(--line); background:rgba(255,255,255,.03);
}
.roster-chip.confirmed{ color:#8ee6b5; border-color:#1c4a34; background:rgba(52,211,153,.08); }
.roster-chip.waiting{ color:var(--muted); }
#commitHint{ flex:1 1 auto; min-width:140px; }

/* Table chat (MT-17) */
.chat-panel h2{ margin-bottom:10px; }
.chat-messages{
  display:grid; gap:6px; max-height:40vh; overflow-y:auto; margin-bottom:10px;
}
.chat-msg{ font-size:.9rem; line-height:1.4; }
.chat-who{ font-weight:800; color:var(--brand-2); margin-right:4px; }
.chat-body{ color:var(--text); word-break:break-word; }
.chat-empty{ color:var(--muted); font-size:.9rem; }
.chat-form{ display:flex; gap:8px; }
.chat-form input{ flex:1 1 auto; }
.chat-form .btn{ flex:none; padding:9px 14px; }

@media(min-width:960px){
  .game-layout{ grid-template-columns:minmax(0,1fr) 320px; align-items:start; }
  .game-side{ position:sticky; top:70px; }
  .move-log{ max-height:38vh; }
  .chat-messages{ max-height:34vh; }
}

.game-seats{ display:grid; gap:0; margin-top:16px; }
.seat-board.is-opponent{ border-bottom-left-radius:0; border-bottom-right-radius:0; }
.seat-board.is-you{
  border-top-left-radius:0; border-top-right-radius:0;
  border-top:2px dashed rgba(217,164,65,.35);
}
.seat-board.is-opponent + .seat-board.is-opponent{ border-top:1px solid var(--line); }

.seat-board{
  background:linear-gradient(180deg, #1a1720, #131118);
  border:1px solid var(--line); border-radius:var(--radius);
  padding:14px; box-shadow:var(--shadow-sm);
  display:grid; gap:12px;
}
.seat-board.is-you{ border-color:#3a3346; background:linear-gradient(180deg,#1d1a25,#141119); }
.seat-board.is-active{ border-color:var(--brand-strong); box-shadow:0 0 0 1px var(--brand-strong), var(--shadow-sm); }

.seat-bar{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.seat-who{ display:flex; align-items:center; gap:8px; min-width:0; flex-wrap:wrap; }
.seat-name{ font-weight:800; letter-spacing:.2px; }
.tag{
  font-size:.72rem; font-weight:800; letter-spacing:.4px; text-transform:uppercase;
  padding:2px 8px; border-radius:999px; border:1px solid var(--line);
}
.tag-you{ color:var(--accent); border-color:#25406a; background:rgba(138,180,255,.1); }
.tag-active{ color:#f0c46a; border-color:#4a3a1a; background:rgba(217,164,65,.1); }
/* "to act" baton passed to this seat (MT-45). */
.tag-baton{ color:#8ee6b5; border-color:#1c4a34; background:rgba(52,211,153,.12); }
.seat-board.is-baton{ border-color:#2f7d57; box-shadow:0 0 0 1px #2f7d57, var(--shadow-sm); }
.life-pill{
  display:inline-flex; align-items:center; gap:6px; flex:none;
  font-weight:800; font-size:1.15rem; color:var(--brand-2);
  padding:3px 12px; border-radius:999px;
  background:rgba(217,164,65,.08); border:1px solid #4a3a1a;
}
.life-heart{ color:var(--danger); font-size:.9em; }

/* Interactive life controls (MT-12) */
.life-ctrl{ display:flex; align-items:center; gap:6px; }
.life-btn{
  width:28px; height:28px; padding:0; flex:none; border-radius:8px;
  display:inline-flex; align-items:center; justify-content:center;
  background:rgba(255,255,255,.05); border:1px solid var(--line);
  color:var(--text); font:inherit; font-weight:800; font-size:1.1rem; line-height:1; cursor:pointer;
}
.life-btn:hover{ background:rgba(217,164,65,.16); border-color:var(--brand-strong); }
.life-set{ font:inherit; cursor:pointer; }
.life-set:hover{ border-color:var(--brand-strong); }

/* Dice / coin toolbar (MT-12) */
.table-tools{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:12px; }
.table-tools .btn{ padding:7px 12px; font-size:.9rem; }
.roll-custom{ display:inline-flex; gap:6px; align-items:center; }
.roll-custom input{ width:78px; }
.roll-result{ font-weight:800; color:var(--brand-2); min-height:1em; }

/* Turn history browser (MT-20) */
.history-bar{
  display:flex; flex-wrap:wrap; align-items:center; gap:8px;
  margin-top:12px; padding-top:12px; border-top:1px solid var(--line);
}
.history-lead{ font-size:.8rem; font-weight:800; letter-spacing:.03em; text-transform:uppercase; color:var(--muted); }
.history-bar .hist-btn{ padding:5px 10px; font-size:.95rem; line-height:1; }
.history-bar .hist-btn:disabled{ opacity:.4; cursor:default; }
.history-label{
  min-width:74px; text-align:center; font-weight:800; color:var(--text);
  padding:4px 12px; border-radius:999px; border:1px solid var(--line);
  background:rgba(255,255,255,.03);
}
.history-bar .hist-live{ padding:5px 12px; font-size:.85rem; }
.history-bar .hist-live[hidden]{ display:none; }
/* When browsing a past turn, dim the (read-only) board and hide live-only tools. */
.viewing-history #tableTools{ display:none; }
.viewing-history .history-label{ color:var(--brand); border-color:var(--brand-strong); background:rgba(217,164,65,.1); }
.viewing-history .game-seats{ opacity:.94; }
.viewing-history .game-seats::before{
  content:"Viewing history — read only"; display:block;
  margin-bottom:10px; padding:6px 12px; border-radius:var(--radius-sm);
  font-size:.82rem; font-weight:700; color:var(--brand);
  background:rgba(217,164,65,.08); border:1px solid var(--brand-strong);
}

/* Zone shells */
.zone{
  background:rgba(255,255,255,.02); border:1px solid var(--line);
  border-radius:var(--radius-sm); padding:10px;
}
.zone-head{
  display:flex; align-items:baseline; justify-content:space-between; gap:8px;
  margin-bottom:8px; font-size:.72rem; font-weight:800; letter-spacing:.5px;
  text-transform:uppercase; color:var(--muted);
}
.zone-head .zone-n{ font-weight:800; color:var(--text); font-size:.8rem; }
.zone-empty{ color:var(--muted); font-size:.85rem; padding:14px 4px; text-align:center; }

.hand-cards{ display:flex; flex-wrap:wrap; gap:8px 10px; align-items:flex-start; }

/* Free-form battlefield (MT-57): one section of the shared table per seat.
   Cards sit at their own spot (left/top = the card's centre, set inline);
   --off fans out different stacks dropped on the same spot. */
.bf-free{
  position:relative; overflow:hidden; border-radius:10px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(217,164,65,.05), transparent 70%),
    linear-gradient(180deg, #17221d, #121a16);
  border:1px solid rgba(255,255,255,.05);
}
.seat-board.is-opponent .bf-free{
  background:
    radial-gradient(120% 90% at 50% 100%, rgba(217,164,65,.05), transparent 70%),
    linear-gradient(0deg, #17221d, #121a16);
}
.bf-item{
  position:absolute;
  transform:translate(calc(-50% + var(--off, 0) * 14px), calc(-50% + var(--off, 0) * 10px));
}
.bf-empty{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; padding:0; }

/* Land stack (MT-38): a pile of same-kind lands with a count + tapped badge. */
.land-stack{ position:relative; flex:none; width:var(--mini-w); }
.land-stack .mini{
  box-shadow:2px 2px 0 -1px #241f2c, 4px 4px 0 -2px #1a1622;   /* faux depth */
  border-radius:6px;
}
.land-stack.actionable{ cursor:pointer; }
.stack-count{
  position:absolute; right:-5px; top:-7px; z-index:2;
  font-size:.7rem; font-weight:800; color:var(--text);
  background:#241f2c; border:1px solid var(--line); border-radius:999px; padding:0 6px;
}
.stack-tapped{
  position:absolute; left:-5px; bottom:6px; z-index:2;
  font-size:.62rem; font-weight:800; color:#f0c46a;
  background:rgba(217,164,65,.16); border:1px solid #4a3a1a; border-radius:999px; padding:1px 6px;
}
.land-stack-menu .stack-status{ color:var(--muted); font-size:.85rem; margin:2px 0 8px; }
.land-stack-menu .stack-controls{ display:flex; gap:6px; margin-bottom:8px; }
.land-stack-menu .stack-portion{ display:flex; gap:6px; align-items:center; }
.land-stack-menu .stack-n{ width:66px; }
.land-stack-menu .btn{ padding:6px 12px; font-size:.85rem; }

/* Face-to-face table (MT-37): you sit at the bottom; opponents are rendered
   across from you and mirrored, so both battlefields meet in the middle and each
   player's land row sits behind their creatures (away from the centre line). */
.seat-board.is-opponent .seat-bar{ order:1; }
.seat-board.is-opponent .pile-row{ order:2; }
.seat-board.is-opponent .zone-battlefield{ order:3; }
/* You: battlefield at the top (toward the centre line), then your hand, then the
   library/graveyard/exile/command piles, with your life/name at the bottom
   nearest you. Creatures stay above your land row. */
.seat-board.is-you .zone-battlefield{ order:1; }
.seat-board.is-you .zone-hand-open{ order:2; }
.seat-board.is-you .pile-row{ order:3; }
.seat-board.is-you .seat-bar{ order:4; }

/* Piles row: library / graveyard / exile / command (+ opponent hand) */
.pile-row{ display:flex; flex-wrap:wrap; gap:12px; }
.pile{ display:grid; gap:4px; justify-items:center; }
.pile-slot{ position:relative; }
.pile-slot.pile-stacked{
  box-shadow:2px 2px 0 -1px #241f2c, 4px 4px 0 -2px #1a1622;   /* faux depth for >1 card */
  border-radius:6px;
}
.pile-empty{
  width:var(--mini-w); aspect-ratio:5/7; border-radius:6px;
  border:1px dashed var(--line); background:rgba(255,255,255,.015);
}
.pile-foot{
  display:flex; align-items:center; gap:6px;
  font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.4px;
  color:var(--muted);
}
.pile-n{
  min-width:18px; text-align:center; color:var(--text); font-weight:800;
  padding:0 5px; border-radius:999px; background:rgba(255,255,255,.05); border:1px solid var(--line);
}

/* Mini card. The outer .mini is the flow box; .mini-face is centred inside it
   and is what rotates when tapped — so the box switches to a landscape footprint
   and correctly reserves space (no overlap with neighbours). */
.mini{
  position:relative; flex:none;
  width:var(--mini-w); height:calc(var(--mini-w) * 7 / 5);
}
.mini.is-tapped{ width:calc(var(--mini-w) * 7 / 5); height:var(--mini-w); }
.mini-face{
  position:absolute; top:50%; left:50%;
  width:var(--mini-w); height:calc(var(--mini-w) * 7 / 5);
  transform:translate(-50%, -50%);
  border-radius:6px; overflow:hidden; background:#0d0d10; border:1px solid var(--line);
  transition:transform .12s ease;
}
.mini.is-tapped .mini-face{ transform:translate(-50%, -50%) rotate(90deg); }
.mini-face img{ width:100%; height:100%; object-fit:cover; display:block; -webkit-user-drag:none; user-select:none; }
.mini-text{
  display:flex; align-items:center; text-align:center; padding:4px;
  font-size:.6rem; font-weight:600; color:var(--muted); overflow:hidden;
}
.mini-back{
  background:
    radial-gradient(120% 80% at 50% 12%, rgba(240,196,106,.22), transparent 60%),
    linear-gradient(180deg, #241a2e, #171420);
  border-color:#3a2f22;
  box-shadow:inset 0 0 0 3px rgba(217,164,65,.14), inset 0 0 0 5px rgba(0,0,0,.35);
}
.mini.actionable{ cursor:pointer; }
.board-interactive .mini.actionable:hover .mini-face{ border-color:var(--brand-strong); box-shadow:0 0 0 1px var(--brand-strong); }

/* Drag & drop (MT-39). touch-action:none lets a touch drag a card without the
   page scrolling; a stationary press is still a tap that opens the card menu. */
.board-interactive .mini.actionable,
.board-interactive .land-stack.actionable{ touch-action:none; }
.mini.is-drag-src, .land-stack.is-drag-src{ opacity:.35; }
.card-ghost{
  position:fixed; z-index:80; margin:0; pointer-events:none;
  opacity:.92; transform:rotate(3deg);
  filter:drop-shadow(0 12px 24px rgba(0,0,0,.6));
}
/* Show where a dragged card can land, and highlight the one under the pointer. */
.dragging-card [data-drop-zone]{
  outline:1px dashed var(--brand-strong); outline-offset:2px; border-radius:8px;
}
.dragging-card [data-drop-zone].drop-hover{
  outline-style:solid; background:rgba(217,164,65,.12);
}
.mini-counter{
  position:absolute; right:2px; bottom:2px; z-index:1;
  font-size:.62rem; font-weight:800; line-height:1;
  padding:2px 4px; border-radius:5px;
  color:#eafaf1; background:rgba(15,40,28,.92); border:1px solid #1c4a34;
}
.mini-token{
  position:absolute; left:2px; top:2px; z-index:1;
  width:14px; height:14px; border-radius:4px;
  display:flex; align-items:center; justify-content:center;
  font-size:.6rem; font-weight:800; line-height:1;
  color:var(--on-brand); background:linear-gradient(180deg,var(--brand-2),var(--brand)); border:1px solid var(--brand-strong);
}

/* Add-token button in the battlefield header */
.token-add{
  width:auto; padding:2px 10px; border-radius:999px; cursor:pointer;
  font-size:.7rem; font-weight:800; letter-spacing:.3px;
  color:var(--brand-2); background:rgba(217,164,65,.08); border:1px solid #4a3a1a;
}
.token-add:hover{ background:rgba(217,164,65,.16); border-color:var(--brand-strong); }

/* Mulligan button (MT-19) — in your own hand header */
.mulligan-btn{
  width:auto; padding:2px 10px; border-radius:999px; cursor:pointer;
  font-size:.7rem; font-weight:800; letter-spacing:.3px;
  color:var(--accent); background:rgba(138,180,255,.1); border:1px solid #25406a;
}
.mulligan-btn:hover{ background:rgba(138,180,255,.18); border-color:var(--accent); }
.hand-btns{ display:inline-flex; gap:6px; margin-left:auto; }
.draw-btn{ color:var(--brand-2); background:rgba(217,164,65,.12); border-color:#6b5320; }
.draw-btn:hover{ background:rgba(217,164,65,.22); border-color:var(--brand); }
.draw-btn:disabled{ opacity:.4; cursor:default; }

/* Card action menu + token popover (anchored, fixed-position) */
.card-menu{
  position:fixed; z-index:60; min-width:170px; max-width:230px; padding:6px;
  display:grid; gap:2px;
  background:linear-gradient(180deg,#1a1720,#131118);
  border:1px solid var(--line); border-radius:var(--radius-sm); box-shadow:var(--shadow);
}
.card-menu-head{
  padding:6px 8px 8px; font-size:.75rem; font-weight:800; color:var(--brand-2);
  border-bottom:1px solid var(--line); margin-bottom:2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.card-menu hr{ border:none; border-top:1px solid var(--line); margin:4px 2px; }
.menu-item{
  width:100%; text-align:left; padding:7px 8px; border-radius:8px;
  background:transparent; border:1px solid transparent; color:var(--text);
  font:inherit; font-size:.85rem; font-weight:600; cursor:pointer;
}
.menu-item:hover{ background:rgba(217,164,65,.12); border-color:var(--brand-strong); }
.token-pop .token-search{ margin-bottom:8px; }
.token-custom{ display:flex; gap:6px; align-items:stretch; }
.token-custom .token-label{ flex:1 1 auto; }
.token-custom .token-label-add{ flex:0 0 auto; width:auto; padding:8px 12px; font-size:.85rem; }

/* Card preview + attribution (MT-21) */
.card-preview{
  position:fixed; z-index:80; width:248px; padding:6px;
  pointer-events:none;   /* a hover ghost — never intercepts the pointer */
  background:linear-gradient(180deg,#1a1720,#131118);
  border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow);
}
.preview-img{
  display:block; width:100%; aspect-ratio:63/88;   /* reserves height before art loads */
  border-radius:4.75%/3.5%; background:#0d0b11;
}
.preview-img + .preview-img{ margin-top:6px; }      /* double-faced: front then back */
.preview-text{
  display:flex; align-items:center; justify-content:center; text-align:center;
  width:100%; aspect-ratio:63/88; padding:10px; color:var(--muted); font-weight:700;
}
.preview-foot{ display:grid; gap:2px; padding:6px 4px 2px; }
.preview-set{ font-size:.72rem; font-weight:800; color:var(--brand-2); }
.preview-credit{ font-size:.66rem; color:var(--muted); line-height:1.3; }
.preview-link{ font-size:.72rem; color:var(--accent); }
/* In the action menu the same figure is interactive (the Scryfall link is tappable). */
.card-menu-fig{ margin:2px 2px 4px; }
.card-menu-fig .preview-img{ width:150px; margin:0 auto; }
.card-menu-fig .preview-text{ width:150px; }
.card-menu-fig .preview-foot{ padding:6px 2px 0; }

/* Large selected-card popup (MT-40): a big, readable card on a dimmed backdrop,
   with the move/change actions tucked into a collapsed disclosure. */
.card-modal-overlay{
  position:fixed; inset:0; z-index:70;
  display:flex; align-items:center; justify-content:center; padding:18px;
  background:rgba(6,5,9,.68); backdrop-filter:blur(3px);
  animation:fadeIn .12s ease;
}
.card-modal{
  position:relative; width:min(90vw, 340px);
  max-height:92vh; overflow-y:auto;
  display:flex; flex-direction:column; align-items:stretch; gap:10px;
}
.card-modal-fig .preview-img{ width:100%; }
.card-modal-fig .preview-foot{ padding:8px 2px 0; }
.card-modal-hidden{
  display:flex; align-items:center; justify-content:center; text-align:center;
  aspect-ratio:63/88; border-radius:14px; padding:16px;
  background:linear-gradient(180deg,#241a2e,#171420); border:1px solid #3a2f22;
  color:var(--brand-2); font-weight:800; font-size:1.05rem;
}
.card-modal-name{ text-align:center; font-weight:800; font-size:1.1rem; color:var(--text); }
/* Swipe track for paging through your hand (MT-44). pan-y keeps vertical scroll
   working while we own horizontal swipes. */
.card-modal-swipe{ display:flex; flex-direction:column; gap:10px; touch-action:pan-y; will-change:transform, opacity; }
.card-modal-swipe-hint{ text-align:center; font-size:.75rem; font-weight:700; color:var(--brand-2); opacity:.8; }
/* Actions on the card (MT-51): battlefield toggles ride the card's edges; the
   move/zone chips sit in an attached bar directly under the card. */
.card-modal-fig{ position:relative; }
.card-edge-btn{
  position:absolute; z-index:2; width:40px; height:40px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:1.15rem; line-height:1; cursor:pointer; color:var(--text);
  border:1px solid var(--line); background:rgba(16,13,22,.82); backdrop-filter:blur(4px);
  box-shadow:0 2px 8px rgba(0,0,0,.5);
}
.card-edge-btn:hover{ border-color:var(--brand-strong); background:rgba(217,164,65,.24); }
.card-edge-btn:active{ transform:scale(.94); }
.edge-tl{ top:8px; left:8px; } .edge-tr{ top:8px; right:8px; }
.edge-ml{ top:50%; left:8px; transform:translateY(-50%); }
.edge-mr{ top:50%; right:8px; transform:translateY(-50%); }
.edge-bl{ bottom:8px; left:8px; } .edge-br{ bottom:8px; right:8px; }
.edge-ml:active, .edge-mr:active{ transform:translateY(-50%) scale(.94); }

.card-action-bar{ display:flex; flex-direction:column; gap:8px; }
.card-move-chips{ display:flex; flex-wrap:wrap; gap:5px; justify-content:center; }
.card-move-chip{
  font:inherit; font-size:.78rem; font-weight:600; padding:5px 11px; border-radius:999px; cursor:pointer;
  border:1px solid var(--line); background:linear-gradient(180deg,#1a1720,#131118); color:var(--text);
}
.card-move-chip:hover{ border-color:var(--brand-strong); background:rgba(217,164,65,.14); }

/* Attached cards (MT-52): each attachment peeks below-right of its host. */
.attach-group{ position:relative; display:inline-block; }
.attach-host{ position:relative; z-index:3; }
.attach-item{ position:absolute; top:0; left:0; z-index:1;
  transform:translate(calc(var(--ai) * 15px), calc(var(--ai) * 11px)); }
.attach-item .mini{ box-shadow:0 2px 6px rgba(0,0,0,.5); }
.attach-badge{ position:absolute; top:-6px; right:-6px; z-index:4;
  font-size:.6rem; font-weight:800; padding:1px 5px; border-radius:999px;
  background:var(--brand-strong); color:#231a06; box-shadow:0 1px 3px rgba(0,0,0,.5); }
.attach-pick{ max-width:280px; max-height:70vh; overflow-y:auto; }
.attach-pick .menu-item{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.attach-empty{ padding:8px; font-size:.82rem; color:var(--muted); }
/* Target-seat selector in the card popup (MT-48). */
.seat-select{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:2px 0 6px; }
.seat-select-label{ font-size:.8rem; color:var(--muted); }
.seat-select-btn{
  font:inherit; font-size:.85rem; padding:3px 10px; border-radius:999px; cursor:pointer;
  border:1px solid var(--line); background:var(--surface-2, rgba(255,255,255,.04)); color:inherit;
}
.seat-select-btn:hover{ border-color:var(--brand-strong); }
.seat-select-btn.is-sel{ border-color:var(--brand-strong); background:rgba(217,164,65,.18); font-weight:700; }
.card-modal-close{
  position:absolute; top:2px; right:2px; width:34px; height:34px; padding:0;
  display:inline-flex; align-items:center; justify-content:center;
  border-radius:50%; border:1px solid var(--line); background:rgba(10,9,13,.7);
  color:var(--text); font-size:1rem; line-height:1; cursor:pointer;
}
.card-modal-close:hover{ border-color:var(--brand-strong); background:rgba(217,164,65,.16); }
@keyframes fadeIn{ from{ opacity:0 } to{ opacity:1 } }

@media (max-width:640px){
  :root{ --mini-w:52px; }
  .hand-cards{ gap:6px 8px; }
  .card-preview{ width:200px; }
  /* Reclaim vertical space on phones (MT-42): tighter cards + top panel, less
     gap between the panel and the seats. */
  .container{ padding:10px 12px; }
  .card{ padding:12px 14px; }
  .game-panel{ padding:10px 12px; }
  .game-panel > #turnInfo{ margin-top:4px; }
  .game-layout{ margin-top:10px; gap:12px; }
  .game-seats{ margin-top:10px; }
  .seat-board{ padding:12px; gap:10px; }
  /* Keep all the piles on one row, sharing the width, with labels truncating
     instead of pushing the piles apart (MT-41). The minmax(0,1fr) column lets
     the pile shrink below the label's natural width so the ellipsis kicks in. */
  .pile-row{ gap:8px; flex-wrap:nowrap; }
  .pile{ flex:1 1 0; min-width:0; grid-template-columns:minmax(0,1fr); }
  .pile-foot{ max-width:100%; min-width:0; }
  .pile-label{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
}

/* ====== Card search autocomplete (MT-05) ====== */
.card-search{ position:relative; }
.card-search-menu{
  position:absolute; z-index:30; left:0; right:0; top:calc(100% + 4px);
  max-height:320px; overflow-y:auto;
  background:linear-gradient(180deg,#1a1720,#131118);
  border:1px solid var(--line); border-radius:var(--radius-sm);
  box-shadow:var(--shadow);
}
.card-search-item{
  display:flex; align-items:baseline; justify-content:space-between; gap:10px;
  padding:8px 12px; cursor:pointer; border-bottom:1px solid rgba(255,255,255,.04);
}
.card-search-item:last-child{ border-bottom:none; }
.card-search-item.active,
.card-search-item:hover{ background:rgba(217,164,65,.12); }
.cs-name{ font-weight:600; }
.cs-meta{ color:var(--muted); font-size:.85rem; white-space:nowrap; }

/* ====== Media / mobile pass (MT-36) ====== */
@media (max-width:720px){
  .topbar-actions{gap:6px}
  .topbar-avatar{width:38px;height:38px}
  .container{padding:14px}
}

/* Touch devices: enlarge the small icon buttons so they're comfortable to tap
   (WCAG-ish ~40px targets), without changing the pointer/desktop layout. */
@media (pointer:coarse){
  .dc-step, .dc-move, .dc-x{ width:34px; height:34px; }
  .btn-back{ width:42px; height:42px; }
  .hist-btn, .hist-live{ min-height:38px; }
}

/* Phones */
@media (max-width:640px){
  h1{ font-size:1.35rem; }
  h2{ font-size:1.08rem; }

  /* Topbar: keep the greeting from shoving the actions off-screen. */
  .topbar{ padding:8px 12px; gap:8px; }
  .topbar-name{ font-size:.95rem; }
  .topbar-actions .btn{ padding:8px 12px; }

  /* Stacky forms & action rows so nothing spills sideways. */
  .deck-add-row{ flex-wrap:wrap; }
  .deck-add-row #addBoard{ flex:1 1 100%; width:100%; }
  .import-actions{ flex-wrap:wrap; }
  .import-actions .btn{ flex:1 1 auto; }
  .roll-custom{ flex-wrap:wrap; }
  .decks-list{ grid-template-columns:1fr; }
  .table-tools{ gap:6px; }
}

/* Small phones */
@media (max-width:400px){
  .container{ padding:12px; }
  .topbar-username{ display:none; }   /* name is enough; reclaim the width */
  .btn{ padding:9px 13px; }
}

/* ====== Card Board deck builder (MT-59) ======
   deck.html is a full-height board: search sidebar on the left, the deck as a
   free-form board on the right with one tab per board. Card art is shown at
   --db-card-w (the toolbar's size slider). Everything is prefixed db- so it
   can't collide with the game table's .card / .mini styles. */
:root{ --db-card-w:130px; }
body.deck-builder{ height:100vh; height:100dvh; display:flex; flex-direction:column; overflow:hidden; }
.db-app{ flex:1; display:flex; min-height:0; }

.db-sidebar{
  width:300px; flex-shrink:0; display:flex; flex-direction:column; min-height:0;
  background:var(--card-2); border-right:1px solid var(--line); transition:background .15s;
}
.db-sidebar.trash{ background:#2a1417; }
.db-side-head{ padding:12px 12px 8px; border-bottom:1px solid var(--line); }
.db-search{ width:100%; }
.db-hint{ color:var(--muted); font-size:.75rem; margin-top:6px; line-height:1.45; }
.db-hint code{ background:var(--card); padding:1px 4px; border-radius:4px; color:var(--text); }
.db-status{ color:var(--muted); font-size:.75rem; padding:6px 12px 0; min-height:22px; }
.db-results{
  flex:1; overflow-y:auto; padding:6px 12px 12px;
  display:grid; grid-template-columns:1fr 1fr; gap:8px; align-content:start;
}
.db-results img{
  width:100%; aspect-ratio:5/7; border-radius:6px; display:block; cursor:grab;
  background:var(--card); touch-action:none; transition:transform .1s;
}
.db-results img:hover{ transform:scale(1.03); }
.db-more{ grid-column:1 / -1; }
.db-trash-msg{ display:none; padding:10px; color:#ffb4b4; font-weight:700; text-align:center; border-top:1px solid var(--line); }
.db-sidebar.trash .db-trash-msg{ display:block; }

.db-main{ flex:1; display:flex; flex-direction:column; min-width:0; position:relative; }
.db-toolbar{
  display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  margin:8px 10px 0; padding:8px 10px; border-radius:var(--radius-sm);
}
.db-toolbar .btn{ padding:6px 10px; font-size:.85rem; }
.db-name{ width:170px; font-weight:700; }
.db-tag{ width:105px; }
.db-sort{ padding:6px 8px; font-size:.85rem; width:auto; }
.db-size{ display:flex; align-items:center; gap:6px; color:var(--muted); font-size:.75rem; margin:0; }
.db-size input{ accent-color:var(--brand); width:80px; }
.db-spacer{ flex:1; }
.db-save{ white-space:nowrap; }
.db-danger:hover{ border-color:var(--danger); color:#ffd7db; }
#dbConnectBtn.on{ background:#c62f2f; border-color:#c62f2f; color:#fff; }

.db-tabs{ display:flex; align-items:flex-end; gap:4px; padding:8px 12px 0; border-bottom:1px solid var(--line); flex-shrink:0; }
.db-tab{
  display:flex; align-items:center; gap:8px; padding:7px 14px; cursor:pointer;
  border:1px solid var(--line); border-bottom:0; border-radius:10px 10px 0 0;
  background:var(--card); color:var(--muted); font:inherit; font-size:.9rem;
}
.db-tab.active{ background:#17221d; color:var(--text); font-weight:700; }
.db-tab.drop-target{ background:rgba(217,164,65,.22); color:var(--text); border-color:var(--brand); }
.db-tab-count{ font-size:.75rem; color:var(--muted); font-weight:400; }
.db-tab-hint{ margin-left:auto; padding-bottom:6px; }

.db-board{
  flex:1; position:relative; overflow:auto; min-height:0;
  background-color:#17221d;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size:40px 40px;
}
.db-board.connecting{
  background-color:#b4875a;
  background-image:
    radial-gradient(rgba(70,40,15,.35) 1px, transparent 1.5px),
    radial-gradient(rgba(255,230,190,.18) 1px, transparent 1.5px);
  background-size:7px 7px, 11px 11px;
  background-position:0 0, 3px 5px;
}
.db-empty{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  color:rgba(255,255,255,.25); pointer-events:none; text-align:center; padding:20px;
}

.db-card{
  position:absolute; width:var(--db-card-w); aspect-ratio:5/7;
  border-radius:6%/4.3%; overflow:hidden; cursor:grab; touch-action:none;
  box-shadow:0 3px 8px rgba(0,0,0,.45); background:var(--card);
}
.db-card img{ width:100%; height:100%; display:block; pointer-events:none; }
.db-card-text{ display:flex; height:100%; align-items:center; justify-content:center; text-align:center; padding:6px; font-size:.75rem; color:var(--muted); }
.db-card.dragging, .db-note.dragging{ cursor:grabbing; box-shadow:0 12px 28px rgba(0,0,0,.6); }
.db-card.selected, .db-note.selected{ outline:2px solid var(--brand); outline-offset:2px; }
.db-board.sorting .db-card{ transition:left .35s ease, top .35s ease; }
.db-col-label{
  position:absolute; font-size:.75rem; font-weight:700; color:rgba(255,255,255,.6);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; pointer-events:none;
}
.db-marquee{ position:absolute; border:1px solid var(--brand); background:rgba(217,164,65,.12); pointer-events:none; z-index:2147483000; }

.db-note{
  position:absolute; display:flex; flex-direction:column; border-radius:4px;
  background:var(--note); box-shadow:0 4px 12px rgba(0,0,0,.45); --note:#f6e27a;
}
.db-note[data-color="pink"]{ --note:#f4a7c0; }
.db-note[data-color="blue"]{ --note:#9fd3f5; }
.db-note[data-color="green"]{ --note:#b5e3a1; }
.db-note-bar{
  height:20px; display:flex; align-items:center; justify-content:space-between;
  padding:0 3px 0 5px; background:rgba(0,0,0,.08); border-radius:4px 4px 0 0; cursor:grab; touch-action:none;
}
.db-note-bar button{ border:0; background:none; cursor:pointer; padding:0 3px; color:rgba(0,0,0,.55); font-size:14px; line-height:1; }
.db-note-bar button:hover{ color:#000; }
.db-note-color{ width:12px; height:12px; border-radius:50%; padding:0 !important; border:1px solid rgba(0,0,0,.35) !important; background:var(--note) !important; filter:brightness(.85); }
.db-note textarea{
  width:180px; height:100px; min-width:110px; min-height:50px; border:0; border-radius:0;
  background:transparent; color:#26231a; font:13px/1.4 system-ui, sans-serif; padding:6px 8px; resize:both; outline:none; box-shadow:none;
}
.db-note textarea::placeholder{ color:rgba(0,0,0,.4); }

.db-links{ position:absolute; left:0; top:0; overflow:visible; pointer-events:none; z-index:2147482000; }
.db-link-line{ fill:none; stroke:#c62f2f; stroke-width:2.2; stroke-linecap:round; filter:drop-shadow(1px 2px 1.5px rgba(0,0,0,.5)); }
.db-link-hit{ fill:none; stroke:transparent; stroke-width:14; }
.db-link-temp{ fill:none; stroke:#c62f2f; stroke-width:2; stroke-dasharray:6 5; opacity:.8; }
.db-board.connecting .db-link-hit{ pointer-events:stroke; cursor:pointer; }
.db-board.connecting .db-link-hit:hover + .db-link-line{ stroke:#ff7a5c; stroke-width:3; }
.db-board.connecting .db-card, .db-board.connecting .db-note, .db-board.connecting .db-note-bar{ cursor:crosshair; }
.pin-source{ outline:2px dashed #c62f2f !important; outline-offset:3px; }

.db-ghost{
  position:fixed; width:var(--db-card-w); border-radius:6px; pointer-events:none; opacity:.85;
  z-index:9999; display:none; box-shadow:0 12px 28px rgba(0,0,0,.6);
}
.db-preview{
  position:fixed; left:10px; bottom:10px; width:280px; border-radius:14px; pointer-events:none;
  z-index:9000; display:none; box-shadow:0 10px 40px rgba(0,0,0,.7);
}
.db-help{
  position:absolute; left:12px; bottom:8px; right:12px; pointer-events:none;
  color:rgba(255,255,255,.35); font-size:.72rem;
}
.db-connect-hint{
  display:none; position:absolute; left:50%; bottom:30px; transform:translateX(-50%);
  background:rgba(20,14,8,.85); color:#f3e6d4; padding:6px 14px; border-radius:20px;
  font-size:.75rem; pointer-events:none; white-space:nowrap; z-index:9500;
}
body.db-connecting .db-connect-hint{ display:block; }

.db-modal{
  position:fixed; inset:0; background:rgba(0,0,0,.6); display:none;
  align-items:center; justify-content:center; z-index:10000; padding:16px;
}
.db-modal.open{ display:flex; }
.db-modal-box{ width:100%; max-width:480px; display:grid; gap:10px; }
.db-modal-box textarea{ min-height:220px; font:13px/1.5 ui-monospace, Consolas, monospace; }
.db-modal-actions{ display:flex; justify-content:flex-end; gap:8px; }

@media (max-width:760px){
  .db-app{ flex-direction:column; }
  .db-sidebar{ width:100%; height:38%; border-right:0; border-bottom:1px solid var(--line); }
  .db-results{ grid-template-columns:repeat(4, 1fr); }
  .db-hint, .db-help, .db-tab-hint{ display:none; }
  .db-toolbar{ margin:6px 6px 0; gap:6px; }
  .db-name{ width:140px; }
  .db-tag{ display:none; }
  .db-size input{ width:70px; }
  .db-preview{ width:200px; left:50%; transform:translateX(-50%); bottom:auto; top:70px; }
}

/* Bulk add from a file (MT-59b) */
.db-file-row{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.db-file-row .btn{ padding:6px 12px; font-size:.85rem; }
.db-modal-box textarea.drop-hover{ outline:2px dashed var(--brand); outline-offset:2px; background:rgba(217,164,65,.08); }

/* Deck picker with art + details (MT-62): one row per deck so similar names are
   easy to tell apart — cover art, name, color pips, style tag and counts. */
.your-deck{ max-width:440px; }
.deck-choices:has(.deck-choice-rich){ display:grid; gap:6px; }
.deck-choice-rich{
  display:flex; align-items:center; gap:10px; border-radius:var(--radius-sm);
  padding:6px 10px 6px 8px;
}
.deck-choice-rich input[type=checkbox]{ width:18px; height:18px; padding:0; border-radius:4px; }
.deck-cover{
  flex:none; width:52px; height:38px; border-radius:6px;
  background:#1d1a24 center / cover no-repeat; border:1px solid var(--line);
}
.deck-choice-body{ display:grid; gap:2px; min-width:0; flex:1; }
.deck-choice-rich .deck-choice-name{ font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.deck-choice-meta{ display:flex; align-items:center; gap:3px; color:var(--muted); font-size:.78rem; white-space:nowrap; overflow:hidden; }
.deck-choice-meta > span{ margin-left:4px; overflow:hidden; text-overflow:ellipsis; }
.deck-choice-open{ flex:none; color:var(--muted); text-decoration:none; padding:2px 6px; border-radius:6px; }
.deck-choice-open:hover{ color:var(--text); background:rgba(255,255,255,.06); }
.pip{ display:inline-block; width:11px; height:11px; border-radius:50%; flex:none; border:1px solid rgba(0,0,0,.35); }
.pip-W{ background:#f4efd2; }
.pip-U{ background:#3f8fd6; }
.pip-B{ background:#2a2530; border-color:#6b6475; }
.pip-R{ background:#d8503f; }
.pip-G{ background:#3c9a5f; }
.pip-C{ background:#a9a3b3; }

/* Deck types + covers (MT-63) */
.db-card.is-cover::after{
  content:"★"; position:absolute; top:4px; right:4px; width:20px; height:20px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; font-size:12px; line-height:1;
  background:var(--brand); color:var(--on-brand); box-shadow:0 1px 4px rgba(0,0,0,.5);
}
.deck-others{ margin-top:4px; }
.deck-others > summary{ cursor:pointer; color:var(--muted); font-size:.8rem; padding:4px 0; }
.deck-others > summary:hover{ color:var(--text); }
.deck-others[open] > .deck-choices{ margin-top:6px; opacity:.85; }
.deck-card .type-badge{ margin-left:6px; }
/* ====== Counters + custom tokens (MT-64) ====== */
/* Counter tray under your Battlefield header: drag a chip onto any card. */
.counter-tray{ display:flex; flex-wrap:wrap; gap:5px; margin:-2px 0 8px; }
.counter-chip{
  font:inherit; font-size:.72rem; font-weight:800; line-height:1; cursor:grab;
  padding:5px 9px; border-radius:999px; touch-action:none; user-select:none;
  color:#eafaf1; background:rgba(15,40,28,.92); border:1px solid #1c4a34;
}
.counter-chip:hover{ border-color:#3aa36f; }
.counter-chip.counter-new{ cursor:pointer; color:var(--muted); background:transparent; border-style:dashed; border-color:var(--line); }
.counter-chip.card-ghost{ position:fixed; z-index:80; pointer-events:none; }
.counter-target .mini-face, .land-stack.counter-target .mini-face{ box-shadow:0 0 0 2px #3aa36f, 0 0 14px rgba(58,163,111,.6); }

/* Net +1/+1 or -1/-1 badge (bottom-right) and other kinds (bottom-left). */
.mini-counter.neg{ color:#ffe1e1; background:rgba(60,14,18,.92); border-color:#6b1f27; }
.mini-counters-other{
  position:absolute; left:2px; bottom:19px; z-index:1; display:grid; gap:1px;
  font-size:.55rem; font-weight:800; line-height:1.1;
}
.mini-counters-other > span{ padding:1px 3px; border-radius:4px; color:#e9e4ff; background:rgba(28,22,52,.92); border:1px solid #3b3166; }

/* Popup: step each counter kind, or add another. */
.counter-edit{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.counter-edit-item{
  display:inline-flex; align-items:center; gap:6px; padding:3px 6px 3px 10px; border-radius:999px;
  background:rgba(15,40,28,.6); border:1px solid #1c4a34; font-size:.82rem;
}
.counter-edit-item b{ min-width:14px; text-align:center; }
.ce-kind{ font-weight:700; }
.ce-btn{
  width:24px; height:24px; padding:0; border-radius:50%; cursor:pointer; font:inherit; font-weight:800;
  background:rgba(255,255,255,.06); border:1px solid var(--line); color:var(--text);
}
.ce-btn:hover{ border-color:var(--brand-strong); }

/* Custom token faces: colour frame by the token's colours. */
.token-W{ --tk:#e9e2c4; --tk-ink:#2b2614; }
.token-U{ --tk:#3f7fc2; --tk-ink:#fff; }
.token-B{ --tk:#3a3340; --tk-ink:#f2eef6; }
.token-R{ --tk:#c9493a; --tk-ink:#fff; }
.token-G{ --tk:#3e8d57; --tk-ink:#fff; }
.token-multi{ --tk:#c9a24a; --tk-ink:#241a06; }
.token-C{ --tk:#9a94a3; --tk-ink:#16141a; }
.mini-face.token-face{
  display:flex; flex-direction:column; justify-content:space-between; padding:4px;
  background:linear-gradient(180deg, var(--tk), color-mix(in srgb, var(--tk) 70%, #000));
  color:var(--tk-ink); border-color:rgba(0,0,0,.4);
}
.tf-name{ font-size:.56rem; font-weight:800; line-height:1.1; overflow:hidden; word-break:break-word; }
.tf-pt{ align-self:flex-end; font-size:.7rem; font-weight:900; padding:0 4px; border-radius:4px; background:rgba(0,0,0,.25); }
.token-card{
  width:min(300px, 72vw); aspect-ratio:5/7; border-radius:16px; padding:16px;
  display:grid; grid-template-rows:auto auto 1fr auto; gap:10px;
  background:linear-gradient(180deg, var(--tk), color-mix(in srgb, var(--tk) 65%, #000));
  color:var(--tk-ink); box-shadow:0 10px 34px rgba(0,0,0,.5); border:6px solid #111;
}
.tc-name{ font-size:1.2rem; font-weight:900; }
.tc-type{ font-size:.85rem; font-weight:700; padding:4px 8px; border-radius:6px; background:rgba(0,0,0,.18); }
.tc-text{ font-size:.95rem; line-height:1.4; white-space:pre-wrap; padding:8px; border-radius:8px; background:rgba(255,255,255,.18); }
.tc-pt{ justify-self:end; font-size:1.3rem; font-weight:900; padding:2px 12px; border-radius:8px; background:rgba(0,0,0,.25); }

/* Token popover: search a real token, or make your own. */
.token-pop{ min-width:270px; max-width:320px; }
.token-or{ text-align:center; color:var(--muted); font-size:.75rem; margin:8px 0 6px; }
.token-form{ display:grid; gap:6px; }
.token-form input, .token-form textarea{ padding:7px 10px; font-size:.9rem; }
.tk-row{ display:flex; gap:6px; }
.tk-row .tk-count{ width:70px; flex:none; }
.tk-colors{ display:flex; gap:6px; }
.tk-color{ display:inline-flex; cursor:pointer; margin:0; }
.tk-color input{ position:absolute; opacity:0; width:0; height:0; }
.tk-color span{
  width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  font-size:.75rem; font-weight:900; border:2px solid transparent; opacity:.45;
}
.tk-color input:checked + span{ opacity:1; border-color:var(--brand); }
.tk-W span{ background:#f4efd2; color:#2b2614; } .tk-U span{ background:#3f8fd6; color:#fff; }
.tk-B span{ background:#2a2530; color:#fff; } .tk-R span{ background:#d8503f; color:#fff; }
.tk-G span{ background:#3c9a5f; color:#fff; }
.tk-create{ padding:8px 12px; }

/* Game hover preview pinned top-right (MT-64): big, always in the same place.
   (The old deck editor's .card-preview rules, which hid this at opacity 0, are gone.) */
.card-preview{ top:72px; right:16px; width:300px; }
.card-preview .token-card{ width:100%; border-width:4px; }
.preview-counters{ display:flex; flex-wrap:wrap; gap:5px; margin:8px 2px 2px; }
.preview-counters span{
  font-size:.8rem; font-weight:800; padding:3px 8px; border-radius:999px;
  color:#eafaf1; background:rgba(15,40,28,.92); border:1px solid #1c4a34;
}
@media (max-width:640px){ .card-preview{ width:200px; top:64px; right:8px; } }

/* ====== P/T boosts (MT-65) ====== */
/* P/T tags sit in the middle of the card: +1/+1 counters, then each boost. */
.pt-tags{
  position:absolute; left:50%; top:50%; transform:translate(-50%, -50%); z-index:2;
  display:flex; flex-direction:column; align-items:center; gap:2px; pointer-events:none;
}
.mini.is-tapped .pt-tags{ transform:translate(-50%, -50%); }
.pt-tag{
  font-size:.66rem; font-weight:900; line-height:1; white-space:nowrap;
  padding:3px 5px; border-radius:6px; letter-spacing:.2px;
  color:#eafaf1; background:rgba(15,40,28,.94); border:1px solid #2f8a5c;
  box-shadow:0 2px 6px rgba(0,0,0,.6);
}
.pt-tag.pt-counters{ background:rgba(16,52,34,.96); border-color:#3aa36f; }
.pt-tag.pt-temp{ color:#2a1c04; background:rgba(240,196,106,.96); border-color:#b9852b; }
.pt-tag.neg{ color:#ffe1e1; background:rgba(60,14,18,.94); border-color:#a33a45; }
.pt-tag.pt-temp.neg{ color:#2a1c04; background:rgba(240,150,106,.96); }
.boost-chip{ background:rgba(60,42,8,.9); border-color:#8a6a24; color:#f6dfa6; }
.boost-chip:hover{ border-color:var(--brand); }

/* Boost editor */
.boost-pop{ min-width:240px; }
.boost-row{ display:flex; align-items:center; gap:8px; margin:6px 0; }
.boost-row > span{ flex:1; font-weight:700; }
.boost-row b{ min-width:34px; text-align:center; font-size:1.05rem; }
.boost-temp{ display:flex; align-items:center; gap:8px; font-weight:600; margin:10px 0 4px; cursor:pointer; }
.boost-temp input{ width:18px; height:18px; padding:0; accent-color:var(--brand); }
.boost-actions{ display:flex; justify-content:flex-end; gap:8px; margin-top:10px; }
.boost-actions .btn{ padding:6px 14px; font-size:.85rem; }

/* Preview: boosts under the card, temp ones in gold */
.preview-counters .pv-boost{ border-color:#2f8a5c; }
.preview-counters .pv-temp{ color:#2a1c04; background:rgba(240,196,106,.96); border-color:#b9852b; }

/* Custom counter chips get an x to remove them from the tray */
.counter-custom{ display:inline-flex; align-items:center; gap:5px; padding-right:5px; }
.chip-x{ display:inline-flex; align-items:center; justify-content:center; width:15px; height:15px; border-radius:50%; font-size:.8rem; line-height:1; cursor:pointer; color:#b9d8c7; background:rgba(255,255,255,.08); }
.chip-x:hover{ color:#fff; background:#a33a45; }

/* Shuffle button under your library pile */
.pile-btn{ width:auto; margin-top:2px; padding:2px 9px; border-radius:999px; cursor:pointer; font:inherit; font-size:.68rem; font-weight:800; color:var(--accent); background:rgba(138,180,255,.1); border:1px solid #25406a; white-space:nowrap; }
.pile-btn:hover{ background:rgba(138,180,255,.18); border-color:var(--accent); }
.pile-btn:disabled{ opacity:.4; cursor:default; }
