/* Sansar on mume.ai: mume-web's brand language (app/globals.css + components/ui, shadcn "neutral" on Tailwind v4)
   reproduced in plain CSS. Tokens are the same oklch values; light/dark follows next-themes' mechanism: a `dark` (or
   `light`) class on <html>, set from localStorage "theme" by the inline script in base.html, with prefers-color-scheme
   as the fallback when no class is set (no JS, or theme "system"). */

:root {
  color-scheme: light;
  --radius: 0.625rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.52 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  /* Sansar's own accent: the saffron of chart-1, darkened to clear 4.5:1 as text on white. */
  --sansar: oklch(0.54 0.17 45);
  --sansar-soft: oklch(0.96 0.03 60);
  /* Chart roles (dataviz reference palette, validated light/dark): series-1 blue, series-2 orange, series-3 aqua. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --grid: oklch(0.93 0 0);
  --good: #0a7d0a;
  --good-bg: oklch(0.96 0.05 145);
  --warn: #8a5a00;
  --warn-bg: oklch(0.96 0.06 85);
  --bad: #b42323;
  --bad-bg: oklch(0.96 0.03 25);
  --info-bg: oklch(0.96 0.03 250);
  --info: #1c5cab;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-header: 0 1px 3px rgba(0, 0, 0, 0.04);
  --sans: "Geist", "Geist Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --deva: "Tiro Devanagari Sanskrit", "Noto Serif Devanagari", "Kohinoor Devanagari", "Nirmala UI", serif;
  --container: 72rem;
  /* One card system for every card on the site: padding, title / label / number sizes. */
  --card-pad: 18px 20px;
  --card-gap: 12px;
  --card-title: 600 15px/1.35 var(--sans);
  --card-label: 400 12px/1.5 var(--sans);
  --card-num: 600 1.05rem/1.35 var(--sans);
  --card-num-lg: 600 1.75rem/1.2 var(--sans);
  --card-sub: 400 12.5px/1.5 var(--sans);
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    color-scheme: dark;
    --background: oklch(0.145 0 0); --foreground: oklch(0.985 0 0);
    --card: oklch(0.205 0 0); --card-foreground: oklch(0.985 0 0);
    --primary: oklch(0.922 0 0); --primary-foreground: oklch(0.205 0 0);
    --secondary: oklch(0.269 0 0); --secondary-foreground: oklch(0.985 0 0);
    --muted: oklch(0.269 0 0); --muted-foreground: oklch(0.72 0 0);
    --accent: oklch(0.269 0 0); --accent-foreground: oklch(0.985 0 0);
    --destructive: oklch(0.704 0.191 22.216);
    --border: oklch(1 0 0 / 10%); --input: oklch(1 0 0 / 15%); --ring: oklch(0.556 0 0);
    --sansar: oklch(0.8 0.13 62); --sansar-soft: oklch(0.27 0.03 60);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --grid: oklch(1 0 0 / 8%);
    --good: #5fd35f; --good-bg: oklch(0.3 0.06 145);
    --warn: #f3c25a; --warn-bg: oklch(0.32 0.06 85);
    --bad: #f08080; --bad-bg: oklch(0.32 0.07 25);
    --info: #8db9f2; --info-bg: oklch(0.3 0.05 250);
    --shadow-header: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
}
:root.dark {
  color-scheme: dark;
  --background: oklch(0.145 0 0); --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0); --card-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 0 0); --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0); --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0); --muted-foreground: oklch(0.72 0 0);
  --accent: oklch(0.269 0 0); --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%); --input: oklch(1 0 0 / 15%); --ring: oklch(0.556 0 0);
  --sansar: oklch(0.8 0.13 62); --sansar-soft: oklch(0.27 0.03 60);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  --grid: oklch(1 0 0 / 8%);
  --good: #5fd35f; --good-bg: oklch(0.3 0.06 145);
  --warn: #f3c25a; --warn-bg: oklch(0.32 0.06 85);
  --bad: #f08080; --bad-bg: oklch(0.32 0.07 25);
  --info: #8db9f2; --info-bg: oklch(0.3 0.05 250);
  --shadow-header: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ─── Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--background); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--background); color: var(--foreground);
  font: 400 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
html.has-sky body { background: transparent; }
main { flex: 1 0 auto; width: 100%; }
a { color: inherit; text-underline-offset: 4px; }
p a, li a, .link { color: var(--foreground); text-decoration: underline; text-decoration-color: color-mix(in oklch, var(--foreground) 30%, transparent); }
p a:hover, li a:hover, .link:hover { text-decoration-color: currentColor; }
h1, h2, h3, h4 { letter-spacing: -0.02em; line-height: 1.2; margin: 0; font-weight: 600; }
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: oklch(0.55 0 0 / 0.6) transparent; }
.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; }
.skip { position: absolute; left: 8px; top: -40px; z-index: 100; background: var(--primary); color: var(--primary-foreground); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 8px; }
.deva, [lang="sa"] { font-family: var(--deva); }
[lang="sa-Latn"] { font-family: var(--sans); font-style: italic; }
.num, td, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted-foreground); }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 48rem; }

/* ─── Sky mount point (static/sky/, merged later): full-bleed, behind everything, never interactive ─── */
.sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.sky:empty { display: none; }

/* ─── Header: StaticHeader (sticky, translucent, blurred, hairline) ─── */
.site-header { position: sticky; top: 0; z-index: 50; isolation: isolate; }
/* Progressive blur: frosted at the top, fading into the sky below the bar (no hard edge). */
.site-header::before {
  content: ""; position: absolute; inset: 0 0 -28px 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in oklch, var(--background) 78%, transparent) 0%,
              color-mix(in oklch, var(--background) 55%, transparent) 62%, transparent 100%);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
}
.site-header .bar { display: flex; height: 56px; align-items: center; justify-content: space-between; gap: 12px; max-width: 80rem; margin: 0 auto; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand a { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.brand img { width: 22px; height: 22px; object-fit: contain; transition: transform .2s; }
.brand a:hover img { transform: scale(1.1); }
.brand .slash { color: var(--muted-foreground); opacity: .6; }
.brand .product { gap: 6px; }
.brand .product .deva { color: var(--sansar); font-weight: 400; font-size: 16px; }
.site-nav { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.site-nav a {
  padding: 6px 12px; border-radius: 8px; color: var(--muted-foreground); text-decoration: none; transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--foreground); background: color-mix(in oklch, var(--foreground) 5%, transparent); }
.site-nav a[aria-current="page"] { color: var(--foreground); background: color-mix(in oklch, var(--foreground) 6%, transparent); }

/* ─── Buttons: components/ui/button (default / outline / secondary / ghost; sm / default / lg / icon) ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  height: 36px; padding: 0 16px; border-radius: calc(var(--radius) - 2px); border: 1px solid transparent;
  font: 500 14px/1 var(--sans); cursor: pointer; text-decoration: none; transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  background: var(--primary); color: var(--primary-foreground);
}
.btn:hover { background: color-mix(in oklch, var(--primary) 90%, transparent); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent); border-color: var(--ring); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-outline { background: var(--background); color: var(--foreground); border-color: var(--border); box-shadow: var(--shadow-sm); }
:root.dark .btn-outline { background: color-mix(in oklch, var(--input) 30%, transparent); border-color: var(--input); }
.btn-outline:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover { background: color-mix(in oklch, var(--secondary) 80%, var(--foreground) 6%); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--accent); }
.btn-sm { height: 32px; padding: 0 12px; gap: 6px; font-size: 13px; }
.btn-lg { height: 40px; padding: 0 24px; }
.btn-icon { width: 36px; padding: 0; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.theme-toggle .moon { display: none; }
:root.dark .theme-toggle .sun { display: none; }
:root.dark .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not(.light):not(.dark) .theme-toggle .sun { display: none; }
  :root:not(.light):not(.dark) .theme-toggle .moon { display: block; }
}

/* ─── Cards, badges, inputs ─── */
.card {
  background: var(--card); color: var(--card-foreground); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--card-pad); }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  font: 500 12px/1 var(--sans); white-space: nowrap; border: 1px solid transparent;
  background: var(--secondary); color: var(--secondary-foreground);
}
.badge-outline { background: transparent; border-color: var(--border); color: var(--muted-foreground); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.winner, .badge.running { background: var(--good-bg); color: var(--good); }
.badge.keep { background: var(--info-bg); color: var(--info); }
.badge.neutral, .badge.queued, .badge.stopped { background: var(--secondary); color: var(--muted-foreground); }
.badge.discard, .badge.failed { background: var(--bad-bg); color: var(--bad); }
.badge.stale { background: var(--warn-bg); color: var(--warn); }
.badge.done { background: var(--secondary); color: var(--secondary-foreground); }
.badge.running .dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; min-height: 36px; padding: 6px 12px; border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--input); background: transparent; color: var(--foreground); font: 400 14px/1.5 var(--sans);
  box-shadow: var(--shadow-sm); transition: box-shadow .15s, border-color .15s;
}
:root.dark .input { background: color-mix(in oklch, var(--input) 30%, transparent); }
select.input { padding-right: 28px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted-foreground) 50%), linear-gradient(135deg, var(--muted-foreground) 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
select.input option { background: var(--card); color: var(--foreground); }
.input:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent); }
.input::placeholder { color: var(--muted-foreground); }

/* ─── Page heads ─── */
.page-head { padding: 48px 0 24px; }
.kicker { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-foreground); }
.page-head h1 { font-size: clamp(2rem, 5vw, 2.75rem); letter-spacing: -0.03em; }
.page-head h1 .deva { color: var(--sansar); font-weight: 400; letter-spacing: 0; margin-left: .15em; }
.lede { margin: 12px 0 0; max-width: 42rem; font-size: 1.0625rem; color: var(--muted-foreground); }
.section { padding: 28px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2 { font-size: 1.25rem; }
.section-head p { margin: 0; color: var(--muted-foreground); font-size: 13px; }
.prose { max-width: 44rem; }
.prose h2 { font-size: 1.375rem; margin: 40px 0 12px; }
.prose h3 { font-size: 1.0625rem; margin: 28px 0 8px; }
.prose p, .prose li { color: color-mix(in oklch, var(--foreground) 88%, transparent); }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: 4px 0; }
.callout { border-left: 3px solid var(--sansar); padding: 10px 16px; background: var(--sansar-soft); border-radius: 0 8px 8px 0; font-size: 14px; }

/* ─── Footer: LandingFooter (four columns, hairline, muted links) ─── */
.site-footer { margin-top: 96px; padding: 48px 0 40px; position: relative; isolation: isolate; }
/* Mirror of the header: the sky fades into a frosted footer instead of meeting a hard line. */
.site-footer::before {
  content: ""; position: absolute; inset: -72px 0 0 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, transparent 0%, color-mix(in oklch, var(--background) 60%, transparent) 72px,
              color-mix(in oklch, var(--background) 85%, transparent) 100%);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 72px);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 72px);
}
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.site-footer h4 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: color-mix(in oklch, var(--foreground) 80%, transparent); margin: 0 0 14px; }
.site-footer nav { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.site-footer nav a { color: var(--muted-foreground); text-decoration: none; width: fit-content; }
.site-footer nav a:hover { color: var(--foreground); }
.site-footer .tag { color: var(--muted-foreground); font-size: 14px; max-width: 22rem; margin: 12px 0 0; }
.site-footer .legal { margin-top: 40px; padding-top: 20px; border-top: 1px solid color-mix(in oklch, var(--border) 40%, transparent); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 13px; color: var(--muted-foreground); }

/* ─── Demo ─── */
.hero { text-align: center; padding: 56px 0 28px; }
.hero .lede { margin-left: auto; margin-right: auto; }
.try .label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.try textarea { font: 1.3rem/1.9 var(--deva); min-height: 5.8rem; resize: vertical; padding: 12px 14px; border-radius: var(--radius); }
.try textarea::placeholder { font: 1rem var(--sans); }
.row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.count { margin-left: auto; font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.settings { margin-top: 12px; font-size: 14px; color: var(--muted-foreground); }
.settings summary { cursor: pointer; width: max-content; border-radius: 6px; }
.settings .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; margin-top: 10px; }
.settings label { display: flex; flex-direction: column; gap: 4px; }
.settings input[type=range] { width: 100%; accent-color: var(--primary); }
.hint { margin: 8px 0 0; font-size: 13px; }
.out { margin-top: 16px; padding: 20px 24px; min-height: 180px; }
.empty { margin: 0; padding: 52px 0; text-align: center; color: var(--muted-foreground); }
.out .verse { font: 1.35rem/2.05 var(--deva); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.out .p { color: var(--muted-foreground); }
.out .g { color: var(--foreground); }
.out .g.live::after { content: ""; display: inline-block; width: 2px; height: 1.1em; margin-left: 2px; vertical-align: -0.15em; background: var(--sansar); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.out .iast { margin: 12px 0 0; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 1rem; line-height: 1.7; color: var(--muted-foreground); white-space: pre-wrap; overflow-wrap: anywhere; }
.out .meta { margin: 12px 0 0; font-size: 13px; color: var(--muted-foreground); display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.out .error { margin: 0; padding: 40px 0; text-align: center; }
.out .error small { display: block; color: var(--muted-foreground); margin-top: 4px; }
.note { font-size: 13px; color: var(--muted-foreground); margin: 10px 2px 0; }
.chips { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.chip { width: 100%; text-align: left; background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; display: block; cursor: pointer; font: inherit; transition: border-color .15s, background .15s; }
.chip:hover { background: var(--accent); }
.chip .t { display: block; font: 1.1rem/1.7 var(--deva); }
.chip .d { display: block; font-size: 12px; color: var(--muted-foreground); }

/* ─── Tokenizer box ─── */
.tok-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tok-input { font: 1.2rem/1.8 var(--deva) !important; min-height: 4.4rem; resize: vertical; }
.tok-pieces { display: flex; flex-wrap: wrap; gap: 4px 3px; min-height: 72px; padding: 14px; align-content: flex-start; }
.tok {
  display: inline-flex; align-items: baseline; padding: 1px 6px 2px; border-radius: 6px; font: 1.12rem/1.75 var(--deva);
  background: var(--tc); color: var(--foreground); border: 1px solid color-mix(in oklch, var(--tc) 60%, var(--foreground) 12%);
  animation: tok-in .28s ease-out both; animation-delay: calc(var(--i, 0) * 14ms);
}
.tok.space { background: transparent; border-style: dashed; color: var(--muted-foreground); font-family: var(--sans); font-size: .8rem; padding: 0 4px; align-self: center; }
.tok.partial { font-family: var(--sans); font-style: italic; font-size: .9rem; align-self: center; }
.tok.byte, .tok.mark { font-family: var(--mono); font-size: .72rem; align-self: center; color: var(--muted-foreground); }
.tok.word-start { margin-left: 8px; }
@keyframes tok-in { from { opacity: 0; transform: translateY(4px) scale(.96); } to { opacity: 1; transform: none; } }
.tc0 { --tc: oklch(0.93 0.05 45); } .tc1 { --tc: oklch(0.93 0.05 250); } .tc2 { --tc: oklch(0.93 0.05 160); }
.tc3 { --tc: oklch(0.93 0.05 330); } .tc4 { --tc: oklch(0.93 0.06 95); } .tc5 { --tc: oklch(0.93 0.04 290); }
:root.dark .tc0 { --tc: oklch(0.33 0.06 45); } :root.dark .tc1 { --tc: oklch(0.33 0.06 250); } :root.dark .tc2 { --tc: oklch(0.33 0.06 160); }
:root.dark .tc3 { --tc: oklch(0.33 0.06 330); } :root.dark .tc4 { --tc: oklch(0.33 0.06 95); } :root.dark .tc5 { --tc: oklch(0.33 0.05 290); }
@media (prefers-color-scheme: dark) {
  :root:not(.light) .tc0 { --tc: oklch(0.33 0.06 45); } :root:not(.light) .tc1 { --tc: oklch(0.33 0.06 250); } :root:not(.light) .tc2 { --tc: oklch(0.33 0.06 160); }
  :root:not(.light) .tc3 { --tc: oklch(0.33 0.06 330); } :root:not(.light) .tc4 { --tc: oklch(0.33 0.06 95); } :root:not(.light) .tc5 { --tc: oklch(0.33 0.05 290); }
}
.tok-counts { padding: var(--card-pad); }
.tok-counts h3, .published h3 { font: var(--card-title); letter-spacing: -0.01em; margin-bottom: 4px; }
.tok-row { display: grid; grid-template-columns: 6.5rem 1fr 3.2rem; gap: 10px; align-items: center; padding: 7px 0; font-size: 14px; }
.tok-row .bar { height: 10px; border-radius: 0 4px 4px 0; background: var(--series-1); transition: width .35s ease-out; min-width: 2px; }
.tok-row.sansar .bar { background: var(--series-2); }
.tok-row .track { background: var(--muted); border-radius: 0 4px 4px 0; height: 10px; }
.tok-row .n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.tok-row .name small { display: block; color: var(--muted-foreground); font-size: 11px; line-height: 1.2; }
.tok-row.na .n { font-weight: 400; color: var(--muted-foreground); }
.tok-meta { font-size: 12px; color: var(--muted-foreground); margin: 10px 0 0; }
.tok-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.published { margin-top: 16px; }
.published table { width: 100%; }

/* ─── Tables ─── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); background: var(--card); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data thead th { font-size: 12px; font-weight: 500; color: var(--muted-foreground); background: color-mix(in oklch, var(--muted) 50%, transparent); position: sticky; top: 0; }
table.data th.r, table.data td.r { text-align: right; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: color-mix(in oklch, var(--accent) 60%, transparent); }
table.data a { text-decoration: none; font-weight: 500; }
table.data a:hover { text-decoration: underline; }
table.data th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; border-radius: 4px; }
table.data th button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
table.data th button .arrow { opacity: .35; font-size: 10px; }
table.data th[aria-sort] button .arrow { opacity: 1; }
table.data td .sub { color: var(--muted-foreground); font-size: 12px; }
table.data td .sub.id { max-width: 15rem; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
table.data td.wrap { white-space: normal; min-width: 9rem; max-width: 13rem; }
table.data th, table.data td { padding: 9px 10px; }
.wide-page { max-width: 80rem; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.filters .field { min-width: 9rem; }
.filters .search { flex: 1 1 14rem; }
.filters .count { margin-left: auto; align-self: center; }

/* ─── Runs: live cards ─── */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 16px; }
/* Every live card has the same rows (header, chips, progress, stats, chart, footer), each a fixed height, so cards
   side by side line up row for row; the footer is pinned to the bottom of the (equal-height) card. */
.live-card { padding: var(--card-pad); display: flex; flex-direction: column; gap: var(--card-gap); min-width: 0; }
.live-card.is-stale { opacity: .78; }
.live-card .lc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.live-card h3 { font: var(--card-title); letter-spacing: -0.01em; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-card h3 a { text-decoration: none; }
.live-card h3 a:hover { text-decoration: underline; }
.live-card .lc-head .badge { flex-shrink: 0; }
.chips-row { display: flex; flex-wrap: nowrap; gap: 6px; min-width: 0; overflow: hidden; height: 22px; }
.chips-row > * { flex-shrink: 0; }
.chips-row.is-clipped { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; margin: 0; }
.stats div { min-width: 0; }
.stats dt, .mini-stats dt { font: var(--card-label); color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats dd { margin: 2px 0 0; font: var(--card-num); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats dd .at { font-size: 11px; font-weight: 400; color: var(--muted-foreground); }
.progress { height: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--series-2); border-radius: 999px; transition: width .8s ease-out; }
.progress-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; line-height: 18px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; margin-bottom: 6px; white-space: nowrap; }
.spark { width: 100%; height: 64px; display: block; overflow: hidden; }
.spark .ln { fill: none; stroke: var(--series-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .area2 { fill: var(--series-2); fill-opacity: .1; stroke: none; }
.spark .xhair { stroke: var(--muted-foreground); stroke-width: 1; stroke-opacity: .5; }
.spark-wrap { position: relative; }
.spark-wrap .cap { display: flex; justify-content: space-between; gap: 8px; height: 18px; font-size: 11px; line-height: 18px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.spark-wrap .tip { min-width: 0; white-space: nowrap; }
/* No curve (an OCR job): the chart row keeps its height as a quiet dashed panel. */
.spark-wrap.is-empty .spark { border: 1px dashed var(--border); border-radius: 8px; background: color-mix(in oklch, var(--muted) 35%, transparent); }
.lc-foot { margin: auto 0 0; font-size: 12px; line-height: 18px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state { padding: 28px 24px; text-align: center; color: var(--muted-foreground); }
.state strong { display: block; color: var(--foreground); font-weight: 600; margin-bottom: 4px; }
.state .btn { margin-top: 12px; }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); font-size: 13px; margin-bottom: 12px; }
.skeleton { background: linear-gradient(90deg, var(--muted) 25%, color-mix(in oklch, var(--muted) 60%, var(--background)) 50%, var(--muted) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton.card-h { height: 330px; }

/* ─── Charts (hand-rolled SVG, static/js/charts.js) ─── */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-grid .wide { grid-column: 1 / -1; }
figure.chart { margin: 0; padding: var(--card-pad); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
figure.chart h3 { font: var(--card-title); letter-spacing: -0.01em; }
figure.chart .sub { font: var(--card-sub); color: var(--muted-foreground); margin: 0; }
/* Cards side by side share their rows (title, description, chart), so a longer description does not push one
   chart lower than its neighbour. */
@supports (grid-template-rows: subgrid) {
  .chart-grid > figure.chart:not(.wide) { display: grid; grid-row: span 3; grid-template-rows: subgrid; grid-template-columns: minmax(0, 1fr); row-gap: 8px; align-content: start; }
  .chart-grid > figure.chart:not(.wide) > .sub { align-self: start; }
}
.chart-box { position: relative; width: 100%; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-box .axis text, .chart-box .lbl { fill: var(--muted-foreground); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart-box .lbl.strong { fill: var(--foreground); font-weight: 500; }
.chart-box .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart-box .axis line, .chart-box .axis path { stroke: var(--border); }
.chart-box .milestone line { stroke: var(--muted-foreground); stroke-width: 1; stroke-opacity: .45; }
.chart-box .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .s1 { stroke: var(--series-1); } .chart-box .f1 { fill: var(--series-1); }
.chart-box .s2 { stroke: var(--series-2); } .chart-box .f2 { fill: var(--series-2); }
.chart-box .s3 { stroke: var(--series-3); } .chart-box .f3 { fill: var(--series-3); }
.chart-box .area2 { fill: var(--series-2); fill-opacity: .1; stroke: none; }
.chart-box .dot { stroke: var(--card); stroke-width: 2; }
.chart-box .hit { fill: transparent; cursor: pointer; }
.chart-box .xhair { stroke: var(--muted-foreground); stroke-width: 1; stroke-opacity: .5; }
.chart-box .hollow { fill: var(--card); stroke-width: 2; }
.tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 120px; max-width: 260px; padding: 8px 10px; border-radius: 8px;
  background: var(--popover, var(--card)); color: var(--foreground); border: 1px solid var(--border); box-shadow: 0 4px 16px rgb(0 0 0 / .12);
  font-size: 12px; line-height: 1.45; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .1s; left: 0; top: 0;
  overflow-wrap: anywhere;
}
.tip.on { opacity: 1; }
.tip b { font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted-foreground); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend i.l { width: 14px; height: 2px; border-radius: 1px; }
.legend i.hollow { background: transparent !important; border: 2px solid; width: 10px; height: 10px; }
.chart-table summary { font-size: 12.5px; color: var(--muted-foreground); cursor: pointer; width: fit-content; border-radius: 4px; }
/* Charts fill the card; the table preview sits at the bottom so side-by-side cards line up row for row. */
figure.chart .chart-box { flex: 1; display: flex; flex-direction: column; gap: 10px; }
figure.chart .chart-box > :first-child { flex: 1; display: flex; flex-direction: column; justify-content: center; }
figure.chart .chart-box > .chart-table { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
div.chart-table tr.more { display: none; }
div.chart-table.open tr.more { display: table-row; }
table.data.compact th, table.data.compact td { padding-top: 7px; padding-bottom: 7px; font-size: 13px; }
.more-btn {
  margin-top: 8px; align-self: flex-start; font: 500 12.5px var(--sans); color: var(--muted-foreground); background: none;
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; cursor: pointer;
}
.more-btn:hover, .more-btn:focus-visible { color: var(--foreground); border-color: var(--ring); outline: none; }
ol.milestones { margin: 8px 0 0; padding-left: 1.6rem; columns: 2 22rem; column-gap: 2rem; font-size: 13px; }
ol.milestones li { break-inside: avoid; margin: 0 0 4px; }
ol.milestones a { color: var(--foreground); }
.chart-empty { padding: 36px 0; text-align: center; color: var(--muted-foreground); font: var(--card-sub); }

/* ─── Run detail ─── */
.run-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.run-id { font-family: var(--mono); font-size: 13px; color: var(--muted-foreground); overflow-wrap: anywhere; margin: 8px 0 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); gap: 16px; }
#run-live .live-grid:empty { display: none; }
.facts .card { padding: var(--card-pad); }
.facts h3, .story h3 { font: 500 12px/1.5 var(--sans); color: var(--muted-foreground); letter-spacing: 0; margin-bottom: 8px; }
.facts dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; line-height: 1.5; }
.facts dt { color: var(--muted-foreground); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.headline { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: 16px; }
.headline .card { padding: var(--card-pad); display: flex; flex-direction: column; min-width: 0; }
.headline .v { font: var(--card-num-lg); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.headline .l, .headline .u { font: var(--card-label); color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.headline .delta { margin-top: auto; padding-top: 4px; }
.delta { font-size: 12px; font-weight: 500; }
.delta.better { color: var(--good); } .delta.worse { color: var(--bad); }
.story { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.story .card { padding: var(--card-pad); }
.story p { margin: 0; }
.kin { display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs { font-size: 13px; color: var(--muted-foreground); }
.crumbs a { color: var(--muted-foreground); text-decoration: none; }
.crumbs a:hover { color: var(--foreground); }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .tok-grid, .chart-grid, .story { grid-template-columns: minmax(0, 1fr); }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
  .site-footer .cols > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .container, .site-header .bar { padding: 0 16px; }
  .site-nav .hide-sm { display: none; }
  .site-nav a { padding: 6px 8px; }
  .brand .mume-name { display: none; }
  .settings .grid { grid-template-columns: 1fr; }
  .out { padding: 14px; }
  .out .verse { font-size: 1.22rem; }
  .page-head { padding: 32px 0 16px; }
  .hero { padding: 36px 0 20px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .count { margin-left: 0; }
  .filters .field { min-width: calc(50% - 4px); flex: 1 1 calc(50% - 4px); }
  .filters .count { margin-left: 0; }
}
/* Phones: the runs table becomes one card per run (label: value pairs), so nothing scrolls sideways. */
@media (max-width: 640px) {
  table.data.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.data.stack, table.data.stack tbody { display: block; }
  table.data.stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.data.stack tr[hidden] { display: none; }
  table.data.stack td { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border: 0; white-space: normal; text-align: right; max-width: none; min-width: 0; font-size: 13px; }
  table.data.stack td::before { content: attr(data-label); color: var(--muted-foreground); text-align: left; font-size: 12px; }
  table.data.stack td.run-cell { grid-column: 1 / -1; display: block; text-align: left; padding-bottom: 6px; }
  table.data.stack td.run-cell::before { content: none; }
  table.data.stack td.nil { display: none; }
  table.data.stack td .sub { display: none; }
  table.data.stack td.run-cell .sub.id { display: block; max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; }
  .out .g.live::after { animation: none; }
}

/* Inline note: a small "i" that shows the note on hover, focus or tap (no extra column). */
.info { position: relative; display: inline-flex; vertical-align: 1px; margin-left: 4px; }
.info-btn {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--muted-foreground);
  font: italic 600 10px/14px Georgia, serif; padding: 0; cursor: help;
}
.info-btn:hover, .info-btn:focus-visible { color: var(--foreground); border-color: var(--ring); outline: none; }
.info-pop {
  position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-30%); z-index: 6; width: max-content; max-width: 280px;
  padding: 8px 10px; border-radius: 8px; background: var(--popover, var(--card)); color: var(--foreground); border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgb(0 0 0 / .12); font-size: 12px; line-height: 1.45; font-weight: 400; white-space: normal;
  opacity: 0; visibility: hidden; transition: opacity .12s;
}
.info:hover .info-pop, .info-btn:focus-visible + .info-pop, .info-btn:focus + .info-pop { opacity: 1; visibility: visible; }
@media (prefers-reduced-motion: reduce) { .info-pop { transition: none; } }

/* Tithi · nakṣatra from the sky engine, written into the footer (never floats over content). */
.sky-caption:not(:empty)::before { content: "·"; margin: 0 8px; opacity: .6; }

/* ─── MuseMesh Lab (/lab): track tabs, track cards, track chips ─── */
.lab-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 4px 0 8px; padding: 4px; border: 1px solid var(--border); border-radius: 999px; width: fit-content; max-width: 100%; background: color-mix(in oklch, var(--card) 80%, transparent); }
.lab-tabs::-webkit-scrollbar { display: none; }
.lab-tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 999px; font-size: 14px; color: var(--muted-foreground); text-decoration: none; white-space: nowrap; }
.lab-tabs a:hover { color: var(--foreground); background: color-mix(in oklch, var(--foreground) 5%, transparent); }
.lab-tabs a[aria-current="page"] { color: var(--foreground); background: color-mix(in oklch, var(--foreground) 8%, transparent); font-weight: 500; }
.lab-tabs .dot, .track-chip .dot, .track-card h3 .dot, .track-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent, var(--muted-foreground)); flex-shrink: 0; display: inline-block; }
.lab-tabs .live-n { font-size: 11px; font-weight: 600; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--good-bg); color: var(--good); font-variant-numeric: tabular-nums; }
.track-chip { gap: 6px; text-decoration: none; color: var(--foreground); }
a.track-chip:hover { border-color: var(--ring); }
.track-title { display: flex; align-items: center; gap: 14px; }
.track-title .dot { width: 14px; height: 14px; }
.track-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr)); gap: 16px; }
.track-card { padding: var(--card-pad); display: flex; flex-direction: column; gap: var(--card-gap); border-top: 3px solid var(--accent); min-width: 0; }
.track-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.track-card h3 { font: var(--card-title); font-size: 1.05rem; letter-spacing: -0.01em; min-width: 0; }
.track-card h3 a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.track-card h3 a:hover { text-decoration: underline; }
.track-card .blurb { margin: 0; font: var(--card-sub); font-size: 13px; color: var(--muted-foreground); flex: 1; }
.track-card .best .l { font: var(--card-label); color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-card .best .v { font: var(--card-num-lg); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.track-card .best .u { font-size: 13px; font-weight: 400; color: var(--muted-foreground); letter-spacing: 0; }
.track-card .best .sub { font: var(--card-sub); color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-card .best .sub a { color: var(--foreground); }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding-top: 12px; border-top: 1px solid var(--border); }
.mini-stats dd { margin: 2px 0 0; font: var(--card-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.track-callout p { margin: 0 0 6px; }
.track-callout p:last-child { margin-bottom: 0; }
.glossary { margin-top: 12px; max-width: 46rem; font-size: 14px; }
.glossary summary { cursor: pointer; width: fit-content; color: var(--muted-foreground); border-radius: 4px; }
.glossary dl { margin: 10px 0 0; display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 8px 16px; }
.glossary dt { font-weight: 500; }
.glossary dt .muted { font-weight: 400; font-size: 12px; display: block; }
.glossary dd { margin: 0; color: var(--muted-foreground); }
.headline .headline-main { border-color: color-mix(in oklch, var(--accent, var(--border)) 45%, var(--border)); }
table.data.scores th.set-name { font-weight: 500; font-size: 13.5px; color: var(--foreground); background: none; white-space: normal; min-width: 12rem; }
table.data.scores th.set-name .sub { font-weight: 400; color: var(--muted-foreground); font-size: 12px; max-width: 34rem; }
table.data.scores tr.is-headline { background: color-mix(in oklch, var(--accent, var(--muted)) 7%, transparent); }
.unit-note { max-width: 46rem; }
.lab-link { margin-top: 12px; }
.run-head .track-chip { font-size: 13px; }
@media (max-width: 640px) {
  .glossary dl { grid-template-columns: 1fr; gap: 2px; }
  .glossary dd { margin-bottom: 8px; }
  table.data.scores th.set-name { min-width: 0; }
  .lab-tabs { border-radius: 12px; }
}

/* Over the sky, muted text needs a little more ink than on a plain page so the contrast guard can keep 4.5:1
   with a light veil (otherwise the veil has to go nearly opaque). Only while the sky is showing. */
html.has-sky.light { --muted-foreground: oklch(0.43 0 0); }
html.has-sky.dark { --muted-foreground: oklch(0.76 0 0); }
