:root {
  --bg: #f4f1ea; --paper: #fffdf8; --ink: #1b2430; --muted: #5d6877; --line: #ddd6c7;
  --brand: #16202c; --accent: #c9822b; --accent-ink: #fff; --ok: #2f7d57; --warn: #b4531f; --bad: #b3261e;
  --tech: #2f6fb0; --case: #7a4fa3; --vendor: #b4531f;
  --radius: 10px; --shadow: 0 1px 2px rgba(22, 32, 44, .08), 0 6px 18px rgba(22, 32, 44, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11171f; --paper: #19222d; --ink: #e9e5da; --muted: #9aa6b4; --line: #2b3745;
    --brand: #0c1117; --accent: #e0a04a; --accent-ink: #1b1204; --ok: #5fc08e; --warn: #e08a52; --bad: #ff8a80;
    --tech: #7db2e8; --case: #c4a0e8; --vendor: #e08a52;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* author `display` rules would otherwise override the hidden attribute */
html { color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 "Iowan Old Style", "Palatino Linotype", Georgia, serif; -webkit-text-size-adjust: 100%; }
h1, h2, h3, .brand, nav a, button, label, .badge, .meta, input, select, textarea, .tabs, .ts { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: var(--brand); color: #f3efe4; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; text-decoration: none; font-size: 18px; }
.mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--accent) 0 50%, #f3efe4 50% 100%); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .18); }
nav { display: flex; gap: 8px; align-items: center; }
nav a { text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 14px; color: #d6d2c6; }
nav a.active { background: rgba(255, 255, 255, .1); color: #fff; }
nav a.cta { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
main { width: min(960px, 100%); margin: 0 auto; padding: 18px 16px calc(120px + env(safe-area-inset-bottom, 0px)); }
h1 { font-size: clamp(24px, 5vw, 34px); line-height: 1.15; margin: 4px 0 6px; text-wrap: balance; }
h2 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 26px 0 8px; }
h3 { font-size: 16px; margin: 0 0 4px; }
.meta { color: var(--muted); font-size: 14px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.list { display: grid; gap: 10px; }
.item { display: block; text-decoration: none; }
.item .row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.item h3 { font-size: 17px; font-family: inherit; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0 14px; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
textarea { min-height: 84px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
button, .btn { font-size: 15px; font-weight: 600; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 8px; padding: 10px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.danger { color: var(--bad); }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; min-height: 0; border-radius: 999px; font-size: 13px; }
.chip.on { background: var(--brand); color: #f3efe4; border-color: var(--brand); }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; }
.badge.technical { color: var(--tech); } .badge.case_study { color: var(--case); } .badge.vendor_pitch { color: var(--vendor); }
.badge.processing, .badge.queued { color: var(--accent); } .badge.error { color: var(--bad); } .badge.done { color: var(--ok); } .badge.draft { color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 8px 0 2px; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.panel { display: grid; gap: 10px; }
.rec { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } .bar > i { transition: none; } }
.timer { font: 600 28px/1 ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }
.meter { flex: 1; min-width: 120px; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--ok); }
video.cam { width: 100%; max-height: 52vh; border-radius: var(--radius); background: #000; object-fit: contain; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 84px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 14px; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; min-height: 40px; color: var(--muted); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.prose p { margin: 0 0 12px; }
.prose ul { padding-left: 20px; margin: 0 0 12px; }
.slides { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.slide img, .inline-slide img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); display: block; background: #000; }
.slide .note { font-size: 14px; color: var(--muted); margin-top: 6px; }
.ts { font-size: 12px; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 0 4px 0 0; min-height: 0; cursor: pointer; font-variant-numeric: tabular-nums; }
.transcript .seg { margin: 0 0 8px; }
.transcript .seg.now { background: color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 6px; }
.inline-slide { margin: 18px 0 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.inline-slide h3 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.inline-slide blockquote { margin: 8px 0 0; padding-left: 10px; border-left: 3px solid var(--accent); color: var(--muted); font-size: 15px; }
.player { position: fixed; left: 0; right: 0; bottom: 0; background: var(--brand); padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 9; }
.player audio { width: 100%; max-width: 960px; display: block; margin: 0 auto; height: 40px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.err { color: var(--bad); font-family: system-ui, sans-serif; font-size: 14px; }
.warn { color: var(--warn); font-family: system-ui, sans-serif; font-size: 14px; }
#toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 999px; font: 14px system-ui, sans-serif; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 20; }
#toast.show { opacity: 1; }
@media print { .top, .player, .toolbar button, #toast { display: none; } body { background: #fff; color: #000; } }
.part-divider { margin: 18px 0 10px; text-align: center; color: var(--muted); font: 600 13px system-ui, sans-serif; letter-spacing: .04em; border-top: 1px dashed var(--line); padding-top: 10px; }
button.chip.danger { color: var(--bad); }
.section { margin: 14px 0 6px; padding-top: 4px; }
.section h3 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.prose .chips { margin: 4px 0 14px; }
.prose p .ts { margin-right: 6px; }
