:root {
  --paper: #f2f4f1;
  --paper-2: #e9ece8;
  --ink: #111a15;
  --muted: #5e6962;
  --line: #d3d9d3;
  --accent: #0f5c4a;
  --accent-ink: #ffffff;
  --error: #c2371f;
  --warn: #b7791f;
  --term-bg: #0e1013;
  --term-chrome: #181b20;
  --term-text: #d7dbd4;
  --term-dim: #7b8289;
  --term-orange: #d97757;
  --term-green: #6fbf8a;
  --term-red: #e5695a;
  --term-yellow: #e0b35a;
  --term-blue: #7aa7e0;

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 5vw, 72px);
  --radius: 4px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- site ---------- */

.topbar {
  position: sticky;
  top: var(--banner-h, 0px);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, white);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 700;
  font-variation-settings: "wdth" 115;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}

.topnav { display: flex; gap: 22px; margin-left: 12px; }
.topnav a { text-decoration: none; color: var(--muted); font-size: 15px; padding-bottom: 2px; border-bottom: 1px solid transparent; }
.topnav a:hover { color: var(--ink); }
.topnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.meter {
  margin-left: auto;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  white-space: nowrap;
}
.meter-label { letter-spacing: 0.02em; text-transform: uppercase; font-size: 10.5px; }
.meter-item { position: relative; display: inline-flex; align-items: baseline; gap: 8px; cursor: help; outline: none; }
.meter-item::after { content: attr(data-tip); display: none; position: absolute; top: calc(100% + 12px); left: -10px; z-index: 1300; padding: 7px 10px; background: var(--ink); color: var(--paper); border-radius: 4px; font-size: 11.5px; letter-spacing: 0; text-transform: none; white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.meter-item:hover::after, .meter-item:focus-visible::after { display: block; }
.meter-value { color: var(--ink); font-weight: 500; font-size: 14px; min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }
.meter-value.bump { animation: bump 320ms ease-out; }
.meter-btn { align-self: center; display: inline-grid; place-items: center; padding: 3px 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper); color: var(--muted); font: inherit; font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; }
.meter-share { margin-left: 6px; }
.meter-share:hover { border-color: var(--accent); color: var(--accent); }
.meter-reset { padding: 3px 5px; }
.meter-reset:hover { border-color: var(--error); color: var(--error); }
@keyframes bump { 0% { color: var(--error); transform: translateY(-2px); } 100% { transform: none; } }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #0b4a3b; border-color: #0b4a3b; color: white; }
.btn-ghost { border-color: var(--line); }
.btn-sm { padding: 8px 14px; font-size: 14px; }

.hero {
  padding: clamp(64px, 12vh, 140px) var(--gutter) clamp(48px, 8vh, 96px);
  max-width: 1120px;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 28px;
}
.display {
  font-size: clamp(44px, 8.2vw, 118px);
  line-height: 0.96;
  font-weight: 700;
  font-variation-settings: "wdth" 118;
  letter-spacing: -0.03em;
  max-width: 11ch;
}
.lede {
  margin-top: 36px;
  max-width: 56ch;
  font-size: clamp(17px, 1.5vw, 21px);
  color: #2b3530;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.hero-note { margin-top: 28px; color: var(--muted); font-size: 14px; }

.section-head { max-width: 60ch; margin-bottom: 36px; }
.section-head h1, .section-head h2 { font-size: clamp(34px, 4.6vw, 64px); line-height: 1; font-variation-settings: "wdth" 112; letter-spacing: -0.025em; font-weight: 700; }
.section-head p { margin-top: 14px; color: var(--muted); }
.section-head .eyebrow { margin-bottom: 20px; }

.page { padding: clamp(56px, 10vh, 120px) var(--gutter) clamp(48px, 8vh, 96px); min-height: 60vh; }

.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.service { background: var(--paper); padding: 32px 28px 28px; display: flex; flex-direction: column; gap: 14px; }
.service h3 { font-size: 22px; }
.service p { color: #2b3530; flex: 1; }
.service a { font-size: 15px; color: var(--accent); text-underline-offset: 3px; }

.ledger-table { width: 100%; border-collapse: collapse; max-width: 880px; font-size: 16px; }
.ledger-table th { text-align: left; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 0 12px 12px 0; border-bottom: 1px solid var(--ink); }
.ledger-table td { padding: 14px 12px 14px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.ledger-table td:nth-child(2) { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ledger-actions { margin-top: 28px; }

.quote-block { margin: 48px 0 0; max-width: 34ch; border-left: 2px solid var(--accent); padding-left: 24px; }
.quote-block p { font-family: var(--display); font-variation-settings: "wdth" 108; font-size: clamp(22px, 2.8vw, 34px); line-height: 1.15; letter-spacing: -0.02em; font-weight: 500; }
.quote-block footer { margin-top: 18px; color: var(--muted); font-size: 15px; }
.contact { margin-top: 48px; font-family: var(--mono); font-size: 14px; color: var(--accent); }

.plan { display: grid; grid-template-columns: 1fr auto; gap: 40px; border: 1px solid var(--ink); padding: 36px 32px; max-width: 880px; }
.plan h3 { font-size: 26px; }
.plan-price { margin-top: 6px; color: var(--muted); }
.plan-list { margin: 22px 0 0; padding-left: 18px; }
.plan-list li { margin-bottom: 6px; }
.plan-cta { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; justify-content: center; }
.plan-cta a { font-size: 15px; color: var(--accent); }

.footer { padding: 28px var(--gutter); border-top: 1px solid var(--line); }
.footer-fine { font-size: 13px; color: var(--muted); }
.footer-fine a { color: inherit; }

/* widgets that act on other elements */
.s-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.s-swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.s-swatch:hover { transform: scale(1.15); }
.s-focus-dim { position: fixed; inset: 0; z-index: 650; background: rgba(17,26,21,0.82); animation: fade-in 200ms; }
.s-focus-keep { position: relative; z-index: 660; background: white; box-shadow: 0 0 0 12px white, 0 30px 80px rgba(0,0,0,0.4); }
.s-collapsed > :not(h5):not(.slop-new) { display: none; }
.s-collapsed::after { content: "Collapsed. Use Expand all to see this again."; font-size: 12px; color: var(--muted); }
.s-pinned { position: fixed !important; z-index: 780; width: min(360px, 80vw); box-shadow: 0 20px 60px rgba(0,0,0,0.3); margin: 0; }

/* widgets that cover the page */
.s-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 760; width: min(34vw, 420px); min-width: 260px; background: white; border-left: 1px solid var(--line); box-shadow: -20px 0 60px rgba(0,0,0,0.15); padding: 72px 20px 20px; overflow: auto; animation: drawer-in 260ms cubic-bezier(.2,.8,.2,1); font-size: 14px; }
.s-drawer.closing { animation: drawer-out 220ms ease-in forwards; }
@keyframes drawer-in { from { transform: translateX(100%); } }
@keyframes drawer-out { to { transform: translateX(100%); } }
.s-drawer .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.s-drawer .x { border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.s-drawer .item { padding: 12px 0; border-top: 1px solid var(--line); }
.s-drawer .item p { color: var(--muted); font-size: 13px; margin: 4px 0 6px; }
.s-interstitial { position: fixed; top: 0; left: 0; right: 0; height: 52vh; z-index: 790; background: var(--ink); color: var(--paper); display: grid; place-items: center; padding: 24px; animation: drop-in 320ms cubic-bezier(.2,.8,.2,1); box-shadow: 0 30px 80px rgba(0,0,0,0.4); }
@keyframes drop-in { from { transform: translateY(-100%); } }
.s-interstitial .inner { max-width: 60ch; }
.s-interstitial .eyebrow { color: var(--term-orange); margin-bottom: 10px; }
.s-interstitial h3 { font-size: clamp(22px, 3vw, 34px); margin-bottom: 10px; }
.s-interstitial p { opacity: 0.85; font-size: 15px; }
.s-interstitial .row { display: flex; gap: 14px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.s-interstitial .timer { font-family: var(--mono); font-size: 12.5px; opacity: 0.8; }
.s-interstitial .s-link { color: var(--paper); }
.s-pip { position: fixed; left: 16px; bottom: 90px; z-index: 770; width: min(300px, 70vw); background: var(--ink); color: var(--paper); border-radius: 8px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.35); animation: slop-in 220ms; }
.s-pip .screen { aspect-ratio: 16 / 9; display: grid; place-items: center; background: linear-gradient(135deg, #1a2a24, #0e1013); position: relative; }
.s-pip .play { font-size: 34px; opacity: 0.9; }
.s-pip .title { position: absolute; left: 10px; bottom: 8px; font-size: 12px; opacity: 0.8; }
.s-pip .bar { height: 3px; background: rgba(255,255,255,0.2); }
.s-pip .bar i { display: block; height: 100%; background: var(--term-orange); width: 0; transition: width 400ms linear; }
.s-pip .ctl { display: flex; gap: 6px; padding: 8px; align-items: center; }
.s-pip .ctl .chip { background: transparent; color: var(--paper); border-color: rgba(255,255,255,0.3); }
.s-pip .x { margin-left: auto; border: 0; background: none; color: var(--paper); font-size: 18px; cursor: pointer; }
.s-note { position: fixed; z-index: 775; width: 200px; padding: 14px 14px 18px; background: #fff3a8; color: #3a3200; box-shadow: 0 12px 30px rgba(0,0,0,0.25); font-size: 13.5px; cursor: grab; touch-action: none; user-select: none; animation: slop-in 220ms; }
.s-note.dragging { cursor: grabbing; box-shadow: 0 24px 50px rgba(0,0,0,0.35); }
.s-note strong { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px; opacity: 0.7; }
.s-chain-marker { display: none; }

/* chill modal */
.s-chill { z-index: 1100; }
.s-chill .s-modal { text-align: center; padding: 40px 32px; }
.s-chill h2 { font-family: var(--display); font-variation-settings: "wdth" 112; font-size: clamp(30px, 4vw, 46px); letter-spacing: -0.02em; font-weight: 700; margin-bottom: 10px; }
.s-chill .row { justify-content: center; }

/* page transitions */
main { animation: page-in 420ms cubic-bezier(.2,.8,.2,1) both; }
body.leaving main { animation: page-out 220ms ease-in forwards; }
@keyframes page-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes page-out { to { opacity: 0; transform: translateY(-10px); } }
.route-bar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 2000; transition: width 240ms ease-in; }
.route-bar.go { width: 85%; }

@media (max-width: 860px) {
  .topnav { display: none; }
  .meter-label { display: none; }
  .meter-sep { display: none; }
  .meter-value { min-width: 0; }
  .meter-value + .meter-value::before { content: "·"; color: var(--muted); margin: 0 6px; }
  .meter-item::after { white-space: normal; width: max-content; max-width: min(260px, 70vw); }
  .plan { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { gap: 12px; }
  .topbar .btn { display: none; }
}

/* ---------- terminal ---------- */

body:has(.term-backdrop) .s-chat, body:has(.term-backdrop) .s-chatwin { z-index: 1001; }
.term-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 12, 14, 0.55);
  display: grid;
  place-items: center;
  padding: 24px;
  cursor: not-allowed;
  animation: fade-in 160ms ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.term {
  width: min(960px, 100%);
  height: min(620px, 86vh);
  background: var(--term-bg);
  color: var(--term-text);
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  user-select: none;
  pointer-events: none;
  animation: term-in 220ms cubic-bezier(.2,.8,.2,1);
}
@keyframes term-in { from { transform: translateY(14px) scale(.985); opacity: 0; } }

.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--term-chrome);
  color: var(--term-dim);
  font-size: 12px;
}
.term-dot { width: 12px; height: 12px; border-radius: 50%; background: #3a3f46; }
.term-dot:nth-child(1) { background: #ff5f57; }
.term-dot:nth-child(2) { background: #febc2e; }
.term-dot:nth-child(3) { background: #28c840; }
.term-title { margin-left: auto; margin-right: auto; }

.term-body {
  margin: 0;
  padding: 16px 18px;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
}
.term-body > div { min-height: 1.5em; }

.term-status {
  display: flex;
  gap: 18px;
  padding: 8px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  color: var(--term-dim);
  font-size: 12px;
}
.term-status .auto { color: var(--term-orange); }
.term-status .term-model { color: var(--term-dim); }

.t-prompt { color: var(--term-text); }
.t-prompt::before { content: "> "; color: var(--term-dim); }
.t-spark { color: var(--term-orange); }
.t-think { color: var(--term-dim); font-style: italic; }
.t-tool { color: var(--term-text); }
.t-tool b { color: var(--term-text); font-weight: 500; }
.t-tool .dot { color: var(--term-green); }
.t-tool .dot.err { color: var(--term-red); }
.t-sub { color: var(--term-dim); }
.t-add { color: var(--term-green); }
.t-del { color: var(--term-red); }
.t-warn { color: var(--term-yellow); }
.t-ok { color: var(--term-green); }
.t-err { color: var(--term-red); }
.t-dim { color: var(--term-dim); }
.t-blue { color: var(--term-blue); }
.t-cursor::after { content: "▍"; color: var(--term-orange); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* live status line under the output */
.term-live {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 18px 10px;
  font-size: 13px;
  color: var(--term-text);
}
.term-spin { color: var(--term-orange); width: 1ch; display: inline-block; margin-right: 6px; }
.t-shimmer {
  background: linear-gradient(90deg, var(--term-dim) 0%, var(--term-dim) 35%, #ffffff 50%, var(--term-dim) 65%, var(--term-dim) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer-text 1.6s linear infinite;
}
.t-shimmer-dots { color: var(--term-dim); }
@keyframes shimmer-text { from { background-position: 125% 0; } to { background-position: -125% 0; } }
.term-live-meta { margin-left: 8px; font-variant-numeric: tabular-nums; }

/* ---------- toasts ---------- */

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1200;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  animation: toast-in 240ms cubic-bezier(.2,.8,.2,1);
  cursor: pointer;
}
@keyframes toast-in { from { transform: translateX(24px); opacity: 0; } }
.toast-error { border-left-color: var(--error); }
.toast-warn { border-left-color: var(--warn); }
.toast-title { font-weight: 600; }
.toast-code { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.toast-body { grid-column: 1 / -1; color: #2b3530; font-size: 13.5px; }
.toast-actions { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 4px; }
.toast-actions button { font-size: 12px; padding: 4px 8px; border: 1px solid var(--line); background: var(--paper); border-radius: 3px; cursor: pointer; }

/* ---------- slop ---------- */

.slop {
  position: relative;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  animation: slop-in 260ms cubic-bezier(.2,.8,.2,1);
  font-size: 15px;
}
@keyframes slop-in { from { transform: translateY(10px); opacity: 0; } }
.slop-new {
  position: absolute;
  top: -9px;
  left: 12px;
  background: var(--error);
  color: white;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 3px;
}
.slop h5 { margin: 0 0 8px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.slop-dock { margin: 8px 0; }

.s-hl { outline: 3px solid var(--warn) !important; outline-offset: 2px; background: #fff3d6 !important; transition: outline 120ms; }
.s-hidden { visibility: hidden !important; }
.s-wiggle { animation: wiggle 400ms ease-in-out; }
@keyframes wiggle { 25% { transform: rotate(-1.5deg); } 75% { transform: rotate(1.5deg); } }

.chip, .s-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none;
}
.s-btn:hover, .chip:hover { background: var(--paper-2); }
.s-btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.s-link { color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.s-badge { display: inline-block; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; padding: 1px 5px; border-radius: 3px; background: var(--error); color: white; vertical-align: middle; }
.s-badge.beta { background: var(--warn); }
.s-badge.ai { background: #5b4bd6; }

/* menus */
.s-menubar { display: flex; flex-wrap: wrap; gap: 2px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); padding: 4px; }
.s-mi { position: relative; }
.s-mi > button { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; padding: 6px 10px; border: 0; background: transparent; border-radius: 3px; cursor: pointer; white-space: nowrap; font-size: 13.5px; }
.s-mi > button:hover, .s-mi.open > button { background: var(--ink); color: var(--paper); }
.s-mi > button .car { margin-left: auto; opacity: 0.6; font-size: 11px; }
.s-sub { display: none; position: absolute; top: 100%; left: 0; min-width: 200px; background: white; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 10px 30px rgba(0,0,0,0.14); padding: 4px; z-index: 30; }
.s-sub .s-sub { top: -5px; left: 100%; }
.s-mi.open > .s-sub { display: block; }
.s-sub .s-mi > button { white-space: normal; }
.s-sep { height: 1px; background: var(--line); margin: 4px 2px; }

/* word dropdowns + tooltips */
.s-para { line-height: 1.7; }
.s-word { position: relative; display: inline; border-bottom: 1px dashed var(--accent); color: var(--accent); cursor: pointer; }
.s-word .s-sub { left: 0; top: 1.4em; font-size: 13px; }
.s-word.open .s-sub { display: block; }
.s-tipword { border-bottom: 1px dotted var(--muted); cursor: help; position: relative; }
.s-tip { position: absolute; bottom: calc(100% + 8px); left: 0; background: var(--ink); color: var(--paper); font-size: 12px; padding: 8px 10px; border-radius: 4px; width: max-content; max-width: 260px; z-index: 40; box-shadow: 0 8px 24px rgba(0,0,0,0.2); line-height: 1.4; }
.s-tip::after { content: ""; position: absolute; top: 100%; left: 12px; border: 6px solid transparent; border-top-color: var(--ink); }
.s-tip .s-tip { bottom: calc(100% + 6px); left: 20px; background: #3a4640; }
.s-hovercard { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; background: white; border: 1px solid var(--line); border-radius: 6px; padding: 12px; width: 260px; box-shadow: 0 10px 30px rgba(0,0,0,0.14); font-size: 13px; line-height: 1.45; }
.s-hovercard .avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--warn)); display: inline-block; vertical-align: middle; margin-right: 8px; }

/* overlays */
.s-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(17,26,21,0.45); display: grid; place-items: center; padding: 20px; animation: fade-in 160ms; }
.s-modal { background: white; border-radius: 8px; padding: 28px; width: min(480px, 100%); box-shadow: 0 30px 80px rgba(0,0,0,0.35); animation: slop-in 220ms; position: relative; }
.s-modal h3 { font-size: 20px; margin-bottom: 8px; }
.s-modal p { color: #2b3530; font-size: 15px; }
.s-modal .row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.s-modal .x { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); }
.s-modal input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; font: inherit; margin-top: 12px; }

.s-cookie { position: fixed; left: 16px; bottom: 16px; z-index: 850; background: var(--ink); color: var(--paper); padding: 16px 18px; border-radius: 6px; width: min(380px, calc(100vw - 32px)); font-size: 13.5px; box-shadow: 0 20px 50px rgba(0,0,0,0.35); animation: slop-in 220ms; }
.s-cookie .row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.s-cookie .s-btn { background: transparent; color: var(--paper); border-color: rgba(255,255,255,0.3); }
.s-cookie .s-btn-primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }

.s-banner { position: sticky; top: 0; z-index: 60; background: var(--warn); color: var(--ink); text-align: center; padding: 8px 48px 8px 16px; font-size: 13.5px; font-weight: 500; position: relative; }
.s-banner.info { background: #5b4bd6; color: white; }
.s-banner.danger { background: var(--error); color: white; }
.s-banner .x { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: inherit; font-size: 18px; cursor: pointer; }
.s-banner-stack { position: sticky; top: 0; z-index: 60; }

.s-sidetab { position: fixed; right: 0; top: 40%; z-index: 800; transform: rotate(-90deg) translate(50%, -100%); transform-origin: right top; background: var(--accent); color: white; padding: 8px 16px; border-radius: 4px 4px 0 0; font-size: 13px; cursor: pointer; border: 0; }
.s-sidetab.n2 { top: 60%; background: var(--warn); }
.s-sidetab.n3 { top: 20%; background: var(--error); }

.s-chat { position: fixed; right: 20px; bottom: 20px; z-index: 850; width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: white; border: 0; cursor: pointer; font-size: 22px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); animation: slop-in 220ms; }
.s-chat .s-badge { position: absolute; top: -4px; right: -4px; }
.s-chatwin { position: fixed; right: 20px; bottom: 88px; z-index: 850; width: min(440px, calc(100vw - 32px)); height: min(500px, calc(100vh - 108px)); display: flex; flex-direction: column; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 20px 50px rgba(0,0,0,0.2); overflow: hidden; font-size: 14px; animation: slop-in 220ms; }
.s-chatwin .head { background: var(--accent); color: white; padding: 10px 12px; font-weight: 600; display: flex; justify-content: space-between; cursor: grab; user-select: none; touch-action: none; }
.s-chatwin.dragging .head { cursor: grabbing; }
.s-chatwin .grip { font-weight: 400; opacity: 0.75; font-size: 12px; }
.s-chatwin .msgs { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; overflow: auto; }
.s-chatwin .msg { background: var(--paper); padding: 8px 10px; border-radius: 6px; max-width: 90%; white-space: pre-line; line-height: 1.45; }
.s-chatwin .msg.thinking { background: linear-gradient(90deg, var(--muted) 0%, var(--muted) 35%, #c9d1cb 50%, var(--muted) 65%, var(--muted) 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer-text 1.6s linear infinite; padding-left: 0; }
.s-chatwin .msg.thinking::after { content: "…"; }
.s-chatwin .msg.thought { background: none; padding: 0 2px; font-size: 12px; color: var(--muted); }
.s-chatwin .msg.streaming::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; }
.s-chatwin .msg.me { align-self: flex-end; background: var(--ink); color: var(--paper); }
.s-chatwin .in { display: flex; border-top: 1px solid var(--line); }
.s-chatwin input { flex: 1; border: 0; padding: 10px 12px; font: inherit; }
.s-chatwin button { border: 0; background: transparent; padding: 0 12px; cursor: pointer; }

.s-backtop { position: fixed; z-index: 800; right: 90px; bottom: 24px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: white; box-shadow: 0 8px 20px rgba(0,0,0,0.15); cursor: pointer; font-size: 18px; animation: slop-in 220ms; }

/* content blocks */
.s-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.s-kpi { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; background: var(--paper); cursor: pointer; }
.s-kpi .v { font-family: var(--display); font-size: 26px; font-weight: 700; font-variation-settings: "wdth" 110; }
.s-kpi .l { font-size: 12px; color: var(--muted); }
.s-kpi .d { font-size: 12px; font-weight: 600; }
.s-kpi .d.up { color: var(--accent); }
.s-kpi .d.down { color: var(--error); }

.s-acc { border: 1px solid var(--line); border-radius: 4px; }
.s-acc > summary { padding: 10px 12px; cursor: pointer; font-weight: 500; list-style: none; display: flex; align-items: center; gap: 8px; }
.s-acc > summary::before { content: "▸"; font-size: 11px; color: var(--muted); }
.s-acc[open] > summary::before { content: "▾"; }
.s-acc > div { padding: 4px 12px 12px 28px; color: #2b3530; font-size: 14px; }
.s-acc .s-acc { margin-top: 8px; }

.s-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.s-tabs button { border: 0; background: transparent; padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; font-size: 14px; }
.s-tabs button.on { border-bottom-color: var(--accent); font-weight: 600; }

.s-skel { display: grid; gap: 8px; }
.s-skel i { display: block; height: 12px; border-radius: 3px; background: linear-gradient(90deg, var(--paper-2) 25%, #f7f8f6 50%, var(--paper-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.s-crumb { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); }
.s-crumb a { color: var(--accent); text-decoration: none; }
.s-crumb a:hover { text-decoration: underline; }

.s-wizard { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.s-wizard .step { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; font-family: var(--mono); }
.s-wizard .step.on { background: var(--accent); color: white; border-color: var(--accent); }
.s-wizard .bar { flex: 1; height: 2px; background: var(--line); }

.s-count { font-family: var(--mono); font-size: 22px; font-weight: 500; letter-spacing: 0.04em; }
.s-count small { display: block; font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

.s-logos { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; color: var(--muted); font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.s-logos span { opacity: 0.6; cursor: pointer; }
.s-logos span:hover { opacity: 1; }

.s-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.s-table th, .s-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.s-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.s-table td.ok { color: var(--accent); font-weight: 700; }

.s-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.s-tags .chip { padding: 3px 9px; font-size: 12.5px; border-radius: 999px; }

.s-prog { height: 8px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.s-prog i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 2s linear; }

.s-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.s-toggle i { width: 36px; height: 20px; border-radius: 999px; background: var(--line); position: relative; transition: background 150ms; }
.s-toggle i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: white; transition: transform 150ms; }
.s-toggle.on i { background: var(--accent); }
.s-toggle.on i::after { transform: translateX(16px); }

.s-share { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.s-rate { display: flex; gap: 2px; font-size: 20px; color: var(--warn); cursor: pointer; }
.s-react { display: flex; gap: 6px; }
.s-react button { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 3px 9px; font-size: 13px; cursor: pointer; }

.s-sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 700; width: 240px; background: white; border-right: 1px solid var(--line); padding: 70px 16px 16px; overflow: auto; box-shadow: 10px 0 40px rgba(0,0,0,0.08); animation: slide-in 220ms cubic-bezier(.2,.8,.2,1); font-size: 14px; }
@keyframes slide-in { from { transform: translateX(-100%); } }
.s-sidebar h5 { margin: 12px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.s-sidebar a { display: block; padding: 6px 8px; border-radius: 4px; text-decoration: none; }
.s-sidebar a:hover { background: var(--paper); }

.s-inline-help { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--muted); color: var(--muted); font-size: 10px; cursor: help; vertical-align: middle; margin-left: 4px; position: relative; }

.s-marquee { overflow: hidden; white-space: nowrap; font-family: var(--mono); font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 0; }
.s-marquee span { display: inline-block; padding-left: 100%; animation: marquee 18s linear infinite; }
@keyframes marquee { to { transform: translateX(-100%); } }

.s-ai-summary { border-left: 3px solid #5b4bd6; padding: 10px 14px; background: #f3f1fb; font-size: 14px; border-radius: 0 6px 6px 0; }
.s-ai-summary .l { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #5b4bd6; font-weight: 600; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }

.s-form { display: grid; gap: 8px; }
.s-form label { font-size: 12.5px; color: var(--muted); }
.s-form input, .s-form select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; font: inherit; width: 100%; background: white; }

.s-float-emoji { position: fixed; pointer-events: none; z-index: 1300; font-size: 22px; animation: float-up 1.4s ease-out forwards; }
@keyframes float-up { to { transform: translateY(-140px); opacity: 0; } }

.s-sticky-cta { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 820; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 8px 8px 0 0; display: flex; gap: 14px; align-items: center; font-size: 14px; box-shadow: 0 -10px 30px rgba(0,0,0,0.2); animation: slide-up 220ms; max-width: calc(100vw - 32px); }
@keyframes slide-up { from { transform: translate(-50%, 100%); } }
.s-sticky-cta .s-btn { background: var(--paper); color: var(--ink); border-color: var(--paper); }

/* ---------- terminal interruptions: questions, login, video ---------- */

.t-ask { border: 1px solid #3a3f46; border-radius: 6px; padding: 8px 12px; margin: 4px 0; }
.t-ask-q { color: var(--term-text); font-weight: 600; margin-bottom: 4px; }
.t-choice { pointer-events: auto; cursor: pointer; color: var(--term-dim); }
.t-choice .t-caret { visibility: hidden; color: var(--term-orange); }
.t-choice.on { color: var(--term-blue); }
.t-choice.on .t-caret { visibility: visible; }
.t-ask.done .t-choice { pointer-events: none; }
.t-ask-help { margin-top: 4px; font-size: 12px; }
.t-press { color: var(--term-yellow); }

.s-login { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100vw - 32px)); background: white; color: var(--ink); border-radius: 10px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,0.5); text-align: center; animation: fade-in 160ms; }
.s-login .x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 18px; cursor: pointer; }
.s-login .mark { font-size: 28px; color: var(--term-orange); }
.s-login h3 { margin: 6px 0; }
.s-login p { font-size: 13.5px; }
.s-login input { width: 100%; margin: 14px 0 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; box-sizing: border-box; }
.s-login .s-btn { width: 100%; }
.s-login .fine { font-size: 12px; color: var(--muted); margin-top: 10px; }

.s-pip .screen { cursor: pointer; }
.term-backdrop.with-video { grid-template-rows: auto auto; align-content: center; gap: 14px; }
.term-backdrop.with-video .term { height: min(320px, 40vh); }
.s-player { position: relative; width: min(960px, 100%); aspect-ratio: 16 / 9; max-height: 44vh; justify-self: center; background: #000; color: white; border-radius: 10px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,0.5); }
.s-player .frame { position: absolute; inset: 0; background: linear-gradient(120deg, #1d2b24, #3a2a1f, #1d2433); background-size: 300% 300%; animation: player-frame 6s ease-in-out infinite; }
@keyframes player-frame { 50% { background-position: 100% 100%; } }
.s-player .title { position: absolute; left: 16px; top: 12px; font-size: 14px; }
.s-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.s-player .note { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 14px; text-align: center; opacity: 0.85; }
.s-player .note code { font-family: var(--mono); }

/* ---------- guided tour ---------- */

.s-tour-block { position: fixed; inset: 0; z-index: 880; }
.s-tour-ring { position: fixed; z-index: 885; border-radius: 8px; box-shadow: 0 0 0 3px var(--accent), 0 0 0 100vmax rgba(17,26,21,0.5); pointer-events: none; transition: left 250ms, top 250ms, width 250ms, height 250ms; }
.s-tour { position: fixed; z-index: 890; width: min(340px, calc(100vw - 24px)); background: white; border-radius: 8px; padding: 16px 18px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); font-size: 14px; animation: slop-in 220ms; }
.s-tour h4 { margin: 4px 0 6px; font-size: 16px; }
.s-tour .added { margin-top: 8px; color: var(--accent); font-size: 12.5px; }
.s-tour .row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.s-tour .link { margin-right: auto; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; text-decoration: underline; cursor: pointer; }
.s-tour .dots { display: inline-flex; gap: 4px; margin-right: 4px; }
.s-tour .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.s-tour .dots i.on { background: var(--accent); }
.t-shell { color: var(--term-text); }
.t-input.done { color: var(--term-text); }
.term-backdrop.shell .term-live, .term-backdrop.shell .term-status { visibility: hidden; }

/* share flow — the card is broken on purpose, except the stats and the controls */
.s-share-flow { z-index: 1000; grid-template-columns: minmax(0, 1fr); justify-items: center; overflow-x: hidden; overflow-y: auto; }
.s-share-lead { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.s-share-scores { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; margin-top: 16px; }
.s-share-score { padding: 8px 0; justify-content: center; font-variant-numeric: tabular-nums; }
.s-share-ends { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); }
.s-share-card { width: min(640px, 100%); }
.s-share-kicker { margin-left: -64px; white-space: nowrap; font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); }
.s-share-title { width: 140%; margin: 6px 0 4px; white-space: nowrap; font-family: var(--display); font-variation-settings: "wdth" 125; font-size: clamp(40px, 7vw, 76px); font-weight: 800; letter-spacing: -0.03em; line-height: 0.95; }
.s-share-sub { height: 14px; white-space: nowrap; letter-spacing: 0.5em; font-size: 15px; }
.s-share-sticker { position: absolute; top: -18px; right: -70px; transform: rotate(14deg); padding: 6px 14px; background: var(--error); color: white; font-family: var(--mono); font-size: 13px; font-weight: 500; white-space: nowrap; box-shadow: 0 6px 16px rgba(0,0,0,0.25); }
.s-share-stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin: 28px 0 18px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.s-share-stats div { padding: 12px 14px; background: white; }
.s-share-stats dt { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.s-share-stats dd { margin: 4px 0 0; font-family: var(--display); font-size: 26px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.s-share-link { font-family: var(--mono); font-size: 13px; color: var(--accent); word-break: break-all; }
.s-share-embed { display: block; margin-top: 14px; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.s-share-embed textarea { display: block; width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font-family: var(--mono); font-size: 12px; text-transform: none; letter-spacing: 0; resize: none; }
.s-share-legal { height: 0; margin: 14px 0 0 40%; width: 90%; font-size: 12px !important; color: var(--muted) !important; }
.s-share-why { display: block; width: 100%; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; resize: vertical; }
