/* ===========================================================================
   Commander Mana Base Calculator — page-scoped styles (mbc- prefix)
   Reuses the shared Deckcipher tokens from content.css. Nothing here leaks
   to other pages: every selector is prefixed `mbc-` or scoped under #mbc-tool.
   =========================================================================== */

:root {
  --mbc-w: #f5e7c4;
  --mbc-u: #74a7e0;
  --mbc-b: #9a86c4;
  --mbc-r: #e08a76;
  --mbc-g: #79c08f;
  --mbc-c: #b9b4c8;
  --mbc-ok: #6fcfa0;
  --mbc-warn: #e8b04a;
  --mbc-bad: #e87a70;
}

/* ---- Hero ----------------------------------------------------------------- */
.mbc-hero {
  display: grid;
  gap: 14px;
  text-align: left;
  max-width: 820px;
}
.mbc-hero .page-title {
  margin: 10px 0 0;
  font-size: clamp(1.9rem, 4.8vw, 2.75rem);
  line-height: 1.2;
}
.mbc-hero .mbc-lead {
  color: var(--text-2);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 58ch;
  margin: 0;
}
@media (max-width: 720px) {
  .mbc-hero .mbc-lead {
    font-size: 0.95rem;
    line-height: 1.55;
  }
}

/* ---- Import panel sizing (spec: 24-28px desktop padding, 16px mobile) ----- */
#mbc-import { padding: 24px; }
@media (max-width: 720px) {
  #mbc-import { padding: 16px; }
}
.mbc-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}
.mbc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 12px 22px;
  appearance: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.96rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  min-height: 44px;
}
.mbc-btn-primary {
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  color: #2a2208;
  box-shadow: 0 14px 30px rgba(201, 168, 76, 0.22);
}
.mbc-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(201, 168, 76, 0.3);
}
.mbc-btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-strong);
  color: var(--text-1);
}
.mbc-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}
/* "Edit / import another deck" changes the *source* deck rather than a
   calculator option, so it reads as a distinct secondary-highlight action: it
   borrows the "improve" category teal (an existing Deckcipher semantic color)
   instead of the gold used by the primary Calculate CTA, and stays a tinted
   outline so it never competes with that CTA. */
.mbc-btn-source {
  background: color-mix(in srgb, #4dbf9c 12%, transparent);
  border-color: color-mix(in srgb, #4dbf9c 42%, transparent);
  color: #8fe4cc;
}
.mbc-btn-source:hover {
  background: color-mix(in srgb, #4dbf9c 18%, transparent);
  border-color: #4dbf9c;
  transform: translateY(-1px);
}
.mbc-btn-source svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* ---- Import panel --------------------------------------------------------- */
.mbc-import-panel {
  display: grid;
  gap: 14px;
}
.mbc-panel-title {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text-1);
}
.mbc-panel-help {
  margin: 0;
  color: var(--text-2);
  font-size: 0.92rem;
}
.mbc-field {
  display: grid;
  gap: 7px;
}
.mbc-field > label,
.mbc-field > span.mbc-label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
  text-transform: uppercase;
}
.mbc-textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  font-family: var(--font-sans);
  line-height: 1.5;
}

/* Hide form while loading so the skeleton isn't cramped */
.mbc-import--loading #mbc-form { display: none !important; }
.mbc-import--loading .mbc-status { display: none; }
#mbc-loader:not([hidden]) { margin-top: 4px; }
.mbc-import-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.mbc-moxfield-row {
  display: flex;
  gap: 8px;
  min-width: 0;
}
.mbc-moxfield-row .tool-input {
  min-width: 0;
  flex: 1 1 auto;
  text-overflow: ellipsis;
}
.mbc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.mbc-actions .mbc-btn {
  flex: 1 1 160px;
  max-width: 210px;
  padding: 11px 20px;
}
.mbc-status {
  margin: 12px 0 0;
  color: var(--text-2);
  font-size: 0.9rem;
  min-height: 1.2em;
}
.mbc-status.is-error { color: var(--red-text); }
.mbc-status.is-success { color: var(--mbc-ok); }

/* ---- Empty state ---------------------------------------------------------- */
.mbc-empty {
  display: grid;
  gap: 14px;
}
.mbc-empty p { color: var(--text-2); margin: 0; max-width: 64ch; }
.mbc-preview-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mbc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid rgba(201, 168, 76, 0.18);
  color: var(--accent-soft);
  font-size: 0.82rem;
  font-weight: 600;
}

/* ---- Section scaffolding -------------------------------------------------- */
.mbc-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; scroll-margin-top: 80px; }
.mbc-section-head { display: grid; gap: 4px; }
.mbc-section-title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-1);
}
.mbc-section-sub { margin: 0; color: var(--text-2); font-size: 0.92rem; }

/* ---- Color pips ----------------------------------------------------------- */
.mbc-pips { display: inline-flex; gap: 5px; align-items: center; }
.mbc-pip {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #15131c;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.mbc-pip.is-w { background: var(--mbc-w); }
.mbc-pip.is-u { background: var(--mbc-u); }
.mbc-pip.is-b { background: var(--mbc-b); color: #efeaf7; }
.mbc-pip.is-r { background: var(--mbc-r); }
.mbc-pip.is-g { background: var(--mbc-g); }
.mbc-pip.is-c { background: var(--mbc-c); }

/* ---- Verdict dashboard ---------------------------------------------------- */
.mbc-verdict {
  display: grid;
  gap: 14px;
  border-radius: 16px;
  padding: 18px;
  position: relative;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(201, 168, 76, 0.1), transparent 60%),
    rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}
/* Badge pinned to top-right corner of verdict box */
.mbc-verdict-status-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
}
/* Pips row centered below commander mini-cards */
.mbc-verdict-pips-center {
  display: flex;
  justify-content: center;
  padding: 2px 0;
}
/* TCGplayer link centered below mini-cards */
.mbc-verdict-tcg {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: -4px;
}
.mbc-cta-sm {
  font-size: 0.78rem;
  padding: 7px 14px;
  min-height: 34px;
}
.mbc-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.mbc-status-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.mbc-status-good { background: rgba(111, 207, 160, 0.12); color: var(--mbc-ok); }
.mbc-status-needs-review { background: rgba(232, 176, 74, 0.14); color: var(--mbc-warn); }
.mbc-status-risky { background: rgba(232, 122, 112, 0.14); color: var(--mbc-bad); }
.mbc-verdict-summary { margin: 0; color: var(--text-1); line-height: 1.55; }

.mbc-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.mbc-metric {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  gap: 3px;
}
.mbc-metric strong { font-size: 1.4rem; color: var(--accent-soft); line-height: 1.1; }
.mbc-metric span { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-2); }

/* ---- Source balance meter ------------------------------------------------- */
.mbc-balance { display: grid; gap: 10px; }
.mbc-balance-row {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  align-items: center;
  gap: 12px;
}
.mbc-balance-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; }
.mbc-bar-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.mbc-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  transition: width var(--transition);
}
.mbc-bar-fill.is-w { background: linear-gradient(90deg, #cbbd92, var(--mbc-w)); }
.mbc-bar-fill.is-u { background: linear-gradient(90deg, #3f6fae, var(--mbc-u)); }
.mbc-bar-fill.is-b { background: linear-gradient(90deg, #6b5a93, var(--mbc-b)); }
.mbc-bar-fill.is-r { background: linear-gradient(90deg, #b65b48, var(--mbc-r)); }
.mbc-bar-fill.is-g { background: linear-gradient(90deg, #4f9168, var(--mbc-g)); }
.mbc-balance-value { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 0.86rem; }

/* ---- Fix-first cards ------------------------------------------------------ */
.mbc-fix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.mbc-fix-card {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 20px;
  min-height: 96px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
}
@media (max-width: 720px) {
  .mbc-fix-card { padding: 16px; }
}
.mbc-fix-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mbc-fix-card strong { font-size: 0.98rem; color: var(--text-1); }
.mbc-fix-card p { margin: 0; color: var(--text-2); font-size: 0.86rem; line-height: 1.5; }
.mbc-sev {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
}
.mbc-sev-high { background: rgba(232, 122, 112, 0.16); color: var(--mbc-bad); }
.mbc-sev-medium { background: rgba(232, 176, 74, 0.16); color: var(--mbc-warn); }
.mbc-sev-low { background: rgba(111, 207, 160, 0.16); color: var(--mbc-ok); }
.mbc-fix-anchor { color: var(--accent-soft); font-size: 0.82rem; font-weight: 600; text-decoration: none; }
.mbc-fix-anchor:hover { text-decoration: underline; }

/* ---- Shared "show more" toggle (fix-first overflow, extra recommendations) */
.mbc-inline-toggle {
  justify-self: start;
  margin-top: 2px;
  padding: 9px 16px;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.mbc-inline-toggle:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-1);
}

/* ---- Color demand vs sources --------------------------------------------- */
.mbc-demand-grid { display: grid; gap: 12px; }
.mbc-demand-row {
  display: grid;
  grid-template-columns: minmax(100px, 140px) 1fr 130px;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
}
.mbc-demand-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  flex-wrap: wrap;
}
/* move double-pip tag to its own row so it doesn't crowd the color name */
.mbc-tag-dbl {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--accent-soft);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 5px;
  padding: 1px 5px;
  flex-basis: 100%;
  margin-top: 2px;
  margin-left: 26px; /* align under color name, past the pip */
}
.mbc-demand-stats { display: grid; gap: 6px; }
.mbc-demand-figures { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.82rem; color: var(--text-2); }
.mbc-demand-figures b { color: var(--text-1); font-variant-numeric: tabular-nums; }
.mbc-demand-meter { display: flex; align-items: center; gap: 8px; }
.mbc-demand-meter .mbc-bar-track { flex: 1 1 auto; }
.mbc-demand-status { justify-self: end; text-align: right; }
.mbc-pill {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.mbc-pill-enough, .mbc-pill-overbuilt { background: rgba(111, 207, 160, 0.13); color: var(--mbc-ok); }
.mbc-pill-slightly-low { background: rgba(232, 176, 74, 0.14); color: var(--mbc-warn); }
.mbc-pill-low { background: rgba(232, 122, 112, 0.14); color: var(--mbc-bad); }
.mbc-tag-dbl {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-soft);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 5px;
  padding: 1px 6px;
}

/* ---- Land count meter ----------------------------------------------------- */
/* Ensure the land section inner elements have breathing room */
#mbc-land { display: grid; gap: 14px; }
.mbc-land-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.mbc-land-hero-figure { display: flex; align-items: baseline; gap: 8px; }
.mbc-land-hero-figure strong { font-size: 2.4rem; font-weight: 800; color: var(--text-1); line-height: 1; }
.mbc-land-hero-figure span { font-size: 0.9rem; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.03em; }
.mbc-land-hero-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mbc-land-hero-range { font-size: 0.86rem; color: var(--text-2); font-weight: 600; }
.mbc-landmeter { display: grid; gap: 10px; }
.mbc-landmeter-track {
  position: relative;
  height: 30px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
.mbc-landmeter-band {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(111, 207, 160, 0.18);
  border-left: 1px dashed rgba(111, 207, 160, 0.5);
  border-right: 1px dashed rgba(111, 207, 160, 0.5);
}
.mbc-landmeter-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent-soft);
  box-shadow: 0 0 10px rgba(201, 168, 76, 0.6);
}
.mbc-landmeter-scale { display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--text-3); }
.mbc-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

/* ---- Probability cards ---------------------------------------------------- */
/* A single horizontal control bar: each option sizes to its content and the
   row wraps intelligently on narrower viewports (see the media queries below)
   rather than stacking every control into its own tall row. */
.mbc-prob-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}
.mbc-prob-controls .mbc-field {
  flex: 0 0 auto;
  gap: 5px;
}
.mbc-prob-controls .mbc-field label,
.mbc-prob-controls .mbc-field span.mbc-label {
  text-transform: none;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-3);
}
.mbc-prob-controls .tool-input,
.mbc-prob-controls .tool-select {
  height: 40px;
  min-height: 40px;
  padding-block: 0;
  font-size: 0.9rem;
}
.mbc-prob-controls input[type="number"].tool-input { width: 78px; }
.mbc-prob-controls .tool-select { min-width: 130px; }
/* "Include ramp" is a single inline toggle, aligned to the bottom of the row
   like the other controls -- not a full-width strip beneath a divider. */
.mbc-prob-controls .mbc-field-toggle {
  align-self: stretch;
  justify-content: flex-end;
}
.mbc-prob-controls .mbc-field-toggle .mbc-toggle {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.83rem;
  color: var(--text-2);
  white-space: nowrap;
}
.mbc-prob-controls .mbc-field-toggle .mbc-toggle:hover { border-color: var(--border-strong); }

@media (max-width: 1024px) {
  /* Tablet: let the bar wrap into ~2 rows instead of forcing one line. */
  .mbc-prob-controls .tool-select { min-width: 120px; }
}
@media (max-width: 600px) {
  /* Mobile: full-width stacked controls, comfortable tap targets. */
  .mbc-prob-controls { gap: 10px; }
  .mbc-prob-controls .mbc-field { flex: 1 1 100%; }
  .mbc-prob-controls input[type="number"].tool-input,
  .mbc-prob-controls .tool-select { width: 100%; min-width: 0; }
  .mbc-prob-controls .mbc-field-toggle .mbc-toggle { width: 100%; justify-content: flex-start; }
}
.mbc-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.mbc-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color var(--transition), background var(--transition);
}
.mbc-toggle input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.mbc-toggle input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 2px solid #1a1400;
  border-top: none;
  border-left: none;
  transform: rotate(42deg);
}
.mbc-prob-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.mbc-prob-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}
.mbc-prob-value { font-size: 1.7rem; font-weight: 800; color: var(--accent-soft); line-height: 1; }
.mbc-prob-label { font-size: 0.84rem; color: var(--text-2); line-height: 1.4; }

/* ---- Ramp / utility compact cards ---------------------------------------- */
.mbc-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.mbc-mini {
  padding: 13px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 4px;
}
.mbc-mini strong { font-size: 1.25rem; color: var(--text-1); }
.mbc-mini span { font-size: 0.78rem; color: var(--text-2); }

/* Color-coded ramp type accents */
.mbc-mini.is-early strong { color: var(--accent-soft); }
.mbc-mini.is-early { border-left-color: var(--accent); }
.mbc-mini.is-color strong { color: var(--mbc-ok); }
.mbc-mini.is-color { border-left-color: var(--mbc-ok); }
.mbc-mini.is-colorless strong { color: var(--text-2); }
.mbc-mini.is-rock { border-left-color: var(--mbc-c); }
.mbc-mini.is-dork { border-left-color: var(--mbc-g); }
.mbc-mini.is-land-ramp { border-left-color: #6fcfa0; }
.mbc-mini.is-treasure { border-left-color: var(--accent); }

/* Space out #mbc-ramp's stacked children (mini grid, note, "why do these
   cards count?" button) so the appended button never touches the note. */
#mbc-ramp {
  display: grid;
  gap: 12px;
}
/* Keep the appended "why do these cards count?" button its natural width
   instead of stretching full-width as a default grid item. */
#mbc-ramp > .classification-action {
  justify-self: start;
}

.mbc-note {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-glow);
  border-radius: 0 10px 10px 0;
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.5;
}
.mbc-note.is-warn { border-left-color: var(--mbc-warn); }

/* ---- Utility land pressure: progressive disclosure of detail lists ------- */
.mbc-utility-details {
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.mbc-utility-summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-2);
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mbc-utility-summary::-webkit-details-marker { display: none; }
.mbc-utility-summary::marker { content: none; }
.mbc-utility-summary::before {
  content: "▸";
  font-size: 0.7rem;
  transition: transform 0.15s;
}
.mbc-utility-details[open] .mbc-utility-summary::before { transform: rotate(90deg); }
.mbc-utility-details-body { padding: 0 14px 14px; display: grid; gap: 8px; }

/* ---- Recommendation buckets (carousel-based) ------------------------------ */
.mbc-rec-bucket-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}
.mbc-rec-bucket-wrap > * { min-width: 0; }
.mbc-rec-bucket-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
/* Add separator between bucket wraps */
.mbc-rec-bucket-wrap + .mbc-rec-bucket-wrap:not(.mbc-hidden) {
  margin-top: 8px;
  padding-top: 8px;
}

/* ---- Recommendation rows (affiliate) ------------------------------------- */
.mbc-rec-grid { display: grid; gap: 10px; }
.mbc-rec-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
}
.mbc-rec-thumb {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  flex: none;
}
.mbc-rec-body { display: grid; gap: 4px; min-width: 0; }
.mbc-rec-name { font-weight: 700; color: var(--text-1); overflow-wrap: anywhere; }
.mbc-rec-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mbc-role-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
}
.mbc-role-tag.is-budget { background: rgba(111, 207, 160, 0.12); color: var(--mbc-ok); }
.mbc-role-tag.is-premium { background: rgba(201, 168, 76, 0.14); color: var(--accent-soft); }
.mbc-rec-price { font-size: 0.8rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mbc-rec-reason { font-size: 0.85rem; color: var(--text-2); line-height: 1.45; overflow-wrap: anywhere; }
.mbc-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.84rem;
  text-decoration: none;
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  color: #2a2208;
  min-height: 40px;
  flex: none;
}
.mbc-cta:hover { transform: translateY(-1px); }
.mbc-rec-empty { color: var(--text-3); font-size: 0.88rem; margin: 0; }

/* ---- Export --------------------------------------------------------------- */
.mbc-export details { border-radius: 12px; }
.mbc-export-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.mbc-export-pre {
  width: 100%;
  min-height: 160px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre;
  overflow: auto;
}

/* ---- Verdict commander mini-cards with foil -------------------------------- */
.mbc-verdict-cmds {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
}
.mbc-verdict-cmd {
  width: 88px;
  height: 123px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  flex: none;
}
.mbc-verdict-cmds.is-pair .mbc-verdict-cmd { width: 68px; height: 95px; }
.mbc-verdict-cmd img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* ---- Related tools (uses shared related-tool-card from content.css) ------- */
.related-tool-desc {
  color: var(--text-2);
  font-size: 0.85rem;
  line-height: 1.45;
}

/* ---- Limited analysis toggle ---------------------------------------------- */
.mbc-limited-details {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(232, 176, 74, 0.28);
}
.mbc-limited-summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--mbc-warn);
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  user-select: none;
}
.mbc-limited-summary::-webkit-details-marker { display: none; }
.mbc-limited-summary::marker { content: none; }
.mbc-limited-summary::before {
  content: "▸";
  font-size: 0.72rem;
  transition: transform 0.15s;
}
.mbc-limited-details[open] .mbc-limited-summary::before { transform: rotate(90deg); }
.mbc-limited-body { padding: 0 14px 14px; }
.mbc-limited-body .mbc-note { margin: 0; }

/* ---- Final CTA ------------------------------------------------------------ */
.mbc-final-cta { display: grid; gap: 8px; justify-items: center; text-align: center; }
.full-audit-cta { padding: 0; }
.full-audit-cta-link {
  display: block;
  width: 100%;
  text-decoration: none;
  color: inherit;
  padding: 18px;
  border-radius: inherit;
  transition: background var(--transition);
}
.full-audit-cta-link:hover { background: rgba(255, 255, 255, 0.025); }
.full-audit-cta h2 { margin: 0; font-size: 1.1rem; color: var(--accent-soft); font-weight: 700; }
.full-audit-cta p { margin: 0; color: var(--text-2); font-size: 0.92rem; line-height: 1.5; }
.full-audit-cta-btn {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 9px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  color: #2a2208;
  font-weight: 700;
  font-size: 0.88rem;
  transition: transform var(--transition), box-shadow var(--transition);
}
.full-audit-cta-link:hover .full-audit-cta-btn {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(201, 168, 76, 0.28);
}

.mbc-hidden { display: none !important; }

/* ---- Paired result rows (7/5 desktop split, stacked under 860px) --------- */
.mbc-pair-row {
  display: grid;
  gap: 24px;
  align-items: start;
  min-width: 0;
}
@media (min-width: 860px) {
  .mbc-pair-row { grid-template-columns: 7fr 5fr; }
}
.mbc-pair-row > .mbc-section { min-width: 0; }

/* ---- "Advanced" badge on the Casting Odds heading ------------------------- */
.mbc-badge-advanced {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  vertical-align: middle;
}

.mbc-more-recs { display: grid; gap: 10px; margin-top: 4px; }

/* ---- Import collapsed bar ------------------------------------------------- */
.mbc-import-collapsed {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 4px;
}
.mbc-import-collapsed-text {
  color: var(--text-2);
  font-size: 0.9rem;
  text-align: center;
}

/* When results are showing, collapse the import form itself */
.mbc-import--has-results #mbc-form {
  display: none;
}

/* ---- Results layout ------------------------------------------------------- */
#mbc-results {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ---- Top dashboard grid: main verdict (8) + chart sidebar (4) ------------- */
.mbc-dashboard-top {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
  min-width: 0;
}

.mbc-dashboard-charts {
  display: grid;
  gap: 16px;
  min-width: 0;
  align-content: start;
}

/* ---- Commander spotlight card --------------------------------------------- */
.mbc-commander-area {
  display: grid;
  gap: 12px;
}

.mbc-commander-card {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  align-items: start;
}

.mbc-commander-media {
  position: relative;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(0, 0, 0, 0.14);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.mbc-commander-media:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.4);
}
.mbc-commander-media {
  aspect-ratio: 488 / 680;
}
.mbc-commander-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.mbc-commander-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(201, 168, 76, 0.9);
  color: #1a1500;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mbc-commander-info {
  display: grid;
  gap: 8px;
  padding: 4px 2px;
}

.mbc-commander-name {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.3;
}

.mbc-commander-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mbc-commander-pair .mbc-commander-card {
  gap: 7px;
}

.mbc-commander-pair .mbc-commander-name {
  font-size: 0.84rem;
}

/* ---- Charts panel --------------------------------------------------------- */
.mbc-chart-widget {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.mbc-chart-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
}

.mbc-donut-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mbc-donut-svg {
  flex: none;
  overflow: visible;
}

.mbc-chart-legend {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.mbc-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--text-2);
  min-width: 0;
}

.mbc-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.mbc-legend-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mbc-legend-count {
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
  font-weight: 600;
}

.mbc-chart-empty {
  color: var(--text-3);
  font-size: 0.82rem;
  margin: 0;
  text-align: center;
  padding: 8px 0;
}

/* ---- Probability cards with radial rings ---------------------------------- */
.mbc-prob-section-head { display: grid; gap: 4px; }
.mbc-prob-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 8px 0 4px;
}
.mbc-prob-group-label:first-child { margin-top: 0; }
.mbc-prob-group-label:not(:first-child) {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.mbc-prob-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  padding: 14px 10px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  align-items: center;
  text-align: center;
}

.mbc-prob-ring {
  display: flex;
  justify-content: center;
  align-items: center;
}

.mbc-prob-ring svg {
  overflow: visible;
}

.mbc-prob-ring-label {
  fill: var(--text-1);
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-sans);
}

.mbc-prob-label {
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.4;
}

.mbc-prob-status {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

.mbc-prob-status-strong { background: rgba(111, 207, 160, 0.14); color: var(--mbc-ok); }
.mbc-prob-status-fine   { background: rgba(232, 176, 74, 0.14); color: var(--mbc-warn); }
.mbc-prob-status-risky  { background: rgba(232, 122, 112, 0.14); color: var(--mbc-bad); }

/* Bucket wrappers and sections use .mbc-hidden for visibility toggling */

/* ---- Manual mode accordion ------------------------------------------------ */
.mbc-manual-mode details {
  border-radius: 0;
}

.mbc-manual-summary {
  display: grid;
  gap: 3px;
  cursor: pointer;
  padding: 4px 0;
  list-style: none;
  user-select: none;
}

.mbc-manual-summary::-webkit-details-marker { display: none; }

.mbc-manual-summary-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mbc-manual-summary-label::after {
  content: "›";
  font-size: 1.2rem;
  line-height: 1;
  color: var(--text-3);
  transition: transform var(--transition);
}

details[open] .mbc-manual-summary-label::after {
  transform: rotate(90deg);
}

.mbc-manual-body {
  margin-top: 16px;
}

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 1100px) {
  .mbc-dashboard-top {
    grid-template-columns: 1fr 240px;
  }
}

@media (max-width: 820px) {
  .mbc-dashboard-top {
    grid-template-columns: 1fr;
  }
  .mbc-dashboard-charts {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .mbc-import-grid { grid-template-columns: 1fr; }
  .mbc-demand-row { grid-template-columns: 1fr; }
  .mbc-demand-status { justify-self: start; text-align: left; }
  .mbc-balance-row { grid-template-columns: 74px 1fr auto; }
  .mbc-rec-row { grid-template-columns: auto 1fr; }
  .mbc-rec-cta-wrap { grid-column: 1 / -1; }
  .mbc-rec-row .mbc-cta { width: 100%; }
  .mbc-dashboard-charts {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 500px) {
  .mbc-dashboard-charts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .mbc-rec-row { grid-template-columns: 1fr; }
  .mbc-rec-thumb { display: none; }
  .mbc-metric strong { font-size: 1.2rem; }
}
