/* Up Next: workshop primer greys, masking-tape yellow, one typeface (Archivo) stretched for headings. */

:root {
  color-scheme: light;
  --bg: #edefee;          /* primer grey */
  --surface: #ffffff;
  --sunken: #e2e5e4;
  --ink: #1b1f24;
  --ink-2: #4d5560;
  --muted: #6c747e;
  --line: #d3d8db;
  --tape: #f2c230;        /* masking-tape yellow */
  --tape-ink: #2a2105;
  --tape-soft: #fbefc4;
  --done: #2e8b57;
  --done-soft: #d9efe2;
  --warn: #b4361f;
  --warn-soft: #f8e0da;
  --shadow: 0 1px 2px rgba(20, 26, 33, 0.06), 0 8px 24px -12px rgba(20, 26, 33, 0.18);
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1a1e24;          /* blue graphite, not black */
    --surface: #22272e;
    --sunken: #171a1f;
    --ink: #e8eaed;
    --ink-2: #bcc3cb;
    --muted: #8f99a4;
    --line: #313840;
    --tape: #f2c230;
    --tape-ink: #241c03;
    --tape-soft: #3a3320;
    --done: #4cc38a;
    --done-soft: #1f3a2d;
    --warn: #ff8a73;
    --warn-soft: #43261f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  }
}

/* ---- base ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
svg { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: none; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--tape); outline-offset: 2px; border-radius: 6px; }
p { margin: 0 0 0.8em; max-width: 68ch; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Headings: same family, stretched wide like a badge */
h1, h2, h3, .display {
  font-variation-settings: "wdth" 125;
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.12;
  margin: 0 0 0.4em;
  text-wrap: balance;
}
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

.shell { width: min(1080px, 100% - 32px); margin-inline: auto; }
main.shell { padding: 28px 0 64px; }

/* ---- header ---------------------------------------------------------- */
.site-header { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(10px); position: sticky; top: 0; z-index: 10; }
.site-header .shell { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 30px; height: 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
.brand-mark i { background: var(--tape); border-radius: 2px; }
.brand-mark i:nth-child(n+3) { background: var(--line); }
.brand-name { font-variation-settings: "wdth" 125; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; overflow-x: auto; scrollbar-width: none; }
.nav a, .nav button {
  font: inherit; font-size: 0.95rem; color: var(--ink-2); text-decoration: none; background: none; border: 0;
  padding: 8px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.nav a:hover, .nav button:hover { background: var(--sunken); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }

.site-footer { border-top: 1px solid var(--line); padding: 20px 0 32px; font-size: 0.875rem; color: var(--muted); }
.site-footer .shell { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.footer-links { display: flex; gap: 18px; }

/* ---- buttons --------------------------------------------------------- */
.btn {
  --b-bg: var(--surface); --b-ink: var(--ink); --b-line: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; font-size: 0.95rem; line-height: 1;
  padding: 12px 18px; min-height: 44px; border-radius: 999px; cursor: pointer; text-decoration: none;
  background: var(--b-bg); color: var(--b-ink); border: 1px solid var(--b-line);
  transition: transform 0.08s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { --b-bg: var(--tape); --b-ink: var(--tape-ink); --b-line: transparent; }
.btn-primary:hover { --b-bg: color-mix(in srgb, var(--tape) 88%, white); }
.btn-quiet { --b-bg: transparent; }
.btn-quiet:hover { --b-bg: var(--surface); }
.btn-small { padding: 8px 14px; min-height: 36px; font-size: 0.875rem; }
.btn-danger { --b-bg: transparent; --b-ink: var(--warn); --b-line: color-mix(in srgb, var(--warn) 45%, transparent); }
.btn-danger:hover { --b-bg: var(--warn-soft); }
.btn svg { width: 18px; height: 18px; flex: none; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--ink-2); cursor: pointer;
  text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
.linkish:hover { color: var(--ink); }
form.inline { display: inline; margin: 0; }

/* Round watched toggle */
.tick {
  width: 40px; height: 40px; border-radius: 50%; flex: none; cursor: pointer;
  display: grid; place-items: center; padding: 0;
  background: transparent; color: var(--muted); border: 2px solid var(--line);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
}
.tick svg { width: 20px; height: 20px; }
.tick:hover { border-color: var(--done); color: var(--done); }
.tick:active { transform: scale(0.94); }
.tick.is-on { background: var(--done); border-color: var(--done); color: #fff; }
.tick.is-on:hover { background: transparent; color: var(--done); }

/* ---- episode strip (signature element) ------------------------------- */
.strip { display: flex; gap: 3px; height: 8px; width: 100%; }
.strip i { flex: 1 1 0; min-width: 3px; border-radius: 2px; background: var(--line); }
.strip i.on { background: var(--tape); }
.strip i.next { background: transparent; box-shadow: inset 0 0 0 2px var(--tape); }
.strip-lg { height: 14px; gap: 4px; }
.strip-lg i { border-radius: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .strip-animate i.on { animation: fill 0.5s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 40ms); transform-origin: left; }
  @keyframes fill { from { transform: scaleX(0); opacity: 0.4; } to { transform: scaleX(1); opacity: 1; } }
}

/* ---- chips ----------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; background: var(--sunken); color: var(--ink-2); }
.chip-continue { background: var(--done-soft); color: var(--done); }
.chip-start { background: var(--tape-soft); color: color-mix(in srgb, var(--tape-ink) 80%, var(--ink)); }
@media (prefers-color-scheme: dark) { .chip-start { color: var(--tape); } }

/* ---- toast ----------------------------------------------------------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow);
  font-weight: 550; max-width: calc(100% - 32px); display: flex; gap: 10px; align-items: center; }
.toast svg { width: 18px; height: 18px; color: var(--done); flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast 5s ease both; }
  @keyframes toast { 0% { opacity: 0; transform: translate(-50%, 12px); } 6%, 85% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, 8px); visibility: hidden; } }
}

/* ---- panels & notices ------------------------------------------------ */
.panel { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.notice { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 14px 18px; border-radius: var(--radius); background: var(--tape-soft); margin-bottom: 24px; }
.notice p { margin: 0; }
.notice.warn { background: var(--warn-soft); }
.section { margin-top: 48px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }

/* ---- dashboard: status bar ------------------------------------------- */
.statusbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.statusbar h1 { margin: 0; }
.status-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 0.9rem; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--done); display: inline-block; margin-right: 6px; }
.dot.warn { background: var(--warn); }
.dot.idle { background: var(--muted); }

/* ---- dashboard: hero (next episode) ----------------------------------- */
.panel.hero-next { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0; overflow: hidden; padding: 0; }
.hero-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--sunken); }
.hero-thumb img { width: 100%; height: 100%; object-fit: cover; }
.play { position: absolute; inset: auto auto 16px 16px; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(10, 12, 15, 0.72); color: #fff; display: grid; place-items: center; backdrop-filter: blur(4px);
  transition: transform 0.15s ease; }
.play svg { width: 22px; height: 22px; margin-left: 3px; }
.hero-thumb:hover .play { transform: scale(1.06); }
.play-yt { position: absolute; left: 16px; bottom: 14px; width: 64px; height: 64px; display: grid; place-items: center;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45)); transition: transform 0.15s ease; }
.play-yt svg { width: 64px; height: 64px; }
.hero-thumb:hover .play-yt { transform: scale(1.08); }
.hero-body { padding: 26px 28px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hero-build { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-build a { font-weight: 650; text-decoration: none; }
.hero-build a:hover { text-decoration: underline; }
/* Mat's titles are ALL CAPS already, so video titles use normal width so they don't shout */
.hero-title { font-size: clamp(1.2rem, 1rem + 0.8vw, 1.5rem); margin: 0; font-variation-settings: "wdth" 100; font-weight: 700; letter-spacing: 0; line-height: 1.25; }
.hero-ep { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--muted); margin-bottom: 6px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }

/* ---- dashboard: queue ------------------------------------------------- */
.queue { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.queue li { display: grid; grid-template-columns: 28px 136px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--line); }
.q-pos { font-variation-settings: "wdth" 125; font-weight: 750; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.q-thumb { border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 16 / 9; background: var(--sunken); }
.q-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.q-thumb:hover img { transform: scale(1.04); }
.q-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.q-build { font-size: 0.85rem; color: var(--ink-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.q-build a { text-decoration: none; font-weight: 600; }
.q-build a:hover { text-decoration: underline; }
.q-title { font-weight: 600; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.q-title a { text-decoration: none; }
.q-title a:hover { text-decoration: underline; }

.empty { text-align: center; padding: 48px 24px; }
.empty .strip { max-width: 240px; margin: 0 auto 20px; }

/* ---- builds list ------------------------------------------------------ */
.build-group { margin-bottom: 8px; }
.build-group > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; padding: 14px 0 10px; }
.build-group > summary::-webkit-details-marker { display: none; }
.build-group > summary h3 { margin: 0; }
.build-group > summary .count { color: var(--muted); font-size: 0.9rem; }
.build-group > summary::after { content: ""; width: 8px; height: 8px; margin-left: auto; align-self: center;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.2s ease; }
.build-group[open] > summary::after { transform: rotate(-135deg); }
.builds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.build { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px;
  border: 1px solid transparent; transition: border-color 0.15s ease; }
.build:hover { border-color: var(--line); }
.build-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.build-name { font-weight: 650; text-decoration: none; line-height: 1.3; }
.build-name:hover { text-decoration: underline; }
.build-count { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.build-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 0.85rem; color: var(--muted); min-height: 36px; }
.build-foot .next-up { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---- build page -------------------------------------------------------- */
.crumb { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-size: 0.9rem; margin-bottom: 14px; }
.crumb:hover { color: var(--ink); }
.crumb svg { width: 16px; height: 16px; }
.build-hero { margin-bottom: 28px; }
.build-hero .strip { margin: 18px 0 10px; }
.build-hero-meta { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.build-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.episodes { list-style: none; margin: 0; padding: 0; counter-reset: ep; }
.episode { display: grid; grid-template-columns: 36px 196px minmax(0, 1fr) auto auto; gap: 16px; align-items: center;
  grid-template-areas: "no thumb body through tick"; padding: 12px 14px; border-radius: var(--radius); }
.ep-no { grid-area: no; }
.ep-thumb { grid-area: thumb; }
.ep-body { grid-area: body; min-width: 0; }
.ep-through { grid-area: through; margin: 0; }
.ep-tick { grid-area: tick; }
.episode + .episode { margin-top: 2px; }
.episode:hover { background: var(--surface); }
.episode.is-next { background: var(--surface); box-shadow: inset 4px 0 0 var(--tape); }
.ep-no { font-variation-settings: "wdth" 125; font-weight: 750; font-size: 1.05rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.episode.is-watched .ep-no { color: var(--done); }
.episode.is-watched .ep-thumb img { opacity: 0.9; }
.episode.is-watched .ep-title { color: var(--ink-2); }
.ep-thumb { border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 16 / 9; background: var(--sunken); }
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-title { font-weight: 600; line-height: 1.35; }
.ep-title a { text-decoration: none; }
.ep-title a:hover { text-decoration: underline; }
.ep-meta { font-size: 0.85rem; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; margin-top: 2px; align-items: center; }
.ep-actions { display: flex; gap: 12px; align-items: center; }
@media (hover: hover) {
  .episode .linkish { opacity: 0; transition: opacity 0.15s ease; }
  .episode:hover .linkish, .episode:focus-within .linkish { opacity: 1; }
}
.next-flag { color: color-mix(in srgb, var(--tape-ink) 70%, var(--ink)); background: var(--tape-soft); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .next-flag { color: var(--tape); } }

/* ---- catch up ---------------------------------------------------------- */
.intro { max-width: 62ch; margin-bottom: 28px; }
.intro p { color: var(--ink-2); font-size: 1.05rem; }
.like-demo { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; white-space: nowrap; }
.like-demo svg { width: 16px; height: 16px; }
.catchup-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.date-form { display: flex; flex-direction: column; gap: 14px; }

/* ---- forms ------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; }
.field .hint, .check-row .hint { display: block; font-size: 0.85rem; color: var(--muted); font-weight: 400; margin-top: 2px; }
input[type="date"], input[type="email"], input[type="number"], input[type="text"], select {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; min-height: 44px; width: 100%;
}
input[type="number"] { max-width: 120px; }
input:focus-visible, select:focus-visible { outline: 3px solid var(--tape); outline-offset: 1px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check-row > span { display: flex; flex-direction: column; }

/* switch */
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 999px; margin: 0;
  background: var(--line); position: relative; cursor: pointer; transition: background-color 0.15s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.18s ease; }
.switch:checked { background: var(--done); }
.switch:checked::after { transform: translateX(18px); }

/* segmented radio */
.segmented { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--sunken); gap: 4px; flex-wrap: wrap; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: block; padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 0.9rem; color: var(--ink-2); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 3px solid var(--tape); }

.settings-form { display: flex; flex-direction: column; gap: 26px; }
.settings-form hr, .rule { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.pick { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; }
.pick input { accent-color: var(--done); width: 18px; height: 18px; }
.stack-lg > * + * { margin-top: 24px; }

/* ---- tables (admin) ---------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.85rem; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table code { font-size: 0.85rem; }
.meter { height: 10px; border-radius: 999px; background: var(--sunken); overflow: hidden; margin: 10px 0 6px; position: relative; }
.meter > span { position: absolute; inset: 0 auto 0 0; background: var(--tape); border-radius: 999px; }
.meter > em { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--warn); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.invite-list { list-style: none; padding: 0; margin: 14px 0 0; }
.invite-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.status-ok { color: var(--done); font-weight: 600; }
.status-bad { color: var(--warn); }

/* ---- landing ------------------------------------------------------------ */
.landing { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 56px; align-items: center; padding: 40px 0 24px; }
.landing .wordmark { display: flex; align-items: center; gap: 0.32em; font-size: clamp(2.6rem, 1.6rem + 4vw, 4.4rem);
  font-weight: 850; letter-spacing: -0.03em; line-height: 1; margin-bottom: 18px; }
.wordmark .brand-mark { width: 1.1em; height: 0.62em; gap: 0.06em; }
.wordmark .brand-mark i { border-radius: 0.07em; }
.landing .tagline { font-variation-settings: "wdth" 125; font-weight: 700; letter-spacing: -0.015em;
  font-size: clamp(1.4rem, 1.05rem + 1.5vw, 2.1rem); line-height: 1.15; margin: 0 0 18px; max-width: 22ch; text-wrap: balance; }
.landing .lede { font-size: 1.15rem; color: var(--ink-2); max-width: 46ch; }
.landing-cta { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; margin-top: 28px; }
.landing-cta .small { max-width: 44ch; }
.gsi { display: inline-flex; align-items: center; gap: 12px; }
.gsi svg { width: 20px; height: 20px; background: #fff; border-radius: 50%; padding: 2px; box-sizing: content-box; }
.demo { display: flex; flex-direction: column; gap: 16px; }
.demo-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; background: var(--surface); padding: 16px 18px; border-radius: var(--radius); box-shadow: var(--shadow); }
.demo-row .build-top { font-size: 0.95rem; }
.demo-row:nth-child(2) { margin-left: 28px; }
.demo-row:nth-child(3) { margin-left: 56px; }
.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 72px; padding-top: 32px; border-top: 1px solid var(--line); }
.how h3 { margin-bottom: 6px; }
.how p { color: var(--ink-2); margin: 0; }
.how-no { font-variation-settings: "wdth" 125; font-weight: 800; font-size: 1.6rem; color: color-mix(in srgb, var(--tape) 75%, var(--ink)); line-height: 1; margin-bottom: 10px; display: block; }

/* ---- prose (privacy) ---------------------------------------------------- */
.prose { max-width: 68ch; }
.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: 0.35em 0; }

/* ---- thumbnails: YouTube's red "watched" bar ------------------------------ */
.yt-thumb { position: relative; display: block; overflow: hidden; border-radius: var(--radius-sm); aspect-ratio: 16 / 9; background: var(--sunken); }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; }
/* Which channel a video is on: neutral outline for the main channel, solid for MK2 */
.ch-tag { display: inline-flex; align-items: center; font-size: 0.75rem; font-weight: 650; line-height: 1;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.ch-main { color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.ch-alt { color: var(--bg); background: var(--ink); }
.hero-ep-right { display: inline-flex; align-items: center; gap: 8px; }
.q-build .ch-tag { flex: none; }

/* YouTube logo marks every link that leaves Up Next for YouTube; links within the site stay plain. */
.yt-mark { white-space: nowrap; margin-left: 0.4em; }
.yt-mark svg, .yt-link svg { width: 1.2em; height: 1.2em; vertical-align: -0.24em; }
.yt-link { display: inline-flex; align-items: center; gap: 6px; }
.btn .yt-logo { width: 22px; height: 22px; }
.btn-primary .yt-logo rect { stroke: rgba(0, 0, 0, 0.12); stroke-width: 0.6; }
.yt-badge { position: absolute; right: 6px; bottom: 9px; width: 24px; height: 24px; display: grid; place-items: center;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45)); pointer-events: none; }
.yt-badge svg { width: 24px; height: 24px; }
.yt-badge-lg { right: 12px; bottom: auto; top: 12px; width: 34px; height: 34px; }
.yt-badge-lg svg { width: 34px; height: 34px; }
.yt-thumb.is-seen::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #ff0033; }

/* ---- build cards with a cover image ---------------------------------------- */
.build.has-cover { padding: 0; gap: 0; overflow: hidden; }
.build.has-cover .build-cover { border-radius: 0; }
/* Mat's thumbnails put him on the left and the car on the right; when cropped narrow, keep the car */
.build-cover img { object-position: 72% center; }
.build-foot .btn { white-space: nowrap; flex: none; }
.build-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 12px; flex: 1 1 auto; min-width: 0; }
/* list layout (Catch up): cover on the left */
.builds.builds-list { grid-template-columns: minmax(0, 1fr); }
.builds-list .build.has-cover { flex-direction: row; align-items: stretch; }
.builds-list .build-cover { flex: 0 0 176px; aspect-ratio: auto; min-height: 99px; }

/* ---- Catch up: side column + file picker ------------------------------------ */
.catchup-side { display: flex; flex-direction: column; gap: 20px; }
.catchup-side .steps { padding-left: 1.2em; margin: 12px 0 16px; font-size: 0.92rem; color: var(--ink-2); }
.catchup-side .steps li { margin: 10px 0; padding-left: 4px; }
.catchup-side .steps li::marker { font-weight: 700; color: var(--ink); }
.catchup-side .steps .btn { margin: 2px 0 4px; }
.step-note { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
/* A button or option name exactly as it appears in Google's screens */
.ui { display: inline-block; padding: 0 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-weight: 600; font-size: 0.85rem; line-height: 1.6; white-space: nowrap; }
.file-pick { position: relative; display: block; cursor: pointer; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-pick-label { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 64px; padding: 12px;
  border: 2px dashed var(--line); border-radius: var(--radius); color: var(--ink-2); font-weight: 600; text-align: center;
  overflow-wrap: anywhere; transition: border-color 0.15s ease, background-color 0.15s ease; }
.file-pick:hover .file-pick-label, .file-pick input:focus-visible + .file-pick-label { border-color: var(--tape); background: var(--tape-soft); }

/* ---- tab bar (phones only) ------------------------------------------------ */
.tabbar { display: none; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 860px) {
  .panel.hero-next { grid-template-columns: minmax(0, 1fr); }
  .hero-body { padding: 20px; }
  .landing { grid-template-columns: minmax(0, 1fr); gap: 36px; padding-top: 16px; }
  .catchup-grid { grid-template-columns: minmax(0, 1fr); }
  .how { grid-template-columns: minmax(0, 1fr); margin-top: 48px; }
}
@media (max-width: 640px) {
  html, body { overflow-x: hidden; }
  body { -webkit-tap-highlight-color: transparent; }
  a, button, input, label, summary { touch-action: manipulation; }
  main.shell { padding-top: 18px; padding-bottom: 40px; }
  h1 { overflow-wrap: anywhere; }
  .landing .wordmark { font-size: clamp(2.4rem, 12vw, 3.2rem); }
  .landing .tagline { font-size: clamp(1.3rem, 6vw, 1.6rem); }

  /* header: brand only; navigation moves to the tab bar */
  .site-header { padding-top: env(safe-area-inset-top); }
  .site-header .shell { min-height: 56px; }
  .site-header .nav { display: none; }
  .brand-name { font-size: 1.05rem; }

  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px max(8px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; min-height: 52px;
    border-radius: 12px; text-decoration: none; color: var(--muted); font-size: 0.72rem; font-weight: 600; }
  .tabbar a svg { width: 24px; height: 24px; padding: 2px 14px; box-sizing: content-box; border-radius: 999px; transition: background-color 0.15s ease; }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .tabbar a[aria-current="page"] svg { background: var(--tape-soft); color: color-mix(in srgb, var(--tape-ink) 75%, var(--ink)); }
  .tabbar a:active svg { background: var(--sunken); }
  body.has-tabbar { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  body.has-tabbar .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toast { border-radius: 16px; width: max-content; }

  /* dashboard */
  .statusbar { gap: 10px; }
  .status-meta { width: 100%; justify-content: space-between; }
  .notice { padding: 14px 16px; }
  .panel.hero-next { border-radius: 16px; }
  .hero-actions .btn { flex: 1 1 0; padding-inline: 10px; white-space: nowrap; }
  .hero-actions form { display: flex; flex: 1 1 0; }
  .hero-actions form .btn { width: 100%; }
  .queue li { grid-template-columns: 112px minmax(0, 1fr) 44px; gap: 12px; padding: 12px 0; }
  .q-pos { display: none; }
  .q-build .chip { display: none; }
  .q-build { gap: 0 8px; font-size: 0.8rem; flex-wrap: nowrap; }
  .q-build a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .q-build .muted { white-space: nowrap; }
  .q-title { font-size: 0.92rem; }
  .section { margin-top: 36px; }
  .builds { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .build { padding: 14px 14px 12px; gap: 8px; }
  .build-foot .next-up { font-size: 0.8rem; }

  .build.has-cover { flex-direction: row; align-items: stretch; }
  .build.has-cover .build-cover, .builds-list .build-cover { flex: 0 0 112px; aspect-ratio: auto; min-height: 84px; }
  .build-body { padding: 10px 12px; gap: 8px; }
  .build-foot { flex-wrap: wrap; gap: 6px 10px; }

  /* build page: thumb | title | tick, number as a badge on the thumbnail */
  .build-hero .strip-lg { height: 12px; gap: 3px; }
  .build-hero-actions, .build-hero-actions form, .build-hero-actions .btn { width: 100%; }
  .build-hero-meta { gap: 12px; }
  .episode {
    grid-template-columns: 128px minmax(0, 1fr) 44px;
    grid-template-areas: "thumb body tick" "thumb through tick";
    gap: 4px 12px; padding: 10px 8px; margin-inline: -8px;
  }
  .episode:hover { background: transparent; }
  .episode.is-next { background: var(--surface); }
  .ep-no { align-self: start; justify-self: start; z-index: 1; margin: 5px; padding: 1px 7px; min-width: 22px; text-align: center;
    font-size: 0.75rem; border-radius: 999px; color: #fff; background: rgba(10, 12, 15, 0.7); }
  .episode.is-watched .ep-no { color: #fff; background: var(--done); }
  .ep-no { grid-area: thumb; }
  .ep-thumb { align-self: start; }
  .ep-body { align-self: start; }
  .ep-through { align-self: start; }
  .ep-title { font-size: 0.92rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .ep-meta { font-size: 0.8rem; gap: 8px; }
  .ep-tick, .queue .tick { align-self: center; }
  .ep-through .linkish { font-size: 0.8rem; padding: 4px 0; }

  /* forms */
  .panel { padding: 18px; border-radius: 16px; }
  .segmented { display: flex; }
  .segmented label { flex: 1 1 0; text-align: center; }
  .settings-form .btn-primary, .date-form .btn-primary { width: 100%; }
  .table th:nth-child(2), .table td:nth-child(2) { display: none; }
  .demo-row:nth-child(2), .demo-row:nth-child(3) { margin-left: 0; }
  .site-footer { padding-bottom: 24px; }
}
@media (max-width: 380px) {
  .queue li, .episode { grid-template-columns: 96px minmax(0, 1fr) 44px; }
}
