@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/schibsted-grotesk-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/schibsted-grotesk-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --fog: #F2F3F0;
  --white: #FFFFFF;
  --ink: #1C2120;
  --stone: #575D5A;
  --well: #E6E8E4;
  --moss: #276150;
  --line: #D9DCD7;
  --field: #7E847F;
  --grabber: #C9CDC7;
  --placeholder: #626865;

  --r: 6px;
  --r-sm: 4px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bar-h: 52px;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fog);
  color: var(--ink);
  font-family: 'Schibsted Grotesk', system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
input::placeholder { color: var(--placeholder); }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Home ---------- */

#home {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--safe-top) 0 calc(var(--bar-h) + var(--safe-bottom) + 40px);
}

.topbar { height: 44px; padding: 0 8px; display: flex; align-items: center; justify-content: flex-end; }

.large-title {
  margin: 0; padding: 0 20px 8px;
  font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: -0.01em;
}

.section-title { margin: 0; padding: 24px 20px 8px; font-size: 20px; line-height: 25px; font-weight: 600; }

.group { margin: 0 16px; background: var(--white); border-radius: var(--r); overflow: hidden; }
.group + .group { margin-top: 12px; }
.group-gap { margin-top: 8px; }

.footnote.spaced { padding-top: 16px; }
.footnote.warn { color: var(--ink); }
.inline-btn { margin: 12px 16px 0; align-self: flex-start; }
.footnote { padding: 8px 32px 0; font-size: 13px; line-height: 18px; color: var(--stone); }
.group-header { padding: 24px 32px 8px; font-size: 15px; line-height: 20px; color: var(--stone); }

.icon-btn {
  width: 44px; height: 44px; border: 0; padding: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
  border-radius: var(--r-sm);
}
.icon-btn.quiet { color: var(--stone); }
.icon-spacer { width: 44px; height: 44px; }

.up-next {
  margin: 8px 16px 0; background: var(--white); border-radius: var(--r);
  padding: 16px; display: flex; align-items: center; gap: 16px;
}
.up-next-text {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px;
  border: 0; background: transparent; padding: 0; text-align: left;
}
.label { font-size: 15px; line-height: 20px; color: var(--stone); }
.up-next-title {
  font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.meta { font-size: 15px; line-height: 20px; color: var(--stone); }
.who { color: var(--moss); font-weight: 600; }

.play-btn {
  width: 64px; height: 64px; flex-shrink: 0; border-radius: 50%; border: 0; padding: 0;
  background: var(--ink); color: var(--white);
  display: inline-flex; align-items: center; justify-content: center;
}
.play-btn svg { display: block; }
.play-btn:active { transform: scale(0.96); }
.play-btn-lg { width: 80px; height: 80px; }

.empty { margin: 8px 16px 0; background: var(--white); border-radius: var(--r); padding: 20px 16px; }
.empty-title { margin: 0 0 4px; font-size: 22px; line-height: 28px; font-weight: 700; }
.empty p { margin: 0; font-size: 15px; line-height: 20px; color: var(--stone); }

/* Banner groups (finished? / install) */
.banner { margin: 8px 16px 0; background: var(--white); border-radius: var(--r); padding: 16px; }
.banner + .up-next, .banner + .empty { margin-top: 12px; }
.banner-title { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.banner .meta { margin-top: 4px; }
.banner-actions { margin-top: 14px; display: flex; gap: 8px; }
.banner-actions > * { flex: 1; }
.steps { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: center; font-size: 17px; line-height: 22px; }
.steps .num { width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; background: var(--well); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

/* Rows with swipe actions */
.row-wrap { position: relative; overflow: hidden; background: var(--ink); }
.row-action {
  position: absolute; right: 0; top: 0; bottom: 0; width: 88px; border: 0;
  background: transparent; color: var(--white);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 13px; line-height: 16px; font-weight: 600;
}
.row {
  position: relative; width: 100%; min-height: 64px; display: flex; align-items: center;
  padding: 0 0 0 16px; border: 0; background: var(--white); text-align: left;
  touch-action: pan-y; transition: transform 0.25s ease;
}
.row.dragging { transition: none; }
.row-inner {
  flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px 10px 0; border-bottom: 1px solid var(--line);
}
.row-wrap:last-child .row-inner { border-bottom: 0; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: 17px; line-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 15px; line-height: 20px; color: var(--stone); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-icon { color: var(--stone); flex-shrink: 0; }

/* Plain list rows (menus) */
.list-btn {
  width: 100%; min-height: 52px; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; border: 0; background: transparent; text-align: left; font-size: 17px;
}
.list-btn, .list-row { position: relative; }
.list-btn + .list-btn::before, .list-btn + .list-row::before, .list-row + .list-btn::before, .list-row + .list-row::before {
  content: ''; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--line);
}
.list-btn .end { margin-left: auto; color: var(--stone); }
.list-btn.center { justify-content: center; }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 8px 8px 16px; }

/* Buttons */
.btn-ink, .btn-well {
  height: 44px; padding: 0 16px; border: 0; border-radius: var(--r-sm);
  font-size: 17px; font-weight: 600; white-space: nowrap;
}
.btn-ink { background: var(--ink); color: var(--white); }
.btn-well { background: var(--well); color: var(--ink); }
.btn-text { height: 44px; padding: 0 8px; border: 0; background: transparent; font-size: 17px; }
.btn-text.strong { font-weight: 600; }
.btn-block { width: 100%; height: 52px; border-radius: var(--r); }

/* Paste bar */
.paste-bar {
  position: fixed; z-index: 10;
  left: max(16px, calc(50% - 264px)); right: max(16px, calc(50% - 264px));
  bottom: calc(var(--safe-bottom) + 12px);
  height: var(--bar-h); display: flex; align-items: center; gap: 8px;
  padding: 0 4px 0 16px; background: var(--white);
  border: 1px solid var(--field); border-radius: var(--r);
}
.paste-bar input {
  flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; outline: none;
  font-size: 17px;
}
.paste-bar input:focus-visible { outline: none; }
.paste-bar:focus-within { border-color: var(--ink); }

/* Toast */
.toast {
  position: fixed; z-index: 60;
  left: max(16px, calc(50% - 264px)); right: max(16px, calc(50% - 264px));
  bottom: calc(var(--safe-bottom) + var(--bar-h) + 24px);
  min-height: 48px; display: flex; align-items: center; gap: 12px;
  padding: 4px 4px 4px 16px; border-radius: var(--r);
  background: var(--ink); color: var(--white); font-size: 15px; line-height: 20px;
}
.toast span { flex: 1; }
.toast-action { height: 40px; padding: 0 12px; border: 0; background: transparent; color: var(--white); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Sheets ---------- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(28, 33, 32, 0.32);
  opacity: 0; transition: opacity 0.25s ease;
}
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  top: calc(var(--safe-top) + 12px);
  background: var(--fog); border-radius: 8px 8px 0 0;
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.open { transform: translateY(0); }
.sheet-backdrop.open { opacity: 1; }
.sheet.dragging { transition: none; }

.sheet-drag .grabber { display: block; margin-left: auto; margin-right: auto; }
.grabber { align-self: center; width: 36px; height: 5px; margin-top: 5px; border-radius: 3px; background: var(--grabber); }
.sheet-head {
  flex-shrink: 0; height: 56px; padding: 0 8px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center;
  touch-action: none;
}
.sheet-head > :first-child { justify-self: start; }
.sheet-head > :last-child { justify-self: end; }
.sheet-head h1 { margin: 0; justify-self: center; display: flex; align-items: center; gap: 6px; font-size: 17px; line-height: 22px; font-weight: 600; white-space: nowrap; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 0 calc(var(--safe-bottom) + 24px); display: flex; flex-direction: column; }
.sheet-body .push { margin-top: auto; padding-top: 24px; }

.item-card { margin: 12px 16px 0; background: var(--white); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.item-card-title { font-size: 22px; line-height: 28px; font-weight: 700; overflow-wrap: anywhere; }
.item-card-episode { font-size: 17px; line-height: 22px; overflow-wrap: anywhere; }
.item-card .btn-ink { margin-top: 12px; align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; }

.field { display: flex; align-items: center; min-height: 52px; margin-left: 16px; padding-right: 16px; }
.field + .field { border-top: 1px solid var(--line); }
.field label { width: 64px; flex-shrink: 0; }
.field input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; outline: none; font-size: 17px; }

.chips { margin: 12px 16px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 44px; padding: 0 16px; border: 0; border-radius: var(--r); background: var(--well); color: var(--moss); font-size: 15px; font-weight: 600; }

.prose { margin: 0 16px; background: var(--white); border-radius: var(--r); padding: 16px; font-size: 17px; line-height: 24px; }
.prose p { margin: 0; }
.prose p + p, .prose ol { margin-top: 12px; }
.prose ol { padding-left: 22px; margin-bottom: 0; }
.prose li + li { margin-top: 6px; }
.prose code { font-size: 15px; background: var(--well); padding: 2px 6px; border-radius: var(--r-sm); overflow-wrap: anywhere; }

/* ---------- Player ---------- */

.player {
  position: fixed; inset: 0; z-index: 50; background: var(--fog);
  transform: translateY(100%); transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.player.open { transform: translateY(0); }
.player-inner {
  height: 100%; max-width: 560px; margin: 0 auto;
  padding: calc(var(--safe-top) + 6px) 24px calc(var(--safe-bottom) + 20px);
  display: flex; flex-direction: column; overflow-y: auto;
}
.player .grabber { margin-top: 0; }
.player-top { margin-top: 4px; display: flex; align-items: center; justify-content: space-between; }
.player-top .icon-btn { margin-left: -10px; }
.player-where { font-size: 15px; line-height: 20px; color: var(--stone); }

.video-wrap { margin-top: 16px; aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; background: #000; }
.video-wrap video { width: 100%; height: 100%; display: block; }

.player-text { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; gap: 8px; }
.player-title { margin: 0; font-size: 44px; line-height: 50px; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.player-title.long { font-size: 34px; line-height: 41px; }
.player-episode { font-size: 20px; line-height: 25px; font-weight: 600; }
.player-episode:empty, .player-why:empty { display: none; }
.player-meta { font-size: 17px; line-height: 22px; color: var(--stone); }
.player-why { margin: 8px 0 0; font-size: 17px; line-height: 24px; max-width: 34ch; }

.scrub { margin-top: 36px; }
.scrub input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent;
  --pct: 0%;
}
.scrub input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--ink) var(--pct), var(--grabber) var(--pct));
}
.scrub input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--grabber); }
.scrub input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--ink); }
.scrub input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--ink); border: 0;
}
.scrub input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 0; }
.scrub-times { display: flex; justify-content: space-between; font-size: 13px; line-height: 18px; color: var(--stone); font-variant-numeric: tabular-nums; }

.transport { margin-top: 20px; display: flex; align-items: center; justify-content: center; gap: 40px; }
.transport-btn { width: 56px; height: 56px; border: 0; padding: 0; background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.transport-btn text { font-family: 'Schibsted Grotesk', system-ui, sans-serif; }

.airplay-row { margin-top: 16px; min-height: 44px; display: flex; justify-content: center; }

.then { margin: 12px -8px 0; background: var(--white); border-radius: var(--r); padding: 10px 10px 10px 16px; display: flex; align-items: center; gap: 12px; }
.then-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.then-label { font-size: 13px; line-height: 18px; color: var(--stone); }
.then-title { font-size: 17px; line-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.then .btn-well { font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  .sheet, .player, .row, .sheet-backdrop { transition: none; }
}
