/* The design language of hypersonic-ai.com: white, ink, Manrope at light weights, tracked
   uppercase labels in 12px, pill buttons, IBM Plex Mono for numbers and metadata, and a
   blurred pastel "lava lamp" behind everything. Light only. Fonts are self-hosted (OFL,
   licences next to the files) so no page talks to a third party. */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(/static/fonts/manrope-4.504-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/ibm-plex-mono-2.005-regular-latin1.woff2) format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02;
}

:root {
  --bg: #FFFFFF;
  --ink: #1A1712;
  --ink-2: #2B2A30;
  --muted: #5C5A63;
  --line: rgba(26, 23, 18, 0.12);
  --line-strong: rgba(26, 23, 18, 0.25);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-2: rgba(255, 255, 255, 0.35);
  --wash: rgba(26, 23, 18, 0.04);
  --ok: #1F7A4D;
  --warn: #9A5B00;
  --bad: #B3261E;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --radius: 18px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Manrope", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }

/* ---- the lava lamp ------------------------------------------------------------------- */
.blobs {
  position: fixed; inset: -120px; z-index: 0; pointer-events: none;
  filter: blur(90px); opacity: 0.4;
}
body.app .blobs { opacity: 0.22; }
.blob { position: absolute; border-radius: 50%; will-change: transform; }
.b1 { left: 1.389vw;  top: 42.222vh; width: 44.444vw; height: 42.222vh; background: #FFB27A; animation: L1 22s ease-in-out infinite alternate; }
.b2 { left: 69.444vw; top: 48.889vh; width: 38.889vw; height: 40vh;     background: #B99BFF; animation: L2 27s ease-in-out infinite alternate; }
.b3 { left: 29.167vw; top: 33.333vh; width: 34.722vw; height: 33.333vh; background: #FFE066; animation: L3 18s ease-in-out infinite alternate; }
.b4 { left: 75vw;     top: 71.111vh; width: 30.556vw; height: 31.111vh; background: #FF7F8A; animation: L4 31s ease-in-out infinite alternate; }
.b5 { left: 8.333vw;  top: 73.333vh; width: 27.778vw; height: 28.889vh; background: #8FE0AE; animation: L5 24s ease-in-out infinite alternate; }
.b6 { left: 48.611vw; top: 20vh;     width: 26.389vw; height: 26.667vh; background: #FF9F6B; animation: L2 27s ease-in-out -12s infinite alternate; }
@keyframes L1 { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(26.389vw, -4.444vh) scale(1.15); } 100% { transform: translate(52.778vw, 3.333vh) scale(0.9); } }
@keyframes L2 { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-29.167vw, 5.556vh) scale(0.85); } 100% { transform: translate(-56.944vw, -2.222vh) scale(1.1); } }
@keyframes L3 { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(36.111vw, 7.778vh) scale(1.25); } }
@keyframes L4 { 0% { transform: translate(0, 0) scale(1.1); } 100% { transform: translate(-44.444vw, -6.667vh) scale(0.9); } }
@keyframes L5 { 0% { transform: translate(0, 0) scale(0.9); } 100% { transform: translate(62.5vw, -3.333vh) scale(1.2); } }
@media (prefers-reduced-motion: reduce) { .blob { animation: none !important; } }
@media (max-width: 720px) { .blobs { inset: -80px; filter: blur(50px); } .b6 { display: none; } }

/* ---- frame --------------------------------------------------------------------------- */
header.top, main, footer { position: relative; z-index: 1; }
header.top {
  display: flex; align-items: baseline; gap: 28px; flex-wrap: wrap;
  padding: 36px clamp(20px, 5vw, 72px) 12px;
}
.wordmark {
  font-weight: 500; font-size: 12px; letter-spacing: 0.28em; text-transform: uppercase;
  white-space: nowrap; color: var(--ink); text-decoration: none;
}
header.top nav { display: flex; gap: 6px 22px; flex-wrap: wrap; flex: 1; }
header.top nav a, .me, .me button.link {
  font-weight: 500; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
}
header.top nav a:hover, .me a:hover, .me button.link:hover { color: var(--ink); }
header.top nav a.on { color: var(--ink); }
.me { display: flex; align-items: baseline; gap: 16px; }
.me .who { font-family: var(--mono); letter-spacing: 0.06em; text-transform: none; font-size: 12px; }
main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px) 64px; flex: 1; }
main.narrow { max-width: 760px; }
footer {
  font-weight: 500; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-2); text-align: center; padding: 28px 16px 36px;
}
footer a { color: inherit; text-decoration: none; }
footer a:hover { color: var(--muted); }

/* ---- type ---------------------------------------------------------------------------- */
h1 { font-weight: 200; font-size: clamp(36px, 5vw, 56px); line-height: 1.02; letter-spacing: -0.045em; margin: 12px 0 18px; }
h2 { font-weight: 500; font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-2); margin: 36px 0 12px; }
.panel h2:first-child, .actions h2 { margin: 0; }
h3 { font-weight: 600; font-size: 15px; margin: 18px 0 6px; }
p.lead { font-weight: 300; font-size: 19px; letter-spacing: -0.01em; color: var(--ink-2); margin-top: -4px; }
.eyebrow { font-weight: 500; font-size: 12px; letter-spacing: 0.5em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
code, pre { font: 13px/1.55 var(--mono); }
code { background: var(--wash); padding: 1px 6px; border-radius: 6px; }
pre { background: rgba(255, 255, 255, 0.7); border: 1px solid var(--line); padding: 14px 16px; border-radius: 14px; overflow-x: auto; position: relative; margin: 8px 0 14px; }
pre code { background: none; padding: 0; }

/* ---- surfaces ------------------------------------------------------------------------ */
.panel, .stat {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.panel { padding: 20px 22px; margin: 14px 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { padding: 16px 18px; }
.stat .k { font-weight: 500; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-weight: 200; font-size: 34px; letter-spacing: -0.04em; line-height: 1.15; }
.stat .v.small { font-weight: 300; font-size: 20px; letter-spacing: -0.01em; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
td.num, th.num { text-align: right; font-family: var(--mono); font-size: 13px; }
.tablewrap { overflow-x: auto; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  font-weight: 500; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  border: 1px solid var(--line-strong); color: var(--muted);
}
.badge.ok { color: var(--ok); border-color: currentColor; }
.badge.warn { color: var(--warn); border-color: currentColor; }
.badge.bad { color: var(--bad); border-color: currentColor; }
.flash { padding: 12px 18px; border-radius: 999px; border: 1px solid var(--ok); color: var(--ok); background: var(--glass); margin-bottom: 18px; }
.flash.error { border-color: var(--bad); color: var(--bad); }

/* ---- controls ------------------------------------------------------------------------ */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 40px;
  padding: 0 22px; border-radius: 999px; cursor: pointer; text-decoration: none;
  font: 500 11px/1 "Manrope", sans-serif; letter-spacing: 0.22em; text-transform: uppercase;
  background: var(--ink); color: #fff; border: 1px solid var(--ink);
  transition: background 0.2s ease, color 0.2s ease;
}
button:hover, .button:hover { background: var(--ink-2); }
button.secondary, .button.secondary { background: var(--glass-2); color: var(--ink); border-color: var(--line-strong); }
button.secondary:hover, .button.secondary:hover { color: var(--muted); }
button.danger { background: transparent; color: var(--bad); border-color: currentColor; }
button.link { background: none; border: 0; min-height: 0; padding: 0; }
button:focus-visible, .button:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
button:disabled { opacity: 0.45; cursor: default; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
form.inline { display: inline; }
label { display: block; font-weight: 500; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-2); margin: 16px 0 6px; }
label .hint { font-weight: 400; letter-spacing: 0.04em; text-transform: none; color: var(--muted); }
input[type=text], input[type=number], input[type=email], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
textarea { min-height: 110px; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checks label { display: flex; gap: 6px; align-items: center; font: 400 14px "Manrope", sans-serif; letter-spacing: 0; text-transform: none; margin: 0; }
.cols { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* ---- meters & charts ----------------------------------------------------------------- */
.meter { margin: 8px 0 12px; }
.meter .row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.meter .row span:last-child { font-family: var(--mono); font-size: 12px; }
progress { width: 100%; height: 6px; appearance: none; border: 0; border-radius: 999px; background: var(--wash); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--wash); }
progress::-webkit-progress-value { background: var(--ink); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--ink); }
progress.hot::-webkit-progress-value { background: var(--bad); }
progress.hot::-moz-progress-bar { background: var(--bad); }
.copy { position: absolute; top: 8px; right: 8px; min-height: 28px; padding: 0 12px; font-size: 10px; }
.secret { font: 15px var(--mono); word-break: break-all; padding: 14px 16px; border: 1px dashed var(--warn); border-radius: 14px; background: var(--glass); }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font: 11px var(--mono); }
svg.chart .empty { fill: var(--muted); font-size: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.on { background: var(--ok); }

/* ---- landing ------------------------------------------------------------------------- */
.hero { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; padding: 9vh 0 6vh; }
.hero > * { margin: 0; }
.hero h1 { font-size: clamp(52px, 9vw, 128px); line-height: 0.95; }
.hero .lead { max-width: 620px; }
.hero .actions { justify-content: center; margin-top: 10px; }
.google {
  display: inline-flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 24px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--glass); color: var(--ink);
  font-weight: 500; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; text-decoration: none;
}
.google:hover { color: var(--muted); }
ol.steps { padding-left: 1.2em; }
ol.steps li { margin: 6px 0; }

/* ---- chat ---------------------------------------------------------------------------- */
body.chat main { max-width: none; padding: 0; display: flex; flex: none; min-height: 0; height: 100vh; height: 100dvh; }
.chat-shell { display: flex; gap: 14px; width: 100%; height: 100%; padding: 14px; position: relative; }
button.icon, .button.icon {
  min-height: 0; width: 34px; height: 34px; padding: 0; border-radius: 10px;
  background: transparent; color: var(--ink-2); border: 1px solid transparent;
}
button.icon:hover, .button.icon:hover { background: var(--wash); color: var(--ink); }

/* sidebar: shown on wide screens unless collapsed; an overlay on narrow ones when opened */
.chat-side {
  /* above the conversation, so the account popup can reach past the sidebar's edge */
  flex: none; width: 264px; display: flex; flex-direction: column; min-height: 0; position: relative; z-index: 5;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.chat-shell.collapsed .chat-side { display: none; }
.chat-float {
  display: none; position: absolute; top: 20px; left: 20px; z-index: 4; gap: 2px; padding: 2px;
  background: rgba(255, 255, 255, 0.88); border: 1px solid var(--line); border-radius: 12px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.chat-shell.collapsed .chat-float { display: flex; }
.side-top { display: flex; align-items: center; gap: 2px; padding: 12px 10px 8px 16px; }
.side-top .grow { flex: 1; }
.convs { list-style: none; margin: 0; padding: 4px 8px; overflow-y: auto; flex: 1; }
.convs li a, .convs li input {
  display: block; width: 100%; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--ink-2);
  font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.convs li a:hover { background: var(--wash); }
.convs li a.on { background: rgba(255, 255, 255, 0.9); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); cursor: text; }
.convs li input { font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); }
.convs .empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }
.ctx {
  position: fixed; z-index: 20; min-width: 150px; padding: 6px; background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(26, 23, 18, 0.14);
}
.ctx button {
  display: block; width: 100%; min-height: 0; padding: 8px 10px; border: 0; border-radius: 8px; text-align: left;
  background: none; color: var(--ink); font: 400 14px "Manrope", sans-serif; letter-spacing: 0; text-transform: none;
}
.ctx button:hover { background: var(--wash); }
.ctx button.danger { color: var(--bad); }

/* account popup, bottom left */
.account { position: relative; border-top: 1px solid var(--line); }
.account summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.account summary::-webkit-details-marker { display: none; }
.account summary:hover { background: var(--wash); }
.account .avatar {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600;
}
.account .who { font: 12px var(--mono); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .menu {
  position: absolute; left: 8px; width: 300px; bottom: calc(100% + 6px); z-index: 10; padding: 14px 16px;
  background: rgba(255, 255, 255, 0.98); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 12px 40px rgba(26, 23, 18, 0.14); font-size: 13px;
}
.account nav { display: flex; flex-direction: column; margin: 10px -8px; padding-top: 8px; border-top: 1px solid var(--line); }
.account nav a { padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--ink-2); }
.account nav a:hover { background: var(--wash); color: var(--ink); }
.account form button { width: 100%; }

/* conversation */
.chat-main { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.log {
  flex: 1; overflow-y: auto; padding: 24px clamp(12px, 3vw, 28px); border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.chat-shell.collapsed .log { padding-top: 64px; }
.log .hello { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; color: var(--muted); }
.log .hello h1 { margin: 0; color: var(--ink); }
.msg { max-width: 780px; margin: 0 auto 18px; }
.msg .who { font-weight: 500; font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; display: flex; gap: 10px; }
.msg .who .meta { font-family: var(--mono); letter-spacing: 0.04em; text-transform: none; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.msg.user .body { background: rgba(26, 23, 18, 0.05); border-radius: 16px; padding: 10px 14px; display: inline-block; max-width: 100%; }
.msg.assistant .body:empty::after { content: "…"; color: var(--muted); }
.msg .note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.msg.error .body { color: var(--bad); }
.msg details.think { margin: 2px 0 8px; font-size: 13px; color: var(--muted); }
.msg details.think summary { cursor: pointer; font-weight: 500; font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; }
.msg details.think div { white-space: pre-wrap; border-left: 2px solid var(--line-strong); padding: 4px 0 4px 12px; margin-top: 6px; }
.divider { max-width: 780px; margin: 0 auto 18px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 500; font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px dashed var(--line-strong); }

/* composer: a quiet mode picker beside the box; status floats above it, taking no room */
.composer { width: 100%; max-width: 836px; margin: 10px auto 0; position: relative; }
.status-line {
  position: absolute; left: 18px; right: 18px; bottom: calc(100% + 4px);
  font: 11px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  pointer-events: none;
}
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
select.model {
  flex: none; width: auto; height: 52px; padding: 0 8px; border: 0; border-radius: 14px; background: transparent;
  cursor: pointer; font: 11px var(--mono); color: var(--muted);
}
select.model:hover { color: var(--ink); background: var(--wash); }
select.model:focus { outline: 1px solid var(--line-strong); }
.composer textarea {
  min-height: 52px; max-height: 240px; resize: none; border-radius: 22px; padding: 14px 18px;
  background: rgba(255, 255, 255, 0.85); line-height: 1.45;
}
.composer button#send { min-height: 52px; }
.sys-row { max-width: 780px; margin: 0 auto 18px; }
.hello .sysbtn { margin-top: 10px; }
button.sysbtn {
  min-height: 30px; padding: 0 14px; font-size: 10px; letter-spacing: 0.2em;
  background: var(--glass-2); color: var(--muted); border-color: var(--line-strong);
}
button.sysbtn:hover { background: var(--glass); color: var(--ink); }
button.sysbtn.on { color: var(--ink); border-color: var(--ink); }
dialog.sys textarea { min-height: 200px; resize: vertical; margin-top: 8px; font-size: 14px; line-height: 1.5; }
dialog.sys .actions button[hidden] { display: none; }
dialog.sys, dialog.age {
  max-width: 420px; width: calc(100% - 32px); padding: 26px 28px 22px; border: 1px solid var(--line);
  border-radius: 20px; background: #fff; color: var(--ink); box-shadow: 0 24px 80px rgba(26, 23, 18, 0.2);
}
dialog.sys { max-width: 600px; }
dialog.sys::backdrop, dialog.age::backdrop { background: rgba(26, 23, 18, 0.25); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog.sys h2, dialog.age h2 { font: 300 24px/1.2 "Manrope", sans-serif; letter-spacing: -0.02em; text-transform: none; color: var(--ink); margin: 6px 0 10px; }
dialog.sys p, dialog.age p { margin: 0 0 6px; color: var(--ink-2); font-size: 14px; }
dialog.age .eyebrow { color: var(--bad); }

@media (max-width: 820px) {
  .chat-shell { padding: 8px; }
  .chat-shell .chat-side { display: none; position: absolute; inset: 8px auto 8px 8px; z-index: 15; width: min(300px, 85vw); background: rgba(255, 255, 255, 0.97); }
  .chat-shell.open .chat-side { display: flex; }
  .chat-shell .chat-float { display: flex; top: 16px; left: 16px; }
  .chat-shell.open .chat-float { display: none; }
  .log { padding-top: 60px; }
}
