/* Lux Web Simulator — one stylesheet, design tokens up top.
   Vanilla CSS on purpose (5-year horizon, no toolchain): see CLD-lux-web-simulator-spec.md §1. */

:root {
  --accent: #5b5bd6;            /* overridden at runtime from vertical theme */
  --accent-soft: #eeeefc;
  --ink: #16182d;
  --ink-soft: #5a5e7a;
  --line: #e4e6f0;
  --bg: #f7f8fc;
  --card: #ffffff;
  --good: #0e9f6e;
  --warn: #b45309;
  --bad: #c0392b;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(22, 24, 45, .07), 0 8px 24px rgba(22, 24, 45, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.5; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }

/* The [hidden] attribute must win over any author `display` rule below. Without this,
   .modal-root { display: flex } overrides [hidden] and the modal overlay renders on page
   load -- a full-screen scrim that blocks all interaction. */
[hidden] { display: none !important; }

/* ---- layout: stage + persistent edu panel ---- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto 1fr;
  grid-template-areas: "topbar topbar" "stage panel";
  min-height: 100vh;
}
.topbar { grid-area: topbar; display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1.4rem; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; }
.brand-mark { font-weight: 800; font-size: 1.35rem; letter-spacing: .02em; color: var(--accent); }
.brand-sub { margin-left: .45rem; color: var(--ink-soft); font-weight: 600; }
.topbar-right { display: flex; gap: .7rem; align-items: center; }
.synthetic-pill { font-size: .72rem; background: #fff7ed; color: var(--warn);
  border: 1px solid #fcd9b6; padding: .25rem .6rem; border-radius: 999px; font-weight: 600; }
.stage { grid-area: stage; padding: 2rem clamp(1rem, 4vw, 3.5rem); max-width: 880px; width: 100%;
  justify-self: center; }
.edu-panel { grid-area: panel; background: var(--card); border-left: 1px solid var(--line);
  padding: 1.3rem; position: sticky; top: 57px; height: calc(100vh - 57px); overflow-y: auto; }
.layout.panel-collapsed { grid-template-columns: minmax(0, 1fr) 0; }
.layout.panel-collapsed .edu-panel { display: none; }

/* Below 768px (mobile) the panel becomes a fixed overlay and defaults collapsed (JS);
   desktop + tablet keep the in-flow 2-column panel, default open. */
@media (max-width: 767px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "topbar" "stage"; }
  /* Fixed overlay, but sized to its CONTENT — not the old full-height panel that left ~60%
     empty (mobile-review P2-b). sidepanel.js sets `top` from the live topbar height so the
     wrapped disclaimer row below doesn't get covered. */
  .edu-panel { position: fixed; right: 0; top: 57px; width: min(92vw, 360px); z-index: 40;
    height: auto; max-height: calc(100vh - 57px); box-shadow: var(--shadow);
    border-radius: 0 0 0 14px; }
  .layout.panel-collapsed .edu-panel { display: none; }
  /* Show the "synthetic data" disclaimer on phones too (mobile-review P2-c): let the topbar
     wrap so the pill takes its own full-width row instead of being hidden entirely. */
  .topbar { flex-wrap: wrap; }
  .synthetic-pill { display: block; order: 3; flex-basis: 100%; text-align: center;
    margin-top: .5rem; font-size: .68rem; }
  /* Comfortable tap targets on the small controls (mobile-review P3-a). */
  .ghost-btn, .link-btn, .mode-toggle button, .edu-tabs button { min-height: 44px; }
  .link-btn { display: inline-flex; align-items: center; }
}

/* ---- generic bits ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.6rem; }
.ghost-btn { background: transparent; border: 1px solid var(--line); border-radius: 9px;
  padding: .45rem .9rem; color: var(--ink-soft); font-weight: 600; }
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }
.primary-btn { background: var(--accent); color: #fff; border: 0; border-radius: 10px;
  padding: .75rem 1.5rem; font-size: 1rem; font-weight: 700; }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }
.primary-btn:hover:not(:disabled) { filter: brightness(1.07); }
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 600;
  text-decoration: underline; padding: .3rem; }
.muted { color: var(--ink-soft); }
.small { font-size: .84rem; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15rem .55rem;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* ---- intro / inputs ---- */
.hero-title { font-size: clamp(1.6rem, 3.5vw, 2.3rem); font-weight: 800; }
.field-row { margin: 1rem 0; }
.field-row label { display: block; font-weight: 600; margin-bottom: .35rem; }
.field-row input[type="text"], .field-row input[type="email"], .field-row select,
.buyer-form input, .buyer-form select {
  width: 100%; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 10px;
  font-size: 1rem; font-family: inherit; background: #fff; color: var(--ink); }
.field-row input:focus, .buyer-form input:focus { outline: 2px solid var(--accent-soft);
  border-color: var(--accent); }
.field-help { font-size: .8rem; color: var(--ink-soft); margin-top: .3rem; }
.intro-actions { display: flex; gap: 1rem; align-items: center; margin-top: 1.4rem; flex-wrap: wrap; }

/* ---- question wizard ---- */
.progress { height: 6px; background: var(--line); border-radius: 999px; margin-bottom: 1.6rem; }
.progress > div { height: 100%; background: var(--accent); border-radius: 999px;
  transition: width .3s ease; }
.chips { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 12px;
  padding: .7rem 1.1rem; font-size: .97rem; font-weight: 600; color: var(--ink);
  transition: transform .06s ease; }
.chip:hover { border-color: var(--accent); }
.chip.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip:active { transform: scale(.97); }
.slider-wrap { margin-top: 1.2rem; }
.slider-value { font-size: 2rem; font-weight: 800; color: var(--accent); }
.slider-bin { font-size: .84rem; color: var(--ink-soft); margin-bottom: .8rem; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.wizard-nav { display: flex; justify-content: space-between; margin-top: 1.6rem; }

/* ---- personas ---- */
.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem; margin-top: 1.2rem; }
.persona-card { text-align: left; background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem; transition: border-color .15s; }
.persona-card:hover { border-color: var(--accent); }
.persona-emoji { font-size: 1.6rem; }
.persona-name { font-weight: 800; margin-top: .3rem; }
.persona-title { color: var(--accent); font-size: .85rem; font-weight: 700; }
.persona-story { font-size: .84rem; color: var(--ink-soft); margin-top: .4rem; }

/* ---- reasoning animation ---- */
.reasoning { max-width: 560px; margin: 3rem auto; }
.reason-step { display: flex; gap: .8rem; align-items: baseline; padding: .55rem 0;
  opacity: .25; transition: opacity .25s; }
.reason-step.active, .reason-step.done { opacity: 1; }
.reason-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line);
  flex: none; position: relative; top: -1px; }
.reason-step.active .reason-dot { background: var(--accent); animation: pulse 0.9s infinite; }
.reason-step.done .reason-dot { background: var(--good); }
.reason-label { font-weight: 700; }
.reason-detail { font-size: .8rem; color: var(--ink-soft); }
.exec-time { text-align: center; margin-top: 1.4rem; font-size: .95rem; color: var(--ink-soft); }
.exec-time strong { color: var(--accent); font-size: 1.15rem; }
@keyframes pulse { 50% { transform: scale(1.5); } }

/* ---- recommendations ---- */
.mode-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; margin: .8rem 0 1.2rem; }
.mode-toggle button { border: 0; background: #fff; padding: .5rem 1rem; font-weight: 600;
  color: var(--ink-soft); }
.mode-toggle button.active { background: var(--accent); color: #fff; }
.offer-card { border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card);
  padding: 1.2rem 1.4rem; display: flex; gap: 1rem; align-items: center; }
.offer-card.top-pick { border-color: var(--accent); box-shadow: var(--shadow); }
.offer-badge { width: 52px; height: 52px; border-radius: 12px; color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex: none; }
.offer-logo { width: 52px; height: 52px; border-radius: 12px; object-fit: contain; flex: none;
  background: #fff; border: 1px solid var(--line); }
.offer-props { margin: .4rem 0 0; padding-left: 1.1rem; }
.offer-props li { font-size: .84rem; color: var(--ink-soft); margin: .15rem 0; }
.offer-body { flex: 1; min-width: 0; }
.offer-name { font-weight: 800; font-size: 1.05rem; }
.offer-tagline { color: var(--ink-soft); font-size: .88rem; }
.offer-cta { flex: none; }
.offer-list { display: flex; flex-direction: column; gap: .9rem; }
.rank-num { font-weight: 800; color: var(--ink-soft); width: 1.4rem; flex: none; }
.carousel { position: relative; }
.carousel-track { display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: .6rem; }
.carousel-track .offer-card { flex: 0 0 min(88%, 420px); scroll-snap-align: center;
  flex-direction: column; align-items: flex-start; }
.results-actions { display: flex; gap: 1rem; margin-top: 1.4rem; flex-wrap: wrap; align-items: center; }
.n1-note { font-size: .8rem; color: var(--ink-soft); background: var(--accent-soft);
  border-radius: 10px; padding: .6rem .9rem; margin-top: 1rem; }

/* ---- intro disclosure ---- */
.disclosure { font-size: .72rem; color: var(--ink-soft); margin-top: 1.1rem;
  padding-top: .9rem; border-top: 1px solid var(--line); line-height: 1.45; }

/* ---- merged results/decline flow ---- */
.decline-card { border-left: 5px solid var(--bad); }
.pivot-card { border-left: 5px solid var(--accent); margin-top: 1.2rem; }
/* above-the-fold CTA banner: prominent, text left + action right, wraps on mobile */
.cta-banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: 1.2rem; background: var(--accent-soft); border: 1px solid var(--accent);
  flex-wrap: wrap; }
.cta-banner strong { font-size: 1.05rem; }
.cta-banner .primary-btn { flex: none; }
/* pivot box header: tag left, "Why these?" pinned top-right */
.box-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.box-why { flex: none; margin: 0; }

/* ---- transparency modal ---- */
.modal-root { position: fixed; inset: 0; background: rgba(22,24,45,.45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: #fff; border-radius: var(--radius); max-width: 760px; width: 100%;
  max-height: 88vh; overflow-y: auto; padding: 1.6rem; }
.modal-close { float: right; }
.explain-english { background: var(--accent-soft); border-radius: 10px; padding: .9rem 1.1rem;
  margin: .9rem 0 1.2rem; font-size: .98rem; }
.rank-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.rank-table th, .rank-table td { text-align: left; padding: .5rem .55rem;
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.rank-table th { color: var(--ink-soft); font-size: .74rem; text-transform: uppercase;
  letter-spacing: .04em; }
.rank-table tr.winner { background: #f2fbf7; }
.rank-table tr.suppressed { color: var(--ink-soft); text-decoration: line-through; }
.conf-pill { font-weight: 700; padding: .15rem .6rem; border-radius: 999px; font-size: .76rem; }
.conf-high { background: #e7f8f1; color: var(--good); }
.conf-building { background: #fff7ed; color: var(--warn); }
.conf-low { background: var(--accent-soft); color: var(--accent); }
.delta-up { color: var(--good); } .delta-down { color: var(--bad); }

/* ---- sandbox ---- */
/* header row: heading left, the finish CTA pinned top-right (above the fold) */
.sandbox-header { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; }
.sandbox-header .primary-btn { flex: none; }
.sandbox-grid { display: grid; grid-template-columns: 300px 1fr; gap: 1.4rem; margin-top: 1rem; }
@media (max-width: 800px) { .sandbox-grid { grid-template-columns: 1fr; } }
.sandbox-controls .chips { margin-top: .4rem; }
.sandbox-controls h4 { margin: 1rem 0 .1rem; font-size: .84rem; }
.sandbox-controls h4:first-child { margin-top: 0; }
.sb-slabel { color: var(--accent); margin-bottom: .1rem; }
.sandbox-controls input[type="range"] { margin-bottom: .3rem; }
.sandbox-live { min-height: 300px; }
.flash { animation: flash .7s ease; }
@keyframes flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }

/* ---- edu panel ---- */
.edu-tabs { display: flex; gap: .4rem; margin-bottom: 1rem; }
.edu-tabs button { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 9px;
  padding: .45rem; font-weight: 700; color: var(--ink-soft); }
.edu-tabs button.active { border-color: var(--accent); color: var(--accent);
  background: var(--accent-soft); }
.edu-panel h3 { font-size: 1rem; }
.edu-panel ul { padding-left: 1.1rem; margin: .6rem 0; }
.edu-panel li { margin: .6rem 0; font-size: .88rem; color: var(--ink-soft); }
.edu-panel li strong { color: var(--ink); }

/* ---- developer drawer ---- */
.dev-drawer { position: fixed; left: 0; right: 0; bottom: 0; max-height: 45vh; overflow-y: auto;
  background: #101226; color: #d8dbf0; z-index: 60; padding: 1rem 1.4rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem;
  border-top: 3px solid var(--accent); }
.dev-drawer h4 { color: #8f95c9; margin: .8rem 0 .3rem; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .08em; }
.dev-drawer pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
.dev-toggle { position: fixed; bottom: 12px; right: 12px; z-index: 61; background: #101226;
  color: #fff; border: 0; border-radius: 999px; padding: .5rem .9rem; font-weight: 700;
  font-size: .78rem; }

/* ---- CTA ---- */
.cta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 640px) { .cta-grid { grid-template-columns: 1fr; } }
.success-note { background: #e7f8f1; color: var(--good); border-radius: 10px;
  padding: .9rem 1.1rem; font-weight: 600; }

/* ================================================================
   Mobile UX review (2026-07-11) — see WEB-SIMULATOR-MOBILE-REVIEW-2026-07-11.md.
   Everything screen-specific is scoped to a breakpoint so desktop stays pixel-identical.
   ================================================================ */

/* P1-a — step counter under the wizard progress bar (all widths). */
.step-count { margin: -1rem 0 1.1rem; font-weight: 600; }

/* P1-b — intro gate error message (all widths). */
.field-error { color: var(--bad); font-size: .85rem; font-weight: 600; margin-top: .5rem; }

/* P3-b — legal disclaimer was 11.5px; lift to a readable size (all widths). */
.disclosure { font-size: .8rem; }

/* P2-b — close button for the "Why Lux?" overlay; only shown on mobile where the panel
   is a fixed overlay (on desktop it's an in-flow column that never needs closing). */
.edu-close { display: none; }
.edu-backdrop { position: fixed; inset: 0; background: rgba(22, 24, 45, .4); z-index: 35; }

/* P2-a — the loan slider was a 16px-tall hit target; give it a comfortable one without
   changing the sandbox sliders. */
.slider-wrap input[type="range"] { height: 44px; }

@media (max-width: 640px) {
  /* P0 — the offer card is a desktop horizontal row (logo | body | CTA) that crushed the body
     to one-word-per-line on phones and let the CTA overlap the copy. Stack it and make the CTA
     full width. Desktop (>640px) keeps the original row untouched. */
  .offer-card { flex-direction: column; align-items: flex-start; gap: .8rem; }
  .offer-cta { width: 100%; }
  .offer-cta .primary-btn { width: 100%; }
}

@media (max-width: 767px) {
  .edu-close { display: block; position: absolute; top: .6rem; right: .8rem; background: none;
    border: 0; font-size: 1.2rem; line-height: 1; color: var(--ink-soft); padding: .4rem;
    min-width: 44px; min-height: 44px; }
  .edu-panel { padding-top: 2.6rem; } /* room for the close button */
}

/* ---- buyer landing pages ---- */
.buyer-page { max-width: 640px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.buyer-hero { border-radius: var(--radius); color: #fff; padding: 2rem 1.6rem; margin-bottom: 1.4rem; }
.buyer-hero h1 { font-size: 1.7rem; }
.prefill-note { display: none; background: #e7f8f1; color: var(--good); border-radius: 10px;
  padding: .7rem 1rem; font-weight: 600; margin-bottom: 1rem; font-size: .9rem; }
.prefill-note.show { display: block; }
.buyer-form label { display: block; font-weight: 600; margin: .9rem 0 .3rem; }
.buyer-form input.prefilled { background: #f2fbf7; border-color: var(--good); }
.demo-footer { text-align: center; color: var(--ink-soft); font-size: .78rem; margin-top: 2.5rem; }
