/* ==========================================================================
   MBClaude — design system
   3 color schemes (light, dark, reader) x 3 layouts (full, informative, compact)
   Themes are CSS variables on <html data-theme>; layouts are <html data-layout>.
   ========================================================================== */

:root {
  --radius: 3px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: var(--font);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 70ch;
  --header-h: 60px;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6fb; --surface: #ffffff; --surface2: #eceff8; --fg: #151926; --muted: #566074; --border: #dde1ee;
  --accent: #3f50e0; --accent2: #0aa5a0; --accent-fg: #ffffff; --accent-soft: #e4e8ff; --link: #2d3dc4;
  --good: #0f7a58; --warn: #96560a; --bad: #b0213a;
  --shadow: 0 1px 2px rgba(20, 25, 50, .06), 0 10px 28px rgba(20, 25, 50, .07);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0f16; --surface: #141925; --surface2: #1b2231; --fg: #e8ecf6; --muted: #9ba5bb; --border: #283044;
  --accent: #8197ff; --accent2: #3fd8c9; --accent-fg: #0a0d18; --accent-soft: #1f2848; --link: #a3b3ff;
  --good: #4fd9a4; --warn: #f1b650; --bad: #ff8094;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
}
html[data-theme="reader"] {
  color-scheme: light;
  --bg: #f7f0e1; --surface: #fffaf0; --surface2: #efe4cc; --fg: #2a231b; --muted: #65584a; --border: #e0d1b3;
  --accent: #96441a; --accent2: #3d6b58; --accent-fg: #ffffff; --accent-soft: #f2dcc4; --link: #85390f;
  --good: #2f6a4f; --warn: #8a5300; --bad: #a3262c;
  --font: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --font-head: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --shadow: 0 1px 2px rgba(60, 40, 10, .08), 0 8px 22px rgba(60, 40, 10, .08);
  --measure: 66ch;
}
html { font-size: 100%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html[data-size="s"] { font-size: 93.75%; }
html[data-size="l"] { font-size: 112.5%; }
html[data-motion="reduce"] { scroll-behavior: auto; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font);
  line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
html[data-theme="reader"] body { line-height: 1.75; font-size: 1.0625rem; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4.5vw, 2.7rem); }
h2 { font-size: clamp(1.25rem, 2.6vw, 1.6rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img, svg, canvas { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
code, kbd, pre { font-family: var(--mono); font-size: .9em; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-fg); padding: .6em 1em; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
.narrow { max-width: 760px; }
.block { padding-block: clamp(24px, 5vw, 48px); }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.block-head h2 { margin: 0; }
.block.two { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 860px) { .block.two { grid-template-columns: 1.3fr 1fr; gap: 3rem; } }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 62ch; }
.hint { color: var(--muted); font-size: .9rem; }
.empty { color: var(--muted); padding: 1rem 0; }
.center-page { display: grid; place-items: center; min-height: 100vh; text-align: center; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.bar { display: flex; align-items: center; gap: .75rem 1.25rem; min-height: var(--header-h); flex-wrap: wrap; padding-block: 6px; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: 1.2rem; color: var(--fg); text-decoration: none; letter-spacing: -.02em; }
.brand b { color: var(--accent); }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a { padding: .45rem .8rem; border-radius: 3px; text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--fg); background: var(--surface2); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.tools { display: flex; gap: .35rem; align-items: center; margin-left: auto; }
.icon-btn { display: inline-grid; place-items: center; min-width: 42px; height: 42px; padding: 0 .6rem; border-radius: 3px; border: 1px solid transparent; background: transparent; color: var(--fg); cursor: pointer; font: inherit; text-decoration: none; }
.icon-btn:hover { background: var(--surface2); border-color: var(--border); }
.icon-btn.txt { font-size: .85rem; font-weight: 600; }
@media (max-width: 640px) {
  .bar { gap: 0 .5rem; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; margin-inline: -6px; padding-bottom: 4px; }
  .nav a { white-space: nowrap; }
  .tools { margin-left: auto; }
}

.popover { position: absolute; right: max(16px, env(safe-area-inset-right)); top: calc(100% + 6px); width: min(320px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; display: grid; gap: .9rem; }
.popover[hidden] { display: none; }
.popover fieldset { border: 0; padding: 0; margin: 0; }
.popover legend { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0; margin-bottom: .4rem; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 3px; overflow: hidden; background: var(--surface2); }
.seg button { flex: 1; border: 0; background: transparent; color: var(--fg); padding: .55rem .4rem; font: inherit; font-size: .88rem; cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.check { display: flex; gap: .5rem; align-items: center; font-size: .92rem; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); background:
  radial-gradient(900px 400px at 85% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
  radial-gradient(700px 380px at -5% 110%, color-mix(in srgb, var(--accent2) 18%, transparent), transparent 70%), var(--surface); }
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-inner { position: relative; padding-block: clamp(48px, 10vw, 110px); }
.hero h1 { max-width: 20ch; font-size: clamp(2.1rem, 6vw, 3.8rem); }
.hero .lede { margin-block: 1rem 1.6rem; }
.grad { background: linear-gradient(100deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 600; color: var(--accent); margin-bottom: .8rem; }
.cta { display: flex; gap: .6rem; flex-wrap: wrap; }
.js .hero-inner > * { animation: rise .8s cubic-bezier(.2, .7, .2, 1) both; }
.js .hero-inner > *:nth-child(2) { animation-delay: .08s; } .js .hero-inner > *:nth-child(3) { animation-delay: .16s; } .js .hero-inner > *:nth-child(4) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- buttons, tags, badges ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .65rem 1.1rem; border-radius: 3px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); text-decoration: none; font: inherit; font-weight: 600; cursor: pointer; min-height: 42px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.small { padding: .3rem .75rem; min-height: 32px; font-size: .85rem; }
.tag { display: inline-block; padding: .15rem .6rem; border-radius: 3px; background: var(--surface2); color: var(--muted); font-size: .8rem; text-decoration: none; border: 1px solid transparent; }
.tag:hover, .tag.on { color: var(--accent); border-color: var(--accent); }
.tag small { opacity: .7; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-block: 1rem 1.5rem; }
.badge { --c: var(--muted); display: inline-block; padding: .1rem .55rem; border-radius: 3px; font-size: .75rem; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); text-transform: uppercase; letter-spacing: .04em; }
.badge-verified, .badge-confirmed, .badge-released { --c: var(--good); }
.badge-likely, .badge-announced { --c: var(--accent); }
.badge-rumor { --c: var(--warn); }
.badge-opinion { --c: var(--muted); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; color: var(--muted); font-size: .85rem; }
.meta.big { font-size: .95rem; margin-bottom: 1.2rem; }
.notice { padding: .75rem 1rem; border-radius: 3px; background: var(--accent-soft); border: 1px solid var(--border); }
.notice.err { background: color-mix(in srgb, var(--bad) 12%, transparent); }

/* ---------- article cards (3 layouts) ---------- */
.cards { display: grid; gap: 1.25rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .25s, border-color .25s; }
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card-media { display: block; aspect-ratio: 16 / 9; background: var(--surface2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s; }
.card:hover .card-media img { transform: scale(1.04); }
.ph { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, hsl(var(--h) 70% 50%), hsl(calc(var(--h) + 60) 70% 35%)); }
.ph svg { width: 55%; }
.card-body { padding: 1rem 1.15rem 1.15rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.card h3 { margin: 0; font-size: 1.2rem; }
.card h3 a { color: var(--fg); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.summary { color: var(--muted); margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; padding-top: .4rem; }
.read { margin-left: auto; }

/* full / rich */
[data-layout="full"] .cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 1.6rem; }
[data-layout="full"] .card:first-child { grid-column: 1 / -1; }
[data-layout="full"] .card:first-child .card-media { aspect-ratio: 21 / 9; }
[data-layout="full"] .card:first-child h3 { font-size: clamp(1.4rem, 3vw, 2rem); }
[data-layout="full"] .card:first-child .summary { font-size: 1.1rem; max-width: 70ch; }
@media (min-width: 900px) { [data-layout="full"] .card:first-child { flex-direction: row; } [data-layout="full"] .card:first-child .card-media { flex: 1.3; aspect-ratio: auto; min-height: 320px; } [data-layout="full"] .card:first-child .card-body { flex: 1; justify-content: center; padding: 2rem; } }

/* informative */
[data-layout="informative"] .cards { grid-template-columns: 1fr; max-width: 920px; }
@media (min-width: 640px) { [data-layout="informative"] .card { flex-direction: row; } [data-layout="informative"] .card-media { width: 240px; flex: none; aspect-ratio: auto; min-height: 150px; } }

/* compact */
[data-layout="compact"] .cards { grid-template-columns: 1fr; gap: 0; max-width: 920px; border-top: 1px solid var(--border); }
[data-layout="compact"] .card { flex-direction: row; background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; transform: none !important; }
[data-layout="compact"] .card-media, [data-layout="compact"] .summary { display: none; }
[data-layout="compact"] .card-body { padding: .7rem .25rem; display: grid; grid-template-columns: auto 1fr; gap: .15rem .9rem; align-items: baseline; }
[data-layout="compact"] .card-body .meta { grid-row: 1 / span 2; min-width: 7.5rem; flex-direction: column; align-items: flex-start; gap: .2rem; }
[data-layout="compact"] .card h3 { font-size: 1.02rem; }
[data-layout="compact"] .tags { padding-top: 0; margin-top: 0; }
[data-layout="compact"] .read { display: none; }
[data-layout="compact"] .block { padding-block: 24px; }

/* ---------- reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); }
.js .reveal.in { opacity: 1; transform: none; }
html[data-motion="reduce"] .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after { animation: none !important; transition: none !important; }

/* ---------- search + lists ---------- */
.search { display: flex; gap: .5rem; max-width: 520px; margin-block: 1rem; }
.search input { flex: 1; }
input, select, textarea { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--border); border-radius: 3px; padding: .6rem .75rem; width: 100%; min-height: 42px; }
textarea { resize: vertical; font-family: var(--mono); font-size: .9rem; line-height: 1.5; }
input[type="checkbox"], input[type="range"] { width: auto; min-height: 0; accent-color: var(--accent); }
.ev-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.ev { display: grid; grid-template-columns: 6.2rem 1fr; gap: .75rem; padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 3px; align-items: start; }
.ev-date { font-weight: 700; color: var(--accent); font-size: .9rem; }
.want { padding-left: 1.2rem; margin: 0; display: grid; gap: .6rem; }

/* ---------- article page ---------- */
.post { padding-block: clamp(20px, 4vw, 40px) 64px; }
.post h1 { max-width: 24ch; }
.crumbs { color: var(--muted); font-size: .9rem; margin-bottom: .6rem; }
.post-hero { margin: 0 0 1.5rem; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.post-hero img { width: 100%; display: block; }
.tldr { font-size: 1.2rem; border-left: 4px solid var(--accent); padding: .3rem 0 .3rem 1rem; max-width: var(--measure); }
.levels { display: flex; gap: .4rem; flex-wrap: wrap; margin-block: 1.2rem; position: sticky; top: calc(var(--header-h) + 4px); z-index: 5; padding-block: .4rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); }
.levels button { border: 1px solid var(--border); background: var(--surface); color: var(--fg); border-radius: 3px; padding: .4rem .9rem; font: inherit; font-size: .9rem; cursor: pointer; }
.levels button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2em; padding-top: .3em; border-top: 1px solid var(--border); }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: .35em; }
.prose img { border-radius: 3px; height: auto; }
.prose blockquote { margin: 1.2em 0; padding: .2em 1em; border-left: 4px solid var(--border); color: var(--muted); }
.prose code { background: var(--surface2); padding: .12em .35em; border-radius: 3px; }
.prose pre { background: var(--surface2); padding: 1rem; border-radius: 3px; overflow-x: auto; border: 1px solid var(--border); }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: .4rem .7rem; }
.prose details { background: var(--surface); border: 1px solid var(--border); border-radius: 3px; padding: .6rem 1rem; margin-block: 1em; }
.lvl[hidden] { display: none; }
.demo-box, .sources, .related, .feedback { max-width: var(--measure); margin-top: 2.5rem; }
.demo-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; max-width: 760px; }
.sources ol { padding-left: 1.2em; }
.votes { display: flex; gap: .5rem; flex-wrap: wrap; }
.vote { display: inline-flex; gap: .4rem; align-items: center; padding: .55rem .95rem; border-radius: 3px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); font: inherit; font-size: .92rem; cursor: pointer; min-height: 42px; transition: transform .15s, border-color .15s, background .15s; }
.vote:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.vote:disabled { cursor: default; opacity: .7; }
.vote.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; opacity: 1; }
.vote-n { font-variant-numeric: tabular-nums; color: var(--muted); }
.vote.pop { animation: pop .4s; }
@keyframes pop { 50% { transform: scale(1.12); } }

/* ---------- forms ---------- */
.form { display: grid; gap: 1rem; max-width: 760px; }
.form label { display: grid; gap: .3rem; font-weight: 600; font-size: .92rem; }
.form label > input, .form label > select, .form label > textarea { font-weight: 400; }
.grid2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.editor { max-width: 900px; }
.preview { padding: 1rem; border: 1px dashed var(--border); border-radius: 3px; max-width: none; }
.table-wrap { overflow-x: auto; margin-bottom: 2rem; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.tbl .act { white-space: nowrap; display: flex; gap: .3rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding-block: 2rem 5rem; color: var(--muted); font-size: .88rem; }
.site-footer p { margin: 0 0 .4rem; }

/* ---------- roadmap ---------- */
.rm-controls { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between; margin-block: 1.2rem; }
.tabs { display: inline-flex; background: var(--surface2); border: 1px solid var(--border); border-radius: 3px; padding: 3px; }
.tabs button { border: 0; background: transparent; color: var(--fg); padding: .5rem 1rem; border-radius: 3px; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; }
.tabs button.on { background: var(--accent); color: var(--accent-fg); }
.tabs button { white-space: nowrap; }
@media (max-width: 420px) { .tabs button { padding: .5rem .6rem; font-size: .85rem; } }
.filters { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; font-size: .88rem; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--fg); border-radius: 3px; padding: .25rem .7rem; font: inherit; font-size: .82rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip::before { content: ""; display: inline-block; width: .6rem; height: .6rem; border-radius: 3px; margin-right: .4rem; background: var(--cat, var(--muted)); }
.filters label { display: inline-flex; gap: .4rem; align-items: center; }
.filters select { width: auto; min-height: 34px; padding: .2rem .5rem; }
.rm-app { min-height: 200px; }
.cal-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; flex-wrap: wrap; }
.cal-head h2 { margin: 0 auto 0 .4rem; font-size: 1.3rem; }
.cal-flex { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-dow { padding: .4rem; font-size: .75rem; text-transform: uppercase; color: var(--muted); text-align: center; background: var(--surface2); }
.cal-cell { min-height: 84px; padding: .3rem; border-top: 1px solid var(--border); border-left: 1px solid var(--border); font-size: .8rem; display: flex; flex-direction: column; gap: 2px; }
.cal-cell:nth-child(7n + 1) { border-left: 0; }
.cal-cell.out { background: color-mix(in srgb, var(--surface2) 55%, transparent); color: var(--muted); }
.cal-cell.today .cal-n { background: var(--accent); color: var(--accent-fg); }
.cal-n { align-self: flex-start; min-width: 1.5rem; text-align: center; border-radius: 3px; padding: 0 .25rem; font-weight: 600; }
.pill { display: block; width: 100%; text-align: left; border: 0; border-left: 4px solid var(--cat, var(--accent)); background: color-mix(in srgb, var(--cat, var(--accent)) 14%, var(--surface)); color: var(--fg); padding: 2px 6px; border-radius: 3px; font: inherit; font-size: .76rem; line-height: 1.25; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.fuzzy { border-left-style: dashed; background: transparent; border: 1px dashed var(--cat, var(--accent)); }
.pill:hover { filter: brightness(.96); outline: 1px solid var(--cat); }
@media (max-width: 640px) { .cal-cell { min-height: 56px; padding: 2px; } .cal-cell .pill { font-size: 0; height: 8px; padding: 0; border-radius: 3px; border-left-width: 0; background: var(--cat); } .cal-cell .pill.fuzzy { background: transparent; } }
.agenda { margin-top: 1.6rem; }
.agenda h3 { margin-bottom: .6rem; }
.agenda-item { display: grid; grid-template-columns: 6.5rem 1fr auto; gap: .8rem; align-items: center; width: 100%; text-align: left; padding: .7rem .9rem; border: 1px solid var(--border); border-left: 4px solid var(--cat); border-radius: 3px; background: var(--surface); color: var(--fg); font: inherit; cursor: pointer; margin-bottom: .5rem; }
.agenda-item:hover { border-color: var(--cat); }
.agenda-item .when { font-weight: 700; color: var(--accent); font-size: .85rem; }
.agenda-item .eta { color: var(--muted); font-size: .8rem; text-align: right; }
.agenda-item.next { background: var(--accent-soft); }
@media (max-width: 640px) { .agenda-item { grid-template-columns: 1fr; gap: .15rem; } .agenda-item .eta { text-align: left; } }

.tl-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.tl { position: relative; }
.tl-axis { position: relative; height: 42px; border-bottom: 1px solid var(--border); background: var(--surface2); }
.tl-tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border); padding: 4px 6px; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.tl-tick.year { border-left-color: var(--fg); color: var(--fg); font-weight: 700; }
.tl-lane { position: relative; border-bottom: 1px dashed var(--border); }
.tl-lane-label { position: sticky; left: 0; display: inline-block; z-index: 3; padding: 2px 8px; margin: 4px 0 0 4px; border-radius: 3px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-fg); background: var(--cat); }
.tl-item { position: absolute; display: flex; align-items: center; gap: 6px; height: 22px; border: 0; background: none; padding: 0; font: inherit; font-size: .78rem; color: var(--fg); cursor: pointer; white-space: nowrap; }
.tl-bar { height: 12px; min-width: 12px; border-radius: 3px; background: var(--cat); opacity: var(--op, 1); flex: none; }
.tl-item.fuzzy .tl-bar { background: repeating-linear-gradient(135deg, var(--cat) 0 6px, transparent 6px 10px); border: 1px solid var(--cat); }
.tl-item:hover .tl-label { text-decoration: underline; }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); z-index: 2; pointer-events: none; }
.tl-today::after { content: "today"; position: absolute; top: 44px; left: 4px; font-size: .7rem; color: var(--bad); font-weight: 700; }

.graph-wrap { position: relative; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: radial-gradient(circle at 50% 40%, var(--surface2), var(--surface)); height: min(72vh, 640px); min-height: 380px; touch-action: none; }
.graph-legend { position: absolute; left: 10px; bottom: 10px; display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .74rem; background: color-mix(in srgb, var(--surface) 82%, transparent); padding: .35rem .6rem; border-radius: 3px; z-index: 2; max-width: calc(100% - 20px); }
.graph-legend i { display: inline-block; width: .6rem; height: .6rem; border-radius: 3px; margin-right: .3rem; background: var(--cat); }
.graph-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 2rem; color: var(--muted); }
.graph-tip { position: absolute; right: 10px; top: 10px; z-index: 2; font-size: .74rem; color: var(--muted); background: color-mix(in srgb, var(--surface) 82%, transparent); padding: .3rem .6rem; border-radius: 3px; }

.rm-detail { position: fixed; z-index: 60; right: 16px; bottom: 16px; width: min(420px, calc(100vw - 32px)); max-height: min(78vh, 640px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); padding: 1.1rem 1.2rem; }
.rm-detail[hidden] { display: none; }
.rm-detail h3 { margin-right: 2rem; }
.rm-detail .close { position: absolute; right: 8px; top: 8px; }
.rm-detail ul { padding-left: 1.1em; margin-top: 0; }
.conf-bar { height: 8px; border-radius: 3px; background: var(--surface2); overflow: hidden; margin: .3rem 0 .8rem; }
.conf-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--warn), var(--good)); }
@media (max-width: 640px) { .rm-detail { right: 8px; left: 8px; bottom: 8px; width: auto; max-height: 70vh; } }

/* ---------- demos ---------- */
.demo { display: grid; gap: .9rem; }
.demo .bars { display: grid; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: 7rem 1fr 3.6rem; gap: .6rem; align-items: center; font-family: var(--mono); font-size: .85rem; }
.bar-track { height: 18px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .45s cubic-bezier(.2, .7, .2, 1); }
.demo .prompt { font-family: var(--mono); background: var(--surface2); padding: .6rem .8rem; border-radius: 3px; }
.demo .prompt b { color: var(--accent); }
.demo .slider { display: grid; gap: .3rem; }
.demo .slider input { width: 100%; }
@media (max-width: 480px) { .bar-row { grid-template-columns: 5rem 1fr 3.2rem; font-size: .78rem; } }

/* ---------- news feed window ---------- */
.fw { position: fixed; z-index: 55; right: 16px; bottom: 16px; width: 360px; height: 480px; min-width: 260px; min-height: 220px; max-width: 96vw; max-height: 92vh; resize: both; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0, 0, 0, .28); }
.fw[hidden] { display: none; }
.fw-head { display: flex; align-items: center; gap: .3rem; padding: .35rem .5rem; background: var(--surface2); border-bottom: 1px solid var(--border); cursor: move; user-select: none; touch-action: none; }
.fw-head strong { font-size: .85rem; margin-right: auto; padding-left: .3rem; }
.fw-head button { border: 0; background: transparent; color: var(--fg); cursor: pointer; width: 30px; height: 30px; border-radius: 3px; font-size: .95rem; }
.fw-head button:hover { background: var(--border); }
.fw-inner { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.fw-bar { display: flex; gap: .4rem; padding: .5rem; border-bottom: 1px solid var(--border); }
.fw-bar select { min-height: 34px; padding: .2rem .5rem; font-size: .85rem; }
.fw-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.fw-list li { padding: .65rem .8rem; border-bottom: 1px solid var(--border); }
.fw-list a { color: var(--fg); font-weight: 600; text-decoration: none; display: block; font-size: .92rem; line-height: 1.3; }
.fw-list a:hover { color: var(--accent); }
.fw-list time { font-size: .72rem; color: var(--muted); }
.fw-list p { margin: .25rem 0 0; font-size: .82rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fw[data-size="s"] .fw-list p, .widget-page.tight .fw-list p { display: none; }
.fw-status { padding: .6rem .8rem; color: var(--muted); font-size: .85rem; }
.widget-page { margin: 0; height: 100vh; }
.widget-page .fw-inner { height: 100vh; }
@media (max-width: 700px) {
  .fw { left: 8px; right: 8px; bottom: 8px; width: auto !important; height: 62vh !important; resize: none; }
  .fw-head { cursor: default; }
}

/* ---------- misc ---------- */
@media print { .site-header, .site-footer, .fw, .votes, .levels { display: none !important; } body { background: #fff; color: #000; } }

/* ---------- update history, benchmark comparison, tools directory ---------- */
.updates { max-width: 760px; margin: 1rem 0; padding: .8rem 1.1rem; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius) var(--radius) 0; }
.updates h2 { font-size: 1rem; margin: 0 0 .4rem; }
.updates ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; font-size: .93rem; }
.updates time { font-weight: 600; margin-right: .4rem; white-space: nowrap; }
.bench .cmp { list-style: none; margin: .4rem 0 0; padding: 0; font-size: .82rem; display: grid; gap: .15rem; }
.tools-group { margin: 1.8rem 0 .8rem; font-size: 1.15rem; }
.tools-group:first-of-type { margin-top: 1.2rem; }

/* ---------- fact sheet ---------- */
.facts { max-width: 760px; margin: 1.2rem 0; padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); }
.facts h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .7rem; }
.facts dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem 1.2rem; margin: 0; }
.facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.facts dd { margin: .1rem 0 0; font-weight: 600; }
.bench { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: .92rem; display: block; overflow-x: auto; }
.bench th, .bench td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.bench th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.bench td small { display: block; color: var(--muted); font-size: .8rem; }
.bench .num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }

/* ---------- KV-cache calculator ---------- */
.demo-box.wide { max-width: none; }
.kv { display: grid; gap: 1.2rem; }
.kv-grid { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 860px) { .kv-grid { grid-template-columns: 1.2fr 1fr; } }
.kv-panel, .kv-result { display: grid; gap: .8rem; align-content: start; }
.kv h3 { margin: 0; font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kv label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
.kv-fields { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kv-fields label[hidden] { display: none; }
.kv-big { font-size: clamp(2.2rem, 7vw, 3.4rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.kv-stack { display: flex; height: 18px; background: var(--surface2); border-radius: var(--radius); overflow: hidden; }
.kv-stack i, .kv-legend i { display: inline-block; }
.kv-full { background: var(--accent); } .kv-slide { background: var(--accent2); } .kv-lin { background: var(--warn); }
.kv-legend { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; font-size: .85rem; }
.kv-legend i { width: .7rem; height: .7rem; border-radius: 2px; vertical-align: -1px; }
.kv-fit { margin: 0; font-weight: 600; }
.kv-fit.ok { color: var(--good); } .kv-fit.bad { color: var(--bad); }
.kv-work { background: var(--surface2); padding: .8rem 1rem; border-radius: var(--radius); overflow-x: auto; font-size: .82rem; margin: .6rem 0 0; }
.kv-details summary { cursor: pointer; font-weight: 600; }
.kv-compare { display: grid; gap: .35rem; }
.kv-row { display: grid; grid-template-columns: minmax(7rem, 14rem) 1fr 6rem; gap: .7rem; align-items: center; font-size: .88rem; }
.kv-row.sel .kv-name { font-weight: 700; color: var(--accent); }
.kv-track { height: 14px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
.kv-track i { display: block; height: 100%; background: var(--muted); }
.kv-row.sel .kv-track i { background: var(--accent); }
.kv-val { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .kv-row { grid-template-columns: 1fr 5rem; } .kv-track { grid-column: 1 / -1; order: 3; } }
.tools-list { max-width: 920px; grid-template-columns: 1fr; }

/* ---------- delta-rule demo ---------- */
.dr { display: grid; gap: 1rem; }
.dr-controls { display: grid; gap: .8rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: end; }
.dr-controls label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
.dr-controls label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.dr-controls .slider input { width: 100%; }
.dr-panels { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .dr-panels { grid-template-columns: 1fr 1fr; } }
.dr-panel { display: grid; gap: .5rem; align-content: start; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; }
.dr-panel h3 { margin: 0; font-size: 1.05rem; }
.dr-panel .hint { margin: 0; font-family: var(--mono); font-size: .78rem; }
.dr-heat { width: min(100%, 224px); aspect-ratio: 1; image-rendering: pixelated; border: 1px solid var(--border); border-radius: var(--radius); }
.dr-mean { font-weight: 700; font-variant-numeric: tabular-nums; }
.dr-mean.good { color: var(--good); } .dr-mean.mid { color: var(--warn); } .dr-mean.bad { color: var(--bad); }
.dr-bars { display: flex; align-items: flex-end; gap: 3px; height: 96px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.dr-bar { position: relative; flex: 1; max-width: 26px; height: 100%; display: flex; align-items: flex-end; }
.dr-bar i { display: block; width: 100%; background: var(--good); border-radius: 2px 2px 0 0; min-height: 1px; transition: height .3s; }
.dr-bar.mid i { background: var(--warn); } .dr-bar.bad i { background: var(--bad); } .dr-bar.none i { background: var(--border); min-height: 2px; }
.dr-bar small { position: absolute; bottom: -15px; left: 0; right: 0; text-align: center; font-size: .62rem; color: var(--muted); }
.dr-summary { margin: 0; font-weight: 600; }

/* ---------- feed thumbnails ---------- */
.fw-list li.has-thumb { display: grid; grid-template-columns: 64px 1fr; gap: .7rem; align-items: start; }
.fw-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius); background: var(--surface2); border: 1px solid var(--border); }
.fw-body { min-width: 0; }

/* ---------- terminal replay ---------- */
.term-box { max-width: 900px; margin-top: 2.5rem; }
.term-box > h2 { padding-top: .6em; border-top: 1px solid var(--border); }
.term-desc { margin-top: 0; }
.term-stage { display: flex; gap: 8px; height: 440px; min-height: 220px; max-width: 100%; resize: vertical; overflow: hidden; background: #0d1117; border: 1px solid var(--border); border-radius: var(--radius); }
.term-stage:fullscreen { resize: none; height: 100vh !important; width: 100vw; border: 0; border-radius: 0; }
.term-pane { position: relative; flex: 1 1 60%; min-width: 0; overflow: hidden; background: #0d1117; }
.term-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.term-inner .xterm { padding: 0; }
.term-inner .xterm-viewport { overflow: hidden !important; }
.term-media { flex: 1 1 40%; min-width: 0; display: grid; place-items: center; background: #161b22; overflow: hidden; }
.term-media img, .term-media video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.term-media-empty { padding: 1rem; text-align: center; color: #8b949e; }
.term-overlay { position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; gap: .3rem; justify-items: center; border: 0; background: rgba(13, 17, 23, .72); color: #fff; cursor: pointer; font: inherit; }
.term-overlay[hidden] { display: none; }
.term-overlay span { font-size: 3rem; line-height: 1; }
.term-overlay:hover span { transform: scale(1.1); }
.term-bar { display: flex; flex-wrap: wrap; gap: .5rem .7rem; align-items: center; margin: .6rem 0; }
.term-bar input[type="range"] { flex: 1 1 140px; min-width: 120px; }
.term-bar .check { display: inline-flex; gap: .3rem; align-items: center; font-size: .85rem; }
.term-bar select { width: auto; min-height: 34px; padding: .2rem .5rem; }
.term-clock { font-variant-numeric: tabular-nums; min-width: 6.5rem; text-align: center; }
.term-steps { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .6rem; counter-reset: step; }
.term-step { counter-increment: step; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: var(--radius); padding: .6rem .8rem; }
.term-step.on { border-left-color: var(--accent); background: var(--accent-soft); }
.term-jump { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--fg); cursor: pointer; text-align: left; }
.term-jump:hover { color: var(--accent); }
.term-note { margin: .3rem 0 0; font-size: .9rem; color: var(--muted); }
.term-cmd { display: flex; gap: .6rem; align-items: flex-start; margin-top: .4rem; }
.term-cmd pre { flex: 1; margin: 0; min-width: 0; padding: .5rem .7rem; background: #0d1117; color: #e6edf3; border-radius: var(--radius); overflow-x: auto; font-size: .85rem; }
.term-cmd code { background: none; padding: 0; color: inherit; }
.term-risk { margin: .4rem 0 0; font-size: .85rem; font-weight: 600; }
.term-risk.danger { color: var(--bad); }
.term-risk.info { color: var(--muted); font-weight: 400; }
.term-transcript { margin-top: .6rem; }
.term-transcript pre { max-height: 320px; overflow: auto; background: var(--surface2); padding: .8rem; border-radius: var(--radius); font-size: .8rem; }
@media (max-width: 700px) { .term-stage { flex-direction: column; height: 520px; } .term-pane, .term-media { flex: 1 1 50%; } }

.term-box.term-wide { max-width: none; }
.term-box.term-wide .term-stage { height: min(78vh, 820px); }

/* ---------- live Python terminal ---------- */
.py-stage { height: 380px; }
.py-pane { display: block; }
.py-pane .xterm { height: 100%; padding: 8px 10px; }
.py-pane .xterm-viewport { background-color: transparent !important; }
.term-tabs { margin: .4rem 0 .8rem; }
.pyterm[hidden], .term[hidden] { display: none; }
.pyterm .term-steps .term-cmd { align-items: center; }

/* ---------- tokenizer demo ---------- */
.tk { display: grid; gap: 1.2rem; }
.tk textarea { width: 100%; font-family: var(--mono); font-size: .9rem; resize: vertical; }
.tk-stats { display: grid; gap: .2rem; font-size: .92rem; }
.tk-chips { display: flex; flex-wrap: wrap; gap: 2px; font-family: var(--mono); font-size: .85rem; line-height: 1.6; padding: .5rem; background: var(--surface2); border-radius: var(--radius); min-height: 2.4rem; max-height: 22rem; overflow: auto; }
.tk-chip { padding: 0 .25rem; border-radius: 2px; white-space: pre; color: var(--fg); }
.tk-chip.c0 { background: color-mix(in srgb, var(--accent) 28%, transparent); } .tk-chip.c1 { background: color-mix(in srgb, var(--accent2) 30%, transparent); }
.tk-chip.c2 { background: color-mix(in srgb, var(--warn) 32%, transparent); } .tk-chip.c3 { background: color-mix(in srgb, var(--good) 28%, transparent); }
.tk-chip.c4 { background: color-mix(in srgb, var(--bad) 22%, transparent); } .tk-chip.c5 { background: color-mix(in srgb, var(--muted) 28%, transparent); }
.tk-merges { columns: 2 16rem; font-size: .85rem; margin: .6rem 0 0; padding-left: 2rem; }
.tk-merges li.off { opacity: .35; }

/* ---------- robot arm demo ---------- */
.ra { display: grid; gap: 1.2rem; grid-template-columns: 1fr; align-items: start; }
.ra-stage { display: grid; gap: .6rem; }
.ra-canvas { width: 100%; height: auto; max-width: 560px; aspect-ratio: 560 / 420; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); touch-action: none; cursor: crosshair; }
.ra-plot { width: 100%; height: auto; max-width: 560px; aspect-ratio: 560 / 110; }
.ra-controls { display: grid; gap: .7rem; align-content: start; }
.ra-controls label { display: grid; gap: .25rem; font-weight: 600; font-size: .9rem; }
.ra-controls label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.ra-controls input[type="range"] { width: 100%; }
.ra-info { display: grid; gap: .25rem; font-size: .92rem; font-variant-numeric: tabular-nums; }
@media (min-width: 960px) { .ra { grid-template-columns: minmax(0, 560px) minmax(260px, 1fr); } }

/* ---------- shared table states ---------- */
.tbl tr.sel td { background: var(--accent-soft); font-weight: 600; }
.tbl td.good { color: var(--good); } .tbl td.bad { color: var(--bad); }
.tk input[type="range"] { width: 100%; }
.kv .row > input, .kv .row > select { width: auto; flex: 1 1 6rem; min-width: 0; }
.lint { max-width: 760px; margin: 1rem 0; padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.lint h3 { margin: 0 0 .4rem; font-size: 1rem; }
.lint ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .25rem; font-size: .9rem; }
.lint .lint-warn::marker { color: var(--bad); } .lint .lint-info::marker { color: var(--muted); }
