/* HELIX desktop renderer — red/black theme, mirrors apps/web/styles/globals.css.
 * Standalone — no @import, no external font, no dependency on the web bundle.
 * If you tweak the brand palette in the web app, mirror the change here too.
 *
 * Apr 2026 polish layer: glass cards, gradient hero, button glow, reveal
 * animations, focus-within glow on the input card. The CSS is browser-only
 * (Electron's Chromium renderer) so we can use backdrop-filter without
 * worrying about IE/Safari fallbacks. */

:root {
  --bg:              #08080a;
  --surface:         #14080a;
  --surface-alt:     #1f0d10;
  --border:          #ef444433;
  --text:            #f6f5f5;
  --dim:             #b8a5a8;
  --accent:          #ef4444;
  --accent-deep:     #b91c1c;
  --good:            #22d3ee;
  --fair:            #f59e0b;
  --bad:             #f87171;
  --glass-bg:        rgba(20, 8, 10, 0.62);
  --glass-border:    rgba(239, 68, 68, 0.22);
  --glass-border-hi: rgba(239, 68, 68, 0.55);
  --glow-soft:       0 0 0 1px rgba(239,68,68,0.10), 0 12px 40px -16px rgba(239,68,68,0.55);
  --glow-strong:     0 0 0 1px rgba(239,68,68,0.30), 0 18px 60px -12px rgba(239,68,68,0.70);
  --shadow-card:     0 8px 32px -16px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.04) inset;
}

* { box-sizing: border-box; }

/* Force the HTML5 `hidden` attribute to win even when an element has an
 * explicit display rule (e.g. `.empty-state { display: flex }`). Without
 * this, calling `el.hidden = true` on a flex/grid card is a no-op
 * because UA `[hidden] { display: none }` has lower specificity than the
 * authored rule. Bug #A from the iter-9 screenshot. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  /* Layered ambient: red glow top-left, deeper red bottom-right, soft
     center accent, base near-black. Reads as "moody, focused tool" not
     "default app window". */
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(239,68,68,0.14) 0%, transparent 55%) fixed,
    radial-gradient(900px 500px at 90% 110%, rgba(185,28,28,0.10) 0%, transparent 60%) fixed,
    radial-gradient(800px 800px at 50% 30%, rgba(239,68,68,0.04) 0%, transparent 70%) fixed,
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
::selection { background: rgba(239,68,68,0.35); color: #fff; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit; font-size: 14px; font-weight: 600;
  border-radius: 10px; padding: 10px 16px; border: 1px solid var(--border);
  cursor: pointer;
  background: transparent; color: var(--text);
  transition: transform .12s cubic-bezier(.2,.8,.2,1),
              background .2s, box-shadow .2s, border-color .2s, filter .2s;
  letter-spacing: .01em;
}
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--glow-soft);
}
button.primary:hover:not(:disabled) {
  filter: brightness(1.10);
  transform: translateY(-1px);
  box-shadow: var(--glow-strong);
}
button.ghost { background: transparent; }
button.ghost:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.10);
  border-color: var(--glass-border-hi);
}

/* ─── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--glass-border);
  background: linear-gradient(180deg, rgba(20,8,10,0.85) 0%, rgba(20,8,10,0.55) 100%);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  position: sticky; top: 0; z-index: 10;
  /* Hairline accent at the bottom edge — subtle, but defines the topbar. */
  box-shadow: 0 1px 0 rgba(239,68,68,0.08);
}
.brand {
  font-weight: 800; letter-spacing: .18em; color: var(--accent);
  font-size: 13px;
}
.brand-badge {
  margin-left: 8px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: .12em;
  vertical-align: 1px;
}
.topbar-spacer { flex: 1; }
.topbar-btn {
  font-size: 12px; padding: 6px 12px; font-weight: 600;
}

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px; color: var(--dim);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--dim);
}
.status-dot[data-state="ok"]       { background: var(--good); box-shadow: 0 0 0 3px #22d3ee33; }
.status-dot[data-state="checking"] { background: var(--fair); animation: pulse 1.4s infinite; }
.status-dot[data-state="partial"]  { background: var(--fair); box-shadow: 0 0 0 3px #f59e0b33; }
.status-dot[data-state="down"]     { background: var(--accent); box-shadow: 0 0 0 3px #ef444433; }
@keyframes pulse {
  0%,100% { opacity: 1; }
  50%     { opacity: .4; }
}

/* ─── Page layout ─────────────────────────────────────────────────────── */
.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 24px 80px;
  display: flex; flex-direction: column; gap: 16px;
}

.hero { padding: 8px 4px; }
.tagline {
  font-size: 44px; line-height: 1.05;
  margin: 0 0 10px;
  letter-spacing: -0.025em; font-weight: 800;
  background: linear-gradient(125deg, #ffffff 0%, #fca5a5 45%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 18px rgba(239,68,68,0.18));
}
.sub { color: var(--dim); margin: 0; max-width: 580px; }

/* ─── Card primitive ──────────────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px 18px;
  backdrop-filter: blur(14px) saturate(110%);
  -webkit-backdrop-filter: blur(14px) saturate(110%);
  box-shadow: var(--shadow-card);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.card:hover { border-color: var(--glass-border-hi); }
.input-card:hover { transform: none; }
.input-card { transition: border-color .2s, box-shadow .2s, transform .18s; }
.input-card:focus-within {
  border-color: var(--glass-border-hi);
  box-shadow: var(--glow-soft);
}

.input-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.input {
  width: 100%;
  background: transparent;
  border: 0; outline: 0;
  color: var(--text);
  font-family: inherit; font-size: 16px;
  resize: vertical;
  padding: 6px 8px 8px;
  caret-color: var(--accent);
}
.input-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.hint { color: var(--dim); margin: 0; padding: 0 4px; font-size: 12px; }
.kbd-hint { margin-left: 8px; opacity: .8; }
kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-alt);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--text);
}

/* ─── Empty state (shown until first analyze) ─────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 12px;
  padding: 20px 22px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%);
}
.empty-icon { font-size: 28px; }
.empty-state h2 { margin: 0; font-size: 18px; color: var(--text); }
.empty-state .body { margin: 0; color: var(--dim); font-size: 14px; }
.empty-suggestions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 4px;
}
.empty-label { color: var(--dim); font-size: 12px; font-weight: 600; margin-right: 4px; }
.empty-pill {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  border-color: var(--border);
  transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
}
.empty-pill:hover {
  border-color: var(--accent);
  background: rgba(239,68,68,0.10);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px -10px rgba(239,68,68,0.55);
}
.empty-icon {
  font-size: 28px;
  /* Subtle pulse so the empty state doesn't feel static when the user
     first opens the app. Reduced-motion users get a static icon. */
  animation: helix-empty-pulse 2.4s ease-in-out infinite;
}
@keyframes helix-empty-pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%     { transform: scale(1.06); opacity: .88; }
}
@media (prefers-reduced-motion: reduce) {
  .empty-icon { animation: none; }
}

/* ─── Segmented provider picker ───────────────────────────────────────── */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: fit-content;
}
.seg-btn {
  background: transparent;
  border: 0;
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  letter-spacing: .02em;
}
.seg-btn.on {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%);
  color: var(--text);
  border: 1px solid rgba(239,68,68,0.30);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 4px 16px -8px rgba(239,68,68,0.55);
}
.seg-btn:hover:not(.on) {
  color: var(--text);
  background: rgba(239, 68, 68, 0.08);
}

/* ─── Skeleton + error ─────────────────────────────────────────────────── */
.skeleton { color: var(--dim); }
.skeleton-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--text);
}
.skeleton-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s infinite;
}
.skeleton-stage { color: var(--dim); margin-top: 4px; font-size: 13px; }

.error-card {
  border-color: var(--accent);
  background: linear-gradient(180deg, #ef444414 0%, var(--surface) 80%);
  display: grid; gap: 10px;
}
.error-head { display: flex; align-items: center; gap: 10px; }
.error-icon {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent); color: #fff;
  font-weight: 700;
}
.error-card .body {
  margin: 0; color: var(--dim); font-size: 13px;
  /* Preserve newlines from explainError() so each provider attempt sits
     on its own line. Without this, \n collapses to a space and the
     bullet list runs together. */
  white-space: pre-wrap;
  font-family: inherit;
}
.error-actions { display: flex; gap: 8px; }

/* ─── Result rendering ────────────────────────────────────────────────── */
.result {
  display: flex; flex-direction: column; gap: 14px;
  animation: helix-fade-up .35s cubic-bezier(.2,.8,.2,1) both;
}
.result > .card { animation: helix-fade-up .42s cubic-bezier(.2,.8,.2,1) both; }
.result > .card:nth-child(1) { animation-delay: 0ms; }
.result > .card:nth-child(2) { animation-delay: 50ms; }
.result > .card:nth-child(3) { animation-delay: 100ms; }
.result > .card:nth-child(4) { animation-delay: 150ms; }
.result > .card:nth-child(5) { animation-delay: 200ms; }
.result > .card:nth-child(n+6) { animation-delay: 250ms; }
@keyframes helix-fade-up {
  from { opacity: 0; transform: translateY(10px) scale(0.992); }
  to   { opacity: 1; transform: translateY(0)    scale(1);     }
}
@media (prefers-reduced-motion: reduce) {
  .result, .result > .card { animation: none; }
  .deal-item-live-badge, .empty-icon, .seg-btn::after { animation: none !important; }
}
.result-head {
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.result-head::before {
  /* Soft red sheen behind the title — adds depth without heavy texture. */
  content: '';
  position: absolute;
  top: -40%; right: -20%;
  width: 70%; height: 200%;
  background: radial-gradient(ellipse at center, rgba(239,68,68,0.10) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}
.result-head > * { position: relative; z-index: 1; }
.eyebrow {
  color: var(--accent); font-weight: 700; font-size: 12px;
  letter-spacing: .14em; text-transform: uppercase;
}
.eyebrow .by { color: var(--dim); font-weight: 500; text-transform: none; letter-spacing: 0; }
.result-head h1 {
  margin: 6px 0 10px;
  font-size: 34px;
  letter-spacing: -0.018em;
  font-weight: 750;
  /* Soft gradient on the product name for visual hierarchy. */
  background: linear-gradient(180deg, #ffffff 0%, #f5e2e2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.4));
}
.meta { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-alt); color: var(--dim); font-size: 12px; font-weight: 600;
  border: 1px solid transparent;
}

.section h2 { margin: 0 0 10px; font-size: 16px; font-weight: 600; color: var(--text); }
.body { margin: 0; color: var(--text); }
.list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.list li { color: var(--text); }
.list.tone-good li::marker { color: var(--good); }
.list.tone-bad  li::marker { color: var(--bad); }

.flag-card { border-color: #f8717155; background: linear-gradient(180deg, #f8717114 0%, var(--surface) 80%); }
.flag-card h2 { color: var(--bad); }

.release-list { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
.release-list dt { color: var(--dim); font-size: 13px; }
.release-list dd { margin: 0; color: var(--text); font-size: 13px; }

.deal-card { border-color: #22d3ee55; background: linear-gradient(180deg, #22d3ee14 0%, var(--surface) 80%); }
.deal-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.deal-item {
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid transparent;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
              border-color 180ms ease,
              box-shadow 180ms ease;
}
.deal-item:hover {
  transform: translateY(-1px);
  border-color: rgba(239, 68, 68, 0.18);
  box-shadow: 0 4px 18px -8px rgba(0, 0, 0, 0.45);
}
.deal-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.deal-item-price {
  color: var(--text);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.01em;
}
.deal-item-retailer { color: var(--dim); font-weight: 500; }
.deal-item-link {
  margin-left: auto;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background 140ms ease, color 140ms ease;
}
.deal-item-link:hover {
  background: rgba(239, 68, 68, 0.12);
  text-decoration: none;
}
.deal-item-notes { color: var(--dim); font-size: 13px; margin-top: 4px; line-height: 1.45; }

/* Search-fallback deal styling — when we synthesized retailer search URLs
   instead of real PDP links. We render these distinctly so users don't
   confuse them with verified live offers. */
.deal-fallback-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.22);
  color: var(--dim);
  font-size: 13px;
  line-height: 1.45;
}
.deal-item-fallback {
  background: var(--surface);
  border: 1px dashed rgba(239, 68, 68, 0.28);
}
.deal-item-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Discount markup: original price (struck-through) + green discount chip */
.deal-item-original {
  color: var(--dim);
  font-size: 13px;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  opacity: 0.75;
}
.deal-item-discount {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 50%, #166534 100%);
  color: #ffffff;
  border: 1px solid #22c55ecc;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  animation: helix-discount-intro 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes helix-discount-intro {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.deal-item-best {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.10) 0%, var(--surface-alt) 80%);
  border: 1px solid rgba(34, 197, 94, 0.35);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.10);
}
.deal-item-best-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #1a0f00;
  border: 1px solid #fbbf24aa;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.35);
}

/* Manufacturer-direct row — most likely to land on the product page.
   Override the dashed-red fallback styling with a confident blue glow so
   users know this row is the strongest bet for finding the product. */
.deal-item-manufacturer {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.10) 0%, var(--surface-alt) 80%);
  border: 1px solid rgba(56, 189, 248, 0.40);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.12);
}
.deal-item-mfr-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
  color: #001624;
  border: 1px solid #38bdf8aa;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

/* Curated PDP — hand-verified URL from the known-pdps database. The
   highest-confidence row class. Green gradient + glow distinguishes it
   from search-fallback (red dashed) and manufacturer (cyan). */
.deal-item-curated {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.10) 0%, var(--surface-alt) 80%);
  border: 1px solid rgba(34, 197, 94, 0.45);
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.14);
}
.deal-item-curated-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
  color: #052010;
  border: 1px solid #22c55eaa;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
}

/* GROUNDED — research-stage URL injected from cloud (Gemini + Google
   Search grounding). Distinct violet to mark "fresh web result, not
   training data or curated guess". Highest confidence after VERIFIED. */
.deal-item-research {
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.10) 0%, var(--surface-alt) 80%);
  border: 1px solid rgba(139, 92, 246, 0.40);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.14);
}
.deal-item-research-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: #ffffff;
  border: 1px solid #8b5cf6cc;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.45);
}

/* LIVE badge — fired when verified_price was extracted from a fresh
   page load. Pulse animation + green glow distinguishes it from any
   model-emitted price as "this is what the retailer is charging RIGHT
   NOW, not what the model thought". */
.deal-item-live-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.7px;
  padding: 3px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  color: #ffffff;
  border: 1px solid #10b981cc;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.55);
  animation: live-intro 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
             live-pulse 2.4s ease-in-out 320ms infinite;
}
@keyframes live-intro {
  from { transform: scale(0.7) rotate(-4deg); opacity: 0; }
  to   { transform: scale(1)   rotate(0);     opacity: 1; }
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(16, 185, 129, 0.55); }
  50%      { box-shadow: 0 0 14px rgba(16, 185, 129, 0.85); }
}
.deal-item-verified-meta {
  margin-top: 6px;
  font-size: 11px;
  color: rgba(16, 185, 129, 0.85);
  font-weight: 500;
  letter-spacing: 0.2px;
  animation: helix-fade-up 320ms cubic-bezier(0.2, 0.8, 0.2, 1) 200ms backwards;
}

/* ─── UNRESTRICTED tier — Phase 3 beta visual treatment ────────────────── */
/* Picker button: a violet-tinted variant to mark it as opt-in / beta. */
.seg-btn.seg-btn-beta {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.10) 0%, rgba(168, 85, 247, 0.04) 100%);
  border-color: rgba(168, 85, 247, 0.35);
}
.seg-btn.seg-btn-beta.on {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.30) 0%, rgba(168, 85, 247, 0.18) 100%);
  border-color: rgba(168, 85, 247, 0.70);
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.25);
}
.seg-beta-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  color: #fff;
  vertical-align: middle;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}

/* Maker-perspective card: blockquote-like treatment with violet ambient
   glow so users immediately recognize it as the UNRESTRICTED tier output. */
.maker-card {
  border-color: rgba(168, 85, 247, 0.45);
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.08) 0%, var(--surface) 80%);
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.12);
  position: relative;
  overflow: hidden;
}
.maker-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(140% 80% at 0% 0%, rgba(168, 85, 247, 0.10), transparent 60%);
}
.maker-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.maker-head h2 { margin: 0; }
.maker-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.45);
}
.maker-body {
  margin: 12px 0 0;
  padding: 14px 16px;
  border-left: 3px solid rgba(168, 85, 247, 0.55);
  background: rgba(168, 85, 247, 0.05);
  border-radius: 0 10px 10px 0;
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  font-style: italic;
  position: relative;
  z-index: 1;
}

/* ─── Hamburger button + sidebar drawer ────────────────────────────── */
.topbar-hamburger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 38px;
  height: 32px;
  padding: 6px 8px;
  margin-right: 4px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.topbar-hamburger:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.42);
}
.topbar-hamburger:active {
  transform: scale(0.97);
}
.topbar-hamburger[aria-expanded="true"] {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.6);
}
.hamburger-bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: var(--text);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 180ms ease;
}
/* Animate to an X when open. Bars 1 and 3 rotate; bar 2 fades out. */
.topbar-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.topbar-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(2) {
  opacity: 0;
}
.topbar-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Drawer container — fills viewport when open so the backdrop can take
   pointer events. Uses `[hidden]` driven by app.js to gate visibility. */
.sidebar {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
}
.sidebar-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  animation: helix-fade-in 180ms ease;
}
@keyframes helix-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.sidebar-panel {
  position: relative;
  width: min(320px, 80vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(31, 13, 16, 0.96) 0%, rgba(20, 8, 10, 0.98) 100%);
  border-right: 1px solid rgba(239, 68, 68, 0.32);
  box-shadow: 0 0 60px rgba(239, 68, 68, 0.12),
              4px 0 30px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px) saturate(120%);
  animation: helix-sidebar-slide 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes helix-sidebar-slide {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0);     }
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--glass-border);
}
.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.sidebar-close {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  transition: background 140ms ease, color 140ms ease;
}
.sidebar-close:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--text);
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  gap: 4px;
  flex: 1;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: background 140ms ease, border-color 140ms ease, transform 120ms ease;
}
.sidebar-item:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.30);
}
.sidebar-item:active {
  transform: scale(0.985);
}
.sidebar-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.10);
  color: var(--accent);
  flex: 0 0 28px;
}
.sidebar-item-icon svg { display: block; }
.sidebar-item-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
  min-width: 0;
}
.sidebar-item-title {
  font-weight: 700;
  letter-spacing: -0.005em;
}
.sidebar-item-pill {
  display: inline-block;
  margin-left: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.7px;
  padding: 2px 7px;
  border-radius: 999px;
  vertical-align: middle;
  text-transform: uppercase;
}
.sidebar-item-pill-gold {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #1a0f00;
  border: 1px solid #fbbf24cc;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.45);
}
.sidebar-item-desc {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.3;
}
.sidebar-item-toggle {
  flex: 0 0 auto;
  font-size: 14px;
  color: var(--dim);
  font-weight: 700;
  transition: color 140ms ease;
}
.sidebar-item.is-on .sidebar-item-toggle {
  color: var(--accent);
}
.sidebar-item.is-on .sidebar-item-icon {
  background: rgba(239, 68, 68, 0.22);
  color: #fff;
}
.sidebar-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--glass-border);
}
.sidebar-foot-text {
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.04em;
}
@media (prefers-reduced-motion: reduce) {
  .sidebar-panel,
  .sidebar-backdrop { animation: none; }
}

/* ─── Phase 3 beta badge in topbar ──────────────────────────────────── */
.phase-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  color: #fff;
  border: 1px solid rgba(168, 85, 247, 0.6);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.45);
  vertical-align: middle;
}

/* ─── UNRESTRICTED bench-event banner ────────────────────────────────── */
.bench-banner {
  display: none;
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
  border: 1px solid;
  animation: bench-banner-slide 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bench-banner-run {
  background: rgba(168, 85, 247, 0.10);
  border-color: rgba(168, 85, 247, 0.45);
  color: #e9d5ff;
}
.bench-banner-ok {
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.45);
  color: #bbf7d0;
}
.bench-banner-err {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}
@keyframes bench-banner-slide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alts { display: grid; gap: 8px; }
.alt {
  background: var(--surface-alt); border-radius: 10px; padding: 10px 12px;
}
.alt-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alt-reason { margin-top: 4px; color: var(--dim); font-size: 13px; }

.verdict-wrap { display: flex; gap: 12px; align-items: flex-start; }
.deal-badge {
  display: inline-block;
  padding: 4px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  flex: 0 0 auto;
}

/* ─── Responsive narrow widths ────────────────────────────────────────── */
@media (max-width: 640px) {
  .tagline { font-size: 28px; }
  .input-row { flex-direction: column; align-items: stretch; }
  .seg { width: 100%; justify-content: stretch; }
  .seg-btn { flex: 1; }
}

/* ─── API Query · ChatGPT-style chat surface ───────────────────────────
 * Shown when state.apiQuery is on; the analyze page is hidden in that mode.
 * The history container is a flex column that grows to fill the viewport
 * minus the topbar, so the input bar always sits at the bottom of the
 * visible area. Refused turns get a red tint so the user immediately sees
 * the backend declined to answer. */
.chat-page { max-width: 920px; margin: 0 auto; padding: 22px 18px;
  display: flex; flex-direction: column; gap: 14px;
  min-height: calc(100vh - 64px); }
.chat-head h1 { font-size: 28px; font-weight: 750; letter-spacing: -0.018em;
  margin: 0; background: linear-gradient(180deg, #fff 0%, #f5e2e2 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.chat-title-pill { display: inline-block; margin-left: 8px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.6px;
  padding: 2px 9px; border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #1a0f00; vertical-align: middle;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.45); }
.chat-sub { color: var(--dim); margin: 4px 0 0; font-size: 13px; }
.chat-history { flex: 1; display: flex; flex-direction: column;
  gap: 10px; padding: 14px; min-height: 320px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px; backdrop-filter: blur(14px) saturate(110%);
  overflow-y: auto; }
.chat-empty { color: var(--dim); font-size: 14px; line-height: 1.6;
  padding: 28px 12px; text-align: center; }
.chat-msg { padding: 12px 14px; border-radius: 12px;
  line-height: 1.55; font-size: 15px; max-width: 80%; }
.chat-msg.user { align-self: flex-end;
  background: linear-gradient(135deg, rgba(239,68,68,0.20) 0%,
    rgba(239,68,68,0.10) 100%);
  border: 1px solid rgba(239,68,68,0.32); }
.chat-msg.assistant { align-self: flex-start;
  background: var(--surface-alt);
  border: 1px solid var(--glass-border); }
.chat-msg.refused { background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.32); color: #fca5a5;
  font-style: italic; }
.chat-msg-thinking { color: var(--dim); font-style: italic;
  animation: helix-thinking 1.4s ease-in-out infinite; }
@keyframes helix-thinking { 0%, 100% { opacity: 0.5 }
  50% { opacity: 1 } }
.chat-bar { display: flex; gap: 10px; align-items: flex-end; }
.chat-input { flex: 1; min-height: 48px; max-height: 200px;
  padding: 12px 14px; resize: vertical;
  background: var(--glass-bg); color: var(--text);
  border: 1px solid var(--glass-border); border-radius: 12px;
  font-family: inherit; font-size: 15px; }
.chat-input:focus { outline: none;
  border-color: rgba(239,68,68,0.55);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.18); }
.chat-send { padding: 12px 22px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 18px -6px rgba(239,68,68,0.6);
  transition: transform 140ms ease, box-shadow 180ms ease; }
.chat-send:hover { transform: translateY(-1px);
  box-shadow: 0 6px 22px -6px rgba(239,68,68,0.75); }
.chat-send:disabled { opacity: 0.45; cursor: not-allowed;
  transform: none; }
.chat-foot { color: var(--dim); font-size: 12px; text-align: center; }
