/* ============================================================================
   The Distillery — application styles
   ========================================================================== */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
.disp { font-family: var(--font-display); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent-tint); }

/* ---- scrollbars (subtle) ---- */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #D8DDE3; border-radius: 6px; border: 2px solid var(--surface-card); }
*::-webkit-scrollbar-thumb:hover { background: #C2C9D1; }

/* ============================ Atoms ============================ */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  border: 1px solid transparent; border-radius: var(--r-control);
  padding: 0 18px; height: 40px; white-space: nowrap;
  transition: filter .12s ease, background .12s ease, border-color .12s ease, transform .04s ease;
}
.btn:active { transform: translateY(1px); }
.btn-teal { background: var(--accent); color: #fff; box-shadow: var(--shadow-cta-teal); }
.btn-teal:hover { filter: brightness(.94); }
.btn-ink { background: var(--ink-button); color: #fff; box-shadow: var(--shadow-cta-ink); }
.btn-ink:hover { filter: brightness(1.25); }
.btn-outline { background: var(--surface-card); color: var(--ink); border-color: #D5DBE2; font-weight: 600; }
.btn-outline:hover { background: var(--surface-sunken); }
.btn-ghost { background: transparent; color: var(--ink-2); font-weight: 600; }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--ink); }
.btn-sm { height: 34px; font-size: 13px; padding: 0 14px; }
.btn-lg { height: 48px; font-size: 15px; padding: 0 22px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { font-size: 13px; line-height: 1; }

/* Color-identity pip / mana symbol */
.pip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.15); flex: 0 0 auto;
}
.pip.sm { width: 15px; height: 15px; font-size: 9px; box-shadow: none; }
.pip.lg { width: 26px; height: 26px; font-size: 13px; }
/* Real MTG mana-symbol SVGs (Scryfall): the art is already a colored circle. */
.pip-sym { background: none; object-fit: contain; border-radius: 50%; }
.pip-W { background: var(--pip-w-bg); color: var(--pip-w-fg); }
.pip-U { background: var(--pip-u-bg); color: var(--pip-u-fg); }
.pip-B { background: var(--pip-b-bg); color: var(--pip-b-fg); }
.pip-R { background: var(--pip-r-bg); color: var(--pip-r-fg); }
.pip-G { background: var(--pip-g-bg); color: var(--pip-g-fg); }
.pip-C { background: var(--pip-c-bg); color: var(--pip-c-fg); }
.pip-N { background: var(--pip-num-bg); color: var(--pip-num-fg); }   /* numeral */
.mana-cost { display: inline-flex; gap: 2px; }

/* Role chip + specimen tag */
.role-chip {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2);
  background: var(--surface-sunken); border: 1px solid var(--border-soft);
  padding: 3px 7px; border-radius: var(--r-chip);
}
.spec-tag {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-3);
  background: var(--surface-sunken); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 5px; letter-spacing: .04em;
}
.count-pill {
  font-family: var(--font-mono); font-size: 11px; color: #fff;
  background: #A6B0BC; padding: 1px 8px; border-radius: var(--r-pill);
}
.format-pill {
  font-size: 11.5px; font-weight: 600; color: var(--accent-ink);
  background: var(--accent-tint); border: 1px solid var(--accent-tint-border);
  padding: 3px 9px; border-radius: var(--r-pill);
}

/* Label (mono uppercase) */
.label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3);
}
.kicker {
  font-family: var(--font-display); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3);
}

/* Brand lockup */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand .flask {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.brand .wordmark { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand.lg .flask { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 4px 12px rgba(14,156,142,.3); }
.brand.lg .wordmark { font-size: 19px; }

/* Field */
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; display: block; }
.field {
  width: 100%; height: 46px; border: 1px solid #D5DBE2; border-radius: var(--r-control);
  background: var(--surface-card); padding: 0 14px; font-family: var(--font-body);
  font-size: 14.5px; color: var(--ink); outline: none; transition: border-color .12s, box-shadow .12s;
}
.field::placeholder { color: var(--ink-3); }
.field:focus { border: 1.5px solid var(--accent); box-shadow: 0 0 0 3px rgba(14,156,142,.12); }
textarea.field { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.5; font-family: var(--font-mono); font-size: 13px; }

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 11px 18px; border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.28);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--status-over); }
.toast.ok { background: var(--accent); }

/* ============================ Landing / auth ============================ */
.landing { display: flex; min-height: 100vh; background: var(--surface-card); }
.landing-hero {
  flex: 1; position: relative; overflow: hidden; background: var(--surface-page);
  padding: 46px 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.landing-hero .dotgrid {
  position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(90deg,#E9ECEF 1px,transparent 1px),linear-gradient(#E9ECEF 1px,transparent 1px);
  background-size: 30px 30px;
}
.landing-hero .glow-teal {
  position: absolute; right: -120px; top: -80px; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(14,156,142,.16), rgba(14,156,142,0) 70%);
}
.landing-hero .glow-violet {
  position: absolute; right: 60px; bottom: -40px; width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(124,92,252,.10), rgba(124,92,252,0) 70%);
}
.landing-hero > * { position: relative; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px; background: var(--accent-tint);
  border: 1px solid var(--accent-tint-border); color: var(--accent-ink);
  font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: var(--r-pill); margin-bottom: 22px;
}
.hero-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.hero h1 { font-family: var(--font-display); font-size: 54px; line-height: 1.04; font-weight: 700; letter-spacing: -.02em; margin: 0 0 18px; max-width: 540px; }
.hero p { font-size: 17px; line-height: 1.6; color: var(--ink-2); max-width: 450px; margin: 0; }
.hero-stats { display: flex; gap: 28px; margin-top: 34px; }
.hero-stats .stat .n { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--accent-ink); }
.hero-stats .stat .l { font-size: 12.5px; color: var(--ink-3); }
.hero-stats .sep { width: 1px; background: var(--border); }
.fineprint { font-size: 12.5px; color: var(--ink-3); }
/* Deployed-build stamp (git sha) — confirms what's live. */
.build-stamp { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); letter-spacing: .02em; }
.fineprint .build-stamp::before { content: "· "; }
.sidebar .build-stamp { display: block; padding: 8px 12px 2px; }

/* Landing hero: copy column + decorative beaker engine, side by side. */
.hero { display: flex; align-items: center; justify-content: flex-start; gap: 28px; }
.hero-copy { flex: 0 1 440px; }
.hero h1 { font-size: 50px; line-height: 1.02; margin-bottom: 18px; }
.hero p { font-size: 16.5px; max-width: 400px; }
.hero-badge.violet { background: #EFEAFE; border-color: #D8CCFB; color: #5B3FD6; }
.hero-badge .ico { font-size: 13px; }
.hero-stats .stat .n.violet { color: #5B3FD6; }
/* AI hook chip (near-black with a green glyph). */
.ai-hook {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 20px;
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 600;
  padding: 11px 16px; border-radius: 11px; box-shadow: 0 8px 20px rgba(17,23,30,.22);
}
.ai-hook b { font-weight: 700; }
.ai-hook .ai-ico {
  width: 26px; height: 26px; border-radius: 7px; background: #34E07F; color: var(--ink);
  display: flex; align-items: center; justify-content: center; font-size: 13px; flex: 0 0 auto;
}

/* ---- Beaker engine (decorative) ---- */
.beaker-engine { flex: 0 0 248px; height: 380px; position: relative; }
.beaker-engine .bk-card {
  position: absolute; width: 64px; height: 89px; border-radius: 5px; overflow: hidden;
  background: #fff; box-shadow: 0 6px 14px rgba(17,23,30,.18);
  transform: rotate(var(--r));
  animation-name: mlBob; animation-timing-function: ease-in-out; animation-iteration-count: infinite;
}
.beaker-engine .bk-card.front { box-shadow: 0 8px 16px rgba(17,23,30,.22); z-index: 2; }
.beaker-engine .bk-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.beaker-engine .bk-steam {
  position: absolute; width: 14px; height: 22px; border-radius: 50%; filter: blur(3px);
  animation-name: mlSteam; animation-timing-function: ease-out; animation-iteration-count: infinite;
}
.beaker-engine .bk-flask { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); width: 182px; height: 212px; }
.beaker-engine .bk-liquid { position: absolute; inset: 0; overflow: hidden;
  clip-path: polygon(42% 2%, 58% 2%, 58% 26%, 99% 96%, 90% 100%, 10% 100%, 1% 96%, 42% 26%); }
.beaker-engine .bk-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 48%; background: linear-gradient(180deg,#3BD0B8,#0E9C8E); }
.beaker-engine .bk-surface { position: absolute; left: 0; right: 0; bottom: 46%; height: 14px; background: #46D8C0; border-radius: 50%; opacity: .7; }
.beaker-engine .bk-bubble { position: absolute; border-radius: 50%; background: rgba(255,255,255,.8);
  animation-name: mlBubble; animation-timing-function: ease-in; animation-iteration-count: infinite; }
.beaker-engine .bk-glass { position: absolute; inset: 0; }
.beaker-engine .bk-tag { position: absolute; right: -6px; top: 96px; font-size: 8px; color: var(--ink-3); }
.beaker-engine .bk-flame {
  position: absolute; left: 50%; bottom: -6px; width: 34px; height: 30px; transform: translateX(-50%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #A78BFA, #7C5CFC 60%, rgba(124,92,252,0) 75%);
  animation: mlFlame 1.3s ease-in-out infinite;
}
.beaker-engine .bk-output {
  position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
  background: #fff; border: 1px solid var(--accent-tint-border); box-shadow: 0 4px 12px rgba(14,156,142,.18);
  padding: 6px 11px; border-radius: var(--r-pill);
}
.beaker-engine .bk-output .mono { font-size: 10px; color: var(--accent-ink); font-weight: 600; }
.beaker-engine .bk-dot { width: 7px; height: 7px; border-radius: 50%; background: #34E07F; }

@keyframes mlBob   { 0%,100% { transform: translateY(0) rotate(var(--r)); } 50% { transform: translateY(-7px) rotate(var(--r)); } }
@keyframes mlSteam { 0% { transform: translateY(0) scale(.8); opacity: .6; } 100% { transform: translateY(-26px) scale(1.3); opacity: 0; } }
@keyframes mlBubble{ 0% { transform: translateY(0); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-46px); opacity: 0; } }
@keyframes mlFlame { 0%,100% { transform: translateX(-50%) scaleY(1); opacity: .9; } 50% { transform: translateX(-50%) scaleY(1.18); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .beaker-engine .bk-card, .beaker-engine .bk-steam, .beaker-engine .bk-bubble, .beaker-engine .bk-flame { animation: none; }
}
@media (max-width: 960px) {
  .hero { display: block; }
  .beaker-engine { display: none; }
}

.auth-panel { flex: 0 0 460px; border-left: 1px solid var(--border); padding: 0 56px; display: flex; flex-direction: column; justify-content: center; }
.auth-panel h2 { font-family: var(--font-display); font-size: 27px; font-weight: 700; margin: 0 0 26px; }
.btn-google {
  width: 100%; height: 46px; border: 1px solid #D5DBE2; background: var(--surface-card);
  border-radius: var(--r-control); font-size: 14.5px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-google:hover { background: var(--surface-sunken); }
.btn-google .g {
  width: 18px; height: 18px; border-radius: 50%;
  background: conic-gradient(#EA4335,#FBBC05,#34A853,#4285F4);
}
.or-divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; }
.or-divider .line { flex: 1; height: 1px; background: var(--border); }
.or-divider span { font-size: 12px; color: var(--ink-3); }
.auth-link { color: var(--accent-ink); font-weight: 700; cursor: pointer; }
.auth-msg { font-size: 13px; margin-top: 14px; min-height: 18px; }
.auth-msg.err { color: var(--status-over); }
.auth-msg.ok { color: var(--accent-ink); }

/* ============================ App shell ============================ */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  flex: 0 0 220px; background: var(--surface-card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px; overflow: hidden;
}
.sidebar .brand { padding: 0 8px 22px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-control-sm);
  color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer; transition: background .12s, color .12s;
}
.nav-item .glyph { font-size: 15px; width: 16px; text-align: center; }
.nav-item:hover { background: var(--surface-sunken); }
.nav-item.active { background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; }
.nav-group { margin-top: 18px; padding: 0 12px 8px; }
.shelf { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-control-sm); color: var(--ink-2); font-size: 14px; cursor: pointer; }
.shelf:hover { background: var(--surface-sunken); }
.shelf .sq { width: 9px; height: 9px; border-radius: 2px; }

/* ----- Two-register nav: Your Lab (teal) · The Distillery (violet) ----------- */
.nav-stack { display: flex; flex-direction: column; }
.nav-reg { display: flex; align-items: center; gap: 8px; margin: 18px 0 6px; padding: 0 12px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-3); }
.nav-reg:first-child { margin-top: 4px; }
.nav-reg .nav-reg-dot { width: 8px; height: 8px; border-radius: 2px; }
.nav-reg.lab .nav-reg-dot { background: var(--accent); }
.nav-reg.dist .nav-reg-dot { background: var(--status-off); }
/* per-register active tint (overrides the generic .nav-item.active) */
.nav-item.lab.active { background: var(--accent-tint); color: var(--accent-ink); }
.nav-item.dist.active { background: var(--status-off-tint); color: var(--status-off-ink); }
.nav-item .nav-new { margin-left: auto; font-family: var(--font-mono); font-size: 8.5px; font-weight: 700;
  letter-spacing: .06em; color: var(--status-off-ink); background: var(--status-off-tint);
  border: 1px solid var(--status-off-tint-border); border-radius: var(--r-pill); padding: 1px 6px; }

/* "Welcome to The Lab" kicker above the brew title on the workspace (#/lab/:id). */
.deckhead .lab-welcome { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 3px; }
/* User chip = a menu button (popover with account actions). The chevron + hover
   affordance signal it's clickable, so feedback/sign-out aren't hidden. */
.user-area { position: relative; margin-top: 4px; border-top: 1px solid var(--border-soft); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px 10px; cursor: pointer; border-radius: var(--r-control-sm); transition: background .12s; }
.user-chip:hover, .user-area.open .user-chip { background: var(--surface-sunken); }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg,var(--accent),var(--status-off)); flex: 0 0 auto; }
.user-chip .nm { font-size: 13px; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .pl { font-size: 11.5px; color: var(--ink-3); }
.user-chip .chev { margin-left: auto; flex: 0 0 auto; display: flex; color: var(--ink-3); transition: transform .15s; }
.user-area.open .user-chip .chev { transform: rotate(180deg); }

.user-menu { position: absolute; left: 6px; right: 6px; bottom: calc(100% + 6px); background: var(--surface-card);
  border: 1px solid var(--border); border-radius: 11px; box-shadow: 0 14px 36px rgba(16,23,30,.22); padding: 6px; display: none; z-index: 130; }
.user-area.open .user-menu { display: block; }
.user-menu .mhead { padding: 6px 9px 9px; margin-bottom: 4px; border-bottom: 1px solid var(--border-soft); }
.user-menu .mhead .mh-nm { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .mhead .mh-em { font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .mi { display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 7px; font-size: 13px; color: var(--ink); cursor: pointer; }
.user-menu .mi:hover { background: var(--surface-sunken); }
.user-menu .mi .ic { width: 16px; text-align: center; font-size: 13px; }
.user-menu .mi.danger:hover { color: var(--status-over); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* Top bar */
.topbar { flex: 0 0 66px; height: 66px; border-bottom: 1px solid var(--border); background: var(--surface-card); display: flex; align-items: center; padding: 0 26px; gap: 18px; }
.topbar h1 { font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.1; margin: 0; }
.topbar .sub { font-size: 12.5px; color: var(--ink-3); }
.searchbox {
  width: 280px; height: 38px; background: var(--surface-page); border: 1px solid var(--border);
  border-radius: var(--r-control); display: flex; align-items: center; gap: 9px; padding: 0 13px;
}
.searchbox input { border: none; background: transparent; outline: none; font-family: inherit; font-size: 13.5px; color: var(--ink); width: 100%; }
.searchbox input::placeholder { color: var(--ink-3); }
.searchbox .ic { color: var(--ink-3); }

/* ============================ Cabinet ============================ */
.filterbar { flex: 0 0 50px; height: 50px; border-bottom: 1px solid var(--border-soft); background: var(--surface-card); display: flex; align-items: center; padding: 0 26px; gap: 8px; }
.chip { font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--border); padding: 5px 11px; border-radius: var(--r-pill); cursor: pointer; }
.chip.active { color: var(--accent-ink); background: var(--accent-tint); border-color: var(--accent-tint-border); font-weight: 600; }
.vsep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
.swatch-row { display: flex; gap: 5px; }
.swatch { width: 20px; height: 20px; border-radius: 50%; cursor: pointer; transition: box-shadow .12s, opacity .12s; }
.swatch.off { opacity: .35; }
.swatch.on { box-shadow: 0 0 0 2px var(--accent); }
.sortmenu { position: relative; font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.sortmenu b { color: var(--ink); }
.sortmenu .caret { color: var(--ink-3); transition: transform .12s; }
.sortmenu.open .caret { transform: rotate(180deg); }
.sortdrop { position: absolute; top: calc(100% + 6px); right: 0; min-width: 168px; background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--r-card-sm); box-shadow: 0 8px 24px rgba(16,23,30,.12); padding: 4px; z-index: 60; display: none; }
.sortmenu.open .sortdrop { display: block; }
.sortdrop .opt { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 10px; border-radius: 6px; color: var(--ink-2); }
.sortdrop .opt:hover { background: rgba(17,23,30,.05); color: var(--ink); }
.sortdrop .opt.sel { color: var(--ink); font-weight: 600; }
.sortdrop .opt.sel::after { content: "✓"; color: var(--accent); font-size: 11px; }

.scroll { flex: 1; overflow-y: auto; }
.cabinet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; padding: 22px 26px; }

.deck-card { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--r-card-sm); overflow: hidden; box-shadow: var(--shadow-card-sm); cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
/* Commander art fills the band, behind the pips/spec overlay (z-index:1 on .band > *). */
.deck-card .band .band-art { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.deck-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16,23,30,.1); border-color: #D8DDE3; }
.deck-card .band { height: 170px; position: relative; display: flex; align-items: flex-start; justify-content: space-between; padding: 11px 13px; }
.deck-card .band > * { position: relative; z-index: 1; }
.deck-card .band.has-art::after { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(180deg, rgba(10,14,18,.15) 0%, rgba(10,14,18,.45) 100%); }
.deck-card .band .spec { font-family: var(--font-mono); font-size: 9.5px; color: rgba(17,23,30,.45); background: rgba(255,255,255,.7); border: 1px solid rgba(17,23,30,.08); padding: 2px 6px; border-radius: 5px; letter-spacing: .06em; }
/* public/private toggle (top-right of the band, replaces the old SPEC tag) */
.deck-card .band .deck-vis { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; letter-spacing: .03em; padding: 3px 8px; border-radius: 999px; border: 1px solid rgba(17,23,30,.1); background: rgba(255,255,255,.78); color: var(--ink-2); cursor: pointer; }
.deck-card .band .deck-vis.is-public { color: var(--accent-ink); background: var(--accent-tint); border-color: var(--accent-tint-border); }
.deck-card .band.has-art .deck-vis { background: rgba(10,14,18,.5); color: #fff; border-color: rgba(255,255,255,.2); }
.deck-card .band.has-art .deck-vis.is-public { background: rgba(14,156,142,.6); color: #fff; border-color: rgba(255,255,255,.25); }
.deck-card .band .deck-vis:disabled { opacity: .6; cursor: default; }
/* hover delete button (bottom-right of the band) */
.deck-card .band .deck-del { position: absolute; bottom: 8px; right: 8px; z-index: 3; width: 26px; height: 26px; border: none; border-radius: 7px; background: rgba(10,14,18,.55); color: #fff; display: none; align-items: center; justify-content: center; cursor: pointer; }
.deck-card:hover .band .deck-del { display: flex; }
.deck-card .band .deck-del:hover { background: var(--status-over); }
.deck-card .band .deck-del:disabled { opacity: .5; cursor: default; }
/* "by <author>" badge on public covers — bottom-right of the band, over the art. */
.deck-card .band .deck-author { position: absolute; bottom: 8px; right: 8px; z-index: 3; max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; letter-spacing: .02em; padding: 3px 8px; border-radius: 999px; background: rgba(10,14,18,.55); color: #fff; border: 1px solid rgba(255,255,255,.18); }
.deck-card .band:not(.has-art) .deck-author { background: rgba(255,255,255,.82); color: var(--ink-2); border-color: rgba(17,23,30,.1); }
/* Engine-readiness beaker (deck not 100% playable yet) — bottom-left of the band. */
.deck-card .band .band-tr { display: flex; align-items: center; gap: 6px; }
.deck-card .band .deck-proc { flex: 0 0 auto; z-index: 2; height: 20px; display: inline-flex; align-items: center; gap: 3px; padding: 0 7px 0 5px; background: linear-gradient(135deg, var(--accent), #0b6f64); border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: default; animation: procPulse 2.4s ease-in-out infinite; }
.deck-card .band .deck-proc svg { display: block; }
.deck-card .band .deck-proc .proc-pct { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: #fff; line-height: 1; }
/* read-only bench (viewing someone else's public deck) */
.ro-banner { font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.benchwrap.readonly .stepper, .benchwrap.readonly #open-add, .benchwrap.readonly .add-panel { display: none !important; }
/* public-decks browse header + copy button */
.pub-head { display: flex; align-items: center; gap: 12px; padding: 16px 26px 10px; }
.pub-head .pub-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.pub-copy { font-size: 11px; font-weight: 600; color: var(--accent-ink); background: var(--accent-tint); border: 1px solid var(--accent-tint-border); border-radius: 7px; padding: 4px 10px; cursor: pointer; white-space: nowrap; }
.pub-copy:hover { filter: brightness(.97); }
.pub-copy:disabled { opacity: .6; cursor: default; }
.deck-card .band.has-art .spec { color: rgba(255,255,255,.85); background: rgba(10,14,18,.45); border-color: rgba(255,255,255,.18); }
.deck-card .body { padding: 13px 15px 15px; }
.deck-card .title { font-family: var(--font-display); font-size: 16px; font-weight: 700; line-height: 1.15; }
.deck-card .commander { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-card .statrow { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border-soft); }
.deck-card .statrow .mono { font-size: 12px; font-weight: 600; }
.deck-card .statrow .lbl { font-size: 11.5px; color: var(--ink-3); }
.deck-card .roles { display: flex; gap: 6px; margin-top: 10px; }

/* favorite star */
.fav { color: var(--ink-3); font-size: 15px; line-height: 1; background: none; border: none; padding: 0 2px; cursor: pointer; transition: color .1s, transform .1s; }
.fav:hover { color: #e8b53d; transform: scale(1.12); }
.fav.on { color: #e8b53d; }
/* Brews-page favorite star (per deck card) + favorites/all segmentation */
.deck-card .band .deck-fav { flex: 0 0 auto; width: 22px; height: 22px; border: none; border-radius: 999px; background: rgba(255,255,255,.78); color: var(--ink-3); font-size: 13px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.deck-card .band.has-art .deck-fav { background: rgba(10,14,18,.5); color: rgba(255,255,255,.72); }
.deck-card .band .deck-fav.on, .deck-card .band .deck-fav:hover { color: #e8b53d; }
.deck-section + .deck-section { margin-top: 20px; }
.deck-section-h { font-family: var(--font-display); font-size: 12.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-3); margin: 2px 2px 12px; }

/* Empty states */
.empty { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
.empty .inner { text-align: center; max-width: 450px; }
.empty .icon { width: 120px; height: 120px; margin: 0 auto 26px; display: flex; align-items: center; justify-content: center; background: var(--accent-tint); border: 1px solid var(--accent-tint-border); border-radius: 20px; }
.empty h2 { font-family: var(--font-display); font-size: 25px; font-weight: 700; margin: 0 0 10px; }
.empty p { font-size: 15px; line-height: 1.6; color: var(--ink-2); margin: 0 0 26px; }
.empty .ctas { display: flex; gap: 12px; justify-content: center; }
.empty .hints { margin-top: 30px; display: flex; gap: 18px; justify-content: center; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }

/* center spinner */
.center-msg { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 14px; gap: 10px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ Bench ============================ */
.benchwrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.breadcrumb { flex: 0 0 52px; height: 52px; background: var(--surface-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 22px; gap: 12px; }
.breadcrumb .back { color: var(--ink-2); font-size: 16px; cursor: pointer; }
.breadcrumb .crumb { font-size: 13px; color: var(--ink-3); cursor: pointer; }
.breadcrumb .crumb.here { color: var(--ink); font-weight: 600; cursor: default; }
.breadcrumb .slash { font-size: 13px; color: var(--ink-dim); }

.deckhead { flex: 0 0 auto; background: var(--surface-card); border-bottom: 1px solid var(--border); padding: 18px 22px; display: flex; align-items: center; gap: 18px; }
.deckhead .idtile { position: relative; overflow: hidden; width: 60px; height: 60px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); flex: 0 0 auto; }
/* Commander cover art fills the tile (over the colour tint, which shows if art 404s). */
.deckhead .idtile .idtile-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.deckhead .meta { flex: 1; min-width: 0; }
.deckhead .meta .titlerow { display: flex; align-items: center; gap: 10px; }
/* Colour-identity pips beside the deck name; hover shows the combo name (e.g. Bant). */
.deckhead .id-pips { display: inline-flex; align-items: center; gap: 4px; cursor: default; }
.deckhead .id-pips .pip { width: 19px; height: 19px; }
/* Fast custom tooltip — replaces the slow (~1s, browser-fixed) native `title` delay.
   Sits below the element with a short reveal delay; keep labels short (no wrap). */
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; top: calc(100% + 7px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0; z-index: 100; box-shadow: 0 4px 12px rgba(16,23,30,.25); transition: opacity .1s ease; }
[data-tip]:hover::after { opacity: 1; transition-delay: .15s; }
.deckhead h1 { font-family: var(--font-display); font-size: 25px; font-weight: 700; margin: 0; }
.deckhead h1.editable { cursor: text; border-radius: 6px; padding: 0 4px; margin: 0 -4px; }
.deckhead h1.editable:hover { background: var(--surface-sunken); }
.deckhead .subline { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; }
.deckhead .subline b.editable { cursor: text; border-radius: 5px; padding: 0 4px; margin: 0 -4px; min-width: 12px; display: inline-block; }
.deckhead .subline b.editable:hover, .deckhead .subline b.editable:focus { background: var(--surface-sunken); outline: none; }
.deckhead .subline .cmd-hint { color: var(--ink-3); font-style: italic; font-size: 12px; }
.deckhead .stats { display: flex; gap: 22px; padding-right: 8px; }
.deckhead .stats .st { text-align: right; }
.deckhead .stats .st .n { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.deckhead .stats .st .n.teal { color: var(--accent-ink); }
.deckhead .stats .st .l { font-size: 11px; color: var(--ink-3); }

.tabbar { flex: 0 0 50px; height: 50px; background: var(--surface-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 22px; gap: 4px; }
.tab { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--ink-2); padding: 14px 14px; cursor: pointer; display: flex; align-items: center; gap: 6px; border-bottom: 2.5px solid transparent; margin-bottom: -1px; }
.tab:first-of-type { padding-left: 4px; }
.tab.active { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.tab .tri { color: var(--accent); }

.viewswitch { display: flex; background: var(--surface-page); border: 1px solid var(--border); border-radius: var(--r-control-sm); padding: 3px; gap: 2px; }
.viewswitch .vs { width: 30px; height: 28px; border-radius: var(--r-chip); display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 13px; cursor: pointer; }
.viewswitch .vs.active { background: var(--surface-card); box-shadow: 0 1px 2px rgba(0,0,0,.08); color: var(--accent-ink); }

/* Bench body: filter rail + grid */
.benchbody { flex: 1; display: flex; overflow: hidden; }
.filter-rail { flex: 0 0 226px; background: var(--surface-card); border-right: 1px solid var(--border); padding: 18px; overflow-y: auto; }
.filter-rail .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.filter-rail .head .t { font-family: var(--font-display); font-size: 13px; font-weight: 700; }
.filter-rail .head .clear { font-size: 11.5px; color: var(--accent-ink); font-weight: 600; cursor: pointer; }
.mini-search { height: 34px; background: var(--surface-page); border: 1px solid var(--border); border-radius: var(--r-control-sm); display: flex; align-items: center; gap: 8px; padding: 0 11px; margin-bottom: 18px; }
.mini-search input { border: none; background: transparent; outline: none; font-family: inherit; font-size: 12.5px; width: 100%; color: var(--ink); }
.mini-search .ic { color: var(--ink-3); }
.checkrow { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink); cursor: pointer; padding: 1px 0; }
.checkbox { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid #C8CFD7; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.checkrow.on .checkbox { background: var(--accent); border-color: var(--accent); color: #fff; font-size: 10px; }
.checkrow .ct { margin-left: auto; color: var(--ink-3); font-family: var(--font-mono); }
/* Deck-specific tags in the Tag filter read in the deck colour (matches their chips). */
.tag-filters .checkrow.deck { color: var(--deck-c, #5B3FD6); }
.tag-filters .checkrow.deck.on .checkbox { background: var(--deck-c, #5B3FD6); border-color: var(--deck-c, #5B3FD6); }
.rail-curve { display: flex; align-items: flex-end; gap: 4px; height: 48px; margin-bottom: 8px; background: repeating-linear-gradient(to top,#EEF1F3 0 1px,transparent 1px 12px); border-bottom: 1px solid var(--border); }
.rail-curve .bar { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .85; min-height: 0; }
.color-pip-row { display: flex; gap: 7px; }
.color-pip-row .pip { cursor: pointer; transition: opacity .12s, box-shadow .12s; }
.color-pip-row .pip.off { opacity: .4; box-shadow: none; }
.color-pip-row .pip.on { box-shadow: 0 0 0 2px var(--accent); }

.cards-area { flex: 1; overflow-y: auto; padding: 20px 22px; background: var(--surface-page); }
.type-group { margin-bottom: 20px; }
.type-group .gh { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.type-group .gh .gt { font-family: var(--font-display); font-size: 14px; font-weight: 700; }
.type-group .gh .rule { flex: 1; height: 1px; background: var(--border); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; align-items: start; }

/* Full Magic card image (Scryfall), with tag chips beneath. */
.mini-card { position: relative; display: flex; flex-direction: column; gap: 7px; }
.mini-card .mc-frame {
  position: relative; aspect-ratio: 488 / 680; border-radius: 4.8% / 3.5%;
  overflow: hidden; box-shadow: 0 2px 8px rgba(16,23,30,.18);
  transition: transform .1s, box-shadow .1s;
}
.mini-card:hover .mc-frame { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(16,23,30,.26); }
.mini-card .mc-img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Fallback name plate when a card has no image / fails to load. */
.mini-card .mc-fallback { display: none; }
.mini-card .mc-frame.noimg .mc-img { display: none; }
.mini-card .mc-frame.noimg .mc-fallback {
  display: flex; position: absolute; inset: 0; align-items: center; justify-content: center;
  text-align: center; padding: 10px; font-family: var(--font-display); font-weight: 600;
  font-size: 12px; color: rgba(17,23,30,.6);
}
.mini-card .qty-badge { position: absolute; bottom: 7px; right: 7px; background: rgba(10,14,18,.82); color: #fff; font-family: var(--font-mono); font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 6px; z-index: 2; }
.mini-card .cmd-badge { position: absolute; bottom: 7px; left: 7px; background: var(--accent); color: #fff; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; z-index: 2; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
/* "Still being brewed by the lab assistant" — engine not done processing this card yet. */
.mini-card .proc-badge { position: absolute; top: 7px; left: 7px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent), #0b6f64); border-radius: 50%; z-index: 3; box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: default; animation: procPulse 2.4s ease-in-out infinite; }
.mini-card .proc-badge svg { display: block; }
@keyframes procPulse { 0%, 100% { transform: scale(1); opacity: .92; } 50% { transform: scale(1.08); opacity: 1; } }
/* Peer-review button while the lab assistant is still processing the deck. */
.btn.is-brewing { opacity: .9; cursor: default; }
.btn.is-brewing .brew-spin { display: inline-flex; animation: brewBob 1.8s ease-in-out infinite; }
@keyframes brewBob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-2px) rotate(6deg); } }
/* Tags under the card */
.mini-card .mc-tags { display: flex; flex-wrap: wrap; gap: 4px; }
/* Shared tag-chip style (Lab + Shelf). `.tag-deck` tints to the deck's identity
   colour via --deck-c, set on the containing element. */
.tag { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-2); background: var(--surface-sunken); border: 1px solid var(--border-soft); padding: 2px 6px; border-radius: var(--r-chip); white-space: nowrap; display: inline-block; }
.tag-gc { color: #8A6D0B; background: #FBF3D6; border-color: #EAD89A; font-weight: 600; }
.tag-deck { font-weight: 600; color: var(--deck-c, #5B3FD6);
  background: color-mix(in srgb, var(--deck-c, #5B3FD6) 12%, #fff);
  border-color: color-mix(in srgb, var(--deck-c, #5B3FD6) 38%, transparent); }
/* hover edit affordances (editor mode) */
.mini-card .stepper { position: absolute; top: 6px; right: 6px; display: none; gap: 3px; z-index: 2; }
.editor .mini-card:hover .stepper { display: flex; }
.stepper button { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-card); color: var(--ink-2); font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.stepper button:hover { background: var(--surface-sunken); color: var(--ink); }
.stepper button.rm:hover { color: var(--status-over); border-color: var(--status-over); }


/* List view */
.list-rows { display: flex; flex-direction: column; gap: 5px; }
.list-row { display: flex; align-items: center; gap: 11px; background: var(--surface-card); border: 1px solid var(--border-soft); border-radius: var(--r-control-sm); padding: 7px 12px; position: relative; }
.list-row:hover { border-color: #D8DDE3; }
.list-row .lr-name { font-family: var(--font-display); font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .lr-qty { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

/* Table view */
.tbl { width: 100%; background: var(--surface-card); }
.tbl .thead, .tbl .trow { display: flex; align-items: center; padding: 0 24px; }
.tbl .thead { height: 38px; border-bottom: 1.5px solid var(--border); background: #FAFBFC; position: sticky; top: 0; z-index: 1; }
.tbl .th { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; color: var(--ink-3); cursor: pointer; user-select: none; }
.tbl .trow { height: 36px; border-bottom: 1px solid var(--surface-sunken); }
.tbl .trow:hover { background: #FAFBFC; }
.col-name { flex: 1; min-width: 0; }
.col-name .nm { font-family: var(--font-display); font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-cost { width: 96px; flex: 0 0 auto; display: flex; gap: 2px; }
.col-type { width: 160px; flex: 0 0 auto; font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-mv { width: 48px; flex: 0 0 auto; text-align: right; font-family: var(--font-mono); font-size: 12.5px; color: var(--accent-ink); font-weight: 600; }
.col-role { width: 130px; flex: 0 0 auto; padding-left: 18px; }
.col-price { width: 74px; flex: 0 0 auto; text-align: right; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); }
.tbl .th.col-mv, .tbl .th.col-price { text-align: right; }

/* ============================ The Readout ============================ */
.readout { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.kpi-row { display: flex; gap: 14px; }
.kpi { flex: 1; background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--r-card-sm); padding: 14px 16px; }
.kpi .n { font-family: var(--font-display); font-size: 26px; font-weight: 700; margin-top: 2px; }
.kpi .n.teal { color: var(--accent-ink); }
.kpi .n.violet { color: var(--status-off); }
.kpi .note { font-size: 11.5px; color: var(--ink-2); }
.kpi .note.ok { color: var(--status-ok); }
.kpi .note.violet { color: var(--status-off); }

.ro-row { display: flex; gap: 14px; }
.panel { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--r-card-sm); padding: 16px 18px; }
.panel .ph { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel .ph .t { font-family: var(--font-display); font-size: 14px; font-weight: 700; }
.panel .ph .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

/* Spectrum curve */
.curve { display: flex; align-items: flex-end; gap: 10px; height: 172px; background: repeating-linear-gradient(to top,#EEF1F3 0 1px,transparent 1px 28px); border-bottom: 1.5px solid #D5DBE2; padding-top: 4px; }
.curve .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.curve .col .cn { font-family: var(--font-mono); font-size: 11px; color: var(--ink); font-weight: 600; }
.curve .col .bar { width: 100%; max-width: 42px; background: linear-gradient(180deg, var(--spectrum-from), var(--spectrum-to)); border-radius: 3px 3px 0 0; min-height: 2px; }
.curve-labels { display: flex; gap: 10px; margin-top: 6px; }
.curve-labels span { flex: 1; text-align: center; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

/* Color balance */
.color-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin-bottom: 18px; }
.color-legend { display: flex; flex-direction: column; gap: 11px; }
.color-legend .lg { display: flex; align-items: center; gap: 10px; }
.color-legend .lg .sw { width: 14px; height: 14px; border-radius: 50%; }
.color-legend .lg .nm { font-size: 13px; flex: 1; }
.color-legend .lg .n { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
.color-legend .lg .pct { font-family: var(--font-mono); font-size: 12px; font-weight: 600; width: 34px; text-align: right; }

/* Assay */
.assay { flex: 1.55; background: var(--surface-card); border: 1px solid var(--accent-tint-border); border-radius: var(--r-card-sm); overflow: hidden; display: flex; flex-direction: column; }
.assay .ah { padding: 14px 18px; background: var(--accent-tint); border-bottom: 1px solid var(--accent-tint-border); display: flex; align-items: center; gap: 10px; }
.assay .ah .t { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--accent-ink); }
.assay .ah .sub { font-size: 11.5px; color: var(--accent-ink); }
.assay .ah .flag { font-family: var(--font-mono); font-size: 10.5px; color: var(--status-off); background: var(--status-off-tint); border: 1px solid var(--status-off-tint-border); padding: 3px 9px; border-radius: var(--r-pill); }
.assay .arows { padding: 6px 18px; overflow-y: auto; }
.assay-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid #F1F3F5; }
.assay-row .lbl { font-size: 13px; color: var(--ink); font-weight: 500; width: 130px; flex: 0 0 auto; }
.assay-row .n { font-family: var(--font-display); font-size: 17px; font-weight: 700; width: 26px; flex: 0 0 auto; text-align: right; }
.assay-row .track { flex: 1; height: 7px; background: #F1F3F5; border-radius: 4px; overflow: hidden; }
.assay-row .track .fill { height: 100%; border-radius: 4px; }
.assay-row .range { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); width: 42px; flex: 0 0 auto; text-align: right; }
.assay-row .stat { font-family: var(--font-mono); font-size: 10px; font-weight: 600; width: 96px; flex: 0 0 auto; text-align: right; }
/* "Your tags" — custom tags grouped, collapsible, no target range */
.assay-grp { margin-top: 4px; border-top: 1px dashed var(--accent-tint-border); }
.assay-grp-h { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px 0; background: none; border: none; cursor: pointer; text-align: left; font: inherit; }
.assay-grp-h .chev { font-size: 10px; color: var(--ink-3); transition: transform .12s ease; }
.assay-grp.open .assay-grp-h .chev { transform: rotate(90deg); }
.assay-grp-h .gl { font-size: 13px; font-weight: 600; color: var(--ink); }
.assay-grp-h .gs { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
.assay-grp-rows { display: none; }
.assay-grp.open .assay-grp-rows { display: block; }
.assay-grp-rows .assay-row:last-child { border-bottom: none; }

/* Type distribution */
.typedist { flex: 1; }
.typedist .row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.typedist .row .lbl { font-size: 12px; color: var(--ink-2); width: 92px; flex: 0 0 auto; }
.typedist .row .track { flex: 1; height: 9px; background: #F1F3F5; border-radius: 5px; overflow: hidden; }
.typedist .row .track .fill { height: 100%; background: #A6B0BC; border-radius: 5px; }
.typedist .row .n { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink); font-weight: 600; width: 22px; text-align: right; }

/* ============================ Persistent Readout rail (variation C) ============================ */
.live-rail { flex: 0 0 300px; background: var(--surface-card); border-left: 1px solid var(--border); padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.live-rail .lh { display: flex; align-items: center; gap: 8px; }
.live-rail .lh .t { font-family: var(--font-display); font-size: 14px; font-weight: 700; }
.live-rail .mini-curve { display: flex; align-items: flex-end; gap: 5px; height: 74px; background: repeating-linear-gradient(to top,#EEF1F3 0 1px,transparent 1px 18px); border-bottom: 1px solid var(--border); }
.live-rail .mini-curve .bar { flex: 1; background: linear-gradient(180deg,var(--spectrum-from),var(--spectrum-to)); border-radius: 2px 2px 0 0; min-height: 1px; }
.live-rail .roles-list { display: flex; flex-direction: column; gap: 9px; }
.live-rail .roles-list .r { display: flex; align-items: center; gap: 9px; }
.live-rail .roles-list .r .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.live-rail .roles-list .r .nm { font-size: 12px; flex: 1; }
.live-rail .roles-list .r .n { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; }
.live-rail .roles-list .r .rg { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); width: 36px; text-align: right; }
.violet-callout { background: var(--status-off-tint); border: 1px solid var(--status-off-tint-border); border-radius: var(--r-control-sm); padding: 10px 12px; }
.violet-callout .t { font-size: 12px; color: var(--status-off-ink); font-weight: 600; }
.violet-callout .d { font-size: 11.5px; color: var(--status-off); margin-top: 2px; }

/* ============================ Editor: add-cards panel ============================ */
.add-panel { flex: 0 0 300px; background: var(--surface-card); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.add-panel .aph { padding: 16px 18px 12px; border-bottom: 1px solid var(--border-soft); }
.add-panel .aph .t { font-family: var(--font-display); font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.add-panel .aph .close { color: var(--ink-3); cursor: pointer; font-size: 16px; }
.add-results { flex: 1; overflow-y: auto; padding: 8px 12px; }
.add-result { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: var(--r-control-sm); cursor: default; }
.add-result:hover { background: var(--surface-sunken); }
.add-result .ar-name { font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-result .ar-type { font-size: 11px; color: var(--ink-3); }
.add-result .plus { width: 24px; height: 24px; border-radius: 6px; background: var(--accent-tint); color: var(--accent-ink); border: 1px solid var(--accent-tint-border); display: flex; align-items: center; justify-content: center; font-size: 15px; cursor: pointer; flex: 0 0 auto; }
.add-result .plus:hover { background: var(--accent); color: #fff; }
.add-result.active { background: var(--surface-sunken); }   /* keyboard ↑/↓ highlight */
.cp-msg { padding: 20px; color: var(--ink-3); font-size: 12.5px; text-align: center; }

/* Commander picker — a card-lookup popover replacing free-text entry. */
.cmd-field { position: relative; display: inline-block; }
.cmd-name { font: inherit; font-weight: 700; color: var(--ink); background: none; border: none; border-bottom: 1px dashed transparent; cursor: pointer; padding: 0; }
.cmd-name:hover { border-bottom-color: var(--accent); color: var(--accent-ink); }
.cmd-name.empty { font-weight: 500; font-style: italic; color: var(--ink-3); }
.cmd-pop { position: absolute; top: calc(100% + 8px); left: 0; width: 320px; max-width: 86vw; background: var(--surface-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,23,30,.18); padding: 14px; z-index: 90; display: none; }
.cmd-pop.open { display: block; }
.cmdp-head { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.cmdp-hint { font-weight: 400; color: var(--ink-3); font-size: 11px; }
.cmdp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cmdp-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: var(--r-pill); background: var(--accent-tint); color: var(--accent-ink); border: 1px solid var(--accent-tint-border); }
.cmdp-chip .x { cursor: pointer; opacity: .6; font-weight: 700; }
.cmdp-chip .x:hover { opacity: 1; }
.cmdp-empty { font-size: 12.5px; color: var(--ink-3); }
.cmdp-search { margin-bottom: 6px !important; }
.cmdp-results { max-height: 260px; overflow-y: auto; padding: 2px 0; }
.cmdp-foot { font-size: 11px; color: var(--ink-3); }

/* save indicator */
.save-state { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.save-state .sdot { width: 6px; height: 6px; border-radius: 50%; background: var(--status-ok); }
.save-state.saving .sdot { background: var(--ink-3); }

/* ============================ Boilerplate ============================ */
.boiler { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; background: var(--surface-sunken); }
.boiler .labgrid { position: absolute; inset: 0; background-image: linear-gradient(#E5E9ED 1px,transparent 1px),linear-gradient(90deg,#E5E9ED 1px,transparent 1px); background-size: 26px 26px; opacity: .55; pointer-events: none; }
.boiler .bbody { flex: 1; overflow-y: auto; padding: 30px 40px; position: relative; }
.boiler h1 { font-family: var(--font-display); font-size: 29px; font-weight: 700; margin: 0 0 4px; }
.boiler .lead { font-size: 14.5px; color: var(--ink-2); margin: 0 0 24px; }
.boiler .cols { display: flex; gap: 26px; align-items: flex-start; }
.boiler .left { flex: 0 0 290px; display: flex; flex-direction: column; gap: 20px; }
.boiler .right { flex: 1; min-width: 0; }
.specimen { background: var(--surface-card); border: 1.5px solid var(--accent); border-radius: 12px; padding: 18px; box-shadow: var(--ring-teal); }
.specimen .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.specimen .nm { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.specimen .cmd { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.specimen .stats { display: flex; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.specimen .stats .n { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--accent-ink); }
.specimen .stats .l { font-size: 10.5px; color: var(--ink-3); }
.specimen .change { font-size: 12px; color: var(--accent-ink); font-weight: 600; margin-top: 12px; cursor: pointer; }

.radio-row { display: flex; align-items: center; gap: 11px; background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--r-control); padding: 11px 14px; cursor: pointer; }
.radio-row.on { border: 1.5px solid var(--accent); box-shadow: 0 0 0 3px rgba(14,156,142,.1); }
.radio-row .radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #C8CFD7; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.radio-row.on .radio { border-color: var(--accent); }
.radio-row.on .radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.radio-row .rl { font-size: 14px; flex: 1; color: var(--ink-2); }
.radio-row.on .rl { color: var(--ink); font-weight: 600; }
.radio-row .seats { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.mini-field { flex: 1; background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--r-control); padding: 10px 12px; }
.mini-field .n { font-family: var(--font-display); font-size: 16px; font-weight: 700; margin-top: 2px; }

.opp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.opp-card { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--r-card-sm); padding: 16px; position: relative; cursor: pointer; transition: border-color .12s; }
.opp-card:hover { border-color: #D8DDE3; }
.opp-card.on { border: 1.5px solid var(--accent); box-shadow: var(--ring-teal); }
.opp-card .check { position: absolute; top: 13px; right: 13px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: none; align-items: center; justify-content: center; }
.opp-card.on .check { display: flex; }
.opp-card .pips { display: flex; gap: 4px; margin-bottom: 11px; }
.opp-card .onm { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.opp-card .arch { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.opp-card .opp-taunt { font-size: 12px; font-style: italic; color: var(--ink-3); margin-top: 8px; line-height: 1.35; }
.intensity { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.intensity .segs { display: flex; gap: 3px; flex: 1; }
.intensity .segs span { height: 5px; flex: 1; border-radius: 3px; background: #E2E6EA; }
.intensity .word { font-size: 11px; color: var(--ink-2); font-weight: 600; }
.boiler-foot { display: flex; align-items: center; gap: 14px; padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--border); }
.boiler-foot .note { font-size: 12px; color: var(--ink-3); }

/* ============================ Reagents / Journal ============================ */
.page-pad { flex: 1; overflow-y: auto; padding: 26px; }
.reagent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 18px; }
.reagent-card { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--r-control); padding: 12px 14px; box-shadow: var(--shadow-card-sm); }
.reagent-card .rn { font-family: var(--font-display); font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.reagent-card .rt { font-size: 11.5px; color: var(--ink-2); margin-top: 4px; }
.reagent-card .rb { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-soft); }

/* The Ingredients — Scryfall library search */
.ing-search { width: 440px; max-width: 46vw; }
.ing-controls { display: flex; align-items: center; gap: 14px; padding: 12px 24px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.ing-ctl { font-size: 12px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 7px; }
.ing-ctl select { font-family: inherit; font-size: 12.5px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--r-control-sm); background: var(--surface-card); color: var(--ink); cursor: pointer; }
.ing-unique { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-control-sm); overflow: hidden; }
.ing-unique button { font-family: inherit; font-size: 12px; padding: 5px 11px; background: var(--surface-card); color: var(--ink-2); border: none; cursor: pointer; }
.ing-unique button.on { background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; }
.ing-count { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.ing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 16px; margin-top: 4px; }
.ing-card { position: relative; aspect-ratio: 5 / 7; border: none; padding: 0; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface-sunken); box-shadow: 0 1px 3px rgba(16,23,30,.12); transition: transform .1s ease, box-shadow .1s ease; }
.ing-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(16,23,30,.18); }
/* Corner action buttons (+, ✓, ◷) stay hidden until hover/focus so they never cover the
   card's printed mana cost; in-deck / considering status reads as a coloured border. */
.ing-card .ing-add { opacity: 0; transition: opacity .12s ease, background .1s ease; }
.ing-card:hover .ing-add, .ing-card:focus-within .ing-add { opacity: 1; }
.ing-card.in-deck { box-shadow: 0 0 0 2.5px var(--deck-c, var(--accent)), 0 1px 3px rgba(16,23,30,.12); }
.ing-card.in-deck:hover { box-shadow: 0 0 0 2.5px var(--deck-c, var(--accent)), 0 8px 20px rgba(16,23,30,.18); }
.ing-card.in-cons { box-shadow: 0 0 0 2.5px #E0922F, 0 1px 3px rgba(16,23,30,.12); }
.ing-card.in-cons:hover { box-shadow: 0 0 0 2.5px #E0922F, 0 8px 20px rgba(16,23,30,.18); }
.ing-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ing-card.noimg .ing-img { display: none; }
.ing-fallback { display: none; }
.ing-card.noimg .ing-fallback { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); text-align: center; }
.ing-more { display: flex; justify-content: center; padding: 24px 0 6px; }
.ing-msg { padding: 30px 4px; font-size: 14px; color: var(--ink-3); }
.ing-msg.err { color: var(--status-off); }
.ing-hint { color: var(--ink-3); font-size: 13.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ing-examples { margin-top: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }
.ing-eg { font-family: var(--font-mono); font-size: 12px; padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface-card); color: var(--accent-ink); cursor: pointer; }
.ing-eg:hover { background: var(--accent-tint); border-color: var(--accent-tint-border); }
.ing-syntax { display: inline-block; margin-top: 16px; font-size: 12.5px; color: var(--accent-ink); }
.ing-attrib { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--border-soft); font-size: 11px; color: var(--ink-3); line-height: 1.5; }
.ing-attrib a { color: var(--ink-2); }
/* "Adding to" brew picker + per-card add button */
.ing-brew select { font-weight: 600; min-width: 168px; }
.ing-divider { width: 1px; height: 20px; background: var(--border); }
.ing-add { position: absolute; top: 7px; right: 7px; width: 28px; height: 28px; border-radius: 8px; border: none; background: var(--accent); color: #fff; font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(16,23,30,.35); }
.ing-add:hover { background: var(--accent-ink); }
.ing-add.in { background: rgba(255,255,255,.95); color: var(--accent-ink); box-shadow: 0 1px 4px rgba(16,23,30,.25); }
.ing-add.in .c-off { display: none; }
.ing-add.in:hover { background: var(--status-off); color: #fff; }
.ing-add.in:hover .c-on { display: none; }
.ing-add.in:hover .c-off { display: inline; }
/* EDHREC popularity badge (shown once a brew/commander is selected) */
.ing-edh { position: absolute; left: 7px; bottom: 7px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 7px; background: rgba(16,23,30,.82); color: #fff; box-shadow: 0 1px 4px rgba(16,23,30,.3); }
/* Saved searches popover */
.ing-saved { position: relative; }
.ing-saved-pop { position: absolute; top: calc(100% + 8px); right: 0; width: 320px; max-width: 86vw; background: var(--surface-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,23,30,.18); padding: 14px; z-index: 90; display: none; }
.ing-saved-pop.open { display: block; }
.ssp-head { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.ssp-sub { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); margin: 12px 0 6px; }
.ssp-hint { font-weight: 400; color: var(--ink-3); font-size: 11px; }
.ssp-save { width: 100%; padding: 8px; border: 1px dashed var(--border); border-radius: 8px; background: var(--surface-sunken); font-family: inherit; font-size: 12.5px; color: var(--accent-ink); cursor: pointer; margin-bottom: 10px; }
.ssp-save:hover:not(:disabled) { border-color: var(--accent); border-style: solid; }
.ssp-save:disabled { color: var(--ink-3); cursor: default; opacity: .7; }
.ssp-list { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }
.ssp-row { display: flex; align-items: center; gap: 6px; }
.ssp-q { flex: 1; min-width: 0; text-align: left; font-family: var(--font-mono); font-size: 12px; color: var(--ink); background: var(--surface-sunken); border: 1px solid var(--border-soft); border-radius: 7px; padding: 6px 9px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ssp-q:hover { border-color: var(--accent); color: var(--accent-ink); }
.ssp-x { width: 24px; height: 24px; flex: 0 0 auto; border: none; background: none; color: var(--ink-3); font-size: 16px; cursor: pointer; border-radius: 6px; }
.ssp-x:hover { color: var(--status-off); background: var(--surface-sunken); }
.ssp-empty { font-size: 12px; color: var(--ink-3); padding: 4px 0; }

/* Considering (maybeboard) — deck/considering mode toggle, tile state, popover */
.ing-mode[hidden], .ing-consider[hidden], .ing-cmdf[hidden] { display: none !important; }   /* beat .ing-unique/.ing-ctl display */
.ing-cmdf { cursor: pointer; user-select: none; }
.ing-cmdf input { cursor: pointer; margin: 0; }
.ing-add.cons { background: #E0922F; color: #fff; box-shadow: 0 2px 6px rgba(16,23,30,.35); }
.ing-add.cons .c-off { display: none; }
.ing-add.cons:hover { background: var(--status-off); }
.ing-add.cons:hover .c-on { display: none; }
.ing-add.cons:hover .c-off { display: inline; }
.ing-add.wantcons { background: #E0922F; }
.ing-add.wantcons:hover { background: #c97d1e; }
.ing-consider { position: relative; }
.ing-consider-btn { font-family: inherit; font-size: 12px; padding: 5px 11px; border: 1px solid var(--border); border-radius: var(--r-control-sm); background: var(--surface-card); color: var(--ink-2); cursor: pointer; }
.ing-consider-btn:hover { border-color: var(--ink-3); }
.ing-consider-pop { position: absolute; top: calc(100% + 8px); left: 0; width: 320px; max-width: 86vw; background: var(--surface-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,23,30,.18); padding: 14px; z-index: 90; display: none; }
.ing-consider-pop.open { display: block; }
.cons-row .cons-name { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cons-promote { flex: 0 0 auto; font-family: inherit; font-size: 11px; font-weight: 600; padding: 4px 8px; border: 1px solid var(--accent-tint-border); border-radius: 7px; background: var(--accent-tint); color: var(--accent-ink); cursor: pointer; }
.cons-promote:hover { background: var(--accent); color: #fff; }

/* ============================ Responsive ============================ */
@media (max-width: 1180px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .cabinet-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 920px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .live-rail, .add-panel { flex-basis: 260px; }
  .landing { flex-direction: column; }
  .auth-panel { flex-basis: auto; border-left: none; border-top: 1px solid var(--border); padding: 40px 32px; }
}

/* ===================== Card detail modal (carddetail.js) ===================== */
.cd-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(16,23,30,.42); display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto; scrollbar-gutter: stable; }
/* Fixed width so the modal is identical for every card (content/height never resizes it). */
.cd-modal { background: var(--surface-card); border-radius: 14px; box-shadow: 0 24px 60px rgba(16,23,30,.3); width: min(880px, calc(100vw - 40px)); display: grid; grid-template-columns: 300px 1fr; gap: 0; overflow: hidden; }
.cd-close { position: absolute; top: 28px; right: calc(50% - 440px + 18px); background: var(--surface-card); border: 1px solid var(--border); border-radius: 8px; padding: 7px 13px; font-size: 13px; font-weight: 600; color: var(--ink-2); box-shadow: var(--shadow-card-sm); }
.cd-close:hover { color: var(--ink); border-color: #D8DDE3; }
.cd-left { padding: 22px; background: var(--surface-sunken); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.cd-imgframe { border-radius: 4.8% / 3.5%; overflow: hidden; box-shadow: 0 4px 14px rgba(16,23,30,.22); aspect-ratio: 488 / 680; }
.cd-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cd-pricebadge { text-align: center; font-size: 13px; font-weight: 600; color: var(--accent-ink); }
.cd-buys { display: flex; flex-direction: column; gap: 8px; }
.cd-buy { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-card); font-size: 13.5px; font-weight: 600; color: var(--ink); text-decoration: none; }
.cd-buy:hover { border-color: var(--accent-tint-border); background: var(--accent-tint); }
.cd-buy.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(14,156,142,.28); }
.cd-buy.primary b { font-weight: 700; }
.cd-disclosure { font-size: 10.5px; color: var(--ink-3); line-height: 1.4; text-align: center; }
.cd-right { padding: 26px 28px; min-width: 0; }
.cd-titlerow { display: flex; align-items: center; gap: 12px; }
.cd-titlerow h2 { font-family: var(--font-display); font-size: 25px; font-weight: 700; margin: 0; }
.cd-pips { display: inline-flex; gap: 4px; }
.cd-pips .pip { width: 20px; height: 20px; }
.cd-typeline { font-size: 14px; color: var(--ink-2); margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cd-pt { color: var(--ink); font-weight: 600; }
.cd-oracle { margin-top: 16px; font-size: 14.5px; line-height: 1.55; color: var(--ink); white-space: normal; }
/* Inline mana/tap/etc. symbols sit on the text baseline within Oracle text + rulings. */
.cd-oracle .pip, .cd-ruling .pip { width: 14px; height: 14px; vertical-align: -.15em; margin: 0 .5px; box-shadow: none; }
.cd-note { margin-top: 6px; font-size: 11px; color: var(--ink-3); font-style: italic; }
.cd-section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border-soft); }
.cd-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); display: block; margin-bottom: 8px; }
.cd-setline { font-size: 13.5px; color: var(--ink); margin-bottom: 8px; }
.cd-dim { color: var(--ink-3); }
.cd-printing { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-card); font-family: inherit; font-size: 13px; color: var(--ink); }
.cd-legality { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px 14px; }
.cd-leg { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.cd-leg-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: 0 0 auto; }
.cd-leg-legal { color: var(--ink); }
.cd-leg-legal .cd-leg-dot { background: var(--status-ok); }
.cd-leg-banned .cd-leg-dot, .cd-leg-restricted .cd-leg-dot { background: var(--status-over); }
.cd-leg-not_legal { color: var(--ink-3); }
.cd-ruling { display: flex; gap: 10px; font-size: 13px; line-height: 1.5; color: var(--ink); padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.cd-ruling-date { color: var(--ink-3); flex: 0 0 76px; }
.cd-empty { font-size: 13px; color: var(--ink-3); }
@media (max-width: 720px) {
  .cd-modal { grid-template-columns: 1fr; max-width: 460px; }
  .cd-left { border-right: none; border-bottom: 1px solid var(--border); }
  .cd-close { right: 20px; top: 20px; }
}

/* ----- Double-faced card flip control (bench mini-card) — "Vapor" ink pill --- */
/* Owner: product-website (2nd session). Always-visible labeled pill, very sheer at
   rest (reads the card straight through) and solidifying on hover; teal on the back
   face. Bottom-left, over the least-important art band. */
.mini-card .mc-flip {
  position: absolute; bottom: 7px; left: 7px; z-index: 3;
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px 0 8px; border: 0; cursor: pointer;
  color: #fff; border-radius: var(--r-pill);
  font-family: var(--font-display); font-weight: 700; font-size: 10px;
  letter-spacing: .05em; text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
  background: rgba(17,23,30,.12);
  backdrop-filter: blur(6px) saturate(1.1); -webkit-backdrop-filter: blur(6px) saturate(1.1);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10);
  transition: background .16s, transform .04s;
}
.mini-card .mc-flip .gl { font-size: 12px; text-shadow: none; transition: transform .4s cubic-bezier(.5,0,.2,1); }
.mini-card .mc-flip:hover { background: rgba(17,23,30,.82); }
.mini-card .mc-flip:active { transform: translateY(1px); }
.mini-card .mc-flip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mini-card .mc-frame.flipped .mc-flip { background: rgba(14,156,142,.40); }
.mini-card .mc-frame.flipped .mc-flip .gl { transform: rotate(180deg); }

/* ===================== Deck tags (bench header) ===================== */
.decktags { position: relative; }
.decktags-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-card); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.decktags-btn:hover { border-color: #D8DDE3; color: var(--ink); }
.decktags-count { background: var(--status-off); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
.decktags-count:empty { display: none; }
.decktags-pop { position: absolute; top: calc(100% + 8px); right: 0; width: 286px; background: var(--surface-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,23,30,.16); padding: 14px; z-index: 80; display: none; }
.decktags-pop.open { display: block; }
.dtp-head { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.dtp-hint { font-weight: 400; color: var(--ink-3); font-size: 11.5px; }
.dtp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dtp-empty { font-size: 12.5px; color: var(--ink-3); }
.dtp-sub { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); margin: 2px 0 7px; }
.dtp-std { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.dt-chip.std { cursor: pointer; user-select: none; }
.dt-chip.std:hover { border-color: var(--ink-3); }
.dt-chip.std.off { opacity: .5; text-decoration: line-through; background: transparent; }
/* Deck-specific tags are violet (the design's indicator colour) so they read as a
   unique addition to this deck; standard/shared tags stay neutral grey. */
.dt-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: var(--r-pill); background: var(--surface-sunken); border: 1px solid var(--border); color: var(--ink-2); }
.dt-chip.deck { color: var(--deck-c, #5B3FD6); background: color-mix(in srgb, var(--deck-c, #5B3FD6) 12%, #fff); border-color: color-mix(in srgb, var(--deck-c, #5B3FD6) 38%, transparent); }
.dt-chip.inline { padding: 1px 7px; font-size: 10.5px; }
.dt-name { cursor: pointer; }
.dt-name:hover { text-decoration: underline; }
.dt-x { cursor: pointer; opacity: .55; font-weight: 700; }
.dt-x:hover { opacity: 1; }
.dtp-input { width: 100%; height: 34px; padding: 0 11px; border: 1px dashed var(--border); border-radius: 8px; background: var(--surface-sunken); font-family: inherit; font-size: 12.5px; color: var(--ink); }
.dtp-input::placeholder { color: var(--ink-3); }
.dtp-input:focus { outline: none; border-style: solid; border-color: var(--accent); }
.dtp-foot { margin-top: 9px; font-size: 10.5px; color: var(--ink-3); line-height: 1.4; }

/* ===================== Foil shimmer (card images) =====================
   Two blended layers over the card art: a shifting rainbow holo (color-dodge)
   + a sweeping white glare (soft-light). `.etched` swaps the holo for a silvery
   sheen. Applied in the card modal (.cd-imgframe) and on bench mini-cards
   (.mc-frame) when the player's chosen finish is foil/etched. */
.cd-imgframe { position: relative; }
.foil-fx { position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit; overflow: hidden; }
/* "Subtle rainbow" foil. Two band layers physically SLIDE across the card (transform,
   not background-position) so the on-card time == the glide duration — no off-screen
   overshoot that makes it flash. A shifting full-spectrum holo (color-dodge, low
   opacity) under a glossy white glare. Slow 14s pass; runs 5 times then rests off-card
   (iteration-count 5 + fill-mode forwards) to keep GPU/blend cost bounded. */
.foil-fx .fb-holo, .foil-fx .fb-glare {
  content: ""; position: absolute; top: -25%; bottom: -25%; left: -15%; width: 80%;
  will-change: transform; animation: foilPass 14s ease-in-out 5 forwards;
}
.foil-fx .fb-holo {
  background: linear-gradient(110deg, transparent 0%, rgba(255,40,150,.5) 30%, rgba(40,170,255,.5) 45%, rgba(60,255,170,.5) 55%, rgba(255,225,60,.5) 70%, transparent 100%);
  mix-blend-mode: color-dodge; opacity: .22;
}
.foil-fx .fb-glare {
  background: linear-gradient(110deg, transparent 12%, rgba(255,255,255,.5) 50%, transparent 88%);
  mix-blend-mode: overlay;
}
/* etched = a quieter silvery sheen */
.foil-fx.etched .fb-holo {
  background: linear-gradient(110deg, transparent 0%, rgba(210,225,255,.5) 35%, rgba(255,255,255,.55) 50%, rgba(200,210,235,.5) 65%, transparent 100%);
  opacity: .2;
}
@keyframes foilPass {
  0%   { transform: translateX(-150%) rotate(10deg); }
  45%  { transform: translateX(150%)  rotate(10deg); }   /* ~6.3s glide across */
  100% { transform: translateX(150%)  rotate(10deg); }   /* ~7.7s rest off-card */
}
@media (prefers-reduced-motion: reduce) { .foil-fx .fb-holo, .foil-fx .fb-glare { animation: none; } }

/* ===================== Group / Sort dropdowns + deck-tag chips ===================== */
.bdd { position: relative; font-size: 13px; }
.bdd-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-card); color: var(--ink-2); font-weight: 600; cursor: pointer; user-select: none; }
.bdd-btn:hover { border-color: #D8DDE3; }
.bdd-lbl { color: var(--ink-3); }
.bdd-btn b { color: var(--ink); }
.bdd-arrow { color: var(--accent-ink); font-weight: 700; }
.bdd-arrow:empty { display: none; }
.bdd-car { color: var(--ink-3); font-size: 10px; }
.bdd-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 222px; background: var(--surface-card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 28px rgba(16,23,30,.14); padding: 5px; display: none; z-index: 70; }
.bdd.open .bdd-menu { display: block; }
.bdd-ml { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 7px 9px 4px; }
.bdd-opt { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 6px; color: var(--ink-2); cursor: pointer; font-weight: 500; }
.bdd-opt:hover { background: rgba(17,23,30,.05); color: var(--ink); }
.bdd-opt.sel { color: var(--ink); font-weight: 600; }
.bdd-ck { width: 14px; color: var(--accent); visibility: hidden; }
.bdd-opt.sel .bdd-ck { visibility: visible; }
.bdd-sep { height: 1px; background: var(--border-soft); margin: 5px 2px; }
.bdd-seg { display: flex; gap: 3px; padding: 5px 7px 2px; }
.bdd-seg button { flex: 1; height: 28px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; border: 1px solid var(--border); background: var(--surface-card); border-radius: 7px; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.bdd-seg button:hover { border-color: #D8DDE3; }
.bdd-seg button.on { background: var(--accent-tint); border-color: var(--accent-tint-border); color: var(--accent-ink); }
/* deck-specific tags on bench cards → violet (matches the deck-tags popover) */
/* (.tag-deck now styled globally via --deck-c — see the shared tag rules above) */
