:root {
  color-scheme: light;
  --paper: #f7f5ed;
  --paper-2: #efede3;
  --surface: #fffef9;
  --ink: #181817;
  --muted: #6d6a61;
  --line: #d9d5c9;
  --yellow: #f2c200;
  --yellow-soft: #ffed8a;
  --success: #147d53;
  --warning: #9f5a00;
  --danger: #b43b32;
  --shadow: 0 22px 60px rgb(38 35 24 / 10%);
  --display: 'Aptos Display', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --body: 'Aptos', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Cascadia Mono', 'SFMono-Regular', Consolas, ui-monospace, monospace;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #111210;
  --paper-2: #191a17;
  --surface: #20211d;
  --ink: #f6f4ea;
  --muted: #aaa79d;
  --line: #383a34;
  --yellow: #f3c51b;
  --yellow-soft: #5a4d13;
  --success: #65d6a5;
  --warning: #ffc25f;
  --danger: #ff877e;
  --shadow: 0 25px 70px rgb(0 0 0 / 35%);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .22; background-image: radial-gradient(var(--line) .7px, transparent .7px); background-size: 22px 22px; mask-image: linear-gradient(to bottom, #000, transparent 70%); }
a { color: inherit; text-underline-offset: .22em; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
[hidden] { display: none !important; }

.skip-link { position: fixed; top: 10px; left: 10px; z-index: 100; padding: .65rem .9rem; background: var(--ink); color: var(--paper); transform: translateY(-160%); border-radius: 4px; }
.skip-link:focus { transform: translateY(0); }
.site-header { width: min(1180px, calc(100% - 40px)); min-height: 82px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; font: 700 1rem var(--display); text-decoration: none; letter-spacing: -.02em; }
.caption-mark { display: inline-grid; place-items: center; min-width: 34px; height: 25px; padding: 0 6px; border-radius: 3px; background: var(--ink); color: var(--yellow); font: 700 .72rem var(--mono); letter-spacing: -.08em; }
.site-nav { display: flex; align-items: center; gap: 25px; color: var(--muted); font-size: .9rem; font-weight: 600; }
.site-nav a, .site-footer a { text-decoration: none; }
.site-nav a:hover, .site-footer a:hover { color: var(--ink); text-decoration: underline; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 15%, transparent); }
.theme-toggle { justify-self: end; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: .82rem; font-weight: 600; }
.theme-toggle:hover { border-color: var(--ink); color: var(--ink); }
.theme-icon { position: relative; display: block; width: 15px; height: 15px; border: 2px solid currentColor; border-radius: 50%; }
.theme-icon::after { content: ''; position: absolute; width: 8px; height: 12px; right: -4px; top: -3px; background: var(--paper); border-radius: 50%; }
:root[data-theme='dark'] .theme-icon::after { display: none; }

.landing-main { width: min(1120px, calc(100% - 40px)); margin: 78px auto 85px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); gap: clamp(60px, 9vw, 120px); align-items: center; }
.hero { max-width: 720px; }
.subtitle-chip { display: inline-block; margin: 0 0 20px; padding: 5px 8px; border-radius: 3px; background: var(--ink); color: var(--yellow); font: 600 .7rem/1.2 var(--mono); letter-spacing: .08em; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.045em; line-height: .98; }
h1 { margin: 0; font-size: clamp(3.45rem, 7vw, 6.5rem); font-weight: 750; font-stretch: condensed; }
h1 span { color: var(--muted); font-weight: 500; }
.hero-copy { max-width: 600px; margin: 24px 0 35px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.16rem); }

.transcript-form { padding: clamp(20px, 3vw, 28px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.field-group label, .choice-group legend { display: block; margin-bottom: 8px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.choice-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.url-field, .select-shell { position: relative; }
.url-field input, .select-shell select { width: 100%; height: 53px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.url-field input { padding: 0 15px 0 47px; font-family: var(--mono); font-size: .88rem; }
.url-field input::placeholder { color: var(--muted); opacity: .75; }
.url-field:focus-within input, .select-shell:focus-within select { border-color: var(--ink); }
.link-glyph { position: absolute; z-index: 1; left: 17px; top: 18px; width: 18px; height: 9px; border: 2px solid var(--muted); border-radius: 8px; transform: rotate(-40deg); }
.link-glyph::after { content: ''; position: absolute; left: 8px; top: 3px; width: 18px; height: 9px; border: 2px solid var(--muted); border-radius: 8px; }
.input-meta { display: flex; justify-content: space-between; gap: 20px; margin-top: 8px; }
.field-hint, .field-error, .detection-note, .challenge-note, .form-status, .copy-status { min-height: 1.2em; margin: 0; font-size: .76rem; color: var(--muted); }
.detection-note { color: var(--success); text-align: right; font-weight: 600; }
.field-error { margin-top: 3px; color: var(--danger); }
.choice-grid { display: grid; grid-template-columns: 1.15fr .9fr .9fr; gap: 14px; margin-top: 22px; }
.segmented-control { display: grid; grid-template-columns: repeat(3, 1fr); height: 45px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.segmented-control label { display: block; margin: 0; text-transform: none; letter-spacing: 0; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-control span { display: grid; place-items: center; height: 100%; border-radius: 4px; color: var(--muted); font-size: .76rem; font-weight: 700; }
.segmented-control input:checked + span { background: var(--ink); color: var(--yellow); }
.segmented-control input:focus-visible + span { outline: 3px solid var(--yellow); }
.select-shell::after { content: '↓'; position: absolute; right: 14px; top: 12px; pointer-events: none; font: 600 .9rem var(--mono); }
.select-shell select { height: 45px; padding: 0 36px 0 12px; appearance: none; font-size: .8rem; font-weight: 600; }
.fallback-toggle { display: flex; gap: 11px; align-items: flex-start; margin-top: 18px; cursor: pointer; }
.fallback-toggle input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--ink); }
.fallback-toggle span { display: grid; gap: 1px; }
.fallback-toggle strong { font-size: .82rem; }
.fallback-toggle small { color: var(--muted); font-size: .74rem; }
.challenge-wrap { min-width: 0; min-height: 74px; margin-top: 20px; padding: 13px 14px; display: flex; align-items: center; gap: 14px; border: 1px dashed var(--line); border-radius: 6px; }
.challenge-wrap.challenge-required { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 7%, transparent); }
.turnstile-slot, .cf-turnstile, #turnstileWidget { flex: 1 1 300px; width: 100%; min-width: 0; max-width: 100%; }
.cf-turnstile, #turnstileWidget { width: 100% !important; }
.cf-turnstile iframe, #turnstileWidget iframe { display: block; width: 100% !important; max-width: 100%; }
.challenge-note { max-width: 220px; }
.primary-button, .secondary-button, .copy-button, .small-button { border: 1px solid var(--ink); border-radius: 6px; font-weight: 700; text-decoration: none; }
.primary-button { width: 100%; min-height: 55px; margin-top: 15px; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; background: var(--yellow); color: #181817; font-family: var(--mono); }
.primary-button:hover { background: var(--ink); color: var(--yellow); }
.primary-button:disabled { cursor: wait; opacity: .6; }
.form-status { margin-top: 10px; text-align: center; }
.caption-preview { padding: 28px 0; transform: rotate(1.2deg); }
.preview-kicker { margin: 0 0 16px 13px; color: var(--muted); font: 600 .68rem var(--mono); letter-spacing: .12em; }
.caption-line { width: max-content; max-width: calc(100% - 6px); margin: 8px 0; padding: 10px 13px; background: var(--ink); color: #fff; box-shadow: 6px 6px 0 var(--yellow); font: 500 clamp(.85rem, 1.7vw, 1.05rem) var(--mono); }
.caption-line span { margin-right: 13px; color: var(--yellow); font-size: .75em; }
.caption-line.active { margin-left: 28px; }
.preview-footnote { max-width: 315px; margin: 24px 0 0 13px; color: var(--muted); font-size: .83rem; }
.trust-strip { width: min(1120px, calc(100% - 40px)); margin: 0 auto 70px; display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); }
.trust-strip p { display: grid; gap: 4px; margin: 0; padding: 24px; border-right: 1px solid var(--line); }
.trust-strip p:last-child { border-right: 0; }
.trust-strip strong { font: 700 .78rem var(--mono); text-transform: uppercase; }
.trust-strip span { color: var(--muted); font-size: .82rem; }

.site-footer { width: min(1180px, calc(100% - 40px)); min-height: 96px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 25px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }

.page-main, .transcript-main, .job-main, .verify-main { width: min(1000px, calc(100% - 40px)); margin: 55px auto 100px; }
.verify-card { width: 100%; max-width: 760px; min-width: 0; margin: 0 auto; padding: clamp(24px, 5vw, 48px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .85fr); gap: clamp(28px, 6vw, 60px); align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.verify-card > * { min-width: 0; }
.verify-card h1 { font-size: clamp(2.7rem, 7vw, 5rem); overflow-wrap: anywhere; }
.verify-card .field-error { overflow-wrap: anywhere; }
.verify-copy { color: var(--muted); }
.verify-card .challenge-wrap { margin-top: 0; }
.page-main.narrow { max-width: 760px; }
.page-hero { padding: 45px 0 40px; border-bottom: 1px solid var(--line); }
.page-hero h1, .job-heading h1, .transcript-title-block h1 { font-size: clamp(2.6rem, 6vw, 5rem); }
.page-hero h1, .job-heading h1 { overflow-wrap: anywhere; }
.page-hero p:last-child { max-width: 680px; margin: 20px 0 0; color: var(--muted); font-size: 1.08rem; }
.prose { padding: 36px 0; }
.prose h2 { margin: 2.2em 0 .7em; font-size: 1.8rem; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 2em; font-size: 1.2rem; }
.prose p, .prose li { color: color-mix(in srgb, var(--ink) 82%, var(--muted)); }
.prose a { font-weight: 600; }
.prose-callout { margin: 28px 0; padding: 20px 22px; border-left: 5px solid var(--yellow); background: var(--surface); }
.prose-callout p { margin: 0; }
.legal-date { font: 600 .75rem var(--mono); color: var(--muted); }
.faq-list { margin: 35px 0; border-top: 1px solid var(--line); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary { cursor: pointer; list-style: none; padding: 22px 42px 22px 0; position: relative; font: 650 1.05rem var(--display); }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: '+'; position: absolute; right: 8px; top: 19px; font: 400 1.5rem var(--mono); }
.faq-list details[open] summary::after { content: '−'; }
.faq-list details p { margin: -5px 45px 23px 0; color: var(--muted); }

.back-nav { margin-bottom: 36px; color: var(--muted); font-size: .84rem; font-weight: 600; }
.back-nav a { text-decoration: none; }
.back-nav a:hover { text-decoration: underline; color: var(--ink); }
.transcript-loading, .empty-state { min-height: 420px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.loading-caption { color: var(--yellow); background: var(--ink); padding: 7px 10px; font: 600 .72rem var(--mono); }
.transcript-loading p { font-family: var(--mono); font-size: .83rem; }
.transcript-error, .error-panel { max-width: 700px; margin: 75px auto; padding: 35px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); }
.transcript-error h1 { font-size: clamp(2rem, 5vw, 3.7rem); }
.transcript-error p:not(.subtitle-chip) { color: var(--muted); }
.secondary-button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; background: var(--ink); color: var(--paper); }
.transcript-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.transcript-header { display: flex; justify-content: space-between; gap: 30px; padding: clamp(24px, 5vw, 45px); border-bottom: 1px solid var(--line); }
.transcript-title-block { min-width: 0; }
.transcript-title-block h1 { overflow-wrap: anywhere; }
.video-byline { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); }
.copy-button { flex: 0 0 auto; height: 43px; padding: 0 16px; display: flex; align-items: center; gap: 9px; background: var(--yellow); color: #181817; }
.copy-icon { width: 13px; height: 15px; border: 2px solid currentColor; border-radius: 2px; box-shadow: 4px -4px 0 -2px var(--yellow), 4px -4px 0 0 currentColor; }
.transcript-toolbar { min-height: 88px; padding: 18px clamp(24px, 5vw, 45px); display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.transcript-view-choice { width: min(390px, 100%); }
.transcript-text { margin: 0; padding: clamp(24px, 5vw, 50px); max-height: 65vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--paper); font: 400 .88rem/1.9 var(--mono); tab-size: 2; }
.download-panel { display: flex; justify-content: space-between; align-items: center; gap: 30px; padding: 28px clamp(24px, 5vw, 45px); }
.download-panel .subtitle-chip { margin-bottom: 9px; }
.download-panel h2 { margin: 0; font-size: 1.55rem; }
.download-grid { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.download-grid a { padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; font: 600 .72rem var(--mono); }
.download-grid a:hover { border-color: var(--ink); background: var(--ink); color: var(--yellow); }
.bookmark-banner { margin-top: 22px; padding: 15px 18px; display: flex; gap: 13px; align-items: center; border: 1px solid var(--line); background: var(--yellow-soft); color: #27230d; border-radius: 7px; }
#jobContent > .bookmark-banner { margin: 0 0 34px; }
:root[data-theme='dark'] .bookmark-banner { color: var(--ink); }
.bookmark-banner p { margin: 0; font-size: .84rem; }
.bookmark-glyph { width: 14px; height: 20px; border: 2px solid currentColor; border-bottom: 0; position: relative; }
.bookmark-glyph::after { content: ''; position: absolute; width: 8px; height: 8px; left: 1px; bottom: -3px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); }

.job-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 28px; }
.job-heading .subtitle-chip { margin-bottom: 14px; }
.job-heading p { margin: 13px 0 0; color: var(--muted); }
.job-actions { flex: 0 0 auto; display: grid; gap: 8px; }
.job-actions .primary-button { min-width: 225px; margin: 0; justify-content: center; gap: 10px; }
.job-actions small { color: var(--muted); text-align: center; }
.progress-shell { position: relative; height: 8px; overflow: hidden; border-radius: 999px; background: var(--line); }
.progress-bar { width: 0%; height: 100%; background: var(--yellow); transition: width .35s ease; }
.counter-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; margin: 20px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.counter { padding: 17px; background: var(--surface); }
.counter strong { display: block; font: 700 1.6rem var(--mono); }
.counter span { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.ticker-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.ticker-header { padding: 15px 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.ticker-header h2 { margin: 0; font-size: 1.25rem; }
.connection-state { color: var(--muted); font: 500 .7rem var(--mono); }
.job-list { margin: 0; padding: 0; list-style: none; }
.job-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 16px; align-items: center; min-height: 66px; padding: 10px 18px; border-bottom: 1px solid var(--line); animation: tick-in .3s ease both; }
.job-row:last-child { border-bottom: 0; }
.row-status { width: max-content; padding: 5px 7px; border-radius: 3px; background: var(--ink); color: var(--paper); font: 600 .62rem var(--mono); text-transform: uppercase; }
.row-status.cached, .row-status.fetched { color: var(--yellow); }
.row-status.no_captions, .row-status.unavailable { background: var(--paper-2); color: var(--muted); }
.row-status.error { background: var(--danger); color: white; }
.row-title { min-width: 0; }
.row-title strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .86rem; }
.row-title small { color: var(--muted); font: .68rem var(--mono); }
.row-download { padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; font: 600 .68rem var(--mono); }
.ticker-empty { padding: 70px 20px; text-align: center; color: var(--muted); font-family: var(--mono); }
.job-note { margin-top: 18px; color: var(--muted); font-size: .78rem; text-align: center; }
.all-done { animation: done-glow .8s ease; }

.health-banner { margin: 30px 0; padding: 20px 22px; display: flex; gap: 15px; align-items: flex-start; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.health-banner[data-tone='good'] { border-left: 6px solid var(--success); }
.health-banner[data-tone='warn'] { border-left: 6px solid var(--warning); }
.health-banner[data-tone='bad'] { border-left: 6px solid var(--danger); }
.health-banner h2 { margin: 0 0 4px; font-size: 1.35rem; }
.health-banner p { margin: 0; color: var(--muted); }
.health-table { width: 100%; border-collapse: collapse; margin: 30px 0; background: var(--surface); border: 1px solid var(--line); }
.health-table th, .health-table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--line); }
.health-table th { color: var(--muted); font: 600 .7rem var(--mono); text-transform: uppercase; }
.health-table td { font-size: .85rem; }
.health-state { font-weight: 700; }
.health-state.good { color: var(--success); }
.health-state.warn { color: var(--warning); }
.health-state.bad { color: var(--danger); }

@keyframes tick-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes done-glow { 50% { box-shadow: 0 0 0 5px var(--yellow), var(--shadow); } }

@media (max-width: 820px) {
  .site-header { grid-template-columns: 1fr auto; }
  .site-nav { display: none; }
  .landing-main { grid-template-columns: 1fr; margin-top: 50px; gap: 30px; }
  .caption-preview { width: max-content; max-width: 100%; margin: 0 auto; }
  .trust-strip { grid-template-columns: 1fr; }
  .trust-strip p { border-right: 0; border-bottom: 1px solid var(--line); }
  .trust-strip p:last-child { border-bottom: 0; }
  .counter-grid { grid-template-columns: repeat(3, 1fr); }
  .counter:nth-child(n+4) { border-top: 1px solid var(--line); }
  .job-heading { align-items: stretch; flex-direction: column; }
  .job-actions { width: 100%; }
  .download-panel { align-items: flex-start; flex-direction: column; }
  .download-grid { justify-content: flex-start; }
  .verify-card { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 580px) {
  .site-header, .site-footer, .landing-main, .trust-strip, .page-main, .transcript-main, .job-main, .verify-main { width: min(100% - 24px, 1180px); }
  .site-header { min-height: 68px; }
  .theme-label { display: none; }
  .landing-main { margin-bottom: 55px; }
  h1 { font-size: clamp(2.8rem, 14vw, 4rem); }
  .transcript-form { padding: 16px; }
  .choice-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .choice-grid .choice-group { grid-column: 1 / -1; }
  .input-meta { display: block; }
  .detection-note { margin-top: 4px; text-align: left; }
  .challenge-wrap { display: block; padding: 10px; overflow: visible; }
  .turnstile-slot, .cf-turnstile, #turnstileWidget { width: 100%; max-width: 100%; }
  .challenge-note { margin-top: 10px; }
  .challenge-note { max-width: none; }
  .site-footer { padding: 25px 0; align-items: flex-start; flex-direction: column; }
  .transcript-header { flex-direction: column; }
  .copy-button { align-self: flex-start; }
  .transcript-toolbar { align-items: stretch; flex-direction: column; }
  .job-row { grid-template-columns: 83px minmax(0, 1fr); }
  .row-download { grid-column: 2; width: max-content; }
  .counter-grid { grid-template-columns: repeat(2, 1fr); }
  .counter:nth-child(n+3) { border-top: 1px solid var(--line); }
  .health-table { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
