/* Car Agent engine. Mobile-first; every size in rem so the text-size selector scales everything. */
:root {
  color-scheme: dark;
  --bg: #0e0c26;
  --bg-2: #171340;
  --text: #eef0ff;
  --muted: #bcbfe6;
  --card: #1b1846;
  --card-glass: rgba(30, 27, 78, 0.62);
  --border: rgba(165, 160, 255, 0.24);
  --indigo: #6366f1;
  --purple: #a855f7;
  --indigo-soft: #818cf8;
  --purple-soft: #c084fc;
  --pink: #f472b6;
  --btn-a: #4f46e5;
  --btn-b: #7e22ce;
  --coral: #ffa197;
  --coral-bg: rgba(255, 120, 105, 0.12);
  --chip-bg: rgba(129, 140, 248, 0.16);
  --user-bubble-a: #4f46e5;
  --user-bubble-b: #7e22ce;
  --bot-bubble: rgba(255, 255, 255, 0.07);
  --bot-bubble-solid: #25225a;
  --input-bg: rgba(10, 8, 34, 0.55);
  --input-solid: #120f33;
  --focus: #f9a8d4;
  --shadow: 0 1.25rem 2.5rem rgba(4, 2, 20, 0.45);
  --grad-text: linear-gradient(90deg, #818cf8, #c084fc 55%, #f472b6);
  --strip: linear-gradient(90deg, #6366f1, #a855f7, #f472b6);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f2ff;
  --bg-2: #ebe7ff;
  --text: #1c1846;
  --muted: #4a4776;
  --card: #ffffff;
  --card-glass: rgba(255, 255, 255, 0.78);
  --border: rgba(79, 70, 229, 0.2);
  --coral: #b4352b;
  --coral-bg: #fff0ed;
  --chip-bg: rgba(99, 102, 241, 0.12);
  --bot-bubble: rgba(99, 102, 241, 0.08);
  --bot-bubble-solid: #eceafe;
  --input-bg: rgba(255, 255, 255, 0.9);
  --input-solid: #ffffff;
  --focus: #be185d;
  --shadow: 0 1.25rem 2.5rem rgba(60, 50, 160, 0.14);
  --grad-text: linear-gradient(90deg, #4f46e5, #7e22ce 55%, #be185d);
}

html { font-size: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[data-font-size="md"] { font-size: 112.5%; }
html[data-font-size="lg"] { font-size: 125%; }
html[data-font-size="xl"] { font-size: 137.5%; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
html.no-scroll, html.no-scroll body { overflow: hidden; }
h1, h2, h3 { font-family: "Space Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif; line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--card); color: var(--text); padding: 0.5rem 0.875rem; border-radius: 0.5rem; }
.skip-link:focus { top: calc(env(safe-area-inset-top, 0px) + 0.5rem); }
:focus-visible { outline: 0.1875rem solid var(--focus); outline-offset: 0.125rem; }

/* vibrant background glow, never dulled by a scrim */
.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40rem 28rem at 12% -6%, rgba(99, 102, 241, 0.55), transparent 70%),
    radial-gradient(36rem 26rem at 88% 4%, rgba(168, 85, 247, 0.45), transparent 70%),
    radial-gradient(34rem 24rem at 60% 105%, rgba(244, 114, 182, 0.32), transparent 70%),
    var(--bg);
}
:root[data-theme="light"] .bg-glow {
  background:
    radial-gradient(40rem 28rem at 12% -6%, rgba(99, 102, 241, 0.3), transparent 70%),
    radial-gradient(36rem 26rem at 88% 4%, rgba(168, 85, 247, 0.24), transparent 70%),
    radial-gradient(34rem 24rem at 60% 105%, rgba(244, 114, 182, 0.2), transparent 70%),
    var(--bg);
}

/* NAV: sticky full-width glass bar */
.nav {
  position: sticky; top: 0; z-index: 30;
  padding: calc(env(safe-area-inset-top, 0px) + 0.5rem) calc(env(safe-area-inset-right, 0px) + 1rem) 0.5rem calc(env(safe-area-inset-left, 0px) + 1rem);
  background: var(--bg-2);
  border-bottom: 0.0625rem solid var(--border);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .nav { background: rgba(14, 12, 38, 0.66); -webkit-backdrop-filter: blur(1rem) saturate(140%); backdrop-filter: blur(1rem) saturate(140%); }
  :root[data-theme="light"] .nav { background: rgba(243, 242, 255, 0.72); }
}
.nav-row {
  width: min(100%, 83.75rem); margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1.25rem;
}
.brand { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; min-width: 0; }
.brand-mark {
  width: 2.25rem; height: 2.25rem; border-radius: 0.625rem; flex: none;
  display: grid; place-items: center; color: #fff; font: 700 0.8125rem/1 "Space Grotesk", "Inter", system-ui, sans-serif;
  background: linear-gradient(135deg, #4f46e5, #7e22ce 60%, #be185d);
}
.brand-name { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name b { font-family: "Space Grotesk", "Inter", system-ui, sans-serif; font-size: 1rem; }
.brand-name small { font-size: 0.75rem; color: var(--muted); }
.nav-links { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.nav-links a { text-decoration: none; padding: 0.375rem 0.75rem; border-radius: 999px; font-weight: 600; font-size: 0.875rem; color: var(--muted); }
.nav-links a[aria-current="page"] { color: var(--text); background: var(--chip-bg); }
.nav-links a:hover { color: var(--text); }
.prefs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.size-group { display: flex; border: 0.0625rem solid var(--border); border-radius: 999px; padding: 0.125rem; }
.size-btn { background: none; border: 0; border-radius: 999px; min-width: 2rem; height: 2rem; padding: 0 0.375rem; cursor: pointer; color: var(--muted); font-weight: 700; line-height: 1; }
.size-btn.s1 { font-size: 0.75rem; } .size-btn.s2 { font-size: 0.875rem; } .size-btn.s3 { font-size: 1rem; } .size-btn.s4 { font-size: 1.125rem; }
.size-btn[aria-pressed="true"] { background: var(--chip-bg); color: var(--text); }
.theme-btn { display: inline-flex; align-items: center; gap: 0.375rem; height: 2.25rem; padding: 0 0.75rem; border-radius: 999px; border: 0.0625rem solid var(--border); background: none; cursor: pointer; font-size: 0.875rem; font-weight: 600; }

/* HERO: compact so the board sits above the fold */
.hero { text-align: center; padding: 1.25rem 1.25rem 1rem; width: min(100%, 62rem); margin: 0 auto; }
.hero-chip { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.75rem; border-radius: 999px; background: var(--chip-bg); border: 0.0625rem solid var(--border); }
.hero h1 { font-size: clamp(1.75rem, 4.2vw, 2.75rem); font-weight: 700; letter-spacing: -0.02em; margin-top: 0.5rem; }
.grad { color: var(--purple-soft); }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .grad { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
}
:root[data-theme="light"] .grad { color: #7e22ce; }
.hero-sub { font-weight: 600; font-size: 0.9375rem; margin: 0.5rem auto 0; max-width: 54rem; color: var(--text); }
.hero-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 0.75rem; }
.chip-link { text-decoration: none; font-size: 0.8125rem; font-weight: 600; padding: 0.375rem 0.875rem; border-radius: 999px; border: 0.0625rem solid var(--border); background: var(--chip-bg); }
.chip-link:hover { border-color: var(--indigo-soft); }

/* BOARD */
.board {
  width: min(100% - 3rem, clamp(56.25rem, 66vw, 83.75rem));
  margin: 0 auto 2rem;
  display: grid; gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.board > * { min-width: 0; }
@media (min-width: 700px) {
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .slot-chat { grid-column: 1 / -1; grid-row: 1; }
  .top-card { grid-column: 1; grid-row: 2; }
  .short-card { grid-column: 2; grid-row: 2; }
  .details-card { grid-column: 3; grid-row: 2; }
}
@media (min-width: 1100px) {
  .board { grid-template-columns: minmax(0, 1.36fr) minmax(0, 1.06fr) minmax(0, 0.98fr) minmax(0, 0.98fr); }
  .slot-chat { grid-column: 1; grid-row: 1; }
  .top-card { grid-column: 2; grid-row: 1; }
  .short-card { grid-column: 3; grid-row: 1; }
  .details-card { grid-column: 4; grid-row: 1; }
}

/* glass cards with a thin colored top strip */
.card {
  position: relative; overflow: hidden;
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .card { background: var(--card-glass); -webkit-backdrop-filter: blur(1.125rem) saturate(150%); backdrop-filter: blur(1.125rem) saturate(150%); }
}
.card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 0.1875rem; background: var(--strip); }
.card h2 { font-size: 1.0625rem; font-weight: 700; }
.muted { color: var(--muted); }

/* CHAT CARD */
.chat-card { display: flex; flex-direction: column; gap: 0.5rem; height: 32rem; container-type: inline-size; }
@media (min-width: 700px) { .chat-card { height: 30rem; } }
@media (min-width: 1100px) {
  .chat-card { height: clamp(22rem, 100vh - 21rem, 38rem); height: clamp(22rem, 100svh - 21rem, 38rem); }
}
.chat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.chat-titles { min-width: 0; flex: 1 1 10rem; }
.chat-sub { font-size: 0.8125rem; color: var(--muted); }
.chat-actions { display: flex; align-items: center; gap: 0.375rem; flex: none; }
.icon-btn { width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 0.0625rem solid var(--border); background: var(--chip-bg); display: grid; place-items: center; cursor: pointer; }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.full-btn { display: inline-flex; align-items: center; gap: 0.375rem; height: 2.25rem; padding: 0 0.75rem; border-radius: 999px; border: 0.0625rem solid var(--border); background: var(--chip-bg); cursor: pointer; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.count-chip { align-self: flex-start; font-size: 0.75rem; font-weight: 600; padding: 0.125rem 0.625rem; border-radius: 999px; background: var(--chip-bg); color: var(--text); }

.log { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 0.625rem; padding: 0.25rem 0.125rem; }
.empty { margin: 0; text-align: center; color: var(--muted); font-size: 0.875rem; padding: 0.5rem; }
.empty-title { color: var(--text); font-weight: 600; margin-bottom: 0.25rem; }
.msg { max-width: 92%; padding: 0.625rem 0.8125rem; border-radius: 0.875rem; font-size: 0.9375rem; white-space: pre-wrap; }
.msg.user { align-self: flex-end; color: #fff; background: var(--user-bubble-a); background: linear-gradient(135deg, var(--user-bubble-a), var(--user-bubble-b)); border-bottom-right-radius: 0.25rem; }
.msg.bot { align-self: flex-start; background: var(--bot-bubble-solid); border: 0.0625rem solid var(--border); border-bottom-left-radius: 0.25rem; }
.msg.error { align-self: flex-start; background: var(--coral-bg); color: var(--coral); border: 0.0625rem solid var(--coral); }
.msg .label { display: block; font-size: 0.6875rem; font-weight: 700; opacity: 0.85; margin-bottom: 0.125rem; white-space: normal; }

/* thinking indicator */
.thinking { white-space: normal; }
.dots { display: inline-flex; gap: 0.3125rem; padding: 0.25rem 0; }
.dots span { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--purple-soft); animation: pulse 1.2s ease-in-out infinite; }
:root[data-theme="light"] .dots span { background: #7e22ce; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .dots span { animation: none; opacity: 1; transform: none; } }
.wait-note { font-size: 0.8125rem; color: var(--muted); margin-top: 0.25rem; }

/* composer: inline at 18.5rem+ card width, stacked below that */
.composer { display: flex; flex-direction: column; gap: 0.5rem; }
.composer textarea {
  width: 100%; min-width: 0; resize: none; display: block;
  min-height: 2.75rem; max-height: 8rem; overflow-y: hidden;
  padding: 0.625rem 0.875rem; border-radius: 1.375rem;
  border: 0.0625rem solid var(--border); background: var(--input-solid); background: var(--input-bg); color: var(--text);
  font: inherit; font-size: 1rem; line-height: 1.45;
}
.composer textarea::placeholder { color: var(--muted); opacity: 1; }
.composer-btns { display: flex; gap: 0.5rem; justify-content: flex-end; align-items: center; }
@container (min-width: 18.5rem) {
  .composer { flex-direction: row; align-items: flex-end; }
  .composer textarea { flex: 1 1 auto; }
}
.mic-btn { width: 2.75rem; height: 2.75rem; flex: none; border-radius: 50%; border: 0.0625rem solid var(--border); background: var(--chip-bg); display: grid; place-items: center; cursor: pointer; }
.mic-btn[aria-pressed="true"] { background: #be185d; color: #fff; border-color: #be185d; box-shadow: 0 0 0 0.25rem rgba(244, 114, 182, 0.3); }
.mic-btn[hidden] { display: none; }
.send-btn { height: 2.75rem; flex: none; padding: 0 1.125rem; border-radius: 999px; border: 0; cursor: pointer; font-weight: 700; color: #fff; background: var(--btn-a); background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); }
.send-btn:disabled { cursor: progress; opacity: 0.75; }
.voice-status { font-size: 0.8125rem; color: var(--muted); }
.voice-error { font-size: 0.8125rem; color: var(--coral); }
.chat-note { font-size: 0.75rem; color: var(--muted); }

/* full page overlay */
.chat-card.is-full {
  position: fixed; inset: 0; z-index: 60; height: auto; max-height: none; border-radius: 0; margin: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 1rem) calc(env(safe-area-inset-right, 0px) + 1rem) calc(env(safe-area-inset-bottom, 0px) + 1rem) calc(env(safe-area-inset-left, 0px) + 1rem);
  background: var(--bg-2);
}
@media (min-width: 900px) { .chat-card.is-full { padding-left: max(1rem, calc((100vw - 56rem) / 2)); padding-right: max(1rem, calc((100vw - 56rem) / 2)); } }

/* SIDE CARDS */
.top-card, .short-card, .details-card { display: flex; flex-direction: column; gap: 0.625rem; }
.pill { align-self: flex-start; font-size: 0.75rem; font-weight: 700; padding: 0.1875rem 0.625rem; border-radius: 999px; background: var(--chip-bg); border: 0.0625rem solid var(--border); }
.tile { border-radius: 0.75rem; padding: 0.875rem; color: #fff; background: #4338ca; background: linear-gradient(135deg, #4338ca, #7e22ce 60%, #9d174d); display: flex; flex-direction: column; gap: 0.25rem; }
.tile-kind { font-size: 0.75rem; font-weight: 600; opacity: 0.9; }
.tile-title { font-family: "Space Grotesk", "Inter", system-ui, sans-serif; font-size: 1.125rem; line-height: 1.25; }
.fit { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; font-size: 0.875rem; color: var(--muted); }
.fit b { font-family: "Space Grotesk", "Inter", system-ui, sans-serif; font-size: 1.5rem; color: var(--text); }
.why { font-size: 0.875rem; }

.gauge-row { display: flex; align-items: center; gap: 0.75rem; }
.gauge { flex: none; width: 4rem; height: 4rem; }
.gauge-track { stroke: var(--chip-bg); }
.gauge-fill { stroke: var(--pink); stroke-linecap: round; transition: stroke-dasharray 0.4s ease; }
:root[data-theme="light"] .gauge-fill { stroke: #be185d; }
@media (prefers-reduced-motion: reduce) { .gauge-fill { transition: none; } }
.gauge-num { font-family: "Space Grotesk", "Inter", system-ui, sans-serif; font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.rank-note { font-size: 0.8125rem; color: var(--muted); }
.shortlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.375rem; }
.shortlist li.muted { font-size: 0.875rem; }
.match-btn { width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.5rem 0.625rem; border-radius: 0.625rem; border: 0.0625rem solid var(--border); background: none; cursor: pointer; font-size: 0.875rem; }
.match-btn span { min-width: 0; }
.match-btn b { flex: none; font-size: 0.8125rem; padding: 0.0625rem 0.5rem; border-radius: 999px; background: var(--chip-bg); }
.match-btn[aria-pressed="true"] { border-color: var(--pink); background: var(--chip-bg); }
:root[data-theme="light"] .match-btn[aria-pressed="true"] { border-color: #be185d; }

.details { margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.details div { display: flex; flex-direction: column; }
.details dt { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.details dd { margin: 0; font-size: 0.875rem; }
.guide-link { font-size: 0.875rem; font-weight: 600; color: var(--purple-soft); }
:root[data-theme="light"] .guide-link { color: #6d28d9; }
.next { border-top: 0.0625rem solid var(--border); padding-top: 0.625rem; }
.next h3 { font-size: 0.9375rem; margin-bottom: 0.25rem; }
.next p { font-size: 0.875rem; }

.site-foot { text-align: center; font-size: 0.8125rem; color: var(--muted); padding: 0 1.5rem calc(env(safe-area-inset-bottom, 0px) + 1.5rem); max-width: 60rem; margin: 0 auto; }
