:root {
  --bg: #05060d;
  --panel: #07091a;
  --card: #10132b;
  --card-2: #0d1030;
  --ink: #f4f6ff;
  --muted: #d5daf2;
  --faint: #b7bdd6;
  --accent: #3bc7ff;
  --accent-strong: #1e30f3;
  --accent-hot: #e21e80;
  --ok: #39ff88;
  --danger: #ff6b6b;
  --accent-line: rgba(59, 199, 255, 0.28);
  --accent-dim: rgba(59, 199, 255, 0.12);
  --glow-a: rgba(30, 48, 243, 0.32);
  --glow-b: rgba(226, 30, 128, 0.14);
  --line: rgba(183, 189, 214, 0.12);
  --cyan-rgb: 59, 199, 255;
  --blue-rgb: 30, 48, 243;
  --hot-rgb: 226, 30, 128;
  --ice: #c0e4f0;
  --ice-rgb: 143, 230, 255;
  --ok-rgb: 57, 255, 136;
  --bg-rgb: 5, 6, 13;
  --cell: 64px;
  --column: 46rem;
  --gutter: clamp(16px, 4vw, 28px);
  --radius: 8px;
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Shell ---------- */
.app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--bg);
}
.app > header, .app > main, .app > footer { position: relative; z-index: 1; }
.app > header { z-index: 5; }

/* Vignette: edges sink into the deep navy, centre stays open. */
.app::after {
  content: "";
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(130% 100% at 50% 46%, transparent 48%, rgba(var(--bg-rgb), .88) 100%),
    linear-gradient(to bottom, rgba(var(--bg-rgb), .55), transparent 18%, transparent 82%, rgba(var(--bg-rgb), .7));
  pointer-events: none;
}

/* ---------- Background FX (lattice + breathing core + canvas) ---------- */
.fx { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }

/* Breathing core: cyan centre, magenta mid ring, blue outer haze. */
.core {
  position: absolute; inset: -10%;
  background:
    radial-gradient(14% 12% at 50% 46%, rgba(var(--ice-rgb), .20), transparent 70%),
    radial-gradient(34% 30% at 50% 46%, rgba(var(--hot-rgb), .16), transparent 72%),
    radial-gradient(70% 60% at 50% 46%, rgba(var(--blue-rgb), .24), transparent 75%),
    radial-gradient(45% 40% at 12% 0%, rgba(var(--blue-rgb), .22), transparent 70%),
    radial-gradient(40% 38% at 92% 100%, rgba(var(--hot-rgb), .12), transparent 70%);
  will-change: transform, opacity;
  animation: breathe 7s ease-in-out infinite alternate;
}
@keyframes breathe {
  from { transform: scale(1); opacity: .85; }
  to   { transform: scale(1.12); opacity: 1; }
}

.chamber { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: .9; }

.field {
  position: absolute; inset: 0; overflow: hidden;
  -webkit-mask-image: radial-gradient(ellipse 85% 80% at 50% 46%, #000 20%, transparent 100%);
          mask-image: radial-gradient(ellipse 85% 80% at 50% 46%, #000 20%, transparent 100%);
}
.grid {
  position: absolute;
  inset: calc(-1 * var(--cell)) calc(-1 * var(--cell)) 0 0;
  background:
    radial-gradient(circle, rgba(var(--ice-rgb), .5) 1px, transparent 1.8px) 0 0 / var(--cell) var(--cell),
    linear-gradient(rgba(var(--blue-rgb), .16) 1px, transparent 1px) 0 calc(var(--cell) / 2) / var(--cell) var(--cell),
    linear-gradient(90deg, rgba(var(--cyan-rgb), .07) 1px, transparent 1px) calc(var(--cell) / 2) 0 / var(--cell) var(--cell);
  will-change: transform;
  animation: lattice 16s linear infinite;
}
/* Pulses running along the wires: magenta rows, cyan/ice columns. */
.grid > i {
  position: absolute;
  top: calc(var(--row, 3) * var(--cell) + var(--cell) / 2);
  left: 0;
  width: 180px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--hot-rgb), .9) 85%, #ff7cc0);
  box-shadow: 0 0 10px rgba(var(--hot-rgb), .7);
  will-change: transform;
  animation: run-x var(--time, 9s) linear var(--delay, 0s) infinite;
}
.grid > i:nth-child(1) { --row: 2;  --time: 8s;  --delay: -2s; }
.grid > i:nth-child(2) { --row: 6;  --time: 11s; --delay: -7s;
  background: linear-gradient(90deg, transparent, rgba(var(--cyan-rgb), .9) 85%, #fff); box-shadow: 0 0 10px rgba(var(--cyan-rgb), .7); }
.grid > i:nth-child(3) { --row: 10; --time: 9s;  --delay: -4s; }
.grid > i:nth-child(n + 4) {
  top: 0;
  left: calc(var(--col, 12) * var(--cell) + var(--cell) / 2);
  width: 1px; height: 150px;
  background: linear-gradient(transparent, rgba(var(--ice-rgb), .85) 85%, #fff);
  box-shadow: 0 0 10px rgba(var(--ice-rgb), .6);
  animation-name: run-y;
}
.grid > i:nth-child(4) { --col: 4;  --time: 10s; --delay: -1s; }
.grid > i:nth-child(5) { --col: 13; --time: 7s;  --delay: -5s;
  background: linear-gradient(transparent, rgba(var(--hot-rgb), .85) 85%, #ffd0e8); box-shadow: 0 0 10px rgba(var(--hot-rgb), .6); }
.grid > i:nth-child(6) { --col: 21; --time: 12s; --delay: -9s; }

@keyframes lattice { to { transform: translate3d(var(--cell), var(--cell), 0); } }
@keyframes run-x {
  from { transform: translateX(-180px); }
  to   { transform: translateX(calc(100vw + 2 * var(--cell))); }
}
@keyframes run-y {
  from { transform: translateY(-150px); }
  to   { transform: translateY(calc(100vh + 2 * var(--cell))); }
}

/* ---------- App bar ---------- */
.app-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) var(--gutter) 12px;
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, rgba(var(--cyan-rgb), .35), rgba(var(--hot-rgb), .25), transparent) 1;
  background: rgba(5, 6, 13, .45);
  -webkit-backdrop-filter: blur(16px);
          backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-logo {
  display: block; height: 30px; width: auto;
  filter: brightness(1.35) drop-shadow(0 0 10px rgba(var(--ice-rgb), .45)) drop-shadow(0 0 2px rgba(var(--cyan-rgb), .6));
  transition: filter .3s;
}
.brand:hover .brand-logo { filter: brightness(1.5) drop-shadow(0 0 14px rgba(var(--ice-rgb), .7)) drop-shadow(0 0 3px rgba(var(--cyan-rgb), .8)); }
.brand-tag {
  padding-left: 10px; border-left: 1px solid rgba(var(--ice-rgb), .25);
  color: var(--ice); font: 600 .95rem/1 var(--font-head); letter-spacing: .02em;
  white-space: nowrap;
}
.brand-tag small { margin-left: 4px; color: var(--accent); font: 500 .68rem var(--font-head); letter-spacing: .14em; text-transform: uppercase; }
.app-bar-end { display: flex; align-items: center; gap: 10px; min-width: 0; }

.chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px; min-width: 0;
  max-width: min(46vw, 26rem);
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 19, 43, .6);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--faint);
  font: 500 .76rem var(--font-body);
  letter-spacing: .01em;
}
.chip-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chip-dot { position: relative; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--faint); }
.chip.ok {
  border-color: rgba(var(--ok-rgb), .35); color: var(--ink);
  background: linear-gradient(90deg, rgba(var(--ok-rgb), .12), rgba(16, 19, 43, .6) 60%);
  box-shadow: 0 0 18px -6px rgba(var(--ok-rgb), .55), inset 0 0 0 1px rgba(var(--ok-rgb), .06);
}
.chip.ok .chip-dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.chip.ok .chip-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid var(--ok);
  animation: ping 1.8s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }
.chip.bad { border-color: rgba(255, 107, 107, .4); color: var(--danger); background: rgba(60, 10, 20, .45); }
.chip.bad .chip-dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); animation: beat 1.2s ease-in-out infinite; }
@keyframes beat { 50% { opacity: .45; transform: scale(.8); } }

.ghost-btn {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--faint);
  font-size: .78rem;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.ghost-btn:hover { border-color: var(--accent-line); color: var(--accent); }

/* ---------- Log ---------- */
.log {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px max(var(--gutter), (100% - var(--column)) / 2) 32px;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--cyan-rgb), .25) transparent;
}
.log:focus-visible { outline-offset: -3px; }

.welcome { padding-top: clamp(28px, 10vh, 112px); }
.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font: 600 .74rem var(--font-head);
  letter-spacing: .16em; text-transform: uppercase;
}
.welcome-title {
  margin: 0 0 14px;
  font: 700 clamp(2rem, 5.4vw, 3.4rem)/1.04 var(--font-head);
  letter-spacing: -.035em;
}
.welcome-title { text-shadow: 0 0 40px rgba(var(--blue-rgb), .35); }
.welcome-title .accent {
  background: linear-gradient(90deg, var(--ice) 0%, var(--accent) 25%, #4f5dff 55%, var(--accent-hot) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 18px rgba(var(--cyan-rgb), .35));
}
.eyebrow { display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before {
  content: ""; width: 26px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
  box-shadow: 0 0 8px var(--accent);
}
.welcome-lede { max-width: 52ch; margin: 0 0 34px; color: var(--muted); }

.prompts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 12px;
}
.prompt {
  --tone: var(--cyan-rgb);
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; align-content: start; gap: 6px;
  padding: 16px 18px 18px;
  border: 1px solid rgba(var(--tone), .26);
  border-radius: 12px;
  background:
    linear-gradient(155deg, rgba(var(--tone), .16), rgba(var(--tone), .02) 60%),
    linear-gradient(180deg, rgba(255, 255, 255, .04), transparent 40%),
    rgba(10, 13, 38, .62);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
          backdrop-filter: blur(18px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 10px 30px -20px rgba(0, 0, 0, .9);
  text-align: left;
  cursor: pointer;
  transition: transform .4s var(--ease), border-color .25s, box-shadow .3s;
}
.prompt::after {          /* accent line on top edge */
  content: ""; position: absolute; left: 14px; right: 14px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--tone), .9), transparent);
  opacity: .55; transition: opacity .3s, left .4s var(--ease), right .4s var(--ease);
}
.prompt:hover::after { opacity: 1; left: 0; right: 0; }
.prompt[data-tone="blue"] { --tone: 92, 108, 255; }
.prompt[data-tone="hot"]  { --tone: var(--hot-rgb); }
.prompt::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(var(--tone), .28), transparent 70%);
  opacity: 0; transition: opacity .3s;
}
.prompt strong {
  display: flex; align-items: center; gap: 10px;
  font: 600 1rem/1.25 var(--font-head);
}
.prompt strong::before {
  content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%;
  background: rgb(var(--tone)); box-shadow: 0 0 10px rgb(var(--tone));
  transition: transform .4s var(--ease);
}
.prompt small { padding-left: 18px; color: var(--faint); font-size: .86rem; line-height: 1.45; }
.prompt:hover { transform: translateY(-4px); border-color: rgba(var(--tone), .65); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 0 0 1px rgba(var(--tone), .15), 0 22px 48px -20px rgba(var(--tone), .85); }
.prompt:hover::before { opacity: 1; }
.prompt:hover strong { color: var(--accent); }
.prompt:hover strong::before { transform: scale(1.5); }
.prompt:active { transform: scale(.98); transition-duration: .1s; }

/* ---------- Messages ---------- */
.msg { margin: 26px 0; }
.msg-user { display: flex; justify-content: flex-end; }
.bubble {
  max-width: min(85%, 36rem);
  padding: 11px 16px;
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(135deg, var(--accent-strong), #2a1fb8 60%, #5a1a9a);
  box-shadow: 0 12px 32px -14px rgba(var(--blue-rgb), .9);
  color: #fff;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
  color: var(--faint);
  font: 600 .8rem var(--font-head); letter-spacing: .02em;
}
.msg-mark {
  width: 10px; height: 10px; flex: none;
  transform: rotate(45deg);
  border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hot));
  box-shadow: 0 0 10px rgba(var(--cyan-rgb), .7);
}
.msg-body {
  font-size: 1.02rem; line-height: 1.68; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-body strong { color: #fff; }
.msg-body code {
  padding: 1px 6px; border-radius: 4px;
  background: var(--accent-dim); color: var(--accent);
  font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.msg-body pre {
  margin: .6em 0; padding: 12px 14px; overflow-x: auto;
  border: 1px solid var(--line); border-left: 2px solid var(--accent-strong);
  border-radius: var(--radius);
  background: var(--panel);
  white-space: pre;
}
.msg-body pre code { padding: 0; background: none; color: var(--muted); }
.msg-body.is-streaming:empty::before { content: "Thinking"; color: var(--faint); }
.msg-body.is-streaming::after {
  content: ""; display: inline-block; width: 8px; height: 1.05em;
  margin-left: 2px; vertical-align: -0.15em;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.msg-body.error-message { color: var(--danger); }
/* follow-up chips under the latest answer — mini welcome prompts */
.followups {
  display: flex; flex-direction: column; gap: 10px; margin-top: 16px; width: 100%;
  animation: followups-in .45s var(--ease) both;
}
.followups-label { color: var(--faint); font: 600 .72rem var(--font-head); letter-spacing: .08em; text-transform: uppercase; }
.followups-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}
@media (min-width: 720px) {
  .followups-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
button.followup {
  --tone: var(--cyan-rgb);
  all: unset;
  box-sizing: border-box;
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  width: 100%; min-width: 0;
  padding: 11px 13px 12px;
  border: 1px solid rgba(var(--tone), .26); border-radius: 10px;
  background:
    linear-gradient(155deg, rgba(var(--tone), .16), rgba(var(--tone), .02) 60%),
    linear-gradient(180deg, rgba(255, 255, 255, .04), transparent 40%),
    rgba(10, 13, 38, .62);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 22px -16px rgba(0, 0, 0, .9);
  color: var(--ink); text-align: left; cursor: pointer;
  transition: transform .4s var(--ease), border-color .25s, box-shadow .3s;
}
button.followup::after {
  content: ""; position: absolute; left: 10px; right: 10px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--tone), .9), transparent);
  opacity: .5; transition: opacity .3s, left .4s var(--ease), right .4s var(--ease);
  pointer-events: none;
}
button.followup::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(180px circle at 50% 0%, rgba(var(--tone), .28), transparent 70%);
  opacity: 0; transition: opacity .3s;
  pointer-events: none;
}
button.followup[data-tone="blue"] { --tone: 92, 108, 255; }
button.followup[data-tone="hot"]  { --tone: var(--hot-rgb); }
button.followup > strong {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin: 0; font: 600 .84rem/1.3 var(--font-head); color: var(--ink);
  transition: color .2s;
}
button.followup > strong::before {
  content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%;
  background: rgb(var(--tone)); box-shadow: 0 0 8px rgb(var(--tone)); transition: transform .4s var(--ease);
}
button.followup > small {
  display: block; width: 100%; box-sizing: border-box;
  margin: 0; padding-left: 14px;
  color: var(--faint); font: 400 .74rem/1.4 Inter, system-ui, sans-serif;
  white-space: normal;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
button.followup:hover {
  transform: translateY(-3px); border-color: rgba(var(--tone), .65);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 0 0 1px rgba(var(--tone), .15), 0 16px 34px -18px rgba(var(--tone), .85);
}
button.followup:hover::before, button.followup:hover::after { opacity: 1; }
button.followup:hover::after { left: 0; right: 0; }
button.followup:hover > strong { color: var(--accent); }
button.followup:hover > strong::before { transform: scale(1.5); }
button.followup:active { transform: scale(.98); transition-duration: .1s; }
@keyframes followups-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 380px) { button.followup > small { display: none; } }
@media (prefers-reduced-motion: reduce) { .followups { animation: none; } button.followup { transition: none; } }
.msg-source {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px;
  color: var(--faint); font-size: .78rem;
}
.msg-source span {
  padding: 2px 8px;
  border: 1px solid var(--accent-line); border-radius: 4px;
  background: var(--accent-dim); color: var(--accent);
}

/* ---------- Dock ---------- */
.dock {
  padding: 10px max(var(--gutter), (100% - var(--column)) / 2) max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(5, 6, 13, .9) 35%, transparent);
}
.composer {
  position: relative; isolation: isolate;
  display: flex; align-items: flex-end; gap: 8px;
  padding: 7px 7px 7px 18px;
  border: 1px solid rgba(var(--cyan-rgb), .22);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 50%),
    rgba(10, 13, 38, .72);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
          backdrop-filter: blur(20px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 18px 50px -24px rgba(var(--blue-rgb), .9);
  transition: border-color .25s, box-shadow .3s;
}
.composer::before {       /* gradient ring, lit on focus */
  content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; padding: 1px;
  background: linear-gradient(110deg, var(--accent), var(--accent-strong) 50%, var(--accent-hot));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .35; transition: opacity .3s;
}
.composer:focus-within { border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08),
    0 0 0 4px rgba(var(--cyan-rgb), .08),
    -14px 0 40px -14px rgba(var(--cyan-rgb), .6),
    14px 0 40px -14px rgba(var(--hot-rgb), .6),
    0 18px 50px -20px rgba(var(--blue-rgb), .9); }
.composer:focus-within::before { opacity: 1; }
.composer textarea {
  flex: 1; min-width: 0; max-height: 40vh;
  padding: 9px 0; border: 0; outline: 0; resize: none;
  background: transparent; color: var(--ink);
  font: inherit; font-size: 1rem; line-height: 1.5;
}
.composer textarea::placeholder { color: var(--faint); opacity: .75; }
.send-button {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-hot));
  color: #fff; cursor: pointer;
  box-shadow: 0 6px 20px -6px rgba(var(--hot-rgb), .7);
  transition: transform .3s var(--ease), filter .2s, opacity .2s;
}
.send-button:enabled:hover { transform: scale(1.07); filter: brightness(1.12); }
.send-button:disabled { opacity: .4; cursor: not-allowed; }
.send-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.disclaimer {
  margin: 10px 0 0; text-align: center;
  color: var(--faint); opacity: .8; font-size: .74rem; line-height: 1.45;
}


/* ---------- Intro stage (Exiom-style dive, PDC palette) ----------
   Visible from first paint. app.js marks it .is-live; if the script
   never runs, the fail-safe fades it so the chat is never stuck. */
.stage {
  position: fixed; inset: 0; z-index: 20; overflow: hidden;
  display: grid;
  background:
    radial-gradient(50% 55% at 50% 50%, rgba(var(--blue-rgb), .26), transparent 70%),
    radial-gradient(45% 50% at 0% 100%, rgba(var(--hot-rgb), .16), transparent 70%),
    radial-gradient(40% 40% at 100% 0%, rgba(var(--cyan-rgb), .10), transparent 70%),
    var(--bg);
  animation: stage-failsafe .6s ease 10s forwards;
}
.stage.is-live { animation: none; }
.stage[hidden] { display: none; }
@keyframes stage-failsafe { to { opacity: 0; visibility: hidden; } }
.stage::after {           /* vignette */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 95% at 50% 50%, transparent 45%, rgba(var(--bg-rgb), .9) 100%);
}
.stage-fx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; will-change: transform; }
.stage-fx .field {
  -webkit-mask-image: radial-gradient(ellipse 80% 75% at 50% 50%, #000 15%, transparent 100%);
          mask-image: radial-gradient(ellipse 80% 75% at 50% 50%, #000 15%, transparent 100%);
}
.stage-fx .core { animation-duration: 5s; }

/* Core orb the chat opens out of. */
.orb {
  position: absolute; left: 50%; top: 50%;
  width: min(72vmin, 620px); aspect-ratio: 1;
  translate: -50% -50%;
  will-change: transform, opacity;
}
.orb-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(var(--ice-rgb), .14);
  -webkit-mask: radial-gradient(circle, transparent 69%, #000 70%);
}
.orb-ring.r1 {
  background: conic-gradient(from 0deg, transparent, rgba(var(--cyan-rgb), .55) 18%, transparent 32%, transparent 60%, rgba(var(--hot-rgb), .45) 74%, transparent 86%);
  animation: spin 14s linear infinite;
}
.orb-ring.r2 {
  inset: 13%;
  background: conic-gradient(from 120deg, transparent, rgba(var(--blue-rgb), .7) 22%, transparent 40%, transparent 70%, rgba(var(--ice-rgb), .5) 82%, transparent 92%);
  animation: spin 10s linear infinite reverse;
}
.orb-ring.r3 {
  inset: 27%; border-style: dashed; border-color: rgba(var(--cyan-rgb), .22);
  -webkit-mask: none; animation: spin 40s linear infinite;
}
.orb-heart {
  position: absolute; inset: 38%; border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--ice-rgb), .35), rgba(var(--cyan-rgb), .12) 40%, rgba(var(--blue-rgb), .08) 60%, transparent 72%);
  filter: blur(6px);
  animation: breathe 4s ease-in-out infinite alternate;
}
@keyframes spin { to { transform: rotate(1turn); } }

.stage-ui {
  position: relative; z-index: 1;
  display: grid; grid-template-rows: auto 1fr auto;
  min-height: 100vh; min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) max(16px, env(safe-area-inset-bottom));
  will-change: transform, opacity;
}
.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stage-link {
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--faint); font-size: .78rem; text-decoration: none;
  transition: color .2s, border-color .2s;
}
.stage-link:hover { color: var(--accent); border-color: var(--accent-line); }
.stage-copy {
  align-self: center; justify-self: center;
  display: flex; flex-direction: column; align-items: center;
  max-width: 44rem; text-align: center;
  padding: 24px 0;
}
.stage-copy > * { animation: rise .9s var(--ease) both; }
.stage-copy > :nth-child(2) { animation-delay: .08s; }
.stage-copy > :nth-child(3) { animation-delay: .16s; }
.stage-copy > :nth-child(4) { animation-delay: .26s; }
.stage-copy > :nth-child(5) { animation-delay: .38s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } }
.stage-logo {
  height: clamp(44px, 8vw, 64px); width: auto; margin-bottom: 22px;
  filter: brightness(1.4) drop-shadow(0 0 18px rgba(var(--ice-rgb), .55)) drop-shadow(0 0 3px rgba(var(--cyan-rgb), .7));
}
.stage-title {
  margin: 0 0 16px;
  font: 700 clamp(2.3rem, 7vw, 4.6rem)/1.02 var(--font-head);
  letter-spacing: -.04em;
  text-shadow: 0 0 50px rgba(var(--blue-rgb), .45);
}
.stage-title .accent {
  white-space: nowrap;
  background: linear-gradient(90deg, var(--ice) 0%, var(--accent) 30%, #4f5dff 60%, var(--accent-hot) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none;
  filter: drop-shadow(0 0 22px rgba(var(--cyan-rgb), .4));
}
.stage-lede { max-width: 48ch; margin: 0 0 32px; color: var(--muted); font-size: 1.05rem; }
.stage-actions { display: flex; gap: 12px; justify-content: center; }
.button-primary {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 15px 28px;
  border: 0; border-radius: 999px;
  background: linear-gradient(110deg, var(--accent-strong), #5a2bd0 55%, var(--accent-hot));
  color: #fff; font: 600 1.02rem/1 var(--font-head); letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(var(--ice-rgb), .18) inset, 0 14px 40px -12px rgba(var(--hot-rgb), .75), 0 0 46px -10px rgba(var(--cyan-rgb), .6);
  transition: transform .35s var(--ease), box-shadow .35s, filter .2s;
}
.button-primary::before {     /* cyan halo */
  content: ""; position: absolute; inset: -6px; z-index: -1; border-radius: inherit;
  background: linear-gradient(110deg, rgba(var(--cyan-rgb), .55), rgba(var(--blue-rgb), .2), rgba(var(--hot-rgb), .55));
  filter: blur(14px); opacity: .55;
  animation: halo 3s ease-in-out infinite alternate;
}
@keyframes halo { to { opacity: .95; transform: scale(1.04); } }
.button-primary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--ease); }
.button-primary:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.1); }
.button-primary:hover svg { transform: translateX(4px); }
.button-primary:active { transform: scale(.97); }
.stage-foot { text-align: center; color: var(--faint); opacity: .7; font-size: .74rem; }

/* During the dive the chat sits above the stage, visible only
   inside a circle opening from the core. */
.is-intro, .is-intro body { overflow: hidden; }
.is-intro .app {
  position: fixed; inset: 0; z-index: 30;
  clip-path: circle(var(--reveal, 0%) at 50% 50%);
  pointer-events: none;
}
/* backdrop blurs inside a moving clip-path glitch and cost frames; the parts are hidden then anyway */
.is-intro .app * { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.app-flash { display: none; }
.is-intro .app-flash {
  display: block; position: absolute; inset: 0; z-index: 40; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, #fff 5%, rgba(var(--ice-rgb), .55) 24%, rgba(var(--cyan-rgb), .3) 44%, rgba(var(--hot-rgb), .16) 60%, transparent 76%);
  opacity: var(--flash, 0);
}
.has-stage .brand[href] { cursor: pointer; }

@media (max-width: 600px) {
  .stage-lede { font-size: .96rem; margin-bottom: 26px; }
  .button-primary { padding: 14px 24px; }
  .orb { width: 92vmin; }
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  body { font-size: 14px; }
  .ghost-btn { padding: 5px 10px; }
  .lbl-long { display: none; }
  .chip { max-width: 38vw; }
  .welcome { padding-top: clamp(8px, 3vh, 28px); }
  .welcome-lede { margin-bottom: 18px; }
  .prompts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .prompt { padding: 11px 12px 12px; gap: 4px; }
  .prompt strong { align-items: flex-start; gap: 8px; font-size: .92rem; }
  .prompt strong::before { margin-top: .4em; }
  .prompt small {
    display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    padding-left: 16px; font-size: .8rem; line-height: 1.3;
  }
  .composer { padding-left: 14px; border-radius: 22px; }
  .composer textarea { font-size: 16px; }   /* no iOS zoom */
  .send-button { width: 38px; height: 38px; }
  .disclaimer { font-size: .7rem; }
}
@media (max-width: 380px) { .brand-tag small { display: none; } .prompt small { display: none; } }
@media (max-width: 600px) { .brand-logo { height: 26px; } .brand-tag small { display: none; } .app { --cell: 48px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .grid > i, .chamber { display: none; }
  .stage-copy > * { animation: none; }   /* static glow + lattice only */
}
