/* ============================================================================
   CardCrow Design System — component kit. Vanilla-CSS recreations of the
   redesign's React components (Button, Chip, Segmented, Badge, StatusTag,
   Surface, ProgressMeter, Input/TextArea/Select, SectionHeader, KPI, Panel,
   data tables, modals, mana pips). Every view builds on these classes.
   ============================================================================ */

/* ------------------------------- Buttons -------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-md); padding: 0 14px;
  font-family: var(--font-sans); font-size: var(--text-sm); letter-spacing: 0.01em;
  font-weight: var(--weight-medium);
  border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
  background: var(--surface-raised); color: var(--text-primary);
  border: 1px solid var(--border-strong); box-shadow: var(--edge-top);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(0.5px) scale(0.995); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn svg { display: block; flex-shrink: 0; }

.btn.primary {
  background: linear-gradient(var(--gold-400), var(--gold-500));
  color: var(--on-accent); border-color: var(--gold-600);
  box-shadow: var(--edge-top), var(--shadow-sm);
  font-weight: var(--weight-semibold);
}
.btn.primary:hover { filter: brightness(1.06); }

.btn.ghost { background: transparent; color: var(--text-secondary); border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-raised); }

.btn.danger { background: var(--seal-tint); color: var(--seal-400); border-color: var(--seal-600); box-shadow: none; }
.btn.danger:hover { background: rgba(187, 76, 64, 0.22); }

.btn.sm { height: var(--control-sm); padding: 0 10px; font-size: var(--text-xs); gap: 6px; }
.btn.lg { height: var(--control-lg); padding: 0 18px; font-size: var(--text-base); gap: 9px; }
.btn.full { width: 100%; }

/* Quiet inline text-link button */
.linkBtn {
  background: transparent; border: 0; padding: 0 0 1px; cursor: pointer;
  font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong);
}
.linkBtn:hover { color: var(--gold-400); }
.linkBtn.gold { color: var(--gold-400); font-weight: var(--weight-semibold); border-bottom-color: var(--gold-700); }
.linkBtn.gold:hover { color: var(--gold-300); }

/* --------------------------------- Chips -------------------------------- */
.chip {
  height: var(--control-md); padding: 0 13px;
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--text-secondary); background: var(--surface-raised);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  cursor: pointer; white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-out);
}
.chip:hover { border-color: var(--ink-600); }
.chip.on {
  color: var(--gold-300); background: var(--gold-tint);
  border-color: var(--gold-600); font-weight: var(--weight-semibold);
  box-shadow: var(--edge-top);
}
.chip.on::before {
  content: ""; width: 12px; height: 12px; flex-shrink: 0;
  background: no-repeat center / contain
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3.5 8.5l3 3 6-6.5" stroke="%23d4b06e" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}
.chip.sm { height: var(--control-sm); padding: 0 10px; font-size: var(--text-xs); }

.chipGroup { display: flex; flex-wrap: wrap; gap: 8px; }
.chipGroupLabel {
  font-family: var(--font-mono); font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wider); text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 8px;
}

/* ------------------------------- Segmented ------------------------------ */
.segmented {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 2px; padding: 3px; height: 38px;
  background: var(--bg-well); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}
.segmented button {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; background: transparent; cursor: pointer; padding: 0 12px;
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-medium);
  letter-spacing: 0.01em; color: var(--text-muted);
  border-radius: calc(var(--radius-md) - 2px);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.segmented button.on {
  color: var(--gold-300); font-weight: var(--weight-semibold);
  background: var(--gold-tint); border: 1px solid var(--gold-700);
  box-shadow: var(--edge-top);
}

/* -------------------------------- Badges -------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px;
  font-family: var(--font-mono); font-size: var(--text-2xs); font-weight: var(--weight-medium);
  letter-spacing: 0.05em; text-transform: uppercase; line-height: 1;
  border-radius: var(--radius-xs); white-space: nowrap;
  color: var(--ink-300); background: rgba(180,171,156,0.10); border: 1px solid var(--border-strong);
}
.badge.gold { color: var(--gold-300); background: var(--gold-tint); border-color: var(--gold-700); }
.badge.goldSolid { color: var(--on-accent); background: var(--gold-500); border-color: transparent; }
.badge.lang { color: var(--info-400); background: var(--info-tint); border-color: rgba(110,163,216,0.4); }
.badge.cond { color: var(--warning-400); background: var(--warning-tint); border-color: rgba(194,137,63,0.42); }
.badge.foil { color: var(--gold-300); background: var(--gold-tint); border-color: var(--gold-600); }
.badge.success { color: var(--success-400); background: var(--success-tint); border-color: rgba(106,157,115,0.42); }
.badge.danger { color: var(--seal-400); background: var(--seal-tint); border-color: var(--seal-600); }
.badge.info { color: var(--info-400); background: var(--info-tint); border-color: rgba(110,163,216,0.4); }
.badge.violet { color: #c79bf0; background: rgba(154,124,184,0.14); border-color: rgba(199,155,240,0.45); }

/* ------------------------------- StatusTag ------------------------------ */
.statusTag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: var(--text-2xs); font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide); text-transform: uppercase; white-space: nowrap;
  color: var(--text-muted);
}
.statusTag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}
.statusTag.success { color: var(--success-400); }
.statusTag.warning { color: var(--warning-400); }
.statusTag.danger { color: var(--seal-400); }
.statusTag.info { color: var(--info-400); }
.statusTag.gold { color: var(--gold-400); }

/* -------------------------------- Surface ------------------------------- */
.surface {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.surface.raised { background: var(--surface-raised); box-shadow: var(--elev-1); }
.surface.well { background: var(--bg-well); border-color: var(--border-soft); box-shadow: inset 0 1px 3px rgba(0,0,0,0.4); }
.surface.interactive { cursor: pointer; }
.surface.interactive:hover { border-color: var(--border-strong); }
.surfaceHeader {
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  background: var(--gold-tint-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.surfaceBody { padding: 16px; }
.surfaceBody.sm { padding: 12px; }
.surfaceBody.lg { padding: 20px; }

/* ----------------------------- ProgressMeter ---------------------------- */
.meter { min-width: 0; }
.meterHead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 12px; }
.meterLabel {
  font-family: var(--font-mono); font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--text-muted);
}
.meterValue {
  font-family: var(--font-mono); font-size: var(--text-xs);
  font-variant-numeric: tabular-nums; color: var(--text-secondary); font-weight: var(--weight-medium);
}
.meterTrack {
  height: 6px; border-radius: var(--radius-pill); background: var(--bg-well);
  border: 1px solid var(--border-soft); overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}
.meterFill {
  height: 100%; border-radius: var(--radius-pill); width: 0;
  background: linear-gradient(90deg, var(--gold-600), var(--gold-400));
  transition: width var(--dur-slow) var(--ease-out);
}
.meterFill.success { background: linear-gradient(90deg, var(--success-500), var(--success-400)); }

/* ----------------------------- Form fields ------------------------------ */
.field, input.field, textarea.field, select.field {
  width: 100%; height: var(--control-md); padding: 0 12px;
  font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-primary);
  background: var(--bg-well); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.35); outline: none;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.field:focus {
  border-color: var(--gold-500);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.35), 0 0 0 3px var(--gold-tint);
}
.field.mono { font-family: var(--font-mono); }
.field.invalid { border-color: var(--seal-500); }
textarea.field { height: auto; padding: 10px 12px; line-height: var(--leading-normal); resize: vertical; }
input.field[type="date"] { font-family: var(--font-mono); font-size: var(--text-xs); color-scheme: dark; }
input.field[type="number"] { font-family: var(--font-mono); }

select.field, .selectWrap select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background: var(--surface-raised); padding-right: 32px;
  box-shadow: none;
}
.selectWrap { position: relative; display: inline-flex; }
.selectWrap::after {
  content: ""; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; pointer-events: none;
  background: no-repeat center / contain
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%238b8375" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
}
select.field option { background: var(--stock-850); }

.fieldLabel {
  display: flex; flex-direction: column; gap: 7px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-faint); font-weight: var(--weight-regular);
}
.fieldWithIcon { position: relative; width: 100%; }
.fieldWithIcon > svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.fieldWithIcon > .field { padding-left: 34px; }

/* ----------------------------- SectionHeader ---------------------------- */
.sectionHead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px 10px 16px;
  background: var(--tint, var(--gold-tint-soft));
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  border-left: 2px solid var(--edge, var(--gold-500));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.sectionHead .shLeft { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sectionHead h2, .sectionHead h3 {
  font-family: var(--font-mono); font-size: var(--text-sm); font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sectionHead .shCount {
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted);
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em; flex-shrink: 0;
}

/* ------------------------------ ScreenHead ------------------------------ */
.screenHead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 22px; flex-wrap: wrap;
}
.screenHead .eyebrow { margin-bottom: 6px; }
.screenHead h1 {
  font-family: var(--font-display); font-size: var(--text-2xl);
  font-weight: var(--weight-semibold); letter-spacing: -0.015em; color: var(--text-primary);
}
.screenIntro {
  max-width: 760px; margin: -12px 0 20px;
  font-size: var(--text-sm); line-height: var(--leading-normal); color: var(--text-muted);
}

/* ------------------------------- KPI / Stat ----------------------------- */
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 13px 15px; box-shadow: var(--edge-top); min-width: 0;
}
.kpi .eyebrow { margin-bottom: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.kpiValue {
  font-family: var(--font-display); font-size: 26px; font-weight: var(--weight-semibold);
  letter-spacing: -0.01em; color: var(--text-primary); font-variant-numeric: tabular-nums;
}
.kpiValue.success { color: var(--success-400); }
.kpiValue.danger { color: var(--seal-400); }
.kpiValue.gold { color: var(--gold-300); }
.kpiGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 12px; }

/* -------------------------------- Panel --------------------------------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--edge-top); padding: 14px 6px 8px;
}
.panelHead { padding: 0 12px 6px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.panelHead h3 { font-family: var(--font-display); font-size: 15px; font-weight: var(--weight-semibold); color: var(--text-primary); }
.panelNote { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }

/* ----------------------------- Data tables ------------------------------ */
.dsTable { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.dsTable th {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 9.5px; font-weight: var(--weight-medium);
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-faint); white-space: nowrap;
}
.dsTable td {
  padding: 9px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.dsTable td.cardName, .dsTable td:first-child { font-family: var(--font-sans); font-size: 13px; color: var(--text-primary); }
.dsTable tbody tr:hover td { background: color-mix(in srgb, var(--surface-hover) 55%, transparent); }
.dsTable tbody tr:last-child td { border-bottom: none; }

/* Recommended-stock pill (analysis tables) */
.targetPill {
  display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 8px;
  border-radius: var(--radius-pill); background: var(--success-tint);
  border: 1px solid color-mix(in srgb, var(--success-500) 40%, transparent);
  color: var(--success-400); font-family: var(--font-mono);
  font-size: 13px; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums;
}
.targetPill.overridden {
  background: rgba(154,124,184,0.14); color: #c79bf0;
  border-color: rgba(199,155,240,0.45);
}

/* Small +/- stepper buttons (inventory / receiving) */
.stepBtn {
  width: 30px; height: 26px; display: inline-grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text-secondary); transition: all var(--dur-fast) var(--ease-out);
  font-family: var(--font-mono); font-size: 15px; line-height: 1;
}
.stepBtn.minus:hover { border-color: var(--seal-500); color: var(--seal-400); }
.stepBtn.plus:hover { border-color: var(--gold-600); color: var(--gold-400); }

/* -------------------------------- Pips ---------------------------------- */
.pips { display: inline-flex; align-items: center; flex-shrink: 0; vertical-align: middle; }
.pips img {
  border-radius: 50%; object-fit: contain; position: relative; display: block;
}
.pips img + img { box-shadow: 0 0 0 1.5px var(--pip-ring, var(--stock-900)); }

/* ------------------------------- Modals --------------------------------- */
.modalOverlay {
  position: fixed; inset: 0; background: rgba(6,5,4,0.78);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 120; padding: 20px;
}
.modalOverlay.show { display: flex; }
.modalPanel {
  background: var(--surface-raised); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
  padding: 26px; width: min(520px, 100%); max-height: 90vh; overflow: auto;
}
.modalPanel h3 {
  margin: 0 0 8px; font-family: var(--font-display); font-size: var(--text-xl);
  font-weight: var(--weight-semibold); letter-spacing: -0.01em;
}
.modalActions { display: flex; gap: 8px; margin-top: 22px; justify-content: flex-end; }

/* Light "paper" fields for the sign-in modal (per the redesign) */
.paperField {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--radius-md);
  border: 1px solid var(--border-strong); background: var(--ink-50); color: #1a140a;
  font-family: var(--font-sans); font-size: 15px; outline: none;
}
.paperField:focus { border-color: var(--gold-500); box-shadow: 0 0 0 3px var(--gold-tint); }

/* --------------------------- Misc shared bits --------------------------- */
.metaLine {
  display: flex; flex-wrap: wrap; gap: 3px 14px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.emptyBox {
  padding: 40px 20px; text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-muted);
}
.emptyBox b, .emptyBox strong { color: var(--text-secondary); }
.flashMsg {
  margin-bottom: 16px; padding: 9px 14px; border-radius: var(--radius-md);
  background: var(--success-tint); border: 1px solid color-mix(in srgb, var(--success-500) 40%, transparent);
  color: var(--success-400); font-family: var(--font-mono); font-size: 12.5px;
}

/* ============================================================================
   CardCrow loader — full logo breathing in the centre while two golden
   "shooting stars" (a comet head + a fading conic tail) orbit it in opposite
   directions at different radii and speeds. Ported from CardCrow_Loader.html.
   Drop-in for every `.metaLoading` state; also standalone as `.ravenLoader`.
   ============================================================================ */
@keyframes cc-spin { to { transform: rotate(360deg); } }
@keyframes cc-spin-rev { to { transform: rotate(-360deg); } }
@keyframes cc-breathe { 0%,100% { opacity: .78; } 50% { opacity: 1; } }

.ravenLoader {
  --loader-size: 92px;
  --loader-box: calc(var(--loader-size) * 1.28);
  --loader-speed: 2.4s;
  --loader-gold: var(--gold-500);
  position: relative; width: var(--loader-box); height: var(--loader-box);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.ravenLoader .ravenHead {  /* the logo, breathing */
  width: var(--loader-size); height: var(--loader-size);
  background: center / contain no-repeat url('/assets/loader-logo.png');
  position: relative; z-index: 2;
  animation: cc-breathe 3.2s var(--ease-in-out) infinite;
}
.ravenLoader .orbit1 {  /* outer comet: bright head + long faint tail */
  position: absolute; inset: 0; border-radius: 50%; z-index: 1;
  animation: cc-spin var(--loader-speed) cubic-bezier(.55,.1,.4,.95) infinite;
}
.ravenLoader .orbit1 .tail {
  position: absolute; inset: 0; border-radius: 50%; opacity: .85;
  background: conic-gradient(from 0deg, transparent 300deg, var(--loader-gold) 358deg, transparent 360deg);
  -webkit-mask: radial-gradient(circle, transparent calc(var(--loader-box)*0.5 - 2.5px), #000 calc(var(--loader-box)*0.5 - 2.5px));
          mask: radial-gradient(circle, transparent calc(var(--loader-box)*0.5 - 2.5px), #000 calc(var(--loader-box)*0.5 - 2.5px));
}
.ravenLoader .orbit1 .head {
  position: absolute; top: -2.5px; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--loader-gold);
  box-shadow: 0 0 5px 1px var(--loader-gold), 0 0 10px 2px rgba(198,161,91,.5);
}
.ravenLoader .orbit2 {  /* inner comet: smaller, opposite direction, slower */
  position: absolute; inset: calc(var(--loader-box)*0.11); border-radius: 50%; z-index: 1;
  animation: cc-spin-rev calc(var(--loader-speed) * 1.55) cubic-bezier(.55,.1,.4,.95) infinite;
}
.ravenLoader .orbit2 .tail {
  position: absolute; inset: 0; border-radius: 50%; opacity: .6;
  background: conic-gradient(from 0deg, var(--loader-gold) 2deg, transparent 48deg, transparent 360deg);
  -webkit-mask: radial-gradient(circle, transparent calc(var(--loader-box)*0.39 - 2px), #000 calc(var(--loader-box)*0.39 - 2px));
          mask: radial-gradient(circle, transparent calc(var(--loader-box)*0.39 - 2px), #000 calc(var(--loader-box)*0.39 - 2px));
}
.ravenLoader .orbit2 .head {
  position: absolute; top: -2px; left: 50%; transform: translateX(-50%);
  width: 3.5px; height: 3.5px; border-radius: 50%; background: var(--loader-gold);
  box-shadow: 0 0 4px 1px var(--loader-gold), 0 0 8px 2px rgba(198,161,91,.45);
}
.ravenLoader.sm { --loader-size: 38px; --loader-speed: 2s; }
.ravenLoader.lg { --loader-size: 150px; }
@media (prefers-reduced-motion: reduce) {
  .ravenLoader .orbit1, .ravenLoader .orbit2, .ravenLoader .ravenHead { animation: none !important; }
  .ravenLoader .ravenHead { opacity: .95; }
}

/* Every existing `.metaLoading` block becomes the comet loader with its text
   beneath — no per-view markup changes. The breathing logo is painted by
   ::before; a single comet orbit by ::after (kept to one orbit for the many
   inline spots, which read cleanly small). */
.metaLoading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; min-height: 150px; position: relative; padding-top: 112px;
}
.metaLoading::before {  /* breathing logo */
  content: ""; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 78px; height: 78px;
  background: center / contain no-repeat url('/assets/loader-logo.png');
  animation: cc-breathe 3.2s var(--ease-in-out) infinite; z-index: 2;
}
.metaLoading::after {  /* one comet orbit */
  content: ""; position: absolute; top: 0; left: 50%; margin-left: -50px;
  width: 100px; height: 100px; border-radius: 50%; z-index: 1;
  background: conic-gradient(from 0deg, transparent 300deg, var(--gold-500) 358deg, transparent 360deg);
  -webkit-mask: radial-gradient(circle, transparent 47px, #000 47px);
          mask: radial-gradient(circle, transparent 47px, #000 47px);
  animation: cc-spin 2.4s cubic-bezier(.55,.1,.4,.95) infinite;
}
.metaLoadingText { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted); letter-spacing: 0.02em; }

/* compact inline variant for small status lines (settings, progress). */
.metaLoading.inline {
  flex-direction: row; align-items: center; justify-content: flex-start;
  gap: 12px; min-height: 0; padding-top: 0;
}
.metaLoading.inline::before {
  position: relative; top: auto; left: auto; transform: none;
  width: 30px; height: 30px; margin-right: -30px;
  animation: cc-breathe 3.2s var(--ease-in-out) infinite;
}
.metaLoading.inline::after {
  position: relative; top: auto; left: auto; margin-left: 0;
  width: 30px; height: 30px;
  -webkit-mask: radial-gradient(circle, transparent 13px, #000 13px);
          mask: radial-gradient(circle, transparent 13px, #000 13px);
}

/* Big full-page CardCrow loading overlay for all normal loading states. */
.metaLoading:not(.inline) {
  position: fixed;
  inset: 0;
  z-index: 9000;
  min-height: 100vh;
  padding-top: 260px;
  background:
    radial-gradient(circle at 50% 42%, rgba(212,176,110,0.10), transparent 32%),
    rgba(7, 6, 5, 0.78);
  backdrop-filter: blur(4px) brightness(0.68);
  -webkit-backdrop-filter: blur(4px) brightness(0.68);
  color: var(--gold-200);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.metaLoading:not(.inline)::before {
  top: 50%;
  width: min(260px, 42vw);
  height: min(260px, 42vw);
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 40px rgba(212,176,110,0.26));
}
.metaLoading:not(.inline)::after {
  top: 50%;
  width: min(340px, 55vw);
  height: min(340px, 55vw);
  margin-left: 0;
  transform: translate(-50%, -50%);
  -webkit-mask: radial-gradient(circle, transparent calc(min(340px, 55vw) / 2 - 4px), #000 calc(min(340px, 55vw) / 2 - 4px));
          mask: radial-gradient(circle, transparent calc(min(340px, 55vw) / 2 - 4px), #000 calc(min(340px, 55vw) / 2 - 4px));
}

.manaPicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 7px; }
.manaPickBtn {
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface-raised); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: .45; filter: grayscale(.8); transition: all var(--dur-fast) var(--ease-out);
}
.manaPickBtn:hover { opacity: .85; filter: grayscale(.25); transform: translateY(-1px); }
.manaPickBtn.on { opacity: 1; filter: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(198,161,91,.15), var(--edge-top); }
.manaConfirmPicker { display: block; margin: 10px 0 14px; color: var(--text-secondary); }
.archTitleLine, .archCardTitle { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.archCardTitle h3 { margin: 0; }
.archTitleLine h2 { margin: 0; }

.analysisCardCell { display:flex; align-items:center; gap:10px; min-width: 220px; }
.analysisCardImg {
  width: 38px; height: 53px; object-fit: cover; border-radius: 4px;
  border: 1px solid var(--border-strong); background: var(--bg-well);
  box-shadow: var(--shadow-sm); flex: 0 0 auto;
}

/* Upgraded full-screen loader uses the actual two-orbit CardCrow loader markup,
   not the older pseudo-element fallback, so both golden circles render cleanly. */
.metaLoading.is-upgraded::before,
.metaLoading.is-upgraded::after { display: none !important; content: none !important; }
.metaLoading.is-upgraded:not(.inline) {
  padding-top: 0;
  gap: 22px;
  text-align: center;
}
.metaLoading.is-upgraded:not(.inline) .ravenLoader.lg {
  --loader-size: min(260px, 42vw);
  --loader-speed: 2.8s;
  filter: drop-shadow(0 0 42px rgba(212,176,110,0.28));
}
.metaLoading.is-upgraded:not(.inline) .metaLoadingText {
  color: var(--gold-200);
  font-size: 13px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Hotfix: the exact inline SVG-style loader is now the only visible loader.
   The old pseudo-element spinner stayed visible in some loading containers,
   creating two loaders at once. Hide the legacy ::before/::after fallback for
   full-screen loading states. Inline status loaders keep their compact behavior. */
.metaLoading:not(.inline)::before,
.metaLoading:not(.inline)::after {
  display: none !important;
  content: none !important;
}
.metaLoading:not(.inline) {
  padding-top: 0 !important;
}
