/**
 * The companion's web app.
 *
 * The palette starts from `src/history/history.css` so the app and the
 * extension's history page read as one product. It is copied rather than
 * imported, for the reason that file gives. Dark only: this is used in a dim
 * room, next to a screen.
 *
 * Its own file, not a `<style>` in the page, so the server can send a CSP of
 * `style-src 'self'`. Values the script sets at runtime (`--seed`, `--fill`,
 * widths, heights) go through the CSSOM, which that policy allows.
 *
 * Layout: phone first. A tab bar at the bottom with the mini-player above it;
 * from 900px a fixed sidebar replaces both the tab bar and the drawer.
 */

:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --surface: #14161a;
  --raised: #1a1d23;
  --raised-2: #22262e;
  --line: #262a33;
  --line-soft: rgb(255 255 255 / 6%);
  --ink: #eef0f4;
  --ink-2: #b6bdca;
  --dim: #7c8598;
  --accent: #4c8dff;
  --accent-2: #6aa3ff;
  --accent-soft: rgb(76 141 255 / 16%);
  --good: #3ecf8e;
  --warn: #f5b544;
  --bad: #ff6b6b;
  --radius: 20px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --gutter: 16px;
  --appbar: 56px;
  --tabbar: 60px;
  --mini: 64px;
  --sidebar: 248px;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, system-ui,
    sans-serif;
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(900px 520px at 50% -240px, rgb(76 141 255 / 10%), transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body.locked {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

button:disabled {
  cursor: default;
  opacity: 0.35;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 10px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon.solid {
  fill: currentColor;
  stroke: none;
}

.eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  from {
    transform: scale(1);
    opacity: 0.7;
  }
  to {
    transform: scale(2.8);
    opacity: 0;
  }
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* ── boot ──────────────────────────────────────────────────────────────── */

.boot {
  display: grid;
  place-items: center;
  min-height: 100dvh;
}

.boot-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--accent-2), #2f6be0);
  box-shadow: 0 8px 30px rgb(76 141 255 / 40%);
  animation: breathe 1.4s ease-in-out infinite alternate;
}

@keyframes breathe {
  to {
    transform: scale(0.9);
    opacity: 0.6;
  }
}

/* ── frame ─────────────────────────────────────────────────────────────── */

.main {
  min-height: 100dvh;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: var(--safe-top);
  background: rgb(11 13 16 / 78%);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--line-soft);
}

.appbar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--appbar);
  padding: 0 max(10px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
}

.appbar-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--ink);
}

.appbar-btn:active {
  background: var(--raised);
}

.appbar-title {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.2s,
    transform 0.25s var(--ease);
}

/* The remote has no large title of its own, so its bar title is always shown. */
body.scrolled .appbar-title,
body[data-tab='remote'] .appbar-title {
  opacity: 1;
  transform: none;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--raised);
  border: 1px solid var(--line-soft);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-2);
  white-space: nowrap;
}

.status-dot {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
}

[data-tone='live'] > .status-dot,
.status-dot[data-tone='live'] {
  background: var(--good);
}

[data-tone='wait'] > .status-dot {
  background: var(--warn);
}

[data-tone='bad'] > .status-dot,
.status-dot[data-tone='bad'] {
  background: var(--bad);
}

[data-tone='live'] > .status-dot::after,
[data-tone='wait'] > .status-dot::after,
.status-dot[data-tone='live']::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: pulse 1.8s var(--ease) infinite;
}

.offline-banner {
  margin: 12px var(--gutter) 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgb(245 181 68 / 12%);
  color: #f7cf85;
  font-size: 13.5px;
}

.view {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px max(var(--gutter), env(safe-area-inset-right))
    calc(var(--tabbar) + var(--safe-bottom) + 28px) max(var(--gutter), env(safe-area-inset-left));
}

body.has-mini .view {
  padding-bottom: calc(var(--tabbar) + var(--mini) + var(--safe-bottom) + 36px);
}

.view.enter > * {
  animation: rise 0.4s var(--ease) both;
}

/* Tab bar */

.tabbar {
  position: fixed;
  z-index: 25;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 4px max(8px, env(safe-area-inset-right)) calc(4px + var(--safe-bottom))
    max(8px, env(safe-area-inset-left));
  background: rgb(14 16 20 / 86%);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-top: 1px solid var(--line-soft);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 52px;
  border-radius: 14px;
  color: var(--dim);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

.tab .icon {
  width: 23px;
  height: 23px;
  transition: transform 0.3s var(--spring);
}

.tab[aria-current='page'] {
  color: var(--ink);
}

.tab[aria-current='page'] .icon {
  color: var(--accent-2);
  transform: translateY(-1px) scale(1.06);
}

/* Mini-player */

.mini {
  position: fixed;
  z-index: 24;
  left: max(8px, env(safe-area-inset-left));
  right: max(8px, env(safe-area-inset-right));
  bottom: calc(var(--tabbar) + var(--safe-bottom) + 8px);
  display: flex;
  align-items: center;
  height: var(--mini);
  padding: 0 8px 0 0;
  border-radius: 18px;
  overflow: hidden;
  background: rgb(34 38 46 / 92%);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border: 1px solid var(--line-soft);
  box-shadow: 0 14px 40px rgb(0 0 0 / 50%);
  animation: rise 0.35s var(--spring) both;
}

.mini-progress {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  background: rgb(255 255 255 / 10%);
}

.mini-fill {
  display: block;
  height: 100%;
  background: var(--accent-2);
}

.mini-body {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  height: 100%;
  padding-left: 10px;
  text-align: left;
}

.mini-text {
  display: grid;
  min-width: 0;
}

.mini-title {
  font-weight: 650;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-sub {
  color: var(--dim);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.mini-play {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  color: var(--ink);
  transition: transform 0.2s var(--spring);
}

.mini-play .icon {
  width: 24px;
  height: 24px;
}

.mini-play:active {
  transform: scale(0.88);
}

/* Sidebar and drawer share one panel. */

.sidebar {
  display: none;
}

.sidebar,
.drawer-panel {
  flex-direction: column;
  gap: 6px;
  padding: calc(18px + var(--safe-top)) 14px calc(18px + var(--safe-bottom));
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent-2), #2f6be0);
  box-shadow: 0 4px 14px rgb(76 141 255 / 35%);
  color: #fff;
}

.brand-mark .icon {
  width: 18px;
  height: 18px;
}

.panel-nav {
  display: grid;
  gap: 2px;
}

.panel-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--ink-2);
  font-weight: 550;
  text-align: left;
  transition:
    background 0.2s,
    color 0.2s;
}

.panel-item:hover {
  background: var(--raised);
  color: var(--ink);
}

.panel-item[aria-current='page'] {
  background: var(--raised-2);
  color: var(--ink);
}

.panel-item[aria-current='page'] .icon {
  color: var(--accent-2);
}

.panel-item-quiet {
  height: 36px;
  color: var(--dim);
  font-size: 13.5px;
}

.live-dot {
  display: none;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 4px rgb(62 207 142 / 18%);
}

.live-dot[data-on='true'] {
  display: block;
}

.panel-spacer {
  flex: 1;
  min-height: 16px;
}

.panel-status {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}

.panel-status-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--raised-2);
  color: var(--ink-2);
}

.panel-status-icon .icon {
  width: 18px;
  height: 18px;
}

.panel-status-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.panel-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
}

.panel-status-sub {
  color: var(--dim);
  font-size: 12.5px;
}

.panel-hint {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  color: var(--dim);
  font-size: 13px;
}

.panel-hint .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.panel-account {
  display: grid;
  gap: 2px;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 55%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.drawer-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: min(320px, 86vw);
  padding-left: max(14px, env(safe-area-inset-left));
  background: var(--bg);
  border-right: 1px solid var(--line-soft);
  box-shadow: 20px 0 60px rgb(0 0 0 / 50%);
  transform: translateX(-100%);
  transition: transform 0.32s var(--ease);
  overflow-y: auto;
}

.drawer.open .drawer-backdrop {
  opacity: 1;
}

.drawer.open .drawer-panel {
  transform: none;
}

@media (min-width: 900px) {
  :root {
    --gutter: 32px;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: var(--sidebar);
    background: rgb(11 13 16 / 70%);
    border-right: 1px solid var(--line-soft);
    overflow-y: auto;
  }

  .main {
    margin-left: var(--sidebar);
  }

  .appbar,
  .tabbar,
  .drawer {
    display: none !important;
  }

  .view {
    padding-top: 36px;
    padding-bottom: 56px;
  }

  body.has-mini .view {
    padding-bottom: calc(var(--mini) + 56px);
  }

  .mini {
    left: calc(var(--sidebar) + 24px);
    right: 24px;
    bottom: 20px;
    max-width: 760px;
    margin: 0 auto;
  }
}

/* ── shared ────────────────────────────────────────────────────────────── */

.art {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
  background:
    radial-gradient(120% 90% at 0% 0%, hsl(calc(var(--seed, 220) + 20) 70% 55% / 55%), transparent 60%),
    linear-gradient(140deg, hsl(var(--seed, 220) 45% 30%), hsl(calc(var(--seed, 220) + 40) 38% 14%));
  color: rgb(255 255 255 / 88%);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.art-initials {
  position: relative;
  z-index: 0;
  text-shadow: 0 2px 12px rgb(0 0 0 / 25%);
}

.art-img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.art.has-img .art-img {
  opacity: 1;
}

.art.has-img .art-initials {
  visibility: hidden;
}

.art-xs {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 13px;
}

.art-sm {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--raised-2);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.chip-ad {
  background: rgb(245 181 68 / 18%);
  color: var(--warn);
}

.chip-glass {
  position: relative;
  z-index: 1;
  background: rgb(0 0 0 / 45%);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chips {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.bar {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: rgb(255 255 255 / 9%);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.bar-light {
  background: rgb(255 255 255 / 22%);
}

.bar-light .bar-fill {
  background: #fff;
}

.round-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: var(--raised-2);
  color: var(--ink);
  transition:
    transform 0.2s var(--spring),
    background 0.2s;
}

.round-btn .icon {
  width: 17px;
  height: 17px;
}

.round-btn:hover {
  background: #2a2f39;
}

.round-btn:active {
  transform: scale(0.9);
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 15px;
  font-weight: 650;
  transition: transform 0.2s var(--spring);
}

.primary-btn {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow:
    0 10px 28px rgb(76 141 255 / 30%),
    inset 0 1px 0 rgb(255 255 255 / 20%);
}

.secondary-btn {
  background: var(--raised-2);
  color: var(--ink);
}

.primary-btn:active,
.secondary-btn:active {
  transform: scale(0.98);
}

.primary-btn .icon,
.secondary-btn .icon {
  width: 18px;
  height: 18px;
}

/* An action that will not work right now: kept, but quiet. */
.is-muted {
  opacity: 0.55;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.actions > * {
  white-space: nowrap;
  padding: 0 12px;
}

.actions > :first-child:not(.is-muted) {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 10px 28px rgb(76 141 255 / 26%);
}

.actions > :not(:first-child) {
  background: var(--raised-2);
  color: var(--ink);
  box-shadow: none;
}

.actions-compact {
  display: flex;
  gap: 6px;
}

.actions-compact > :first-child:not(.is-muted) {
  box-shadow: none;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--accent-2);
  font-weight: 600;
  font-size: 14px;
}

.text-btn .icon {
  width: 16px;
  height: 16px;
}

.text-btn:hover:not(:disabled) {
  background: var(--accent-soft);
}

.note {
  color: var(--dim);
  font-size: 14px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 440px;
  margin: 8vh auto 0;
  padding: 0 8px;
  animation: rise 0.5s var(--ease) both;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  border-radius: 24px;
  background: linear-gradient(160deg, var(--raised-2), var(--surface));
  border: 1px solid var(--line-soft);
  box-shadow: 0 20px 40px rgb(0 0 0 / 35%);
  color: var(--accent-2);
}

.empty-icon .icon {
  width: 30px;
  height: 30px;
}

.empty-title {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.empty-body {
  color: var(--dim);
  margin-bottom: 20px;
}

.toast {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(var(--tabbar) + var(--safe-bottom) + 16px);
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  border-radius: 14px;
  background: rgb(34 38 46 / 94%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-soft);
  box-shadow: 0 16px 40px rgb(0 0 0 / 45%);
  font-size: 14px;
  font-weight: 550;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px) scale(0.98);
  transition:
    opacity 0.25s var(--ease),
    transform 0.35s var(--spring);
}

body.has-mini .toast {
  bottom: calc(var(--tabbar) + var(--mini) + var(--safe-bottom) + 24px);
}

.toast[data-show='true'] {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.toast[data-tone='error'] {
  color: #ffc7c7;
  border-color: rgb(255 107 107 / 30%);
}

@media (min-width: 900px) {
  .toast {
    bottom: 28px;
    margin-left: calc(var(--sidebar) / 2);
  }

  body.has-mini .toast {
    bottom: calc(var(--mini) + 36px);
  }
}

/* ── page furniture ────────────────────────────────────────────────────── */

.page-head {
  margin-bottom: 20px;
}

.page-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.page-title {
  font-size: 30px;
  font-weight: 760;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.page-sub {
  margin-top: 6px;
  color: var(--dim);
  font-size: 14.5px;
}

.section {
  margin-bottom: 32px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-head .section-title {
  margin-bottom: 0;
}

.section-link {
  margin-right: -10px;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ── home ──────────────────────────────────────────────────────────────── */

/* A rail that snaps, one and a bit cards wide on a phone so it reads as
   scrollable. */
.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(84%, 360px);
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter));
  padding: 4px var(--gutter) 14px;
  scroll-padding: 0 var(--gutter);
}

.rail::-webkit-scrollbar {
  display: none;
}

.rail-posters {
  grid-auto-columns: 132px;
}

.rail > * {
  scroll-snap-align: start;
}

.resume {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 16px 34px rgb(0 0 0 / 40%);
  transition: transform 0.3s var(--spring);
}

.resume:hover {
  transform: translateY(-3px);
}

.art-wide {
  position: absolute;
  inset: 0;
  font-size: 44px;
  place-items: start end;
  padding: 16px 20px;
  color: rgb(255 255 255 / 30%);
}

.resume-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgb(0 0 0 / 5%) 20%, rgb(0 0 0 / 82%));
  pointer-events: none;
}

.resume-open {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.resume-body {
  position: absolute;
  z-index: 2;
  left: 16px;
  right: 78px;
  bottom: 16px;
  display: grid;
  gap: 4px;
  pointer-events: none;
}

.resume-body .chip {
  justify-self: start;
  margin-bottom: 4px;
}

.resume-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.resume-meta {
  font-size: 13px;
  color: rgb(255 255 255 / 78%);
  margin-bottom: 6px;
}

.resume-play {
  position: absolute;
  z-index: 4;
  right: 14px;
  bottom: 14px;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  color: #0b0d10;
  box-shadow: 0 8px 22px rgb(0 0 0 / 45%);
  transition: transform 0.25s var(--spring);
}

.resume-play .icon {
  width: 20px;
  height: 20px;
  margin-left: 2px;
}

.resume-play:hover {
  transform: scale(1.06);
}

.resume-play:active {
  transform: scale(0.92);
}

.week-card {
  display: flex;
  align-items: stretch;
  gap: 18px;
  width: 100%;
  padding: 18px;
  border-radius: var(--radius);
  background:
    radial-gradient(120% 140% at 100% 0%, rgb(76 141 255 / 14%), transparent 60%),
    var(--surface);
  border: 1px solid var(--line-soft);
  text-align: left;
  transition: transform 0.25s var(--spring);
}

.week-card:active {
  transform: scale(0.99);
}

.week-text {
  display: grid;
  align-content: center;
  gap: 2px;
}

.week-total {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.week-sub {
  color: var(--dim);
  font-size: 13px;
}

.week-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  flex: 1;
  max-width: 280px;
  margin-left: auto;
}

.week-col {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
  justify-items: center;
}

.week-track {
  position: relative;
  display: flex;
  align-items: flex-end;
  width: 100%;
  max-width: 18px;
  height: 72px;
}

.week-bar {
  display: block;
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: rgb(76 141 255 / 55%);
}

.week-col.is-today .week-bar {
  background: var(--accent-2);
}

.week-day {
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
}

.week-col.is-today .week-day {
  color: var(--ink);
}

/* A swipeable rail suits a thumb, not a mouse wheel. Wide screens get a grid. */
@media (min-width: 900px) {
  .rail {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    margin: 0;
    padding: 4px 0 0;
    overflow: visible;
  }

  .rail-posters {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* ── library ───────────────────────────────────────────────────────────── */

.toolbar {
  position: sticky;
  top: calc(var(--appbar) + var(--safe-top));
  z-index: 10;
  display: grid;
  gap: 10px;
  margin: 0 calc(-1 * var(--gutter)) 18px;
  padding: 10px var(--gutter);
  background: linear-gradient(180deg, rgb(11 13 16 / 94%) 70%, rgb(11 13 16 / 0%));
}

.toolbar-plain {
  position: static;
  background: none;
  padding-top: 0;
}

@media (min-width: 900px) {
  .toolbar {
    top: 0;
  }
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 6px 0 14px;
  gap: 10px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--dim);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.search:focus-within {
  border-color: rgb(76 141 255 / 55%);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search .icon {
  width: 18px;
  height: 18px;
}

.search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px; /* 16px, or iOS zooms the page on focus */
}

.search-input::placeholder {
  color: var(--dim);
}

.search-input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--dim);
}

.search-clear:hover {
  color: var(--ink);
  background: var(--raised);
}

.toolbar-row {
  display: flex;
  gap: 10px;
}

.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--raised);
}

.seg-inline {
  flex: 1;
  max-width: 420px;
}

.seg-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 36px;
  padding: 0 6px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition:
    background 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}

.seg-btn:hover:not(:disabled):not([aria-pressed='true']) {
  color: var(--ink);
}

.seg-btn[aria-pressed='true'] {
  background: var(--raised-2);
  color: var(--ink);
  box-shadow:
    0 2px 8px rgb(0 0 0 / 30%),
    inset 0 1px 0 rgb(255 255 255 / 6%);
}

.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: none;
}

.select {
  -webkit-appearance: none;
  appearance: none;
  height: 42px;
  padding: 0 34px 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--raised);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.select-wrap .icon {
  position: absolute;
  right: 10px;
  width: 16px;
  height: 16px;
  color: var(--dim);
  pointer-events: none;
}

.chip-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter);
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: none;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s;
}

.filter-chip[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: #0b0d10;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
}

@media (min-width: 560px) {
  .grid-posters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 760px) {
  .grid-posters {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 24px 18px;
  }
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  text-align: left;
}

.tile-art {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  font-size: 28px;
  box-shadow: 0 10px 24px rgb(0 0 0 / 35%);
  transition:
    transform 0.3s var(--spring),
    box-shadow 0.3s;
}

.tile:hover .tile-art {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgb(0 0 0 / 50%);
}

.tile:active .tile-art {
  transform: scale(0.97);
}

.tile-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  height: 20px;
  font-size: 9.5px;
}

.tile-bar {
  position: absolute;
  z-index: 1;
  left: 10px;
  right: 10px;
  bottom: 10px;
  background: rgb(0 0 0 / 45%);
}

.tile-done {
  position: absolute;
  z-index: 1;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgb(62 207 142 / 92%);
  color: #06140d;
}

.tile-done .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.tile-body {
  display: grid;
  gap: 2px;
  padding: 0 2px;
}

.tile-title {
  font-weight: 650;
  font-size: 14.5px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile-meta {
  color: var(--dim);
  font-size: 12.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile-skeleton .tile-art,
.tile-skeleton .tile-body {
  background: linear-gradient(90deg, var(--surface), var(--raised), var(--surface));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  box-shadow: none;
}

.tile-skeleton .tile-art {
  aspect-ratio: 2 / 3;
  border-radius: 14px;
}

.tile-skeleton .tile-body {
  height: 34px;
  border-radius: 8px;
}

/* ── activity ──────────────────────────────────────────────────────────── */

.timeline {
  display: grid;
  gap: 26px;
  max-width: 820px;
}

.tl-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.tl-total {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tl-date {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-size: 13px;
  color: var(--dim);
  opacity: 0.75;
}

.tl-list {
  display: grid;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

.tl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 12px;
}

.tl-row + .tl-row {
  border-top: 1px solid var(--line-soft);
}

.tl-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  padding: 12px 4px 12px 14px;
  text-align: left;
  transition: background 0.2s;
}

.tl-main:hover {
  background: rgb(255 255 255 / 2%);
}

.tl-time {
  width: 42px;
  flex: none;
  color: var(--dim);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.tl-text {
  display: grid;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.tl-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tl-meta {
  color: var(--dim);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tl-text .bar {
  height: 3px;
  margin-top: 3px;
}

@media (max-width: 420px) {
  .tl-time {
    display: none;
  }
}

/* ── stats ─────────────────────────────────────────────────────────────── */

.stat-hero {
  display: grid;
  gap: 4px;
  padding: 20px;
  margin-bottom: 16px;
  border-radius: 24px;
  background:
    radial-gradient(120% 100% at 0% 0%, rgb(76 141 255 / 12%), transparent 60%),
    var(--surface);
  border: 1px solid var(--line-soft);
}

.hero-value {
  font-size: 48px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.hero-sub {
  color: var(--dim);
  font-size: 14px;
  margin-bottom: 18px;
}

.delta {
  font-weight: 650;
}

/* Direction only, and the glyph carries it too, so colour is never alone. */
.delta.up {
  color: var(--good);
}

.delta.down {
  color: var(--ink-2);
}

.chart {
  display: grid;
  gap: 8px;
}

.chart-plot {
  position: relative;
  height: 180px;
  margin-left: 34px;
}

.chart-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chart-gridline {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
}

.chart-tick {
  position: absolute;
  right: calc(100% + 8px);
  top: -8px;
  color: var(--dim);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chart-cols {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  gap: 2px;
}

.chart-col {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex: 1;
  min-width: 0;
  border-radius: 6px;
  cursor: default;
}

.chart-col:hover,
.chart-col.is-active {
  background: rgb(255 255 255 / 4%);
}

.chart-bar {
  display: block;
  width: 100%;
  max-width: 24px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
  transition: height 0.5s var(--ease);
}

.chart-dense .chart-bar {
  border-radius: 3px 3px 0 0;
}

.chart-col.is-current .chart-bar,
.chart-col.is-active .chart-bar {
  background: var(--accent-2);
}

.chart-labels {
  display: flex;
  gap: 2px;
  margin-left: 34px;
}

.chart-label {
  flex: 1;
  min-width: 0;
  color: var(--dim);
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}

.chart-tip {
  position: absolute;
  z-index: 2;
  top: -8px;
  display: grid;
  gap: 1px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--raised-2);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgb(0 0 0 / 45%);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
  transform: translate(-50%, -100%);
  pointer-events: none;
}

.chart-tip strong {
  color: var(--ink);
  font-size: 14px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 900px) {
  .kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.kpi {
  display: grid;
  gap: 2px;
  align-content: start;
  padding: 14px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}

.kpi-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 8px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-2);
}

.kpi-icon .icon {
  width: 16px;
  height: 16px;
}

.kpi-label {
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 600;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.kpi-note {
  color: var(--dim);
  font-size: 12px;
}

.stat-columns {
  display: grid;
  gap: 16px;
}

@media (min-width: 900px) {
  .stat-columns {
    grid-template-columns: 1.4fr 1fr;
    align-items: start;
  }
}

.stat-card .card-title {
  font-size: 15px;
  font-weight: 650;
}

.card-note {
  color: var(--dim);
  font-size: 12.5px;
  margin: 2px 0 12px;
}

.rank {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 6px;
  border-radius: 12px;
  text-align: left;
}

button.rank-row:hover {
  background: var(--raised);
}

.rank-main {
  display: grid;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.rank-label {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-track {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: rgb(255 255 255 / 6%);
  overflow: hidden;
}

.rank-fill {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}

.rank-value {
  flex: none;
  min-width: 56px;
  text-align: right;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── remote ────────────────────────────────────────────────────────────── */

.remote {
  display: grid;
  gap: 16px;
}

@media (min-width: 1100px) {
  .remote {
    grid-template-columns: minmax(380px, 440px) 1fr;
    gap: 24px;
    align-items: start;
  }

  /* Qualified, or `.now`'s own `position: relative` below wins and the `top`
     becomes a shove. */
  .remote > .now {
    position: sticky;
    top: 36px;
  }
}

.now {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 20px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgb(255 255 255 / 4%), rgb(255 255 255 / 1%)), var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow: 0 30px 60px rgb(0 0 0 / 35%);
}

.now-glow {
  position: absolute;
  z-index: -1;
  inset: -40% -20% auto;
  height: 320px;
  background: radial-gradient(closest-side, hsl(var(--seed, 220) 70% 50% / 32%), transparent);
  filter: blur(20px);
  pointer-events: none;
}

.now-backdrop {
  position: absolute;
  inset: 0 0 auto;
  z-index: -2;
  height: 220px;
  opacity: 0.35;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent);
  mask-image: linear-gradient(180deg, #000, transparent);
}

.now-backdrop .art-initials {
  display: none;
}

.now-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.art-now {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  font-size: 24px;
  box-shadow: 0 12px 28px rgb(0 0 0 / 40%);
}

.now-meta {
  min-width: 0;
}

.now-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.now-episode {
  margin-top: 3px;
  color: var(--ink-2);
  font-size: 14px;
}

.ad-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgb(245 181 68 / 12%);
  color: #f7cf85;
  font-size: 13.5px;
}

.scrub {
  margin-top: 22px;
}

.times {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.scrub.active .times .time:first-child {
  color: var(--accent-2);
}

/* Range: one track painted with a --fill stop, so the elapsed part is coloured
   in every engine without a second element behind it. */
.slider {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --fill: 0%;
  --track: 5px;
}

.slider:disabled {
  cursor: default;
  opacity: 0.4;
}

.slider::-webkit-slider-runnable-track {
  height: var(--track);
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent-2) 0,
    var(--accent) var(--fill),
    rgb(255 255 255 / 12%) var(--fill)
  );
  transition: height 0.15s var(--ease);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: calc((var(--track) - 18px) / 2);
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 2px 8px rgb(0 0 0 / 45%),
    0 0 0 0 var(--accent-soft);
  transition:
    transform 0.2s var(--spring),
    box-shadow 0.2s;
}

.slider:active::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow:
    0 2px 8px rgb(0 0 0 / 45%),
    0 0 0 8px var(--accent-soft);
}

.slider::-moz-range-track {
  height: var(--track);
  border-radius: 999px;
  background: rgb(255 255 255 / 12%);
}

.slider::-moz-range-progress {
  height: var(--track);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgb(0 0 0 / 45%);
}

.slider-scrub {
  --track: 6px;
}

.scrub.active .slider-scrub {
  --track: 10px;
}

.slider.muted {
  opacity: 0.45;
}

.transport {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1.4fr 1.15fr 1fr;
  align-items: center;
  justify-items: center;
  margin-top: 10px;
}

.ctl {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: var(--ink);
  transition:
    transform 0.25s var(--spring),
    background 0.2s;
}

.ctl .icon {
  width: 22px;
  height: 22px;
}

.ctl:hover:not(:disabled) {
  background: rgb(255 255 255 / 6%);
}

.ctl:active:not(:disabled) {
  transform: scale(0.88);
}

.ctl-seek {
  width: 60px;
  height: 60px;
}

.ctl-seek .icon {
  width: 34px;
  height: 34px;
  stroke-width: 1.6;
}

.seek-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 2px;
  font-size: 10.5px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.ctl-play {
  width: 76px;
  height: 76px;
  background: #fff;
  color: #0b0d10;
  box-shadow:
    0 14px 34px rgb(0 0 0 / 45%),
    0 0 0 6px rgb(255 255 255 / 6%);
}

.ctl-play:hover:not(:disabled) {
  background: #fff;
}

.ctl-play .icon {
  width: 30px;
  height: 30px;
}

.steps-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.steps {
  display: flex;
  gap: 4px;
  flex: 1;
}

.step {
  flex: 1 1 0;
  min-width: 0;
  height: 32px;
  padding: 0 2px;
  border-radius: 9px;
  color: var(--dim);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition:
    background 0.2s,
    color 0.2s;
}

.step[aria-pressed='true'] {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.skip-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  animation: rise 0.35s var(--spring) both;
}

.skip {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  border-radius: 14px;
  background: #fff;
  color: #0b0d10;
  font-weight: 650;
  box-shadow: 0 10px 26px rgb(0 0 0 / 35%);
  transition: transform 0.2s var(--spring);
}

.skip .icon {
  width: 16px;
  height: 16px;
}

.skip:active {
  transform: scale(0.97);
}

.panels {
  display: grid;
  gap: 16px;
  align-items: start;
}

@media (min-width: 640px) {
  .panels {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  }
}

.card {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line-soft);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-2);
}

.card-icon .icon {
  width: 16px;
  height: 16px;
}

.card-title {
  flex: 1;
  font-size: 15px;
  font-weight: 650;
}

.card-value {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.card-body {
  display: grid;
  gap: 14px;
}

.card.is-off .card-grid,
.card.is-off .field,
.card.is-off .pill-row {
  opacity: 0.5;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--raised);
  color: var(--ink);
  transition:
    transform 0.2s var(--spring),
    background 0.2s;
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
}

.icon-btn:hover:not(:disabled) {
  background: var(--raised-2);
}

.icon-btn:active:not(:disabled) {
  transform: scale(0.9);
}

.icon-btn[aria-pressed='true'] {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.sound-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sound-row .slider {
  flex: 1;
  min-width: 0;
}

.stepper {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 14px;
  background: var(--raised);
}

.stepper-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 18px;
}

.stepper-top .text-btn {
  height: 24px;
  margin: -4px -6px -4px 0;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 12.5px;
}

.stepper-label,
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
}

.stepper-ctl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.stepper .icon-btn {
  width: 36px;
  height: 36px;
  background: var(--raised-2);
}

.stepper-value {
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.field {
  display: grid;
  gap: 8px;
}

.pill-row {
  display: flex;
  gap: 8px;
}

.pill {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--raised);
  font-size: 14px;
  font-weight: 600;
  transition:
    transform 0.2s var(--spring),
    background 0.2s;
}

.pill .icon {
  width: 17px;
  height: 17px;
}

.pill:hover:not(:disabled) {
  background: var(--raised-2);
}

.pill:active:not(:disabled) {
  transform: scale(0.97);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 4px 0;
  text-align: left;
  font-size: 15px;
  font-weight: 550;
}

.switch {
  position: relative;
  flex: none;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: var(--raised-2);
  transition: background 0.25s var(--ease);
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgb(0 0 0 / 35%);
  transition: transform 0.3s var(--spring);
}

.switch-row[aria-checked='true'] .switch {
  background: var(--accent);
}

.switch-row[aria-checked='true'] .switch-thumb {
  transform: translateX(20px);
}

.continue {
  width: 100%;
  margin-top: 12px;
  text-align: left;
}

.continue-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.continue-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  text-align: left;
  transition:
    transform 0.2s var(--spring),
    background 0.2s;
}

.continue-row:hover {
  background: var(--raised);
}

.continue-row:active {
  transform: scale(0.98);
}

.continue-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.continue-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.continue-meta {
  color: var(--dim);
  font-size: 13px;
}

.continue-play {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  color: #0b0d10;
}

.continue-play .icon {
  width: 15px;
  height: 15px;
}

/* ── show sheet ────────────────────────────────────────────────────────── */

/* A bottom sheet on a phone, a panel from the right on anything wider. */
.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 55%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: calc(100dvh - var(--safe-top) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 26px 26px 0 0;
  background: var(--surface);
  border-top: 1px solid var(--line-soft);
  box-shadow: 0 -20px 60px rgb(0 0 0 / 55%);
  transform: translateY(100%);
  transition: transform 0.38s var(--ease);
  outline: none;
  padding-bottom: var(--safe-bottom);
}

.sheet.dragging {
  transition: none;
}

.sheet-layer.open .sheet-backdrop {
  opacity: 1;
}

/* A drag sets an inline transform, which outranks this until it is cleared. */
.sheet-layer.open .sheet {
  transform: none;
}

@media (min-width: 720px) {
  .sheet {
    left: auto;
    top: 0;
    width: min(500px, 92vw);
    max-height: none;
    border-radius: 0;
    border-top: 0;
    border-left: 1px solid var(--line-soft);
    transform: translateX(100%);
  }
}

.sheet-art {
  position: relative;
  height: 210px;
  font-size: 56px;
  touch-action: none;
}

.sheet-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgb(0 0 0 / 20%) 0%, transparent 35%, var(--surface));
}

.sheet-grip {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 50%;
  width: 40px;
  height: 5px;
  margin-left: -20px;
  border-radius: 999px;
  background: rgb(255 255 255 / 55%);
}

@media (min-width: 720px) {
  .sheet-grip {
    display: none;
  }

  .sheet-art {
    height: 240px;
    touch-action: auto;
  }
}

.sheet-close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  background: rgb(0 0 0 / 45%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
}

.sheet-body {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 16px;
  padding: 0 20px 28px;
  margin-top: -48px;
}

.sheet-head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.sheet-poster {
  width: 84px;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  font-size: 20px;
  box-shadow: 0 14px 30px rgb(0 0 0 / 50%);
}

.sheet-head-text {
  min-width: 0;
}

.sheet-title {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.sheet-facts {
  margin-top: 4px;
  color: var(--dim);
  font-size: 13.5px;
}

.sheet-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
}

.sheet-progress .bar {
  flex: 1;
}

.sheet-resume {
  display: grid;
  gap: 10px;
}

.sheet-resume-label {
  font-weight: 650;
  font-size: 15px;
}

.synopsis {
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.synopsis.open {
  display: block;
}

.synopsis-more {
  margin-left: -12px;
}

.sheet-body > .section-title {
  margin: 8px 0 -4px;
}

.eps {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: 18px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

.ep {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
}

.ep + .ep {
  border-top: 1px solid var(--line-soft);
}

.ep-latest {
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
}

.ep-unwatched .ep-label {
  color: var(--ink-2);
  font-weight: 500;
}

.ep-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: var(--raised);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ep-done .ep-num {
  background: rgb(62 207 142 / 14%);
  color: var(--good);
}

.ep-num .icon {
  width: 15px;
  height: 15px;
  stroke-width: 3;
}

.ep-main {
  display: grid;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.ep-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ep-tag {
  flex: none;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ep-state {
  color: var(--dim);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.ep-main .bar {
  height: 3px;
  margin-top: 3px;
}

.ep-done .bar-fill {
  background: var(--good);
  opacity: 0.6;
}

.ep .round-btn {
  width: 36px;
  height: 36px;
}

/* ── sign in ───────────────────────────────────────────────────────────── */

.login {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(380px, 100%);
  padding: 28px 24px;
  border-radius: 28px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgb(76 141 255 / 14%), transparent 60%),
    var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow: 0 30px 80px rgb(0 0 0 / 50%);
  text-align: center;
  animation: rise 0.5s var(--ease) both;
}

.login-card.shake {
  animation: shake 0.4s var(--ease);
}

@keyframes shake {
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}

.login-mark {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 6px;
  border-radius: 18px;
  background: linear-gradient(140deg, var(--accent-2), #2f6be0);
  box-shadow: 0 12px 34px rgb(76 141 255 / 40%);
  color: #fff;
}

.login-mark .icon {
  width: 30px;
  height: 30px;
}

.login-title {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.login-sub {
  color: var(--dim);
  margin-top: -6px;
}

.login-field {
  position: relative;
  display: flex;
  align-items: center;
  height: 52px;
  margin-top: 8px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.login-field:focus-within {
  border-color: rgb(76 141 255 / 55%);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.login-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 14px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.login-reveal {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: 4px;
  border-radius: 10px;
  color: var(--dim);
}

.login-error {
  min-height: 20px;
  color: #ffb4b4;
  font-size: 13.5px;
}

.login-submit {
  width: 100%;
}

/* ── motion ────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
