:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, sans-serif;
  font-synthesis: none;
  background: #f8f7f3;
  color: #242620;
  --paper: #f8f7f3;
  --surface: #fffefa;
  --ink: #242620;
  --muted: #575a51;
  --rule: #d9d7ce;
  --control-border: #999b90;
  --accent: #a3422d;
  --accent-soft: #f5e8df;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
p { color: var(--muted); line-height: 1.55; }
a { color: var(--accent); text-underline-offset: .19em; }
h1, h2, h3 { line-height: 1.14; margin: 0; }
h1 { font: 400 clamp(2.45rem, 6vw, 4rem)/1.05 var(--serif); letter-spacing: -.04em; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
.small { font-size: .8125rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.site-bar {
  max-width: 1096px;
  min-height: 66px;
  margin-inline: auto;
  padding-inline: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 1.125rem;
  font-weight: 750;
  letter-spacing: -.035em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark { color: var(--accent); width: 32px; height: 32px; }
.app-nav { display: flex; align-self: stretch; gap: 6px; }
.app-nav button {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: inset 0 -2px transparent;
  color: var(--muted);
  padding-inline: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}
.app-nav button[aria-current="page"] { box-shadow: inset 0 -2px var(--accent); color: var(--accent); }
.app-nav button:hover { background: var(--paper); }
.app-nav svg, .action-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app-nav circle { fill: var(--surface); }

main { max-width: 1096px; margin-inline: auto; padding: 40px 28px 48px; }
button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 8px 14px;
  font: 650 .875rem/1.25 system-ui, sans-serif;
  color: white;
  background: var(--accent);
  cursor: pointer;
}
button:hover { background: #883420; }
button:disabled { opacity: .5; cursor: default; }
.secondary { color: var(--ink); background: transparent; border-color: var(--control-border); }
.secondary:hover, .quiet:hover { background: #efede6; }
.quiet { color: var(--muted); background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
}
.intro p { margin: 8px 0 0; }
.intention {
  width: min(100%, 256px);
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 5px 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-size: .8125rem;
}
.intention strong { font-weight: 650; }
.intention-count { font-variant-numeric: tabular-nums; color: var(--ink); }
.intention-note { color: var(--muted); grid-column: 1 / -1; overflow-wrap: anywhere; }
progress {
  grid-column: 1 / -1;
  width: 100%;
  height: 5px;
  appearance: none;
  border: 0;
  border-radius: 4px;
  background: #e5e1d7;
  color: var(--accent);
}
progress::-webkit-progress-bar { border-radius: inherit; background: #e5e1d7; }
progress::-webkit-progress-value { border-radius: inherit; background: var(--accent); }
progress::-moz-progress-bar { border-radius: inherit; background: var(--accent); }

.list-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--rule);
}
.list-heading span { color: var(--muted); font-size: .8125rem; }
.video-list { list-style: none; margin: 0; padding: 0; }
.video {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}
.video-link {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(140px, 196px) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}
.video-link:hover h3 { text-decoration: underline; text-underline-offset: .18em; }
.thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 5px;
  background: #e7e2d7;
  color: #685f50;
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 28px; height: 28px; fill: currentColor; }
.video h3 { font-size: 1.0625rem; line-height: 1.32; overflow-wrap: anywhere; }
.video-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 7px;
  font-size: .8125rem;
  color: var(--muted);
  line-height: 1.4;
  margin: 6px 0 0;
}
.video-meta time::before { content: '·'; margin-right: 7px; }
.video-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.video-actions button { display: inline-flex; align-items: center; gap: 7px; padding-inline: 10px; }
.video-actions .selected { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.watched-label { display: block; margin-top: 6px; color: var(--muted); font-size: .8125rem; font-weight: 600; }
.unavailable { grid-template-columns: minmax(0, 1fr) auto; }
.unavailable p { margin: 4px 0 0; }

.card, .empty {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: clamp(16px, 3vw, 26px);
}
.empty { margin-top: 14px; }
.empty p { margin: 8px 0 14px; }
.row { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
label { display: block; margin: 14px 0; font-weight: 600; font-size: .875rem; }
input {
  display: block;
  min-height: 44px;
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 5px;
  font: 1rem/1.4 system-ui, sans-serif;
}
input[type="checkbox"] { margin: 0; min-height: auto; width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--accent); }
.check-label { display: flex; align-items: center; gap: 9px; min-height: 44px; }
.channel-form label { flex: 1 1 200px; margin: 0; }
.channel-list { margin: 22px 0 0; padding: 0; list-style: none; }
.channel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.channel p { margin: 3px 0 0; overflow-wrap: anywhere; }
.settings { display: grid; gap: 14px; max-width: 640px; }
.settings p { overflow-wrap: anywhere; }
.settings h2 + p { margin-top: 7px; }
.settings p:last-child { margin-bottom: 0; }
.progress-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.progress-controls button { min-width: 44px; font-size: 1.15rem; }

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 390px);
  gap: clamp(28px, 7vw, 90px);
  align-items: center;
  margin: 30px auto 46px;
  max-width: 944px;
}
.auth-intro h1 { max-width: 12ch; }
.auth-intro p { max-width: 37ch; margin-bottom: 0; }
.cue-sheet { color: var(--accent); display: block; width: min(60%, 230px); margin-bottom: 24px; }
.auth-form-panel {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.auth-form-panel h2 { font-size: 1.375rem; }
.auth-form-panel .row button { flex: 1 1 auto; }
.auth-form-panel p:last-child { margin-bottom: 0; }
.fixture-help { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: .8125rem; }
.fixture-help summary { cursor: pointer; min-height: 32px; display: list-item; padding-top: 5px; }
.fixture-help code { overflow-wrap: anywhere; }
.auth { max-width: 500px; margin: 24px auto; }
.auth h1, .policy-document h1 { font-size: clamp(2rem, 5vw, 3rem); }
.policy-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--rule); }
.policy-links a { color: var(--muted); padding-block: 6px; }
.policy-document { max-width: 800px; }
.policy-document section + section { margin-top: 20px; }
.policy-document h2 { margin-top: 24px; }

.error, .success {
  padding: 10px 13px;
  margin-bottom: 14px;
  border-left: 3px solid;
  font-size: .875rem;
  line-height: 1.5;
}
.error { background: #f7e6de; color: #79301f; }
.success { background: #eeeee7; color: #343b32; }
.status-line { margin: 18px 0; }

@media (max-width: 800px) {
  .site-bar { min-height: 56px; padding-inline: 16px; }
  main { padding: 24px 16px 32px; }
  body:has(.app-nav:not([hidden])) main { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .app-nav {
    position: fixed;
    z-index: 2;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    background: var(--surface);
    border-top: 1px solid var(--rule);
    padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
  }
  .app-nav button {
    flex-direction: column;
    gap: 4px;
    min-height: 58px;
    padding: 7px 3px;
    font-size: .6875rem;
    white-space: normal;
    box-shadow: inset 0 2px transparent;
  }
  .app-nav button[aria-current="page"] { box-shadow: inset 0 2px var(--accent); background: var(--accent-soft); }
  .app-nav button:focus-visible { outline-offset: -4px; }
  .intro { align-items: start; flex-direction: column; gap: 14px; padding-bottom: 16px; margin-bottom: 15px; }
  .intro p { font-size: .875rem; }
  .intention { width: 100%; }
  .video { grid-template-columns: 1fr; gap: 8px; padding: 12px 0; }
  .video-link { grid-template-columns: minmax(84px, 35%) minmax(0, 1fr); gap: 12px; }
  .video-actions { justify-content: start; }
  .unavailable .video-actions { justify-content: start; }
  .auth-layout { grid-template-columns: 1fr; margin: 2px auto 28px; gap: 20px; max-width: 440px; }
  .auth-intro h1 { font-size: clamp(2rem, 8vw, 2.8rem); max-width: 18ch; }
  .auth-intro p { font-size: .875rem; margin-top: 8px; }
  .cue-sheet { display: none; }
  .auth-form-panel { padding: 18px; }
}

.player-dialog { width: min(900px, 96vw); max-width: none; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface, white); }
.player-dialog::backdrop { background: rgba(0, 0, 0, .75); }
.player-dialog button { margin-bottom: 12px; }
.player-dialog iframe { display: block; width: 100%; aspect-ratio: 16 / 9; min-height: 200px; border: 0; }
