:root {
  --ink: #151827;
  --indigo: #24264f;
  --indigo-dark: #16172f;
  --copper: #b8753c;
  --copper-light: #f3e5d8;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --muted: #66697a;
  --line: #d9d8df;
  --success: #2f684f;
  --danger: #9d2e2e;
  --shadow: 0 18px 50px rgba(18, 19, 43, .12);
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--copper); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 50; background: var(--surface); color: var(--indigo); padding: .75rem 1rem; }
.skip-link:focus { top: 1rem; }
.eyebrow { margin: 0 0 .65rem; color: var(--copper); font: 700 .78rem/1.2 Arial, sans-serif; letter-spacing: .18em; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; color: var(--indigo-dark); font-size: clamp(2rem, 6vw, 4.5rem); line-height: .98; }

.access-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; background: radial-gradient(circle at 15% 10%, rgba(184,117,60,.24), transparent 26rem), linear-gradient(145deg, var(--indigo-dark), var(--indigo)); }
.access-card { width: min(100%, 43rem); padding: clamp(1.5rem, 5vw, 4rem); border-top: 6px solid var(--copper); background: var(--paper); box-shadow: var(--shadow); }
.access-card .subtitle { max-width: 32rem; margin: 1rem 0 2.25rem; font-size: 1.15rem; line-height: 1.55; color: var(--muted); }
.access-card label, .library label { display: block; margin-bottom: .55rem; font: 700 .9rem/1.4 Arial, sans-serif; }
.code-row { display: flex; gap: .75rem; }
input { min-height: 3rem; width: 100%; border: 1px solid #a7a7b4; border-radius: 0; background: var(--surface); color: var(--ink); padding: .7rem .85rem; font-family: Arial, sans-serif; font-size: 1rem; }
button { min-height: 3rem; border: 1px solid var(--indigo); border-radius: 0; padding: .7rem 1rem; background: var(--indigo); color: white; font: 700 .9rem/1.2 Arial, sans-serif; }
button:hover { background: var(--indigo-dark); }
.help, .error, .byline { font-family: Arial, sans-serif; }
.help { margin: .7rem 0 0; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.error { min-height: 1.3rem; color: var(--danger); font-weight: 700; }
.byline { margin: 2rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

#library { max-width: 84rem; margin: 0 auto; padding: clamp(1rem, 4vw, 3rem); }
.site-header { display: flex; align-items: start; justify-content: space-between; gap: 2rem; padding: 2rem 0 1.5rem; border-bottom: 1px solid var(--line); }
.site-header h1 { max-width: 56rem; }
.site-header p:last-child { max-width: 46rem; margin: 1rem 0 0; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }
.secondary { background: transparent; color: var(--indigo); white-space: nowrap; }
.secondary:hover { background: var(--copper-light); }
button:disabled { cursor: not-allowed; opacity: .65; }
.part-nav { position: sticky; top: 0; z-index: 20; display: flex; gap: .5rem; overflow-x: auto; margin: 0 -1rem; padding: .8rem 1rem; background: rgba(251,250,247,.96); border-bottom: 1px solid var(--line); }
.part-nav button { min-height: 2.65rem; background: transparent; color: var(--indigo); white-space: nowrap; }
.part-nav button.active { background: var(--indigo); color: white; }
.library[hidden] { display: none !important; }
.library-tools { display: grid; grid-template-columns: auto minmax(15rem, 28rem) auto; align-items: center; gap: .75rem; margin: 2rem 0 1rem; }
.library-tools label { margin: 0; }
.progress-wrap { margin: 1.2rem 0 2rem; }
.progress-copy { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font: .9rem/1.4 Arial, sans-serif; }
.text-button { min-height: auto; padding: 0; border: 0; background: transparent; color: var(--indigo); text-decoration: underline; }
.progress-track { height: .55rem; margin-top: .55rem; overflow: hidden; background: #dedee5; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--copper); transition: width .25s ease; }
.status { min-height: 1.5rem; color: var(--muted); font: .9rem/1.4 Arial, sans-serif; }
.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.35rem; }
.video-card { overflow: hidden; border: 1px solid var(--line); border-top: 4px solid var(--copper); background: var(--surface); box-shadow: 0 8px 24px rgba(18,19,43,.06); }
.video-frame { aspect-ratio: 16/9; display: grid; place-items: center; background: linear-gradient(145deg, var(--indigo-dark), var(--indigo)); color: white; }
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.placeholder { max-width: 22rem; padding: 1rem; text-align: center; font: .9rem/1.5 Arial, sans-serif; color: #eeeef6; }
.video-body { padding: 1.2rem; }
.week-label, .part-label { margin: 0; font: 700 .76rem/1.4 Arial, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.week-label { color: var(--copper); }
.part-label { color: var(--muted); }
.video-card h2 { margin: .35rem 0 .55rem; color: var(--indigo-dark); font-size: clamp(1.25rem, 3vw, 1.65rem); line-height: 1.2; }
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-top: 1.2rem; }
.complete-control { display: flex; align-items: center; gap: .45rem; margin: 0; font: 700 .82rem/1.3 Arial, sans-serif; }
.complete-control input { min-height: auto; width: 1.15rem; height: 1.15rem; accent-color: var(--success); }
.video-card.completed { border-top-color: var(--success); }
.video-card.completed .week-label { color: var(--success); }
footer { margin-top: 3rem; padding: 2rem 0; border-top: 1px solid var(--line); color: var(--muted); font: .88rem/1.55 Arial, sans-serif; }
footer p { max-width: 55rem; }

@media (max-width: 720px) {
  .code-row, .site-header, .progress-copy { align-items: stretch; flex-direction: column; }
  .library-tools { grid-template-columns: 1fr; }
  .video-grid { grid-template-columns: 1fr; }
  .site-header .secondary { align-self: start; }
  .card-actions { align-items: stretch; flex-direction: column; }
  .complete-control { min-height: 2.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .progress-track span { transition: none; }
}
