/* ============================================================
   Resonance - bare semantic similarity tool
   Single dark theme. No themes, no gauge, no flourish - just the
   two inputs, a compare button, and a number.
   ============================================================ */
:root {
  --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', monospace;

  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --bg: #0c0c0e;
  --surface-1: #161618; /* card */
  --surface-2: #1d1d20; /* raised */
  --inset: #121214; /* input field */
  --inset-focus: #101016;

  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.16);
  --hover: rgba(255, 255, 255, 0.04);

  --text: #f1f1f3;
  --text-dim: #a6a6ae;
  --text-faint: #6c6c76;

  /* One restrained accent - a clean azure. */
  --accent: #5b8cff;
  --accent-hover: #75a0ff;
  --accent-ink: #06080f;
  --accent-soft: rgba(91, 140, 255, 0.16);

  --score: #5b8cff;

  --shadow-card: 0 10px 30px -16px rgba(0, 0, 0, 0.7), 0 40px 80px -50px rgba(0, 0, 0, 0.95);
  --shadow-pop: 0 4px 12px -4px rgba(0, 0, 0, 0.6);
}

/* ---------- Theme: Light (crisp neutral high-key) ---------- */
/* Dark stays the default (the bare :root above). This light variant is applied
   when the user toggles to it, or when the OS prefers light - both resolved to
   an explicit [data-theme] before first paint by the inline guard in index.html.
   Pure-white surfaces on a clean cool-neutral ground, near-black ink, and the
   same brand azure tuned a touch deeper so it holds contrast on white. */
[data-theme='light'] {
  --bg: #f3f4f6;
  --surface-1: #ffffff;
  --surface-2: #fafbfc;
  --inset: #ffffff;
  --inset-focus: #ffffff;

  --line: rgba(17, 24, 39, 0.1);
  --line-strong: rgba(17, 24, 39, 0.18);
  --hover: rgba(17, 24, 39, 0.04);

  --text: #111827; /* near-black ink */
  --text-dim: #4b5563;
  --text-faint: #9ca3af;

  --accent: #2f6bed;
  --accent-hover: #2559cc;
  --accent-ink: #ffffff;
  --accent-soft: rgba(47, 107, 237, 0.12);

  --score: #2f6bed;

  --shadow-card: 0 1px 2px rgba(17, 24, 39, 0.05), 0 16px 36px -20px rgba(17, 24, 39, 0.22);
  --shadow-pop: 0 4px 14px -6px rgba(17, 24, 39, 0.18);
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
html,
body {
  background: var(--bg);
}
body {
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01' 1, 'cv01' 1;
  overflow-x: hidden;
}
/* Smooth the ground/ink swap when toggling between themes. */
html,
body {
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

.hidden,
[hidden] {
  display: none !important;
}

/* Visually hidden but available to assistive tech. */
.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;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0;
}

/* ---------- Brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.brand-mark svg {
  width: 17px;
  height: 17px;
}
.brand-name {
  font-weight: 600;
  font-size: 16.5px;
  letter-spacing: -0.02em;
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 500;
  letter-spacing: -0.01em;
  border: none;
  border-radius: var(--r-md);
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  background: transparent;
  transition: transform 0.12s var(--ease), background 0.18s, box-shadow 0.18s, color 0.18s, opacity 0.18s;
  white-space: nowrap;
}
.btn:active {
  transform: translateY(0.5px) scale(0.992);
}
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.btn svg {
  width: 15px;
  height: 15px;
}
.btn-block {
  width: 100%;
}
.btn-sm {
  padding: 7px 12px;
  font-size: 13.5px;
}
.btn-lg {
  padding: 13px 28px;
  font-size: 15px;
  font-weight: 600;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: var(--shadow-pop);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}
.btn-primary:disabled {
  background: var(--accent-soft);
  color: var(--text-faint);
  box-shadow: inset 0 0 0 1px var(--line);
  opacity: 1;
}
.btn-ghost {
  color: var(--text-dim);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn-ghost:hover {
  color: var(--text);
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-dim);
  background: transparent;
  border: none;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}
.theme-toggle:hover {
  color: var(--text);
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.theme-toggle svg {
  width: 17px;
  height: 17px;
}
/* Show the icon for the theme a click switches *to*: a sun while dark, a moon
   while light. */
.theme-toggle .icon-moon {
  display: none;
}
.theme-toggle .icon-sun {
  display: block;
}
[data-theme='light'] .theme-toggle .icon-sun {
  display: none;
}
[data-theme='light'] .theme-toggle .icon-moon {
  display: block;
}

.link {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.link:hover {
  color: var(--accent-hover);
}

.kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 9px;
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  background: var(--hover);
  line-height: 1;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
}

/* ---------- Spinner ---------- */
.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent-ink) 35%, transparent);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
}
.btn-ghost .spinner {
  border-color: var(--line);
  border-top-color: var(--accent);
}
.spinner.big {
  width: 28px;
  height: 28px;
  border-width: 3px;
  border-color: var(--line);
  border-top-color: var(--accent);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Focus ---------- */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  border-radius: var(--r-sm);
}

/* ---------- Boot ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--bg);
}

/* ---------- Inputs ---------- */
input,
textarea {
  width: 100%;
  background: var(--inset);
  color: var(--text);
  font: inherit;
  border: none;
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  transition: box-shadow 0.16s, background 0.16s;
}
input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}
input:focus,
textarea:focus {
  outline: none;
  background: var(--inset-focus);
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft);
}
/* The faint accent-soft halo reads weakly on a light ground - give the input and
   pane focus a slightly stronger ring there. */
[data-theme='light'] input:focus,
[data-theme='light'] textarea:focus,
[data-theme='light'] .pane:focus-within {
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* ---------- Auth ---------- */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 408px;
  background: var(--surface-1);
  border-radius: var(--r-lg);
  padding: 30px;
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-card);
}
.auth-card .brand {
  margin-bottom: 26px;
}
.auth-card .theme-toggle {
  position: absolute;
  top: 22px;
  right: 22px;
}
.auth-head {
  margin-bottom: 22px;
}
.auth-title {
  font-weight: 600;
  font-size: 27px;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 7px;
}
.auth-sub {
  color: var(--text-dim);
  margin: 0;
  font-size: 14.5px;
}

.field {
  display: block;
  margin-bottom: 14px;
}
.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 7px;
  font-weight: 450;
}
.input-wrap {
  position: relative;
}
.input-wrap input {
  padding-right: 44px;
}
.reveal {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.reveal:hover {
  color: var(--text-dim);
  background: var(--hover);
}
.reveal svg {
  width: 17px;
  height: 17px;
}
.reveal .eye-off {
  display: none;
}
.reveal[aria-pressed='true'] .eye {
  display: none;
}
.reveal[aria-pressed='true'] .eye-off {
  display: block;
}

.form-error {
  color: #e5484d;
  font-size: 13px;
  margin: 2px 0 12px;
}
.form-error.center {
  text-align: center;
  margin: 14px 0 0;
}
#auth-submit {
  margin-top: 6px;
}
/* Federated sign-in sits above the form: one outlined button, the same weight
   as the rest of the card. The brand colour lives in the mark only - the
   button itself stays on the app's surface so it doesn't outshout the primary
   action below it. */
.btn-oauth {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 11px 16px;
}
.btn-oauth:hover:not(:disabled) {
  background: var(--surface-1);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.btn-oauth .oauth-mark {
  width: 17px;
  height: 17px;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-dim);
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.auth-toggle {
  text-align: center;
  margin: 20px 0 0;
  color: var(--text-dim);
  font-size: 14px;
}

/* ============================================================
   App shell
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 24px;
}
.account {
  display: flex;
  align-items: center;
  gap: 10px;
}
.who {
  color: var(--text-dim);
  font-size: 13.5px;
  margin-right: 4px;
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stage {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(16px, 5vh, 44px) 24px 64px;
}

/* ---------- Intro (compact, left-aligned - it's a tool, not a landing page) ---------- */
.intro {
  margin: 0 0 22px;
}
.intro h1 {
  font-weight: 600;
  font-size: clamp(26px, 3.6vw, 34px);
  letter-spacing: -0.032em;
  line-height: 1.06;
  margin: 0 0 9px;
}
.lede {
  color: var(--text-dim);
  max-width: 56ch;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- Console: two input fields side by side ---------- */
.console {
  display: grid;
  gap: 16px;
}
.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}
.pane {
  position: relative;
  padding: 14px 14px 30px;
  background: var(--inset);
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.18s, background 0.18s;
}
.pane:focus-within {
  background: var(--inset-focus);
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft);
}
.pane.over {
  box-shadow: inset 0 0 0 1px rgba(229, 72, 77, 0.6);
}
.pane-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  height: 16px;
}
.pane-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  transition: color 0.18s;
}
.pane:focus-within .pane-label {
  color: var(--accent);
}
.pane.over .pane-label {
  color: #e5484d;
}
.pane-clear {
  background: none;
  border: none;
  color: var(--text-faint);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.pane-clear:hover {
  color: var(--text);
}
.console textarea {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  min-height: 168px;
  resize: none;
  line-height: 1.6;
  font-size: 15px;
  letter-spacing: -0.004em;
}
.console textarea:focus {
  background: transparent;
  box-shadow: none;
}
.count {
  position: absolute;
  right: 14px;
  bottom: 11px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0.8;
  transition: color 0.16s, opacity 0.16s;
}
.count.zero {
  opacity: 0.4;
}
.count.warn {
  color: #d98a2b;
  opacity: 1;
}
.count.over {
  color: #e5484d;
  opacity: 1;
}

/* action bar */
.actions {
  display: flex;
  align-items: center;
  gap: 11px;
}

/* ============================================================
   Result - just a number, a label, and the raw cosine
   ============================================================ */
.result {
  position: relative;
  margin-top: 30px;
  padding: 36px 30px 32px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}
.result.is-loading,
.result.is-empty {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
}

.result-score {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-mono);
  line-height: 1;
}
.result-num {
  font-size: clamp(64px, 12vw, 84px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  color: var(--score);
}
.is-loading .result-num,
.is-empty .result-num {
  color: var(--text-faint);
  letter-spacing: 0;
}
.result-unit {
  font-size: clamp(26px, 5vw, 32px);
  font-weight: 500;
  color: var(--text-faint);
  margin-left: 4px;
}
.is-empty .result-unit {
  opacity: 0;
}
.result-label {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 10px;
  color: var(--text);
}
.is-empty .result-label,
.is-loading .result-label {
  color: var(--text-dim);
}
.is-loading .result-label {
  animation: pulse 1.2s var(--ease) infinite;
}
.result-cosine {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 8px;
  letter-spacing: 0.02em;
}
.result-cosine span {
  color: var(--text-dim);
}
@keyframes pulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.75;
  }
}

/* Copy-result affordance: quiet, in the card's top-right corner. */
.result-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 6px;
}
.result-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-faint);
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}
.result-copy svg {
  width: 14px;
  height: 14px;
}
.result-copy:hover {
  color: var(--text);
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.result-copy.copied {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}
@media (max-width: 520px) {
  .result-copy-label {
    display: none;
  }
  .result-copy {
    padding: 7px;
  }
}

/* History button + count badge */
#history-btn {
  position: relative;
  overflow: visible;
}
.count-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  line-height: 1;
  box-shadow: 0 0 0 2px var(--bg);
  z-index: 1;
}

/* ============================================================
   History drawer
   ============================================================ */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 5, 8, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.drawer-scrim.open {
  opacity: 1;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 41;
  width: min(440px, 92vw);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  box-shadow: inset 1px 0 0 var(--line);
  transform: translateX(100%);
  transition: transform 0.36s var(--ease), box-shadow 0.36s var(--ease);
  will-change: transform;
}
.drawer.open {
  transform: translateX(0);
  box-shadow: inset 1px 0 0 var(--line), -30px 0 80px -40px rgba(0, 0, 0, 0.6);
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-head .eyebrow {
  margin-bottom: 9px;
}
.drawer-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}
.icon-btn {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-dim);
  background: transparent;
  border: none;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}
.icon-btn svg {
  width: 16px;
  height: 16px;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.drawer-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.link.danger {
  color: var(--text-faint);
}
.link.danger:hover {
  color: #e5484d;
}
.link.danger.armed {
  color: #e5484d;
  font-weight: 600;
}

/* history entries */
.hist-empty {
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
  padding: 60px 30px;
  line-height: 1.6;
}
.hist-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  transition: background 0.14s;
}
.hist-row:hover {
  background: var(--hover);
}
.hist {
  min-width: 0;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 8px 14px 24px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text);
}
.hist-score {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  text-align: right;
}
.hist-score small {
  font-size: 11px;
  opacity: 0.6;
  margin-left: 1px;
}
.hist-texts {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hist-a,
.hist-b {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  line-height: 1.45;
}
.hist-a {
  color: var(--text);
}
.hist-b {
  color: var(--text-faint);
}
.hist-time {
  justify-self: end;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  white-space: nowrap;
}
.hist-del {
  width: 44px;
  align-self: stretch;
  display: grid;
  place-items: center;
  border: none;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.14s, color 0.14s;
}
.hist-row:hover .hist-del {
  opacity: 1;
}
.hist-del svg {
  width: 15px;
  height: 15px;
}
.hist-del:hover,
.hist-del:focus-visible {
  color: #e5484d;
  opacity: 1;
}

/* ---------- Explainer / FAQ (crawlable content below the tool) ---------- */
.explainer {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  max-width: 62ch;
  color: var(--text-dim);
}
.explainer-disclosure summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
  user-select: none;
}
.explainer-disclosure summary::-webkit-details-marker {
  display: none;
}
.explainer-disclosure summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
  flex: none;
}
.explainer-disclosure[open] summary::before {
  transform: rotate(45deg);
}
.explainer-disclosure summary:hover {
  color: var(--text);
}
.explainer-body {
  margin-top: 18px;
}
.explainer h2 {
  color: var(--text);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
  margin: 26px 0 8px;
}
.explainer-body > p:first-child,
.explainer h2:first-child {
  margin-top: 0;
}
.explainer p {
  margin: 0 0 12px;
  font-size: 14.5px;
  line-height: 1.6;
}
.explainer strong {
  color: var(--text);
  font-weight: 600;
}
.explainer code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
}
.faq {
  margin: 0;
}
.faq dt {
  color: var(--text);
  font-weight: 550;
  font-size: 14.5px;
  margin-top: 16px;
}
.faq dd {
  margin: 4px 0 0;
  font-size: 14.5px;
  line-height: 1.6;
}

.foot {
  text-align: center;
  margin-top: 26px;
  color: var(--text-faint);
  font-size: 12.5px;
}
.foot code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 680px) {
  .panes {
    grid-template-columns: 1fr;
  }
  .actions {
    flex-direction: column;
    align-items: stretch;
  }
  .actions .btn-lg {
    width: 100%;
  }
  .kbd {
    display: none;
  }
}

@media (max-width: 520px) {
  .who {
    display: none;
  }
  #history-btn span:not(.count-badge) {
    display: none;
  }
  .topbar {
    padding: 16px 18px;
  }
  .topbar .brand-name {
    display: none;
  }
  .stage {
    padding: 16px 18px 56px;
  }
  .console textarea {
    min-height: 128px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   tryai: tabs, and the Try Jev tool
   ============================================================ */
/* Segmented control, shared by the tool tabs and the question-type picker. */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r-md);
  background: var(--inset);
  box-shadow: inset 0 0 0 1px var(--line);
}
.seg-item {
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: calc(var(--r-md) - 3px);
  padding: 7px 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}
.seg-item:hover {
  color: var(--text);
}
.seg-item.active {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 0 0 1px var(--line-strong);
}
[data-theme='light'] .seg-item.active {
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08), inset 0 0 0 1px var(--line);
}
.seg-sm .seg-item {
  font-size: 12px;
  padding: 5px 10px;
}
.tabs {
  margin: 0 0 26px;
}
.tabs .seg-item {
  padding: 8px 18px;
}

/* ---------- Jev console ---------- */
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}
.chip:hover {
  color: var(--text);
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.chip.active {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.pane-hint {
  text-transform: none;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-left: 8px;
}
.jev-console textarea {
  min-height: 120px;
  font-family: var(--font-sans);
}
.jev-console .pane.over {
  box-shadow: inset 0 0 0 1px rgba(229, 72, 77, 0.6);
}

/* Question type picker: three tiles, one selected */
.jev-types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.jtype {
  font: inherit;
  text-align: left;
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  background: var(--surface-1);
  border: none;
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}
.jtype:hover {
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.jtype[aria-selected='true'] {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.jtype-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.jtype[aria-selected='true'] .jtype-name {
  color: var(--accent);
}
.jtype-blurb {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-dim);
}
@media (max-width: 560px) {
  .jev-types {
    grid-template-columns: 1fr;
  }
}

/* Step labels between the blocks: scenarios, 1 state, 2 question */
.jev-step {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 6px;
}
.step-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}
.step-num {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  letter-spacing: 0;
}
.step-hint {
  font-size: 12.5px;
  color: var(--text-faint);
}
.jev-state-pane {
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.jev-kind {
  margin-left: 0;
}

/* The one question: instructions up top, then the criteria in their own
   inset box so the options read as the answers, not as more state. */
.qcard {
  padding: 12px;
  background: var(--surface-1);
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px var(--line);
  display: grid;
  gap: 12px;
}
.qhead {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}
.qid-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.qid-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.qid,
.crit-name {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0;
}
.qid {
  width: 150px;
}
.qcard input {
  padding: 8px 11px;
  font-size: 14px;
}
.qinstr {
  font-size: 15px;
  font-weight: 500;
}
.critbox {
  padding: 10px 12px 12px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface-2));
  box-shadow: inset 0 0 0 1px var(--line);
  border-left: 3px solid var(--accent);
  display: grid;
  gap: 8px;
}
.critbox-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.critbox-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.critbox-hint {
  font-size: 12px;
  color: var(--text-faint);
}
.crit {
  display: grid;
  gap: 6px;
}
.crit-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}
.crit-choice .crit-row {
  grid-template-columns: minmax(90px, 150px) 1fr auto;
}
.crit-noul .crit-row {
  grid-template-columns: 34px 1fr;
}
.crit-key {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  min-width: 22px;
  text-align: right;
}
.crit-choice .crit-name {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.crit-del {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.crit-del:hover:not(:disabled) {
  color: #e5484d;
  background: var(--hover);
}
.crit-del:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}
.crit-add {
  justify-self: start;
  font-size: 12.5px;
  padding: 2px 0 0 4px;
}
.crit-add:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
}
.actions-note {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

/* Pool notice + bring-your-own key */
.notice {
  margin-top: 22px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.notice-title {
  margin: 0 0 6px;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.notice-body {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.55;
}
.byo {
  margin-top: 14px;
  color: var(--text-dim);
}
.byo summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
  user-select: none;
}
.byo summary::-webkit-details-marker {
  display: none;
}
.byo summary::before {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
}
.byo[open] summary::before {
  transform: rotate(45deg);
}
.byo summary:hover {
  color: var(--text);
}
.byo-body {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
.byo-body input {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0;
}
.byo-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-faint);
}
.byo-hint code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
}

/* ---------- Jev results ---------- */
.jev-results {
  margin-top: 30px;
  display: grid;
  gap: 14px;
}
.answers {
  display: grid;
  gap: 12px;
}
.answer {
  padding: 20px 22px 18px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-card);
  display: grid;
  gap: 12px;
}
.is-loading .answer {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
}
.answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.answer-id {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.answer-type {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.answer-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--text-dim);
}
.is-loading .answer-main {
  animation: pulse 1.2s var(--ease) infinite;
  font-size: 15px;
}
.answer-value {
  font-family: var(--font-mono);
  font-size: clamp(30px, 5vw, 40px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--score);
  font-variant-numeric: tabular-nums;
}
.answer-value small {
  font-size: 0.5em;
  color: var(--text-faint);
  letter-spacing: 0;
}
.answer-sub {
  font-size: 14px;
}
.bars {
  display: grid;
  gap: 7px;
}
.bar {
  display: grid;
  grid-template-columns: minmax(70px, 34%) 1fr 44px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-dim);
}
.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
}
.bar-label em {
  font-style: normal;
  font-family: var(--font-sans);
  font-size: 12.5px;
  margin-left: 6px;
  color: var(--text-faint);
}
.bar.strong .bar-label,
.bar.strong .bar-pct {
  color: var(--text);
}
.bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: width 0.6s var(--ease);
}
.bar.strong .bar-fill {
  background: var(--accent);
}
.bar-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.jev-cost {
  margin: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

/* "The request we sent" */
.request {
  color: var(--text-dim);
}
.request summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  user-select: none;
}
.request summary::-webkit-details-marker {
  display: none;
}
.request summary::before {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
  flex: none;
}
.request[open] summary::before {
  transform: rotate(45deg);
}
.request-model {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-faint);
}
.code-block {
  margin-top: 12px;
  border-radius: var(--r-md);
  background: var(--inset);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
}
.code-block pre {
  margin: 0;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}

@media (max-width: 680px) {
  .jev-kbd {
    display: none;
  }
  .actions-note {
    margin-left: 0;
    text-align: center;
  }
  .qhead {
    grid-template-columns: 1fr;
  }
  .qid {
    width: 100%;
  }
  .qid-wrap {
    display: grid;
    grid-template-columns: auto 1fr;
  }
  .crit-choice .crit-row {
    grid-template-columns: 1fr auto;
  }
  .crit-choice .crit-row input:not(.crit-name) {
    grid-column: 1 / -1;
  }
  .bar {
    grid-template-columns: minmax(60px, 40%) 1fr 40px;
  }
}
