/* ============================================================
   ThomAlysis — Minimal premium design system.
   EDGE · CeMESS · Universität Wien
   ============================================================ */

:root {
  /* Surface */
  --bg:       #ffffff;
  --bg-soft:  #fafafb;
  --bg-cool:  #f6f7f9;
  --surface:  #ffffff;

  /* Ink — high-contrast typographic hierarchy */
  --ink:    #0a0c10;
  --ink-2:  #3a4150;
  --ink-3:  #6b7280;
  --ink-4:  #a0a6b4;

  /* Hairlines */
  --line:        #ececef;
  --line-strong: #d8dae0;

  /* Brand — UniVie blue, refined */
  --brand:        #0063A6;
  --brand-deep:   #00467a;
  --brand-ink:    #002b4a;
  --brand-tint:   #eef4fa;
  --brand-tint-2: #dde9f4;

  /* Data palette (used by Chart.js) */
  --c-data:    #0b1220;
  --c-fit:     #0063A6;
  --c-band:    rgba(0, 99, 166, 0.10);
  --c-accent:  #14a37f;
  --c-warm:    #d97706;
  --c-cool:    #6366f1;

  /* Status */
  --ok:   #14a37f;
  --warn: #d97706;
  --err:  #c1392f;

  /* Type */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Geometry */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

::selection { background: var(--brand-tint-2); color: var(--brand-ink); }

a { color: inherit; text-decoration: none; }
code { font-family: var(--font-mono); font-size: 0.92em; }
input, select, button { font-family: inherit; }
h1, h2, h3, h4, h5 { margin: 0; letter-spacing: -0.02em; color: var(--ink); }

/* ============================================================
   NAV — refined dark / blackish (UniVie blue used only as accent)
   ============================================================ */
.nav-wrap {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(10, 12, 18, 0.86);              /* near-black with mild translucency */
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.nav-wrap.scrolled {
  background: rgba(8, 10, 16, 0.94);
  border-bottom-color: rgba(255, 255, 255, 0.10);
  box-shadow: 0 1px 14px -6px rgba(0, 0, 0, 0.35);
}
.nav-wrap .brand { color: white; }
.nav-wrap .brand-dot {
  background: var(--brand); color: white;
  font-weight: 700;
}
.nav-wrap .brand-dot::after { border-color: rgba(255, 255, 255, 0.16); }
.nav-wrap .brand-text small { color: rgba(255, 255, 255, 0.58); }
.nav-wrap .nav-links a {
  color: rgba(255, 255, 255, 0.78);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.nav-wrap .nav-links a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.06);
}
.nav-wrap .nav-links .btn-primary {
  background: white; color: var(--inkblack);
  border-color: transparent;
}
.nav-wrap .nav-links .btn-primary:hover:not(:disabled) {
  background: #f1f1f3; color: var(--inkblack);
}
.nav-wrap .nav-links .btn-primary svg { color: var(--inkblack); }
.nav {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px;
  height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: 11px;
  font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink);
}
.brand-dot {
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 13px;
  letter-spacing: 0;
  position: relative;
}
.brand-dot::after {
  content: "";
  position: absolute; inset: -2px;
  border-radius: 9px;
  border: 1px solid var(--line);
}
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: var(--r-sm);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.nav-links a:hover { color: var(--ink); background: var(--bg-cool); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  height: 38px; padding: 0 16px;
  font-size: 14px; font-weight: 500;
  border-radius: var(--r-sm); border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
              color 0.15s var(--ease), transform 0.05s var(--ease),
              box-shadow 0.15s var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; stroke-width: 2; }

.btn-primary {
  background: var(--ink); color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}
.btn-primary:hover:not(:disabled) { background: #1d2330; }

.btn-secondary {
  background: var(--surface); color: var(--ink);
  border-color: var(--line-strong);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--ink-3); background: var(--bg-soft); }

.btn-ghost {
  background: transparent; color: var(--ink-2);
}
.btn-ghost:hover:not(:disabled) { color: var(--ink); background: var(--bg-cool); }

.btn-block { width: 100%; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; }

/* ===========================================================================
   LANDING PAGE — Cinematic editorial.
   ---------------------------------------------------------------------------
   New palette (psychology):

   • Hero "ink black"  #08090c → premium drama, focus, no distractions
   • Cream surface     #f5f1e8 → paper-like warmth, editorial gravitas
   • Pure white        #ffffff → calm structural breaks
   • Ocean blue        #0063A6 → trust + scientific authority (UniVie)
   • Champagne accent  #d4b85a → singular warm moment, used once or twice
   • Soft cyan         #6dabd6 → highlight on dark, like fluorescent paint

   Rhythm: dark hero → cream → dark method → cream workflow → dark team → cream cite.
   Alternation creates cinematic pacing without overwhelming.
   ========================================================================= */
.landing-surface {
  background: #f5f1e8;
  color: var(--ink);
  --cream: #f5f1e8;
  --cream-2: #ece6d6;
  --inkblack: #08090c;
  --champagne: #d4b85a;
  --cyan: #6dabd6;
}

/* ---------- Scroll progress (Apple's tiny rail at top) ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; z-index: 60;
  background: transparent; pointer-events: none;
}
.scroll-progress > .bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--brand-deep));
  transition: width 0.05s linear;
}

/* ---------- HERO — vertical 3-zone composition ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  background: var(--inkblack);
  color: white;
  overflow: hidden;
  padding: 110px 0 70px;
  display: flex; align-items: stretch;
  isolation: isolate;
}
/* Cursor-following spotlight (subtle, premium) */
.hero::before {
  content: "";
  position: absolute; inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    520px 360px at var(--mx, 50%) var(--my, 40%),
    rgba(109, 171, 214, 0.18),
    transparent 65%
  );
  transition: opacity 0.4s var(--ease);
}
/* Faint vignette to push focus to centre */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 100%, rgba(0,0,0,0.6), transparent 60%);
}

/* (.hero-bg replaced by .hero-curve which lives inline in the 3-zone layout) */

.hero-inner {
  position: relative; z-index: 2;
  max-width: 1180px; margin: 0 auto; width: 100%;
  padding: 0 32px;
  display: flex; flex-direction: column;
  align-items: center;
  gap: 26px;
  text-align: center;
}
.hero-top { display: flex; flex-direction: column; align-items: center; gap: 18px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 12px; color: rgba(255, 255, 255, 0.82); font-weight: 500;
  margin-bottom: 36px;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(109, 171, 214, 0.22);
}
.eyebrow .pipe { color: rgba(255, 255, 255, 0.32); }

.display {
  font-family: "Source Serif Pro", "Iowan Old Style", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.display em { font-style: italic; color: var(--cyan); font-weight: 500; }
.display .pale { color: rgba(0,0,0,0.45); font-weight: 400; font-style: italic; }

/* Brand name — primary hero typography */
.hero-brand {
  font-family: "Source Serif Pro", "Iowan Old Style", Georgia, serif;
  font-size: clamp(52px, 8.4vw, 126px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  color: white;
  margin: 0;
  opacity: 0;
  transform: translateY(20px);
  animation: heroWord 0.9s var(--ease) 0.15s forwards;
}
/* Tagline — italic accent below the brand */
.hero-tagline {
  font-family: "Source Serif Pro", serif;
  font-size: clamp(18px, 1.8vw, 26px);
  font-weight: 400;
  font-style: italic;
  color: rgba(255, 255, 255, 0.62);
  letter-spacing: -0.005em;
  margin: 0;
  opacity: 0;
  animation: heroFade 0.9s var(--ease) 0.5s forwards;
}
.hero-tagline em { color: var(--cyan); font-style: italic; }

/* Curve viz — middle zone */
.hero-curve {
  position: relative;
  width: 100%;
  max-width: 1180px;
  height: clamp(220px, 30vh, 320px);
  margin: 6px auto 4px;
  opacity: 0;
  animation: heroFade 1.0s var(--ease) 0.7s forwards;
}
.hero-curve canvas { width: 100%; height: 100%; display: block; }

/* Curve overlay annotations — float over the canvas */
.curve-anno {
  position: absolute;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.62);
  font-family: var(--font-mono);
  pointer-events: none;
}
.curve-anno b { color: rgba(255, 255, 255, 0.92); font-weight: 500; }
.curve-anno.c0 { top: 14px; right: 14px; }
.curve-anno.tb { bottom: 20px; left: 18px; }
.curve-anno .pill {
  display: inline-block;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 3px 10px;
}

/* Hero CTAs below the curve */
.hero-actions {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  opacity: 0;
  animation: heroFade 0.9s var(--ease) 0.95s forwards;
}
.hero h1.display .reveal-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(28px);
  filter: blur(8px);
  animation: heroWord 0.9s var(--ease) forwards;
}
.hero h1.display .reveal-word:nth-child(1) { animation-delay: 0.15s; }
.hero h1.display .reveal-word:nth-child(2) { animation-delay: 0.30s; }
.hero h1.display .reveal-word:nth-child(3) { animation-delay: 0.55s; }
@keyframes heroWord {
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.hero h1.display em {
  position: relative;
  text-shadow: 0 0 60px rgba(109, 171, 214, 0.4);
}

.hero-sub {
  font-size: clamp(15px, 1.2vw, 17.5px);
  color: rgba(255, 255, 255, 0.62);
  max-width: 460px;
  margin: 0 0 44px;
  line-height: 1.6;
  opacity: 0;
  animation: heroFade 0.9s var(--ease) 0.75s forwards;
}
@keyframes heroFade { to { opacity: 1; } }

.hero-ctas {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  opacity: 0;
  animation: heroFade 0.9s var(--ease) 0.9s forwards;
}
/* Dark-mode buttons in hero */
.hero .btn-primary {
  background: white; color: var(--inkblack);
  box-shadow: 0 1px 0 rgba(0,0,0,0.05) inset, 0 12px 40px -12px rgba(109,171,214,0.4);
}
.hero .btn-primary:hover:not(:disabled) { background: #f0f0f0; color: var(--inkblack); }
.hero .btn-secondary {
  background: rgba(255,255,255,0.04); color: white;
  border-color: rgba(255,255,255,0.16);
}
.hero .btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.32); color: white;
}

/* Hero scroll cue */
.scroll-cue {
  position: absolute; left: 50%; bottom: 32px;
  transform: translateX(-50%);
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4); font-weight: 600;
  display: inline-flex; flex-direction: column; align-items: center; gap: 10px;
  opacity: 0;
  animation: heroFade 0.9s var(--ease) 1.4s forwards;
  z-index: 3;
}
.scroll-cue::after {
  content: ""; width: 1px; height: 32px;
  background: linear-gradient(180deg, rgba(255,255,255,0.5), transparent);
  animation: scrollDown 1.8s ease-in-out infinite;
}
@keyframes scrollDown {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 0.2; }
  50%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
  100% { transform: scaleY(1); transform-origin: bottom; opacity: 0; }
}

/* (hero-corner was removed per design feedback) */

/* ---------- Section primitives ---------- */
.section {
  padding: 140px 32px;
  position: relative;
  background: var(--cream);
}
.section-inner {
  max-width: 1180px; margin: 0 auto;
  position: relative;
}
.section.white { background: white; }
.section.alt { background: var(--cream); }
.section.dark {
  background: var(--inkblack);
  color: rgba(255, 255, 255, 0.92);
}
.section.dark .section-eyebrow { color: rgba(255, 255, 255, 0.55); }
.section.dark .display { color: white; }
.section.dark .display em { color: #6dabd6; }
.section.dark p { color: rgba(255, 255, 255, 0.75); }
.section.dark .lead { color: rgba(255, 255, 255, 0.85); }
.section.dark .hairline { border-color: rgba(255, 255, 255, 0.12); }

.section-eyebrow {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--ink-3); font-weight: 600;
  margin-bottom: 18px;
}
.section h2.display {
  font-size: clamp(34px, 4.5vw, 56px);
  line-height: 1.06;
  margin: 0 0 22px;
  max-width: 760px;
}
.section .lead {
  font-size: clamp(16px, 1.15vw, 18px);
  color: var(--ink-2);
  max-width: 640px;
  line-height: 1.65;
  margin: 0 0 28px;
}
.section p { color: var(--ink-2); font-size: 15.5px; line-height: 1.65; }
.section p + p { margin-top: 14px; }

/* Section reveal animation (driven by IntersectionObserver) */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal.delay-1 { transition-delay: 0.06s; }
.reveal.delay-2 { transition-delay: 0.12s; }
.reveal.delay-3 { transition-delay: 0.18s; }
.reveal.delay-4 { transition-delay: 0.24s; }

/* Word-by-word reveal for section headlines — cinematic scroll feel */
.word-reveal {
  display: inline-block;
  opacity: 0;
  transform: translateY(24px) rotate(-1.2deg);
  filter: blur(6px);
  transition:
    opacity 0.65s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.65s cubic-bezier(0.22, 0.61, 0.36, 1),
    filter 0.65s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.word-reveal.in {
  opacity: 1;
  transform: translateY(0) rotate(0);
  filter: blur(0);
}

/* ---------- The Challenge ---------- */
.challenge-grid {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 80px;
  align-items: center;
}
.bignum {
  font-family: var(--font-display);
  font-size: clamp(80px, 11vw, 150px);
  letter-spacing: -0.05em;
  line-height: 0.92;
  font-weight: 600;
  color: var(--brand-deep);
  display: block;
  font-variant-numeric: tabular-nums;
}
.bignum-cap {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-3); font-weight: 600;
  margin-bottom: 12px;
}

/* ---------- The Method ---------- */
.eq-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  padding: 32px 36px;
  margin-top: 28px;
}
.eq-card .eq {
  font-family: var(--font-mono);
  font-size: clamp(15px, 1.4vw, 19px);
  color: white;
  line-height: 1.85;
  letter-spacing: -0.005em;
}
.eq-card .eq em { color: #6dabd6; font-style: normal; font-weight: 500; }
.eq-card .eq .neutral { color: rgba(255, 255, 255, 0.55); }
.eq-card .eq-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.5); font-weight: 600;
  margin-bottom: 8px;
}
.eq-card .eq-block + .eq-block { margin-top: 24px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.10); }

/* === Single-row equation layout (.eq-card.eq-card-row) === */
.eq-card.eq-card-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 30px 0;
  margin-top: 0;
}
.eq-card.eq-card-row .eq-block {
  padding: 4px 28px;
  min-width: 0;            /* allow grid items to shrink */
}
.eq-card.eq-card-row .eq-block + .eq-block {
  margin-top: 0;
  padding-top: 4px;
  border-top: none;
  border-left: 1px solid rgba(255,255,255,0.10);
}
.eq-card.eq-card-row .eq-label {
  margin-bottom: 14px;
  font-size: 10.5px;
}
.eq-card.eq-card-row .math-display {
  font-size: 14.5px;     /* shrinks KaTeX uniformly */
  overflow-x: auto;
  /* hide the scrollbar visually while keeping it functional */
  scrollbar-width: none;
}
.eq-card.eq-card-row .math-display::-webkit-scrollbar { display: none; }

.method-row { margin-top: 12px; }

/* Symbol-key — clean 3 × 2 aligned table inside a soft frame */
.symbol-key-wrap {
  margin-top: 28px;
  padding: 22px 30px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
}
.symbol-key-label {
  font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 600;
  margin-bottom: 14px;
  display: block;
}
.symbol-key-inline {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 24px;
  row-gap: 16px;
  justify-items: center;        /* center each cell horizontally */
}
.symbol-key-inline li {
  display: inline-flex;          /* item shrinks to content, centered in cell */
  align-items: baseline;
  gap: 12px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.78);
}
.symbol-key-inline b {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: -0.005em;
}
@media (max-width: 920px) {
  .symbol-key-inline { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .symbol-key-inline { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  .eq-card.eq-card-row { grid-template-columns: 1fr; }
  .eq-card.eq-card-row .eq-block + .eq-block {
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.10);
    padding-top: 22px; margin-top: 22px;
  }
}

/* Legacy keys kept for any other usage */
.method-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 64px;
  align-items: start;
  margin-top: 12px;
}
.symbol-key {
  list-style: none; padding: 0; margin: 22px 0 0;
}
.symbol-key li {
  font-size: 13px; color: rgba(255, 255, 255, 0.75);
  display: flex; align-items: baseline; gap: 8px;
}
.symbol-key b {
  color: #6dabd6; font-family: var(--font-mono); font-weight: 500;
  min-width: 30px; display: inline-block;
}

/* ---------- Workflow ---------- */
.workflow-list {
  list-style: none; padding: 0; margin: 48px 0 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px;
  counter-reset: step;
}
.workflow-list li {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 36px 28px 30px;
  position: relative;
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s var(--ease);
}
.workflow-list li:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 10px 32px -16px rgba(15, 23, 42, 0.18);
}
.workflow-num {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600;
  color: var(--brand);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.workflow-num::before {
  content: ""; display: inline-block;
  width: 24px; height: 1px; background: var(--brand);
}
.workflow-list h3 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 10px;
  color: var(--ink);
}
.workflow-list p { font-size: 14.5px; line-height: 1.6; margin: 0; }

/* ---------- Features ---------- */
.features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  margin-top: 56px;
}
.feature {
  background: var(--bg);
  padding: 32px 28px;
  transition: background 0.18s var(--ease);
}
.feature:hover { background: var(--bg-soft); }
.feature h3 {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600;
  margin: 14px 0 8px;
  color: var(--ink);
}
.feature p { font-size: 14px; line-height: 1.55; color: var(--ink-2); margin: 0; }
.feature-ico {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--brand-tint);
  color: var(--brand-deep);
  display: inline-flex; align-items: center; justify-content: center;
}
.feature-ico svg { width: 18px; height: 18px; stroke-width: 1.8; }

/* ---------- Heritage ---------- */
.heritage-grid {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 64px;
  align-items: center;
}
.crest {
  /* abstract wordmark / "crest" — restrained, not a real seal */
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 36px 32px;
  background: rgba(255, 255, 255, 0.03);
}
.crest .top {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 22px;
}
.crest .seal {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 600; font-size: 20px;
  color: white;
}
.crest .name { font-size: 16px; font-weight: 600; color: white; }
.crest .sub  { font-size: 12.5px; color: rgba(255,255,255,0.55); margin-top: 2px; }
.crest hr.hairline { border: none; border-top: 1px solid rgba(255,255,255,0.12); margin: 18px 0; }
.crest ul { list-style: none; padding: 0; margin: 0; }
.crest li {
  display: flex; align-items: baseline; gap: 14px;
  padding: 7px 0;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.78);
}
.crest li b {
  font-weight: 500; color: rgba(255, 255, 255, 0.55);
  min-width: 76px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
}

/* ---------- KaTeX math display ---------- */
.math-display {
  margin: 0;
  padding: 4px 0;
  font-size: 1.06em;
  color: white;
  overflow-x: auto;
}
.math-display .katex { color: white; }
.math-display .katex .mathnormal { color: #cfe1f0; }
.math-display .katex .mfrac .frac-line { border-bottom-color: rgba(255,255,255,0.55); }
.math-inline {
  display: inline-block;
  padding: 0 2px;
  color: var(--brand-deep);
}
.math-inline .katex { color: var(--brand-deep); }

/* ---------- Team — monumental two-person layout ---------- */
.team-monumental {
  text-align: center;
  padding: 140px 32px;
  position: relative;
  overflow: hidden;
}
.team-monumental::before {
  /* subtle radial highlight behind monograms */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(700px 400px at 50% 30%, rgba(109,171,214,0.10), transparent 65%);
  pointer-events: none;
}
.team-mono-row {
  position: relative;
  display: flex; justify-content: center; align-items: center;
  gap: clamp(28px, 5vw, 76px);
  margin: 8px 0 56px;
  line-height: 0.9;
}
/* hairline dividers between adjacent monograms (works with 2 or 3) */
.team-mono-row::before,
.team-mono-row::after {
  content: ""; position: absolute;
  top: 22%; bottom: 22%;
  width: 1px; background: rgba(255,255,255,0.08);
}
.team-mono-row::before { left: 33.33%; }
.team-mono-row::after  { left: 66.67%; }
.team-mono-row.two-only::before { left: 50%; }
.team-mono-row.two-only::after  { display: none; }

.team-mono {
  font-family: "Source Serif Pro", serif;
  font-weight: 500;
  font-size: clamp(80px, 13vw, 188px);
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.4);
  position: relative;
  display: inline-block;
  transition: -webkit-text-stroke-color 0.4s var(--ease), transform 0.4s var(--ease);
  cursor: default;
  flex: 0 0 auto;
}
.team-mono:hover {
  -webkit-text-stroke-color: var(--cyan);
  transform: translateY(-2px);
}
.team-mono::after {
  content: attr(data-name);
  position: absolute;
  left: 50%; bottom: -34px;
  transform: translateX(-50%);
  -webkit-text-stroke: 0;
  color: rgba(255, 255, 255, 0.65);
  font-family: var(--font-sans);
  font-size: 13px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.team-monumental .team-where {
  font-size: 13.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin: 92px 0 32px;
}
.team-monumental .team-where b { color: white; font-weight: 500; }
.team-mail {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 22px;
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 999px;
  color: white;
  font-size: 14px; font-family: var(--font-mono);
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), transform 0.16s var(--ease);
}
.team-mail:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.40);
  transform: translateY(-1px);
}
.team-mail svg { width: 14px; height: 14px; stroke-width: 1.8; }

/* ---------- Citation ---------- */
.cite-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 32px;
  margin-top: 28px;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px;
}
.cite-card .cite-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--brand); font-weight: 600;
  margin-bottom: 8px;
}
.cite-card .cite-text {
  font-family: "Source Serif Pro", Georgia, serif;
  font-size: 16px; color: var(--ink); line-height: 1.55;
}
.cite-card .cite-text em { color: var(--brand-deep); font-style: italic; }

/* ---------- Final CTA ---------- */
.cta {
  text-align: center;
  padding: 140px 32px;
}
.cta h2.display {
  font-size: clamp(40px, 5vw, 64px);
  margin: 0 auto 24px;
  max-width: 900px;
}
.cta .lead { margin: 0 auto 36px; }
.cta-buttons { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.cta .micro {
  font-size: 12px; color: var(--ink-3);
  margin-top: 22px;
  display: inline-flex; align-items: center; gap: 8px;
}
.cta .micro::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-accent);
}

/* ---------- Footer — UniVie blue ---------- */
.foot {
  background: var(--brand);                /* UniVie blau */
  color: rgba(255, 255, 255, 0.78);
  padding: 64px 32px 28px;
  font-size: 13.5px;
  position: relative;
}
.foot::before {
  /* subtle highlight strip at the very top of the footer */
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
}
.foot-inner {
  max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 56px;
  padding-bottom: 44px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.foot h4 {
  font-size: 11px; font-weight: 600;
  color: white;
  text-transform: uppercase; letter-spacing: 0.12em;
  margin: 0 0 18px;
}
.foot ul { list-style: none; padding: 0; margin: 0; }
.foot ul li { padding: 5px 0; }
.foot a { color: rgba(255, 255, 255, 0.82); transition: color 0.15s var(--ease); }
.foot a:hover { color: white; }
.foot .brand { color: white; }
.foot .brand .brand-dot {
  background: white; color: var(--brand);
}
.foot .lede {
  max-width: 320px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.55;
}
.foot-inner {
  border-bottom-color: rgba(255, 255, 255, 0.16);
}
.foot-bottom {
  max-width: 1180px; margin: 0 auto;
  padding-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  font-size: 12px; color: rgba(255, 255, 255, 0.60);
  flex-wrap: wrap;
}
.foot-bottom a { color: rgba(255, 255, 255, 0.78); }
.foot-credit { font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.foot-credit b { color: white; font-weight: 500; letter-spacing: 0.005em; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .hero-inner,
  .challenge-grid,
  .method-grid,
  .heritage-grid { grid-template-columns: 1fr; gap: 48px; }
  .features { grid-template-columns: 1fr 1fr; }
  .workflow-list { grid-template-columns: 1fr; }
  .foot-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .features { grid-template-columns: 1fr; }
  .section { padding: 80px 22px; }
  .hero { padding: 80px 22px 60px; }
  .foot-inner { grid-template-columns: 1fr; gap: 36px; }
  .hero-meta { grid-template-columns: 1fr 1fr; gap: 20px; }
}

/* ============================================================
   TOOL PAGE — IDE-style: thin rail, flyout panels, naked plots
   Premium layer: dot-grid canvas, sparklines, refined micro-UI
   ============================================================ */
body.app {
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
  display: flex; flex-direction: column;
}

/* --- Tool topbar (compact, ~54 px) — refined --- */
.tool-top {
  display: flex; align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.82));
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  position: relative;
  z-index: 30;
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.7) inset,
    0 1px 0 0 rgba(0, 0, 0, 0.02);
}
.tool-top .brand { font-size: 13.5px; }
.tool-top .sep {
  width: 1px; height: 22px; background: var(--line);
}
.tool-top .stretch { flex: 1; }

/* Topbar icon-actions — fancy primary buttons */
.act {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  height: 32px; padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink-2);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: all 0.16s var(--ease);
  position: relative;
  overflow: hidden;
}
.act:hover:not(:disabled) {
  border-color: var(--ink-3); color: var(--ink);
}
.act:disabled { opacity: 0.4; cursor: not-allowed; }
.act svg {
  width: 14px; height: 14px;
  stroke-width: 1.8;
}
.act-primary {
  background: var(--ink); color: white; border-color: var(--ink);
  box-shadow: 0 1px 0 rgba(255,255,255,0.07) inset, 0 1px 2px rgba(0,0,0,0.05);
}
.act-primary:hover:not(:disabled) { background: #1d2330; }
.act-primary::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(60px 30px at var(--mx,50%) 0%, rgba(255,255,255,0.18), transparent 70%);
  opacity: 0; transition: opacity 0.18s var(--ease);
  pointer-events: none;
}
.act-primary:hover::after { opacity: 1; }

.act-icon {
  width: 32px; height: 32px; padding: 0;
}
.act-icon svg { width: 15px; height: 15px; }

/* Status pill in topbar */
.tstatus {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px 0 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  max-width: 340px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tstatus::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-4); flex-shrink: 0;
}
.tstatus.busy { background: #fff7e0; border-color: #f4d68a; color: #815b00; }
.tstatus.busy::before { background: #d97706; animation: pulse 1.4s ease-in-out infinite; }
.tstatus.ok { background: #e6f7ef; border-color: #b8e3cc; color: #1b6c52; }
.tstatus.ok::before { background: #14a37f; }
.tstatus.err { background: #fdecee; border-color: #f3b9c4; color: #991b1b; }
.tstatus.err::before { background: #c1392f; }
.tstatus .timing { color: var(--ink-3); font-family: var(--font-mono); font-size: 11px; }

/* Live stats — premium chips with embedded sparklines */
.live-stats { display: flex; gap: 7px; align-items: center; }
.lstat {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 11px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 0.18s var(--ease),
              background 0.18s var(--ease),
              transform 0.06s var(--ease),
              box-shadow 0.18s var(--ease);
  position: relative;
}
.lstat:hover {
  background: var(--bg-soft);
  border-color: var(--ink-4);
  box-shadow: 0 1px 0 rgba(0,0,0,0.03), 0 2px 8px -4px rgba(15,23,42,0.10);
}
.lstat:active { transform: translateY(0.5px); }
.lstat.active {
  border-color: var(--ink); background: var(--ink); color: rgba(255,255,255,0.7);
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 4px 14px -4px rgba(0,0,0,0.35);
}
.lstat.active .v { color: white; }
.lstat.active .lstat-spark path.fill { fill: rgba(255,255,255,0.16); }
.lstat.active .lstat-spark path.line { stroke: white; }
.lstat .label { font-weight: 500; }
.lstat .v {
  font-family: var(--font-mono); color: var(--ink); font-weight: 500;
  transition: color 0.3s var(--ease);
}
.lstat .v.flash { color: var(--brand); }
.lstat-spark {
  width: 36px; height: 18px;
  margin-left: -2px;
  display: block;
  flex-shrink: 0;
}
.lstat-spark path.fill { fill: rgba(0,99,166,0.14); }
.lstat-spark path.line { stroke: var(--brand); stroke-width: 1.4; fill: none; }
.lstat-spark .empty {
  fill: none; stroke: var(--line-strong); stroke-width: 1.2; stroke-dasharray: 2 2;
}

/* Body: rail + flyout panel + canvas */
.tool-body {
  display: flex; flex: 1; min-height: 0; overflow: hidden;
}

/* --- Left icon rail — refined with active-bar + vertical brand --- */
.rail {
  width: 56px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, var(--bg), var(--bg-soft));
  padding: 14px 10px;
  display: flex; flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  z-index: 20;
  position: relative;
}
.rail::after {
  /* very subtle inner highlight */
  content: ""; position: absolute; inset: 0 0 0 auto;
  width: 1px; background: linear-gradient(180deg, transparent, rgba(255,255,255,0.5), transparent);
  pointer-events: none;
}
.rail-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: color 0.16s var(--ease), background 0.16s var(--ease),
              border-color 0.16s var(--ease), transform 0.06s var(--ease);
  position: relative;
}
.rail-btn::before {
  /* left accent bar for active state */
  content: ""; position: absolute;
  left: -10px; top: 50%; transform: translateY(-50%) scaleY(0);
  width: 2.5px; height: 18px; border-radius: 0 2px 2px 0;
  background: var(--ink);
  transition: transform 0.2s var(--ease);
}
.rail-btn:hover { background: var(--bg-cool); color: var(--ink); }
.rail-btn:active { transform: scale(0.94); }
.rail-btn.active {
  background: var(--ink); color: white; border-color: var(--ink);
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 6px 16px -4px rgba(0,0,0,0.35);
}
.rail-btn.active::before { transform: translateY(-50%) scaleY(1); }
.rail-btn svg { width: 17px; height: 17px; stroke-width: 1.7; }
.rail-btn .dot {
  position: absolute; top: 5px; right: 5px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 0 1.5px var(--bg);
  display: none;
}
.rail-btn[data-done="1"] .dot { display: block; }
.rail-btn.active .dot { box-shadow: 0 0 0 1.5px var(--ink); }

.rail-spacer { flex: 1; }

.rail-vbrand {
  font-size: 9.5px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-4);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin: 8px auto 4px;
  user-select: none;
}

.rail-btn .tip {
  position: absolute; left: calc(100% + 12px); top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--ink); color: white;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11.5px; font-weight: 500;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.16s var(--ease), transform 0.16s var(--ease);
  z-index: 100;
  display: inline-flex; align-items: center; gap: 8px;
}
.rail-btn .tip::before {
  content: ""; position: absolute;
  right: 100%; top: 50%; transform: translateY(-50%);
  border: 4px solid transparent; border-right-color: var(--ink);
}
.rail-btn .tip kbd {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: var(--font-mono);
  font-size: 10px; color: rgba(255,255,255,0.9);
}
.rail-btn:hover .tip { opacity: 1; transform: translateY(-50%) translateX(0); }

/* --- Flyout panel --- */
.flyout {
  width: 0;
  background: var(--bg);
  border-right: 1px solid transparent;
  overflow: hidden;
  transition: width 0.22s var(--ease), border-color 0.22s var(--ease);
  flex-shrink: 0;
  position: relative;
}
.flyout.open {
  width: 320px;
  border-right-color: var(--line);
}
.flyout-inner {
  width: 320px; height: 100%;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.flyout-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.flyout-head h2 {
  font-size: 13px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.005em;
}
.flyout-head .badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--bg-cool);
  font-size: 10.5px; font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.flyout-head .badge.done {
  background: var(--ink); color: white;
}
.flyout-close {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: transparent; border: none;
  color: var(--ink-3); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s var(--ease);
}
.flyout-close:hover { background: var(--bg-cool); color: var(--ink); }
.flyout-close svg { width: 14px; height: 14px; stroke-width: 1.8; }

.flyout-body {
  padding: 16px 18px 20px;
  overflow-y: auto;
  flex: 1;
}

/* --- Fancy upload icon button --- */
.upload-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--bg-soft);
  cursor: pointer;
  transition: all 0.18s var(--ease);
  position: relative;
  margin-bottom: 16px;
}
.upload-card:hover {
  border-color: var(--brand);
  background: var(--brand-tint);
}
.upload-card.has-file {
  border-style: solid; border-color: var(--c-accent);
  background: #f0faf6;
}
.upload-card input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: var(--ink); color: white;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease), background 0.18s var(--ease);
}
.upload-icon svg { width: 18px; height: 18px; stroke-width: 1.8; }
.upload-card:hover .upload-icon { transform: translateY(-2px); background: var(--brand); }
.upload-card.has-file .upload-icon { background: var(--c-accent); }
.upload-meta { flex: 1; min-width: 0; }
.upload-meta .t {
  font-size: 13px; font-weight: 500; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upload-meta .s {
  font-size: 11.5px; color: var(--ink-3);
  margin-top: 2px;
}

/* Reused field styles */
.field { display: block; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: block;
  font-size: 10.5px; font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 5px;
}
.input, .select {
  display: block;
  width: 100%;
  height: 34px;
  padding: 0 11px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-size: 13.5px; color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.input:hover, .select:hover { border-color: var(--ink-4); }
.input:focus, .select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,99,166,0.14);
}
.select {
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%236b7280' stroke-width='1.5'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 11px;
}
.field-row {
  display: grid; grid-template-columns: 1fr 80px; gap: 5px;
}
.grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.toggle {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--ink-2);
  cursor: pointer; padding: 7px 0;
}
.toggle input { display: none; }
.toggle .track {
  width: 28px; height: 16px;
  background: var(--line-strong);
  border-radius: 999px;
  position: relative;
  transition: background 0.18s var(--ease);
  flex-shrink: 0;
}
.toggle .track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: white; border-radius: 50%;
  transition: transform 0.2s var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.toggle input:checked + .track { background: var(--ink); }
.toggle input:checked + .track::after { transform: translateX(12px); }
.toggle code { font-size: 11.5px; background: var(--bg-cool); padding: 1px 5px; border-radius: 3px; color: var(--ink); }

.divider {
  height: 1px; background: var(--line);
  margin: 14px -18px;
}

.hint {
  margin: 12px 0 0;
  font-size: 11.5px; color: var(--ink-3);
  line-height: 1.55;
}
.hint code { background: var(--bg-cool); padding: 1px 5px; border-radius: 3px; font-size: 11px; color: var(--ink); }

/* --- Canvas (main plot area) — subtle dot grid background --- */
.canvas {
  flex: 1;
  overflow: auto;
  padding: 26px 32px 44px;
  display: flex; flex-direction: column;
  gap: 32px;
  min-width: 0;
  position: relative;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(15, 23, 42, 0.045) 1px, transparent 0);
  background-size: 24px 24px;
  background-position: 12px 12px;
}
/* Refined custom scrollbar */
.canvas::-webkit-scrollbar { width: 10px; height: 10px; }
.canvas::-webkit-scrollbar-track { background: transparent; }
.canvas::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,0.10); border-radius: 999px;
  border: 2px solid var(--bg);
}
.canvas::-webkit-scrollbar-thumb:hover { background: rgba(15,23,42,0.22); }

/* Plot — no card chrome, lives on the background, but with a refined frame */
.plot {
  display: flex; flex-direction: column;
  position: relative;
  padding: 4px 0;
}
.plot-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 2px 12px;
  border-bottom: 1px solid var(--line);
  gap: 14px;
}
.plot-title {
  font-size: 11.5px; font-weight: 600;
  color: var(--ink);
  text-transform: uppercase; letter-spacing: 0.09em;
  display: inline-flex; align-items: center; gap: 9px;
}
.plot-title::before {
  /* tiny brand pip */
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: var(--ink);
  display: inline-block;
}
.plot-meta {
  font-size: 11px; color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 14px;
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap; justify-content: flex-end;
}
.plot-meta > span {
  display: inline-flex; align-items: baseline; gap: 4px;
}
.plot-meta b {
  font-weight: 500; color: var(--ink);
  font-family: var(--font-mono); font-size: 11.5px;
}
.plot-meta i { font-size: 10px; }
.form-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  background: var(--ink); color: white;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-radius: 4px;
  font-family: var(--font-sans);
}
.form-badge.log { background: var(--brand); }
.plot-chart { position: relative; width: 100%; }
.plot-main .plot-chart { height: 440px; flex: none; }
.plot-sm  .plot-chart { height: 280px; flex: none; }

.plot-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 36px;
}

/* Custom SVG violin + box panel — matches the original Tk app's posterior layout */
.violin-host {
  width: 100%;
  position: relative;
  user-select: none;
}
.violin-host svg { display: block; width: 100%; height: 100%; }
.violin-host .violin-body {
  fill: rgba(120, 158, 195, 0.28);
  stroke: rgba(120, 158, 195, 0.85);
  stroke-width: 1.3;
  stroke-linejoin: round;
  transition: fill 0.18s var(--ease), stroke 0.18s var(--ease), transform 0.18s var(--ease);
  cursor: pointer;
}
.violin-host .v-group { transition: opacity 0.18s var(--ease); }
.violin-host .v-group.dim { opacity: 0.38; }
.violin-host .v-group.hi .violin-body {
  fill: rgba(120, 158, 195, 0.42);
  stroke: var(--brand);
}
.violin-host .box-iqr {
  fill: white; stroke: var(--ink);
  stroke-width: 1.2;
}
.violin-host .median-line {
  stroke: var(--warm); stroke-width: 2;
}
.violin-host .whisker {
  stroke: var(--ink-2); stroke-width: 1;
}
.violin-host .mean-mark {
  fill: var(--warm); stroke: white; stroke-width: 1.5;
}
.violin-host .axis-tick {
  font-size: 9.5px;
  fill: var(--ink-4);
  font-family: var(--font-mono);
}
.violin-host .axis-label {
  font-size: 11.5px;
  fill: var(--ink);
  font-weight: 600;
  font-family: var(--font-sans);
}
.violin-host .axis-value {
  font-size: 11px;
  fill: var(--ink-2);
  font-family: var(--font-mono);
}
.violin-host .axis-unit {
  font-size: 9.5px;
  fill: var(--ink-4);
  font-family: var(--font-sans);
}
.violin-host .grid-line {
  stroke: var(--grid, #f3f4f6);
  stroke-width: 1;
}
.violin-host .panel-divider {
  stroke: var(--line);
  stroke-width: 1;
}
.violin-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: 13px; font-style: italic;
}

/* Stats panel (overlay-like, but inline) */
.stats-section {
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.stats-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.stats-head h3 {
  font-size: 11.5px; font-weight: 600; color: var(--ink);
  text-transform: uppercase; letter-spacing: 0.08em;
}

.tbl-wrap {
  overflow-x: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 1px 2px rgba(15,23,42,0.04);
}
.tbl {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.tbl thead th {
  text-align: right;
  font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3);
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  white-space: nowrap;
}
.tbl thead th:first-child { text-align: left; padding-left: 18px; }
.tbl thead th:last-child  { padding-right: 18px; }
.tbl thead th.spk { text-align: center; }
.tbl tbody td {
  padding: 12px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.tbl tbody td:first-child { padding-left: 18px; }
.tbl tbody td:last-child  { padding-right: 18px; }
.tbl tbody td:first-child {
  text-align: left;
  font-family: var(--font-sans);
  color: var(--ink);
  font-weight: 500;
}
.tbl tbody td.spk { padding: 6px 8px; text-align: center; }
.tbl tbody td.spk svg { vertical-align: middle; }
.tbl tbody tr {
  transition: background 0.12s var(--ease);
  cursor: pointer;
}
.tbl tbody tr:hover { background: var(--bg-soft); }
.tbl tbody tr.row-hi { background: var(--brand-tint); }
.tbl tbody tr.row-hi td:first-child { color: var(--brand-deep); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .empty {
  text-align: center; padding: 32px;
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-style: italic;
  font-size: 13px;
}
.row-hint {
  font-size: 11px; color: var(--ink-3); margin-bottom: 10px;
}
.row-hint kbd {
  background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 4px; padding: 1px 6px;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2);
}

/* Empty state — refined, animated icon */
.canvas-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.canvas-empty.show { opacity: 1; }
.canvas-empty .box {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  color: var(--ink-2);
  font-size: 13.5px;
  text-align: center;
}
.canvas-empty .ic {
  width: 68px; height: 68px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, var(--bg), var(--bg-soft));
  border: 1px solid var(--line);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 8px 24px -10px rgba(15,23,42,0.15);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3);
  position: relative;
}
.canvas-empty .ic::after {
  content: "";
  position: absolute; inset: -6px;
  border-radius: 22px;
  border: 1px dashed var(--line-strong);
  opacity: 0.6;
  animation: emptyRing 3.4s ease-in-out infinite;
}
@keyframes emptyRing {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50%      { transform: scale(1.08); opacity: 0.25; }
}
.canvas-empty .ic svg { width: 26px; height: 26px; stroke-width: 1.5; }
.canvas-empty .lbl { color: var(--ink); font-weight: 500; }
.canvas-empty .sub {
  color: var(--ink-3); font-size: 12px; margin-top: -8px;
  display: inline-flex; align-items: center; gap: 6px;
}
.canvas-empty .sub kbd {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 10.5px; color: var(--ink-2);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

/* Science panel content */
.sci-eq {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.sci-eq .lbl {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3); font-weight: 600;
  margin-bottom: 6px;
}
.sci-eq .eq {
  font-family: var(--font-mono); font-size: 12.5px;
  color: var(--ink); line-height: 1.6;
}
.sci-eq .eq em { color: var(--brand); font-style: normal; }
.sci-eq .eq sub { font-size: 0.75em; }
.sci-text {
  font-size: 12.5px; color: var(--ink-2); line-height: 1.62;
  margin: 0 0 12px;
}
.sci-text:last-child { margin-bottom: 0; }
.sci-text code { background: var(--bg-cool); padding: 1px 5px; border-radius: 3px; font-size: 11.5px; color: var(--ink); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.22);
  z-index: 200;
}
.toast.err { background: var(--err); }
.toast.ok { background: #11875e; }
.toast[hidden] { display: none; }

/* Responsive */
@media (max-width: 1100px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .proof-inner { grid-template-columns: 1fr; }
  .proof-cell { border-left: none; border-top: 1px solid var(--line); padding: 16px 0 0; }
  .proof-cell:first-child { border-top: none; padding-top: 0; }
  .plot-row { grid-template-columns: 1fr; gap: 28px; }
  .live-stats { display: none; }
}
@media (max-width: 760px) {
  .tool-top { gap: 8px; padding: 0 12px; }
  .tool-top .brand span:last-child { display: none; }
  .tstatus { max-width: 160px; font-size: 11px; }
  .flyout.open { width: 280px; }
  .flyout-inner { width: 280px; }
  .canvas { padding: 16px 18px 32px; }
}
