/* UZEX AI Hackathon × Win to Win — screening prototype UI
   Palette: hackathon navy / mint / royal blue + W2W cyan. Font: Onest (Cyrillic + Latin). */

:root {
  --navy: #0c1033;
  --navy-2: #11164a;
  --navy-3: #171d5c;
  --line: rgba(174, 180, 224, 0.18);
  --line-strong: rgba(174, 180, 224, 0.36);
  --ink: #ffffff;
  --ink-2: #b9bfe6;      /* secondary text, tinted from the navy hue */
  --ink-3: #8a92cc;
  --mint: #3df58a;
  --mint-ink: #07301a;
  --royal: #3f5bd8;
  --royal-deep: #2c42a8;
  --cyan: #0abcf3;
  --w2w: #232325;
  --danger: #ff7a7a;
  --amber: #ffd166;

  --font: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "Consolas", ui-monospace, monospace;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.75), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --wrap: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--navy);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--mint); color: var(--mint-ink); }
body { caret-color: var(--mint); scrollbar-color: var(--royal) var(--navy-2); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--navy-2); }
::-webkit-scrollbar-thumb { background: var(--royal); border: 3px solid var(--navy-2); border-radius: 8px; }

:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; border-radius: 3px; }

a { color: var(--mint); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: #fff; }

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }

code, pre, kbd, .mono { font-family: var(--mono); }

.wrap { width: min(var(--wrap), 100% - 2.5rem); margin-inline: auto; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--mint); color: var(--mint-ink); padding: 0.6rem 1rem; border-radius: var(--radius);
  font-weight: 600; transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* Mono labels: the registry voice. Used for data, meta, and system labels only. */
.label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12, 16, 51, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 1rem;
  min-height: 68px;
}
.brands { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand svg { flex: none; }
.brand-name { font-weight: 700; line-height: 1.05; letter-spacing: -0.01em; font-size: 0.95rem; }
.brand-name small { display: block; font-weight: 500; color: var(--ink-2); font-size: 0.72rem; letter-spacing: 0.02em; margin-top: 2px; }
.brand-x { color: var(--ink-3); font-weight: 300; font-size: 1.1rem; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }

.lang-switch {
  display: inline-flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.lang-switch button {
  border: 0; background: transparent; color: var(--ink-2);
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em;
  padding: 0.35rem 0.75rem; border-radius: 999px; transition: background 0.2s var(--ease-out), color 0.2s;
}
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--navy); font-weight: 700; }
.lang-switch button:not([aria-pressed="true"]):hover { color: var(--ink); }

.tg-link {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.45rem 0.85rem; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: 0.9rem; transition: border-color 0.2s, background 0.2s;
}
.tg-link:hover { border-color: var(--cyan); background: rgba(10, 188, 243, 0.08); color: var(--ink); }
.tg-link svg { color: var(--cyan); }
.tg-link .tg-handle { font-family: var(--mono); font-weight: 500; font-size: 0.8rem; }

/* ---------- Hero ---------- */
.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 2.5rem; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); gap: 3rem; align-items: end; }

.crumbs { display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem; align-items: center; margin-bottom: 1.4rem; }
.crumbs .tag { color: var(--ink-2); }
.crumbs .tag.mint { background: var(--mint); color: var(--mint-ink); padding: 0.22rem 0.55rem; border-radius: 3px; font-weight: 600; }

.headline { margin: 0; font-size: clamp(2.2rem, 5.4vw, 3.9rem); line-height: 1.02; font-weight: 700; letter-spacing: -0.03em; }
.headline .box { display: inline-block; padding: 0.06em 0.22em 0.1em; margin-bottom: 0.08em; }
.headline .box.white { background: var(--ink); color: var(--navy); }
.headline .box.blue { background: var(--royal); color: var(--ink); margin-left: 0.9em; }

.lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--ink-2); max-width: 36em; margin: 1.5rem 0 0; }

.facts { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin-top: 2rem; }
.facts > div { padding: 0.6rem 1.25rem 0.6rem 0; border-right: 1px solid var(--line-strong); }
.facts > div:last-child { border-right: 0; }
.facts .label { display: block; margin-bottom: 0.25rem; }
.facts strong { color: var(--mint); font-weight: 600; font-size: 1.02rem; letter-spacing: -0.01em; }

/* Binary registry grid (decorative, aria-hidden) */
.registry { align-self: stretch; display: flex; flex-direction: column; justify-content: flex-end; gap: 0.6rem; }
.registry-head { display: flex; justify-content: space-between; gap: 1rem; }
.registry-head .right { color: var(--mint); }
.bin-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.bin-grid span {
  aspect-ratio: 1; display: grid; place-items: center;
  font-family: var(--mono); font-size: 0.68rem;
  background: var(--navy-2); color: var(--ink-3); border-radius: 3px;
  transition: background 0.6s var(--ease-out), color 0.6s;
}
.bin-grid span.on { background: var(--mint); color: var(--mint-ink); font-weight: 700; }
.bin-grid span.hi { background: #e8ebff; color: var(--navy); font-weight: 700; }
.bin-grid span.row { background: rgba(63, 91, 216, 0.55); color: var(--ink); }

/* ---------- Ask ---------- */
.ask { padding: 1rem 0 2rem; }
.ask-panel {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 1.25rem; position: relative;
}
.ask-form { display: grid; grid-template-columns: 1fr auto; gap: 0.75rem; align-items: stretch; }
.ask-form label { grid-column: 1 / -1; }
.ask-input {
  width: 100%; min-height: 3.6rem; max-height: 12rem; resize: vertical;
  padding: 0.95rem 1.1rem; font: inherit; font-size: 1.15rem; line-height: 1.4;
  color: var(--ink); background: var(--navy); border: 1px solid var(--line-strong); border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ask-input::placeholder { color: var(--ink-3); }
.ask-input:focus { outline: none; border-color: var(--mint); box-shadow: 0 0 0 3px rgba(61, 245, 138, 0.18); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.85rem 1.4rem; border-radius: var(--radius); border: 1px solid transparent;
  font-weight: 700; font-size: 1rem; letter-spacing: -0.01em;
  transition: transform 0.15s var(--ease-out), background 0.2s, filter 0.2s, opacity 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn-mint { background: var(--mint); color: var(--mint-ink); text-decoration: none; }
.btn-mint:hover { filter: brightness(1.06); color: var(--mint-ink); }
.btn-mint:disabled { opacity: 0.55; filter: none; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.82rem; font-weight: 600; }
.btn kbd { font-family: var(--mono); font-size: 0.7rem; opacity: 0.7; font-weight: 500; }

.ask-hint { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 0.6rem; }
.ask-hint .label { font-size: 0.74rem; text-transform: none; letter-spacing: 0.02em; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.chip {
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink-2);
  border-radius: 999px; padding: 0.4rem 0.85rem; font-size: 0.88rem; text-align: left;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.chip:hover { color: var(--ink); border-color: var(--mint); background: rgba(61, 245, 138, 0.07); }
.chip .chip-lang { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; margin-right: 0.45rem; color: var(--ink-3); }

.demo-banner {
  display: none; margin-bottom: 1rem; padding: 0.7rem 1rem; border-radius: var(--radius);
  background: rgba(255, 209, 102, 0.1); border: 1px dashed rgba(255, 209, 102, 0.6); color: var(--amber);
  font-size: 0.9rem;
}
.demo-banner.show { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
.demo-banner .label { color: var(--amber); }

/* ---------- Conversation / answer cards ---------- */
.thread { display: flex; flex-direction: column; gap: 1.25rem; margin-top: 1.5rem; }
.thread:empty { display: none; }

.q-row { display: flex; gap: 0.75rem; align-items: flex-start; }
.q-row .q-mark {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--royal); font-family: var(--mono); font-size: 0.8rem; font-weight: 700;
}
.q-text { font-size: 1.12rem; font-weight: 600; padding-top: 0.25rem; letter-spacing: -0.01em; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.q-row, .card, .ask-panel, #ask { scroll-margin-top: calc(var(--header-h, 68px) + 0.75rem); }

.card {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden;
  animation: card-in 0.55s var(--ease-out) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); clip-path: inset(0 0 12% 0 round 10px); }
  to { opacity: 1; transform: none; clip-path: inset(0 0 0 0 round 10px); }
}
.card-head {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.7rem 1.1rem; border-bottom: 1px solid var(--line);
}
.status {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700;
  padding: 0.25rem 0.55rem; border-radius: 3px;
}
.status.found { background: var(--mint); color: var(--mint-ink); }
.status.notfound { background: var(--ink); color: var(--navy); }
.status.error { background: var(--danger); color: #3a0b0b; }
.status.loading { background: var(--royal); color: var(--ink); }
.status.demo { background: var(--amber); color: #3b2a00; }
.card-meta { margin-left: auto; display: flex; gap: 1rem; flex-wrap: wrap; }
.card-meta .label { color: var(--ink-3); }
.card-meta .label b { color: var(--ink); font-weight: 600; }

.card-body { padding: 1.1rem 1.1rem 1.2rem; }
.answer-text { font-size: 1.12rem; line-height: 1.5; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.answer-text.muted { color: var(--ink-2); }

/* Parsed answer: paragraphs, "- " bullets, and the 📎 basis block */
.answer { display: grid; gap: 0.7rem; overflow-wrap: anywhere; }
.answer-p { margin: 0; font-size: 1.05rem; line-height: 1.5; }
.answer-p.lead { font-size: 1.18rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.4; }
.answer-list { margin: 0; padding: 0 0 0 1.15rem; display: grid; gap: 0.3rem; font-size: 1.02rem; line-height: 1.45; }
.answer-list li::marker { color: var(--mint); }
.answer-list b { font-weight: 600; color: var(--ink); }
.answer-basis {
  margin-top: 0.35rem; padding: 0.7rem 0.9rem 0.75rem; border-radius: var(--radius);
  background: rgba(10, 188, 243, 0.07); border: 1px solid rgba(10, 188, 243, 0.28); border-left: 3px solid var(--cyan);
  font-size: 0.88rem; color: var(--ink-2); line-height: 1.45;
}
.answer-basis .ab-label { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cyan); margin-bottom: 0.35rem; font-weight: 700; }
.ab-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.15rem; }
.ab-list li::before { content: "· "; color: var(--cyan); }
.ab-list b { font-weight: 600; color: var(--ink); }
.card.notfound .answer-basis { background: rgba(44, 66, 168, 0.08); border-color: rgba(44, 66, 168, 0.3); border-left-color: var(--royal-deep); color: var(--navy); }
.card.notfound .answer-basis .ab-label, .card.notfound .ab-list li::before { color: var(--royal-deep); }
.card.notfound .answer-list b, .card.notfound .ab-list b { color: var(--navy); }
.meta-item { display: inline-flex; gap: 0.35em; align-items: baseline; white-space: nowrap; }

/* "Not in the data" — inverted, unmistakable */
.card.notfound { background: var(--ink); color: var(--navy); border-color: var(--ink); }
.card.notfound .card-head { border-bottom-color: rgba(12, 16, 51, 0.12); }
.card.notfound .status.notfound { background: var(--navy); color: var(--ink); }
.card.notfound .card-meta .label, .card.notfound .card-meta .label b { color: var(--navy); }
.card.notfound .answer-text { color: var(--navy); }
.card.notfound .nf-note { margin: 0.75rem 0 0; font-size: 0.92rem; color: var(--royal-deep); }
.card.notfound .basis { background: #eef0fb; border-top-color: rgba(12, 16, 51, 0.12); }
.card.notfound .basis summary { color: var(--navy); }
.card.notfound .basis summary:hover { background: rgba(12, 16, 51, 0.04); }
.card.notfound .basis-meta .label { color: var(--royal-deep); }
.card.notfound .basis-meta .label b { color: var(--navy); }

/* Error */
.card.error { border-color: rgba(255, 122, 122, 0.4); }
.card.error .answer-text { color: var(--ink); }
.err-actions { margin-top: 0.9rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* Loading / "thinking" */
.card.loading { border-color: rgba(63, 91, 216, 0.6); box-shadow: var(--shadow), 0 0 0 1px rgba(63, 91, 216, 0.25); }
.card.loading .card-body { display: grid; gap: 0.9rem; }
.thinking { display: flex; align-items: center; gap: 0.9rem; }
.orb {
  flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--mint), var(--royal) 70%);
  box-shadow: 0 0 0 0 rgba(61, 245, 138, 0.45);
  animation: orb-pulse 1.4s ease-in-out infinite;
}
@keyframes orb-pulse {
  0% { transform: scale(0.92); box-shadow: 0 0 0 0 rgba(61, 245, 138, 0.45); }
  70% { transform: scale(1); box-shadow: 0 0 0 14px rgba(61, 245, 138, 0); }
  100% { transform: scale(0.92); box-shadow: 0 0 0 0 rgba(61, 245, 138, 0); }
}
.elapsed { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.elapsed .num { font-family: var(--mono); font-size: 2rem; font-weight: 700; color: var(--mint); letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.elapsed .num small { font-size: 1rem; color: var(--ink-2); font-weight: 500; }
.elapsed .note { color: var(--ink-2); font-size: 0.9rem; }
.progress { height: 4px; background: var(--navy); border-radius: 2px; overflow: hidden; position: relative; }
.progress i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left center; background: linear-gradient(90deg, var(--mint), var(--cyan)); transition: transform 1s linear; }
.progress::after {
  content: ""; position: absolute; inset: 0; width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: progress-sheen 1.6s linear infinite;
}
@keyframes progress-sheen { from { transform: translateX(-100%); } to { transform: translateX(400%); } }
.progress.late i { background: var(--amber); }
.loading-steps { display: flex; gap: 0.5rem 0.9rem; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.loading-steps li { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--ink-3); transition: color 0.3s; }
.loading-steps li .dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; border: 1.5px solid currentColor; flex: none; display: grid; place-items: center; font-size: 0.5rem; }
.loading-steps li.active { color: var(--mint); font-weight: 700; }
.loading-steps li.active .dot { background: currentColor; animation: dot-blink 0.9s ease-in-out infinite; }
.loading-steps li.done { color: var(--ink-2); }
.loading-steps li.done .dot { background: currentColor; border-color: transparent; }
.loading-steps li.done .dot::after { content: "✓"; color: var(--navy); font-weight: 700; }
.loading-steps li:not(:last-child)::after { content: "→"; margin-left: 0.5rem; color: var(--ink-3); font-weight: 400; }
@keyframes dot-blink { 50% { opacity: 0.35; } }
.skeleton { display: grid; gap: 0.5rem; }
.skeleton i { display: block; height: 0.8rem; border-radius: 4px; background: linear-gradient(90deg, var(--navy) 25%, var(--navy-3) 45%, var(--navy) 65%); background-size: 240% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton i:nth-child(1) { width: 82%; } .skeleton i:nth-child(2) { width: 64%; } .skeleton i:nth-child(3) { width: 48%; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* Fresh answer: ring flash so the eye lands on it */
.card.fresh { animation: card-in 0.55s var(--ease-out) both, card-flash 2.2s ease-out both; }
@keyframes card-flash {
  0% { box-shadow: var(--shadow), 0 0 0 0 rgba(61, 245, 138, 0.0); }
  18% { box-shadow: var(--shadow), 0 0 0 4px rgba(61, 245, 138, 0.7); }
  100% { box-shadow: var(--shadow), 0 0 0 4px rgba(61, 245, 138, 0); }
}
.card.notfound.fresh { animation-name: card-in, card-flash-nf; }
@keyframes card-flash-nf {
  0% { box-shadow: var(--shadow), 0 0 0 0 rgba(255, 255, 255, 0); }
  18% { box-shadow: var(--shadow), 0 0 0 4px rgba(255, 255, 255, 0.8); }
  100% { box-shadow: var(--shadow), 0 0 0 4px rgba(255, 255, 255, 0); }
}

/* Floating pill: "answer below / above", "agent working", "new question" */
.jump-pill {
  position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 60; min-height: 44px; padding: 0.6rem 1.1rem; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(17, 22, 74, 0.92); color: var(--ink);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-weight: 600; font-size: 0.92rem; box-shadow: var(--shadow); white-space: nowrap; max-width: calc(100vw - 2rem);
  animation: pill-in 0.3s var(--ease-out) both;
}
.jump-pill[hidden] { display: none; }
.jump-pill.answer { background: var(--mint); color: var(--mint-ink); border-color: var(--mint); }
.jump-pill.loading { border-color: var(--royal); font-family: var(--mono); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.jump-pill.loading::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--mint); margin-right: 0.55rem; vertical-align: middle; animation: dot-blink 0.9s ease-in-out infinite; }
.jump-pill:hover { filter: brightness(1.08); }
@keyframes pill-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Send button busy state */
.ask-form.is-busy .btn-mint { opacity: 0.75; }
.ask-form.is-busy .btn-mint kbd { display: none; }
.ask-form.is-busy .btn-mint::after { content: ""; width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid rgba(7, 48, 26, 0.35); border-top-color: var(--mint-ink); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Basis / grounding panel */
.basis { border-top: 1px solid var(--line); background: rgba(12, 16, 51, 0.5); }
.basis summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem 0.75rem;
  padding: 0.8rem 1.1rem; font-weight: 600; user-select: none; min-height: 44px;
}
.basis summary .chev { flex: none; }
.basis-title { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; }
.basis-title::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 2px; background: var(--mint); flex: none; }
.card.notfound .basis-title::before { background: var(--royal-deep); }
.basis summary::-webkit-details-marker { display: none; }
.basis summary:hover { background: rgba(255, 255, 255, 0.03); }
.basis summary .chev { margin-left: auto; transition: transform 0.25s var(--ease-out); }
.basis[open] summary .chev { transform: rotate(180deg); }
.basis-meta { display: flex; gap: 1rem; flex-wrap: wrap; }
.basis-meta .label b { color: var(--ink); font-weight: 600; }
.basis-content { padding: 0 1.1rem 1.1rem; display: grid; gap: 1rem; }

.sql-block { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--navy); }
.sql-block .sql-head { display: flex; align-items: center; justify-content: space-between; padding: 0.45rem 0.6rem 0.45rem 0.9rem; border-bottom: 1px solid var(--line); }
.sql-block pre { margin: 0; padding: 0.9rem; overflow: auto; font-size: 0.85rem; line-height: 1.55; color: #dfe3ff; tab-size: 2; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22rem; }
.sql-block .sql-head .label { white-space: nowrap; }
.sql-block code { font-family: var(--mono); }
.tok-kw { color: var(--mint); font-weight: 600; }
.tok-fn { color: var(--cyan); }
.tok-str { color: var(--amber); }
.tok-num { color: #ffb3ff; }
.tok-cm { color: var(--ink-3); font-style: italic; }
.copy-btn.copied { color: var(--mint); border-color: var(--mint); }

/* Result table: horizontal scroll with edge fades + hint when wider than the card */
.table-box { position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; max-height: 24rem; overscroll-behavior-x: contain; scrollbar-width: thin; }
.table-wrap:focus-visible { outline-offset: -2px; }
.table-box::before, .table-box::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 2.2rem; pointer-events: none; z-index: 2;
  opacity: 0; transition: opacity 0.2s;
}
.table-box::before { left: 0; background: linear-gradient(90deg, rgba(17, 22, 74, 0.95), transparent); }
.table-box::after { right: 0; background: linear-gradient(270deg, rgba(17, 22, 74, 0.95), transparent); }
.table-box.can-scroll:not(.at-start)::before { opacity: 1; }
.table-box.can-scroll:not(.at-end)::after { opacity: 1; }
.scroll-hint { display: none; padding: 0.35rem 0.8rem; font-size: 0.66rem; text-transform: none; letter-spacing: 0.04em; color: var(--cyan); background: var(--navy); border-top: 1px solid var(--line); }
.table-box.can-scroll .scroll-hint { display: block; }
.card.notfound .table-box, .card.notfound .sql-block { border-color: rgba(12, 16, 51, 0.15); }
table.result { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 0.86rem; }
table.result th, table.result td { padding: 0.5rem 0.8rem; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); vertical-align: top; }
table.result th { position: sticky; top: 0; z-index: 1; background: var(--navy-3); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; }
table.result td.num, table.result th.num { text-align: right; }
table.result td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.result td.txt { min-width: 6ch; }
table.result td.txt.long { white-space: normal; min-width: 18ch; max-width: 34ch; overflow-wrap: anywhere; }
table.result td.nil { color: var(--ink-3); }
table.result th.idx, table.result td.idx { color: var(--ink-3); font-family: var(--mono); font-size: 0.72rem; padding-right: 0.3rem; width: 1%; text-align: right; }
table.result td.bool { font-family: var(--mono); font-size: 0.78rem; }
table.result td.bool.yes { color: var(--mint); }
table.result td.bool.no { color: var(--danger); }
table.result tr:last-child td { border-bottom: 0; }
table.result tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }
.card.notfound table.result th { background: #dde1f7; color: var(--navy); }
.table-note { color: var(--ink-3); font-size: 0.8rem; font-family: var(--mono); }
.empty-rows { padding: 0.8rem 1rem; color: var(--ink-2); font-size: 0.9rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* ---------- How it works ---------- */
.how { padding: 3rem 0 2rem; border-top: 1px solid var(--line); margin-top: 2rem; }
.section-title { font-size: clamp(1.7rem, 3.4vw, 2.4rem); letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 0.5rem; font-weight: 700; text-wrap: balance; }
.section-lede { color: var(--ink-2); margin: 0 0 2rem; max-width: 60ch; }

.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; position: relative; counter-reset: step; list-style: none; margin: 0; padding: 0; }
.pipeline::before {
  content: ""; position: absolute; left: 0; right: 0; top: 1.25rem; height: 1px;
  background: linear-gradient(90deg, var(--royal), var(--mint));
}
.step { position: relative; padding: 0 1.25rem 0 0; }
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: var(--navy); border: 1px solid var(--mint); color: var(--mint);
  font-family: var(--mono); font-weight: 700; font-size: 0.85rem; position: relative; z-index: 1;
}
.step:last-child::before { background: var(--mint); color: var(--mint-ink); }
.step h3 { margin: 0.9rem 0 0.3rem; font-size: 1.05rem; letter-spacing: -0.01em; }
.step p { margin: 0; color: var(--ink-2); font-size: 0.92rem; line-height: 1.5; }
.step .out { display: inline-block; margin-top: 0.6rem; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--cyan); }

.how-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 1.5rem; margin-top: 2.5rem; align-items: start; }

.guarantee { background: var(--royal); color: var(--ink); border-radius: var(--radius-lg); padding: 1.6rem 1.6rem 1.5rem; box-shadow: var(--shadow); }
.guarantee h3 { margin: 0 0 0.4rem; font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.15; }
.guarantee p { margin: 0 0 1rem; color: #eef1ff; }
.guarantee ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.6rem; }
.guarantee li { display: grid; grid-template-columns: 1.6rem 1fr; gap: 0.5rem; align-items: start; line-height: 1.45; }
.guarantee li svg { color: var(--mint); margin-top: 0.15rem; }
.guarantee .fine { margin: 1rem 0 0; font-size: 0.85rem; color: #e6eaff; }

.datafacts { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.datafacts header { padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.datafacts header .label.mint { color: var(--mint); }
.datafacts dl { margin: 0; display: grid; grid-template-columns: auto 1fr; }
.datafacts dt, .datafacts dd { margin: 0; padding: 0.65rem 1.1rem; border-bottom: 1px solid var(--line); }
.datafacts dt { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); align-self: center; }
.datafacts dd { font-size: 0.95rem; }
.datafacts dd code { font-size: 0.78rem; color: var(--cyan); }
.datafacts dt:nth-last-of-type(1), .datafacts dd:last-of-type { border-bottom: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.75rem 0 2.5rem; }
.site-footer .wrap { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.site-footer .cobrand { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; }
.site-footer .cobrand .x { color: var(--ink-3); font-weight: 300; }
.site-footer .right { margin-left: auto; display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-footer .right a { color: var(--ink-2); font-size: 0.9rem; text-decoration: none; }
.site-footer .right a:hover { color: var(--ink); }

.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; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
  .pipeline { grid-template-columns: 1fr; gap: 1.5rem; }
  .pipeline::before { left: 1.25rem; right: auto; top: 0; bottom: 0; width: 1px; height: auto; background: linear-gradient(180deg, var(--royal), var(--mint)); }
  .step { padding: 0 0 0 3.5rem; }
  .step::before { position: absolute; left: 0; top: 0; }
  .step h3 { margin-top: 0.35rem; }
  .how-grid { grid-template-columns: 1fr; }
}
/* Touch: comfortable tap targets, no iOS zoom on focus */
@media (pointer: coarse) {
  .chip, .lang-switch button, .btn-sm, .tg-link { min-height: 44px; }
  .lang-switch button { padding-inline: 0.9rem; }
  .ask-input { font-size: max(16px, 1.05rem); }
}

@media (max-width: 640px) {
  .wrap { width: min(var(--wrap), 100% - 2rem); }
  body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .site-footer { padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 0px)); }
  .site-header .wrap { flex-wrap: wrap; row-gap: 0.5rem; padding: 0.5rem 0; }
  .header-actions { margin-left: auto; }
  .ask-panel { padding: 1rem; }
  .card-head { padding: 0.6rem 0.85rem; }
  .card-body { padding: 0.9rem 0.85rem 1rem; }
  .basis summary { padding: 0.7rem 0.85rem; }
  .basis-content { padding: 0 0.85rem 0.85rem; }
  .answer-p.lead { font-size: 1.08rem; }
  .answer-p, .answer-list { font-size: 0.98rem; }
  .q-text { font-size: 1.02rem; }
  .elapsed .num { font-size: 1.7rem; }
  .table-wrap { max-height: 60vh; }
  .sql-block pre { font-size: 0.78rem; }
  .ask-hint { font-size: 0.7rem; }
  .ask-hint .label:last-child { display: none; }
  .brand-name { font-size: 0.85rem; }
  .brand-x { display: none; }
  .brands { gap: 0.6rem; }
  .brand + .brand { padding-left: 0.6rem; border-left: 1px solid var(--line-strong); }
  .tg-link .tg-handle { display: none; }
  .headline .box.blue { margin-left: 0.4em; }
  .ask-form { grid-template-columns: 1fr; }
  .ask-input { font-size: max(16px, 1.05rem); min-height: 6rem; } /* the 3-line placeholder fits */
  .btn-mint { min-height: 48px; }
  .btn kbd { display: none; }
  /* phones: bring the question box up to the first screen (decorative registry hidden, facts in 2 columns) */
  .hero { padding: 1.5rem 0 1rem; }
  .registry { display: none; }
  .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; margin-top: 1rem; }
  .facts > div { border-right: 0; padding-right: 0; }
  .card-meta { margin-left: 0; }
  .datafacts dl { grid-template-columns: 1fr; }
  .datafacts dt { padding-bottom: 0; border-bottom: 0; }
}

/* ---------- Page loader (voxel splash) ---------- */
.splash {
  position: fixed; inset: 0; z-index: 1000; background: var(--navy);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6rem;
  opacity: 1;
  /* CSS-only safety net: even if JS never runs, the splash is gone by ~2.5 s */
  animation: splash-out 0.4s ease 2.1s forwards;
}
.splash.out { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.35s ease, visibility 0s 0.35s; animation: none; }
.no-splash .splash { display: none; animation: none; }
@keyframes splash-out { to { opacity: 0; visibility: hidden; pointer-events: none; } }
.splash-scene { display: flex; align-items: center; gap: 1.4rem; }
.splash-cubes { overflow: visible; }
.splash-cubes .cube { animation: cube-drop 0.7s cubic-bezier(0.22, 1.4, 0.36, 1) both; }
.splash-cubes .c1 { animation-delay: 0.05s; }
.splash-cubes .c2 { animation-delay: 0.2s; }
.splash-cubes .c3 { animation-delay: 0.32s; }
.splash-cubes .c4 { animation-delay: 0.46s; }
@keyframes cube-drop {
  from { opacity: 0; transform: translateY(-70px); }
  to { opacity: 1; transform: none; }
}
.splash-cubes .mint .t { fill: var(--mint); } .splash-cubes .mint .l { fill: #2bd37a; } .splash-cubes .mint .r { fill: #1da35c; }
.splash-cubes .royal .t { fill: #5a74e8; } .splash-cubes .royal .l { fill: var(--royal); } .splash-cubes .royal .r { fill: var(--royal-deep); }
.splash-cubes .green .t { fill: #2bd37a; } .splash-cubes .green .l { fill: #1da35c; } .splash-cubes .green .r { fill: #167a45; }
.splash-cubes .px { fill: #e8ebff; animation: px-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) var(--d, 0s) both; }
.splash-cubes .px:nth-child(3n) { fill: var(--mint); }
.splash-cubes .px:nth-child(3n + 1) { fill: #7f94f0; }
@keyframes px-in {
  0% { opacity: 0; transform: translate(var(--dx), var(--dy)); }
  30% { opacity: 1; }
  100% { opacity: 0.35; transform: none; }
}
.splash-x { color: var(--ink-3); font-size: 1.6rem; font-weight: 300; animation: splash-fade 0.5s ease 0.55s both; }
.splash-w2w { border-radius: 12px; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.8); animation: splash-fade 0.6s var(--ease-out) 0.6s both; }
.splash-text { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; animation: splash-fade 0.5s ease 0.75s both; }
.splash-title { font-weight: 700; font-size: 0.95rem; letter-spacing: -0.01em; }
.splash-label { font-size: 0.68rem; text-transform: none; letter-spacing: 0.04em; color: var(--ink-3); }
.splash-label::after { content: ""; display: inline-block; width: 0.45rem; height: 0.45rem; margin-left: 0.5rem; vertical-align: middle; background: var(--mint); animation: dot-blink 0.9s ease-in-out infinite; }
@keyframes splash-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- "Agent is working" voxel scene (canvas) ---------- */
.agent-scene {
  position: relative; height: 190px; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(ellipse at 50% 60%, rgba(63, 91, 216, 0.14), transparent 70%), var(--navy);
  border: 1px solid var(--line);
}
.agent-scene canvas { display: block; width: 100%; height: 100%; }
.agent-scene .scene-tag { position: absolute; right: 0.7rem; top: 0.55rem; font-size: 0.62rem; color: var(--ink-3); letter-spacing: 0.1em; pointer-events: none; }
.agent-scene .scene-tag b { color: var(--mint); font-weight: 600; }
.agent-scene.deliver { animation: scene-flash 0.5s ease-out both; }
@keyframes scene-flash { 30% { box-shadow: inset 0 0 0 2px var(--mint), 0 0 24px -4px rgba(61, 245, 138, 0.6); } 100% { box-shadow: none; } }
@media (max-width: 640px) { .agent-scene { height: 165px; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .splash { display: none; animation: none; }
  .agent-scene.deliver, .splash-label::after { animation: none; }
  .card, .card.fresh, .orb, .progress::after, .skeleton i, .loading-steps li.active .dot, .jump-pill, .jump-pill.loading::before { animation: none; }
  .card.fresh { box-shadow: var(--shadow), 0 0 0 3px var(--mint); }
  .bin-grid span, .btn, .chip, .lang-switch button { transition: none; }
}
