:root {
  --bg: #f7f7f4; --surface: #ffffff; --surface-2: #f0f0ec; --text: #1b1d1f; --muted: #5d6166; --line: #e2e2dc;
  --accent: #3346c4; --accent-ink: #ffffff; --accent-soft: #e8ebfb; --warn: #8a5a00; --warn-soft: #fff4dc;
  --shadow: 0 1px 2px rgba(20, 24, 28, .05), 0 8px 30px rgba(20, 24, 28, .07);
  --radius: 16px; --max: 1080px; --read: 720px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111314; --surface: #1a1d1f; --surface-2: #222628; --text: #ecedee; --muted: #a2a7ab; --line: #2d3235;
    --accent: #93a3ff; --accent-ink: #0b1030; --accent-soft: #1d2340; --warn: #f2c063; --warn-soft: #33290f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111314; --surface: #1a1d1f; --surface-2: #222628; --text: #ecedee; --muted: #a2a7ab; --line: #2d3235;
  --accent: #93a3ff; --accent-ink: #0b1030; --accent-soft: #1d2340; --warn: #f2c063; --warn-soft: #33290f;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img, svg, video { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* Header */
.site-head { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.site-head .wrap { display: flex; align-items: center; gap: 20px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand svg { width: 28px; height: 28px; flex: none; }
.nav { display: flex; gap: 18px; margin-left: auto; align-items: center; font-size: 15px; }
.nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.nav a:hover, .nav a[aria-current] { color: var(--text); }
.langs { display: flex; gap: 4px; }
.langs a { font-size: 13px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; }
.langs a[aria-current] { background: var(--surface-2); }
.nav > a.only-sm { display: none; }
@media (max-width: 720px) { .nav > a { display: none; } .nav { gap: 12px; } .nav > a.only-sm { display: inline; } }

/* Hero */
.hero { padding: 44px 0 8px; text-align: center; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.12; letter-spacing: -.025em; margin: 0 auto 14px; max-width: 820px; }
.hero .lede { font-size: clamp(17px, 2.2vw, 19px); color: var(--muted); max-width: 680px; margin: 0 auto 18px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 26px; padding: 0; list-style: none; }
.chips li { display: flex; align-items: center; gap: 6px; font-size: 14px; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--text); }
.chips svg { width: 15px; height: 15px; color: var(--accent); }

/* Tool card */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 20px; max-width: 860px; margin: 0 auto; text-align: left; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
@media (max-width: 560px) { .opts { grid-template-columns: 1fr; } }
.field { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field select { font: inherit; font-size: 15px; font-weight: 500; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 34px 9px 12px; appearance: none; width: 100%;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.drop { display: grid; justify-items: center; gap: 6px; padding: 38px 16px; border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: var(--radius); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); cursor: pointer; text-align: center; transition: background .15s, border-color .15s; }
.drop:hover, .drop.over { background: var(--accent-soft); border-color: var(--accent); }
.drop.disabled { opacity: .5; pointer-events: none; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.drop svg { width: 40px; height: 40px; color: var(--accent); }
.drop strong { font-size: 18px; }
.btn { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 15px; font-weight: 600; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn.small { font-size: 14px; padding: 7px 12px; }
.drop small { color: var(--muted); font-size: 13px; }
.tool-note { font-size: 13px; color: var(--muted); margin: 10px 2px 0; }

.run { padding: 6px 2px 2px; }
.run-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 14px 0 10px; }
.bar span { display: block; height: 100%; width: 2%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.tool.busy .bar span { background-image: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent); background-size: 200px 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: -200px 0; } to { background-position: 200px 0; } }
@media (prefers-reduced-motion: reduce) { .tool.busy .bar span { animation: none; } }
.status { margin: 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.plan { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.notice { margin: 12px 0 0; font-size: 13px; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); }

.result { margin-top: 16px; }
.player { margin-bottom: 12px; }
.player audio { width: 100%; }
.player video { width: 100%; max-height: 360px; border-radius: 12px; background: #000; }
.done { font-weight: 600; margin: 0 0 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.hint { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.transcript { list-style: none; margin: 0; padding: 4px; max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.transcript li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 7px 8px; border-radius: 8px; }
.transcript li.now { background: var(--accent-soft); }
.ts { font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--accent); background: none; border: 0; padding: 1px 0; cursor: pointer; text-align: left; align-self: start; }
.tx { outline: none; border-radius: 4px; }
.tx:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent); }

/* Content */
main section.block { padding: 46px 0 0; }
.read { max-width: var(--read); margin: 0; }
.wrap.read { max-width: var(--max); margin: 0 auto; }
.wrap.read > * { max-width: var(--read); }
.wrap.read > h2:not(:first-child) { margin-top: 36px; }
h2 { font-size: clamp(23px, 3vw, 29px); letter-spacing: -.015em; line-height: 1.25; margin: 0 0 14px; }
h3 { font-size: 18px; margin: 22px 0 6px; }
.read p, .read li { color: var(--text); }
.read p { margin: 0 0 14px; }
.steps { counter-reset: s; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: var(--max); margin: 0 auto; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; margin-bottom: 10px; }
.steps strong { display: block; margin-bottom: 4px; }
.steps span { color: var(--muted); font-size: 15px; }
/* Bento: measured facts. The first tile is the large one. */
.facts { display: grid; grid-template-columns: 1.3fr 1fr; grid-template-rows: auto auto; gap: 14px; margin: 18px 0 10px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; align-content: end; gap: 4px; }
.fact:first-child { grid-row: span 2; background: var(--accent-soft); border-color: transparent; padding: 26px; }
.fact b { display: block; font-size: 30px; line-height: 1.1; letter-spacing: -.03em; }
.fact:first-child b { font-size: clamp(44px, 7vw, 64px); color: var(--accent); }
.fact span { color: var(--muted); font-size: 14px; }
@media (max-width: 640px) { .facts { grid-template-columns: 1fr; } .fact:first-child { grid-row: auto; } }
.lede-sm { font-size: 18px; color: var(--muted); }
.page-head { padding: 40px 0 6px; }
.page-head h1 { font-size: clamp(28px, 4.4vw, 40px); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 8px; }
.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.crumbs a { color: var(--muted); }
table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 6px 0 16px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 6px 0 16px; }
.table-wrap table { margin: 0; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 600; padding: 10px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-weight: 700; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 12px; color: var(--muted); }
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; max-width: var(--max); margin: 0 auto; }
.related a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; }
.related a span { display: block; font-weight: 400; color: var(--muted); font-size: 14px; }
.related a:hover { border-color: var(--accent); }
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 16px 18px; margin: 18px 0; }

/* Footer */
.site-foot { margin-top: 64px; border-top: 1px solid var(--line); padding: 30px 0 40px; font-size: 14px; color: var(--muted); }
.foot-grid { display: grid; grid-template-columns: 1.3fr 2fr 1fr 1fr; gap: 22px; }
.foot-grid .cols { display: block; columns: 2; column-gap: 22px; }
.foot-grid .cols li { margin-bottom: 5px; break-inside: avoid; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-grid > div:nth-child(2) { grid-column: 1 / -1; } }
.site-foot .foot-h { color: var(--text); font-size: 14px; letter-spacing: 0; margin: 0 0 8px; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--text); }
.credit { margin-top: 22px; font-size: 13px; }
@media (max-width: 560px) { .transcript li { grid-template-columns: 46px 1fr; gap: 8px; } .tool { padding: 16px; } }

/* Video tool */
.file-card { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 640px) { .file-card { grid-template-columns: 1fr; } }
.preview { position: relative; border-radius: 12px; overflow: hidden; background: #0d0f14; aspect-ratio: 16 / 9; display: grid; place-items: center; }
.preview video { width: 100%; height: 100%; object-fit: contain; display: block; }
.preview .nopreview { color: #c9cdd6; font-size: 14px; padding: 16px; text-align: center; }
.meta { display: grid; gap: 6px; }
.meta .fname { font-size: 16px; }
.meta .facts-line { color: var(--muted); font-size: 14px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); margin-right: 6px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0; }
.chip { font: inherit; font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; }
.chip small { font-weight: 500; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip[aria-pressed="true"] small { color: inherit; opacity: .85; }
.chip input { width: 64px; font: inherit; border: 0; background: transparent; color: inherit; padding: 0; text-align: right; }
.chip input:focus { outline: none; }
.chip input::placeholder { color: var(--muted); font-weight: 600; }
.chip input::-webkit-outer-spin-button, .chip input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.chip input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.meta .linkish { justify-self: start; }
.panel { display: grid; gap: 10px; margin-top: 14px; }
.panel .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.estimate { font-size: 14px; color: var(--muted); margin: 0; }
.estimate.bad { color: var(--warn); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.trimrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.trimrow label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.trimrow .pair { display: flex; gap: 6px; }
.trimrow .pair .btn { white-space: nowrap; flex: none; }
.trimrow input { font: inherit; font-size: 15px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.go { margin-top: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn.big { font-size: 17px; padding: 12px 22px; border-radius: 12px; }
.linkish { font: inherit; font-size: 14px; background: none; border: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; padding: 0; }
.outcome { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 640px) { .outcome { grid-template-columns: 1fr; } }
.stats { display: grid; gap: 10px; align-content: start; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 22px; letter-spacing: -.02em; }
.stat.main { background: var(--accent-soft); }
.stat.main b { font-size: 30px; color: var(--accent); }
.stat span { font-size: 13px; color: var(--muted); }
.err { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .segmented { grid-template-columns: 1fr; } }
.segmented button { font: inherit; text-align: left; display: grid; gap: 2px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; }
.segmented button strong { font-size: 15px; }
.segmented button small { font-size: 13px; color: var(--muted); }
.segmented button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.panel.tight { margin-top: 0; gap: 6px; }
