/* Outfit, self-hosted (SIL Open Font License, fonts/OFL.txt) so no visitor data goes to a font CDN. */
@font-face {
  font-family: 'Outfit'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('fonts/outfit-latin-wght-normal.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;
}
@font-face {
  font-family: 'Outfit'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('fonts/outfit-latin-ext-wght-normal.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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Fraunces'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('fonts/fraunces-latin-full-normal.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;
}
@font-face {
  font-family: 'Fraunces'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('fonts/fraunces-latin-ext-full-normal.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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #060518;
  /* Text, accents and surfaces come from js/palette.js, per world. */
  --radius: 28px;
  --display: 'Fraunces', Georgia, serif;
  --gutter: clamp(16px, 4vw, 40px);
  --mini-h: 0px;
  --side-w: 0px;
  --tab-h: calc(56px + env(safe-area-inset-bottom));
  /* Motion, after Emil Kowalski's rules: strong ease-out for entering and exiting, ease-in-out for things
     moving on screen, the iOS drawer curve for sheets. Never ease-in on UI. UI stays under 300ms;
     sheets, drawers and toasts are the exceptions. */
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-press: 160ms;  /* press feedback */
  --dur-ui: 200ms;     /* state changes, small reveals */
  --dur-move: 250ms;   /* a highlight or card moving on screen, a screen arriving */
  --dur-sheet: 400ms;  /* sheets, drawers, toasts */
  /* Type scale: six steps for UI text; display titles keep their own clamp() sizes */
  --fs-2xs: 0.75rem;   /* tracked caps: eyebrows, tab labels */
  --fs-xs: 0.875rem;   /* meta, hints */
  --fs-sm: 1rem;       /* body, controls */
  --fs-md: 1.15rem;    /* row and option labels */
  --fs-lg: 1.35rem;    /* row titles, sub-heads */
  --fs-xl: 1.6rem;     /* section titles */
  --fs-2xl: 2rem;
  /* Spacing: 4px base */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 300 16px/1.45 'Outfit', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
body.has-mini { --mini-h: 84px; }
body.no-gl { background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 70%); }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
/* Focus is moved to the page heading on navigation so screen readers announce it; no ring needed there. */
#app:focus, #app [data-route-focus]:focus { outline: none; }
.skip-link {
  position: fixed; left: 16px; top: -64px; z-index: 50; padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: var(--accent-ink); font-weight: 500; transition: top 0.2s;
}
.skip-link:focus { top: calc(12px + env(safe-area-inset-top)); }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i-fill { fill: currentColor; stroke: none; }
svg .i-solid { fill: currentColor; stroke: none; }
svg.i-skip text { font: 500 7px 'Outfit', sans-serif; fill: currentColor; stroke: none; }
svg.i-sliders { color: var(--accent); }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#app { position: fixed; inset: 0 0 var(--tab-h) var(--side-w); overflow: hidden; padding-top: env(safe-area-inset-top); }
html.large-text { font-size: 18px; }
html.large-text body { font-size: 18px; }

.eyebrow { font-size: var(--fs-2xs); font-weight: 400; letter-spacing: 0.32em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 10px; }
.hint { color: var(--ink-3); font-size: var(--fs-xs); margin: 6px 0 0; }
.muted { color: var(--ink-2); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; font-size: var(--fs-xs); }
.link:hover { color: var(--ink); }
/* Standalone text buttons get a full 44px target; inline links inside sentences keep their line height */
button.link { display: inline-flex; align-items: center; min-height: 44px; }
.view-enter { animation: view-enter var(--dur-move) var(--ease) both; }
.boot-error { padding: 40px var(--gutter); color: var(--ink-2); }
.noscript { max-width: 640px; margin: 0 auto; padding: 80px var(--gutter); color: var(--ink-2); }
.noscript h1 { color: var(--ink); font-weight: 200; font-size: 3rem; margin: 0 0 12px; }

/* ── App shell: tab bar on phones, sidebar on wide screens ──────────────── */
#sidebar { display: none; }
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: var(--tab-h); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(10, 8, 26, 0.82); border-top: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-2); font-size: var(--fs-2xs); letter-spacing: 0.01em; transition: color 0.2s;
}
.tab svg { width: 26px; height: 26px; }
.tab[aria-current="page"] { color: var(--accent); font-weight: 500; }
.tab[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 32%; right: 32%; height: 2px; border-radius: 2px; background: var(--accent); }
.tab .dot { position: absolute; top: 5px; left: calc(50% + 8px); width: 8px; height: 8px; }
body[data-view="player"], body[data-view="night"], body[data-view="ring"] { --tab-h: 0px; }
body[data-view="player"] #tabbar, body[data-view="night"] #tabbar, body[data-view="ring"] #tabbar { display: none; }
body:has(#intro) #tabbar, body:has(#intro) #sidebar { opacity: 0; pointer-events: none; }
#tabbar, #sidebar { transition: opacity 1.2s var(--ease) 0.2s; }

.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); display: inline-block; }
.tab-ind svg { width: 20px; height: 20px; }

.screen { height: 100%; display: flex; flex-direction: column; max-width: 1500px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px var(--gutter) 0; }
.page .page-head.flush { padding-inline: 0; }
.page-title { font-size: clamp(3rem, 9vw, 5.2rem); font-weight: 200; line-height: 1; letter-spacing: -0.02em; margin: 0; color: var(--ink); }
.page-sub { color: var(--ink-2); margin: 12px 0 0; font-size: var(--fs-sm); }
.head-actions { display: flex; align-items: center; gap: var(--space-1); margin-top: 6px; flex: none; }
.head-actions svg { width: 30px; height: 30px; }
.head-actions [aria-current="page"] svg { fill: currentColor; }
/* Narrow phones: four header icons and the title share 320px */
@media (max-width: 359px) {
  .page-title { font-size: 2.5rem; }
  .head-actions { gap: 0; }
  .head-actions .icon-btn { width: 40px; height: 40px; }
  .head-actions svg { width: 26px; height: 26px; }
}
.page-clock { display: none; color: var(--ink-2); letter-spacing: 0.14em; font-size: var(--fs-xs); padding-top: 12px; font-variant-numeric: tabular-nums; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: var(--space-4) var(--gutter) 2px; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-tab {
  flex: none; position: relative; padding: 8px var(--space-4) 12px; font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap;
}
.chip-tab:first-child { padding-left: 0; }
.chip-tab[aria-pressed="true"] { color: var(--ink); }
.chip-tab[aria-pressed="true"]::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 3px; border-radius: 2px; background: var(--accent);
}
.chip-tab:first-child[aria-pressed="true"]::after { left: -4px; right: 10px; }

.tiles { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 16px var(--gutter) 6px; flex: none; scroll-padding-inline: var(--gutter); scroll-snap-type: x proximity; }
.tiles::-webkit-scrollbar { display: none; }
/* Fade the trailing edge so it reads as a scrolling row; cleared once you reach the end */
.tiles { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent); }
.tiles.at-end { -webkit-mask-image: none; mask-image: none; }
.tile {
  flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink); white-space: nowrap;
  transition: background-color var(--dur-ui) ease, border-color var(--dur-ui) ease, color var(--dur-ui) ease, transform var(--dur-press) var(--ease);
}
.tile-label { font-size: var(--fs-xs); line-height: 1.15; font-weight: 400; }
.tile:hover { border-color: rgba(255, 255, 255, 0.4); }
.tile[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.tile:active { transform: scale(0.97); }
.tiles.glides { position: relative; }
.tiles.glides .tile { position: relative; z-index: 1; }
.tiles.glides .tile[aria-pressed="true"] { background: transparent; }
.tile-glide { position: absolute; left: 0; top: 16px; height: 44px; border-radius: 999px; background: var(--accent); pointer-events: none; }
.tile-glide.ready { transition: transform var(--dur-move) var(--ease-in-out), width var(--dur-move) var(--ease-in-out), opacity var(--dur-ui) ease; }
.card-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.stage { height: clamp(240px, 40vh, 420px); pointer-events: none; }
/* Where the orb can be tapped and spun. Sideways drags are the spin, up and down still scrolls. */
.card-body .stage, .player .stage { pointer-events: auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.stage-short { height: clamp(200px, 30vh, 320px); }
.list-col {
  padding: 0 var(--gutter) calc(var(--mini-h) + 40px);
  background: linear-gradient(180deg, rgba(6, 4, 18, 0) 0, rgba(6, 4, 18, 0.78) 60px);
}

/* ── Rows ────────────────────────────────────────────────────────────────── */
.list-title { font-size: var(--fs-lg); font-weight: 300; line-height: 1.2; margin: var(--space-6) 0 12px; color: var(--ink); }
.list > .group-head:first-child { padding-top: 16px; }
.empty-action { align-self: flex-start; margin-top: var(--space-4); padding: 11px 20px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink); font-size: var(--fs-sm); transition: background 0.2s, border-color 0.2s; }
.empty-action:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--ink-3); }
/* Image placeholders breathe softly until their WebGL thumbnail arrives */
body:not(.no-gl) .article-thumb:not([style*="background-image"]),
body:not(.no-gl) .feature-img:not([style*="background-image"]),
body:not(.no-gl) .article-hero:not([style*="background-image"]) { animation: placeholder 1.8s ease-in-out infinite; }
.list { margin: 0; padding: 0; border-top: 1px solid var(--line); }
.group-head { padding: var(--space-6) 0 8px; font-size: var(--fs-2xs); letter-spacing: 0.28em; text-transform: uppercase; color: var(--tint); }
.row { display: flex; align-items: center; gap: 6px; min-height: 84px; border-bottom: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: var(--space-4) 0; }
.row-title { font-size: var(--fs-lg); font-weight: 300; line-height: 1.25; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: var(--fs-xs); color: var(--ink-2); margin-top: 2px; }
.row.current .row-title { color: var(--tint); }
.row-main:hover .row-title { color: #fff; }
.empty { padding: var(--space-8) 0; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); }
.empty strong { font-weight: 400; color: var(--ink); font-size: var(--fs-md); }

.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--ink); flex: none; transition: background 0.2s; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); }
.icon-btn.ring { border: 1.5px solid var(--line-2); }
.heart svg { width: 26px; height: 26px; transition: transform var(--dur-press) var(--ease), color var(--dur-ui) ease, fill var(--dur-ui) ease; }
.heart[aria-pressed="true"] svg { fill: var(--rose); stroke: var(--rose); }
.heart:active svg { transform: scale(0.9); }
.heart.pop svg { animation: heart-pop 280ms var(--ease); }
.play-btn {
  width: 48px; height: 48px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 1.75px solid var(--ink); transition: background-color var(--dur-ui) ease, color var(--dur-ui) ease, transform var(--dur-press) var(--ease);
}
.play-btn svg { width: 20px; height: 20px; }
.play-btn:hover { background: var(--ink); color: var(--bg); }
.play-btn:active { transform: scale(0.96); }
.play-btn.lg { width: 54px; height: 54px; }

.pick {
  width: 36px; height: 44px; flex: none; position: relative;
}
.pick::before {
  content: ''; position: absolute; left: 6px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  border-radius: 50%; border: 1.5px solid var(--ink-3); transition: background-color var(--dur-ui) ease, border-color var(--dur-ui) ease;
}
.pick.on::before { background: var(--accent); border-color: transparent; }
span.pick { width: 30px; }

/* ── Alarm block (Wake) ─────────────────────────────────────────────────── */
.alarm { display: flex; align-items: center; gap: 14px; padding: var(--space-4) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.alarm-time { flex: 1; display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.alarm-clock { font-size: 2.8rem; font-weight: 200; line-height: 1; letter-spacing: -0.01em; }
.alarm-clock small { font-size: var(--fs-xl); margin-left: 8px; }
.alarm-days { color: var(--ink-2); margin-top: 6px; }
.alarm-med { border-bottom: 1px solid var(--line); margin-bottom: 28px; }

.switch {
  width: 56px; height: 32px; flex: none; border-radius: 16px; position: relative;
  background: rgba(255, 255, 255, 0.16); transition: background 0.25s;
}
/* The track stays slim; the tap area reaches 44px */
.switch::before { content: ''; position: absolute; inset: -6px 0; }
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #f4f1ea; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); transition: transform var(--dur-ui) var(--ease);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(24px); }

/* ── Mini player ─────────────────────────────────────────────────────────── */
#mini { position: fixed; left: var(--side-w); right: 0; bottom: var(--tab-h); z-index: 5; pointer-events: none; }
.mini {
  pointer-events: auto; position: relative;
  display: flex; align-items: center; gap: 12px;
  max-width: 1500px; margin: 0 auto;
  height: var(--mini-h);
  padding: 0 var(--gutter);
  background: rgba(12, 9, 30, 0.7);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-top: 1px solid var(--line-2);
  animation: rise var(--dur-sheet) var(--ease-drawer);
}
.mini-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; text-align: left; }
.orb {
  width: 52px; height: 52px; border-radius: 12px; flex: none;
  background: var(--surface) center / cover;
  box-shadow: inset 0 0 0 1px var(--line-2);
}
body:not(.paused) .orb { animation: breathe 10s ease-in-out infinite; }
.mini-text { display: flex; flex-direction: column; min-width: 0; }
.mini-text strong { font-weight: 300; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-text small { color: var(--ink-2); font-size: var(--fs-xs); }
.mini-controls { display: flex; align-items: center; gap: 10px; }
.mini { gap: 6px; }
.mini-open { margin-right: 4px; }
.mini-bar { position: absolute; left: 0; right: 0; top: -1px; height: 2px; }
.mini-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.5s linear; }
.wide-only { display: none; }

/* ── Pages: favorites + players ─────────────────────────────────────────── */
.page {
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  max-width: 1300px; margin: 0 auto;
  padding: 0 var(--gutter) calc(28px + env(safe-area-inset-bottom));
}
.topbar { display: flex; align-items: center; justify-content: space-between; height: 64px; margin: 0 -10px; }
.wordmark { font-size: var(--fs-xs); letter-spacing: 0.5em; text-transform: uppercase; color: var(--ink-2); padding-left: 0.5em; }

.player { display: flex; flex-direction: column; isolation: isolate; }
/* Veils: the sky stays clear around the orb and darkens behind anything you have to read */
.player-titles, .controls { position: relative; }
.player-titles::before, .controls::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none; left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter));
}
.player-titles::before { top: -120px; bottom: -96px; background: linear-gradient(180deg, rgba(var(--veil), var(--veil-a)) calc(100% - 96px), rgba(var(--veil), 0)); }
/* The hard shadow carries the veil below the last control without adding scroll length */
.controls::before { top: -96px; bottom: 0; background: linear-gradient(180deg, rgba(var(--veil), 0), rgba(var(--veil), var(--veil-a)) 96px); box-shadow: 0 160px 0 rgba(var(--veil), var(--veil-a)); }
.player-grid { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.player-titles { margin-top: 6px; }
.player-title { font-size: clamp(2.6rem, 9vw, 4.6rem); font-weight: 200; line-height: 1.02; letter-spacing: -0.02em; margin: 0; }
.player-sub { color: var(--ink-2); margin: 8px 0 0; }
.player .stage { flex: 1; min-height: 260px; height: auto; }
.player-sounds .stage { min-height: 340px; }
.controls { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }

.transport { display: flex; align-items: center; justify-content: center; gap: 44px; padding: 10px 0 var(--space-4); }
.transport.solo { padding: 0 0 24px; }
.big-play {
  width: 84px; height: 84px; display: grid; place-items: center; border-radius: 50%;
  transition: transform var(--dur-press) var(--ease), background-color var(--dur-ui) ease;
}
.big-play:not(.small) { border: 1.75px solid var(--ink); }
.big-play svg { width: 34px; height: 34px; }
.big-play:hover { background: rgba(255, 255, 255, 0.06); }
.big-play:active { transform: scale(0.96); }
.big-play.small { width: 64px; height: 64px; border: 1.5px solid var(--line-2); margin: 0 auto; }
.big-play.small svg { width: 28px; height: 28px; }
.skip svg { width: 40px; height: 40px; stroke-width: 1.3; }
.skip { width: 56px; height: 56px; }

.settings-bar {
  display: flex; align-items: center; gap: 18px; width: 100%;
  padding: var(--space-6) 6px 6px; border-top: 1px solid var(--line); text-align: left;
}
.settings-icon svg { width: 34px; height: 34px; }
.settings-text { flex: 1; display: flex; flex-direction: column; font-size: var(--fs-lg); }
.settings-text small { font-size: var(--fs-sm); color: var(--ink-2); }

.seek { padding-top: 8px; }
.times { display: flex; justify-content: space-between; color: var(--ink-2); font-size: var(--fs-xs); margin-top: 8px; font-variant-numeric: tabular-nums; }


.options { border-top: 1px solid var(--line); }
.option-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: var(--space-4) 2px; border-bottom: 1px solid var(--line); text-align: left; font-size: var(--fs-md);
}
.option-row:last-child { border-bottom: 0; }
.option-row small { display: block; font-size: var(--fs-xs); color: var(--ink-2); }
.option-row svg { width: 20px; height: 20px; color: var(--ink-2); }
.with-icon { display: inline-flex; align-items: center; gap: 14px; }
.with-icon svg { width: 24px; height: 24px; color: var(--ink); }

.cta {
  margin-top: 12px; width: 100%; height: 60px; border-radius: 14px;
  background: var(--grad-soft); color: var(--accent-ink); font-size: var(--fs-md); font-weight: 400;
  transition: transform var(--dur-press) var(--ease);
}
.cta:active { transform: scale(0.98); }
.clock-small { text-align: center; color: var(--ink-2); margin: 16px 0 0; }

/* ── Range sliders ──────────────────────────────────────────────────────── */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; cursor: pointer; --p: 50%; }
/* The unfilled part is an opaque neutral so the gradient only shows up to the current value */
.range { --track-rest: var(--track); }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, transparent var(--p), var(--track-rest) var(--p)), var(--accent); }
.range::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, transparent var(--p), var(--track-rest) var(--p)), var(--accent); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #fff; border: 0; }
.range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; }
.range:disabled { opacity: 0.35; }

/* ── Sheet ──────────────────────────────────────────────────────────────── */
#sheet-root { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#sheet-root:empty { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity var(--dur-sheet) var(--ease); }
.sheet {
  position: absolute; left: 50%; bottom: 0; width: min(560px, 100%);
  max-height: 86vh; display: flex; flex-direction: column;
  background: var(--sheet); border: 1px solid var(--line-2); border-bottom: 0;
  backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border-radius: 26px 26px 0 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, 100%); transition: transform var(--dur-sheet) var(--ease-drawer);
}
#sheet-root.open { pointer-events: auto; }
#sheet-root.open .sheet-backdrop { opacity: 1; }
#sheet-root.open .sheet { transform: translate(-50%, 0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) 16px 6px 24px; }
.sheet-head h2 { margin: 0; font-weight: 300; font-size: var(--fs-xl); }
.sheet-body { overflow-y: auto; padding: 4px 24px calc(28px + env(safe-area-inset-bottom)); }
.sheet .eyebrow { margin: var(--space-6) 0 6px; color: var(--tint); }
.field { padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--fs-md); }
.value-line { margin: 6px 0 0; font-size: var(--fs-sm); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); font-size: var(--fs-sm);
  transition: background-color var(--dur-ui) ease, border-color var(--dur-ui) ease, color var(--dur-ui) ease, transform var(--dur-press) var(--ease);
}
.chip:hover:not(:disabled) { color: var(--ink); border-color: var(--ink-3); }
.chip:active:not(:disabled) { transform: scale(0.96); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 400; }
.chip:disabled { opacity: 0.35; cursor: default; }
.choice {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: var(--space-4) 0; border-bottom: 1px solid var(--line); text-align: left;
}
.choice strong { display: block; font-weight: 300; font-size: var(--fs-md); }
.choice small { display: block; color: var(--ink-2); font-size: var(--fs-xs); }
.choice.on strong { color: var(--accent); }
.choice svg { color: var(--accent); }
.alarm-edit { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.time-input {
  flex: 1; width: 100%; min-width: 0; padding: 0;
  background: transparent; color: var(--ink); border: 0; font: 200 clamp(2.2rem, 10vw, 3.4rem)/1 'Outfit', sans-serif; color-scheme: dark;
}
.time-input::-webkit-calendar-picker-indicator { opacity: 0.55; cursor: pointer; }
.days { display: flex; justify-content: space-between; gap: 6px; margin-top: 12px; }
.day { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--ink-2); transition: background-color var(--dur-ui) ease, border-color var(--dur-ui) ease, color var(--dur-ui) ease; }
.day.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 500; }

/* ── Sleep mode ─────────────────────────────────────────────────────────── */
body[data-view="night"] #app { background: rgba(0, 0, 0, 0.38); }
.night { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; text-align: center; cursor: default; }
/* Hero in the top band, clock pinned just below centre, info anchored to the bottom:
   revealing the controls grows the info upward without moving the clock */
.night-stage { position: absolute; inset: 0 0 58% 0; height: auto; }
.night-center { position: absolute; left: 0; right: 0; top: 48%; transform: translateY(-50%); animation: night-settle 12s ease-in-out 40s both; }
.night-info > p:not(.night-warn), .show-controls { animation: night-settle 12s ease-in-out 40s both; }
.night.awake .night-center, .night.awake .night-info > p, .night.awake .show-controls { animation: none; }
@keyframes night-settle { to { opacity: 0.52; } }
.night-clock { margin: 0; font-size: clamp(4.5rem, 20vw, 8rem); font-weight: 200; line-height: 1; letter-spacing: -0.03em; color: rgba(240, 217, 191, 0.9); font-variant-numeric: tabular-nums; animation: night-drift 1200s ease-in-out infinite alternate; }
/* A slow wander, so a screen left on all night doesn't hold one bright shape in place */
@keyframes night-drift { 25% { translate: 14px -10px; } 50% { translate: -10px 12px; } 75% { translate: 12px 8px; } 100% { translate: -14px -8px; } }
.night-clock small { font-size: 0.32em; margin-left: 0.25em; letter-spacing: 0; }
.rest { margin: var(--space-4) 0 0; letter-spacing: 0.42em; color: var(--ink-3); font-size: var(--fs-md); padding-left: 0.42em; }
.night-info { margin-top: auto; padding: 0 var(--gutter) calc(24px + env(safe-area-inset-bottom)); color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.night-info p { margin: 0; }
.night-info p:empty { display: none; }
.night-warn { color: var(--ink); max-width: 34ch; margin-top: var(--space-2) !important; text-wrap: balance; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── The alarm ringing ──────────────────────────────────────────────────── */
body[data-view="ring"] #app { background: rgba(5, 4, 13, 0.22); }
.ring-screen { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 var(--gutter) calc(var(--space-8) + env(safe-area-inset-bottom)); }
.ring-stage { position: absolute; inset: 0 0 62% 0; height: auto; }
.ring-center { margin-top: auto; padding-top: 34vh; }
.ring-greet { margin: 0; font-size: var(--fs-xl); font-weight: 300; }
.ring-greet:focus { outline: none; }
.ring-clock { margin: var(--space-2) 0 0; font-size: clamp(4.5rem, 22vw, 6rem); font-weight: 200; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring-clock small { font-size: 0.32em; margin-left: 0.25em; letter-spacing: 0; }
.ring-sub { margin: var(--space-4) 0 0; color: var(--ink-2); text-wrap: balance; }
.ring-actions { margin-top: auto; width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.ring-actions .cta { margin-top: 0; }
.ring-snooze { width: 100%; height: 60px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--glass); font-size: var(--fs-md); transition: transform var(--dur-press) var(--ease); }
.ring-snooze:active { transform: scale(0.98); }
.show-controls { margin-top: var(--space-4); display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); padding: 10px 16px; }
.show-controls svg { width: 18px; height: 18px; }
.night-controls { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 4px; animation: fade var(--dur-move) var(--ease); }
.night-controls .hint { margin: 0; min-height: 1.2em; }
.night-controls .link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; }
.night-controls[hidden] { display: none; }

/* ── Welcome ────────────────────────────────────────────────────────────── */
#intro {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; text-align: center;
  padding: 0 var(--gutter) calc(48px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(5, 4, 13, 0.85), rgba(5, 4, 13, 0) 55%);
}
/* Starts below the wordmark so the orb never sits on it */
.intro-stage { position: absolute; inset: min(56px, 5vh) 0 max(46%, 400px) 0; pointer-events: none; }
/* Short phones: the copy needs less than 400px, so the stage shifts down clear of the wordmark */
@media (max-height: 700px) { .intro-stage { top: 36px; bottom: 360px; } }
.intro-copy { position: relative; max-width: 560px; display: flex; flex-direction: column; align-items: center; }
.intro-title {
  margin: var(--space-4) 0 0; font-size: clamp(2.8rem, 9vw, 5.4rem); font-weight: 200; line-height: 1.02; letter-spacing: -0.025em;
  color: var(--ink);
}
.intro-title span { display: block; }
.intro-title span + span { color: var(--tint); }
.intro-sub { margin: var(--space-4) 0 0; color: var(--ink-2); font-size: var(--fs-sm); max-width: 30em; }
.intro-begin {
  margin-top: var(--space-8); height: 58px; padding: 0 54px; border-radius: 999px;
  background: var(--grad); color: var(--accent-ink); font-size: var(--fs-md); font-weight: 400; letter-spacing: 0.02em;
  transition: transform var(--dur-press) var(--ease), filter var(--dur-ui) ease;
}
@media (hover: hover) and (pointer: fine) { .intro-begin:hover { transform: translateY(-2px); filter: brightness(1.08); } }
.intro-begin:active { transform: scale(0.97); }
.intro-hint { margin: 16px 0 0; color: var(--ink-3); font-size: var(--fs-xs); letter-spacing: 0.04em; }
#intro .wordmark { position: fixed; top: calc(env(safe-area-inset-top) + 32px); left: 0; right: 0; margin: 0; color: var(--ink); font-size: var(--fs-sm); }
#intro .wordmark, #intro .intro-title span, #intro .intro-sub, #intro .intro-begin, #intro .intro-hint {
  opacity: 0; transform: translateY(18px); filter: blur(6px);
  transition: opacity 1.4s var(--ease), transform 1.4s var(--ease), filter 1.4s var(--ease);
}
#intro.in .wordmark { transition-delay: 0.2s; }
#intro.in .intro-title span:nth-child(1) { transition-delay: 0.45s; }
#intro.in .intro-title span:nth-child(2) { transition-delay: 0.75s; }
#intro.in .intro-sub { transition-delay: 1.05s; }
#intro.in .intro-begin { transition-delay: 1.3s; }
#intro.in .intro-hint { transition-delay: 1.5s; }
#intro.in .wordmark, #intro.in .intro-title span, #intro.in .intro-sub, #intro.in .intro-begin, #intro.in .intro-hint { opacity: 1; transform: none; filter: none; }
#intro.out { opacity: 0; transform: scale(1.04); filter: blur(10px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), filter 0.6s var(--ease); pointer-events: none; }
body:has(#intro) #app, body:has(#intro) #mini { opacity: 0; }
#app, #mini { transition: opacity 1.2s var(--ease) 0.2s; }

.topbar-actions { display: inline-flex; gap: 2px; }

/* ── Insights ───────────────────────────────────────────────────────────── */
.page { padding-bottom: calc(var(--mini-h) + 48px); }
.insights .chips { padding-inline: 0; margin-top: 6px; }
.feature { display: block; margin-top: var(--space-4); color: inherit; }
.feature-img {
  display: block; aspect-ratio: 16 / 9; border-radius: 22px; border: 1px solid var(--line);
  background: var(--surface) center / cover; transition: transform 1.2s var(--ease), filter 0.4s; filter: brightness(0.92);
}
.feature:hover .feature-img { filter: brightness(1.05); }
.feature-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: var(--space-4) 2px 20px; border-bottom: 1px solid var(--line); }
.feature-body .eyebrow { display: block; margin: 0 0 6px; }
.feature-title { display: block; font-size: clamp(1.55rem, 4.5vw, 2.3rem); font-weight: 300; line-height: 1.15; }
.feature-summary { display: block; color: var(--ink-2); margin-top: 8px; max-width: 38em; }
.feature-body svg, .article-row svg { width: 22px; height: 22px; color: var(--ink-2); flex: none; }
.section-title { font-weight: 300; font-size: var(--fs-xl); margin: var(--space-8) 0 6px; }
.article-list { list-style: none; margin: 0; padding: 0; }
.article-row { display: flex; align-items: center; gap: 16px; padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.article-thumb { width: 96px; height: 76px; border-radius: 14px; flex: none; border: 1px solid var(--line); background: var(--surface) center / cover; }
.article-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.article-name { font-size: var(--fs-md); line-height: 1.25; }
.article-row:hover .article-name { color: #fff; }

.article { max-width: 760px; }
/* Long-form text needs a calmer field than the live sky behind it */
.article .eyebrow { margin-top: 10px; }
.article-title { font-size: clamp(2.3rem, 7vw, 3.8rem); font-weight: 200; line-height: 1.05; letter-spacing: -0.015em; margin: 0; color: var(--ink); }
.article-dek { color: var(--ink-2); font-size: var(--fs-md); margin: 16px 0 0; }
.article-hero { aspect-ratio: 16 / 9; border-radius: 22px; border: 1px solid var(--line); background: var(--surface) center / cover; margin: var(--space-6) 0 var(--space-8); }
.prose { font-size: var(--fs-md); line-height: 1.75; color: var(--ink-2); }
.prose p { margin: 0 0 var(--space-4); }
.prose h2 { font-weight: 400; font-size: var(--fs-lg); margin: var(--space-8) 0 8px; color: var(--ink); }
.prose ul { margin: 0 0 var(--space-6); padding-left: 1.2em; }
.prose li { margin: 6px 0; }
.prose strong { font-weight: 500; color: var(--ink); }
.prose blockquote { margin: var(--space-8) 0; padding: 2px 0 2px var(--space-6); border-left: 2px solid var(--accent); font-size: var(--fs-lg); font-weight: 300; line-height: 1.5; color: var(--ink); }
.listen { margin-top: 40px; }
.disclaimer { color: var(--ink-3); font-size: var(--fs-xs); margin: var(--space-8) 0 0; }

/* Insights: the same sky as everywhere else, under a veil in the world's own colour */
/* Home has no extra scrim: its sky and orb show as brightly as on Sleep; .hub-body carries its own veil */
body[data-view="articles"] #app, body[data-view="article"] #app { background: rgba(var(--veil), 0.84); }
.hub { display: flex; flex-direction: column; padding-bottom: 0; isolation: isolate; overflow-x: hidden; }
.hub > .page-head { position: relative; }
.hub > .page-head::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none; top: -40px; bottom: 0; left: calc(-1 * var(--gutter)); right: -100vw;
  /* Ends with the header, so the orb below it shows at full strength */
  background: linear-gradient(180deg, rgba(var(--veil), var(--veil-a)) 40%, rgba(var(--veil), 0));
}
/* The orb gets a real band of the page; the content starts a little closer below it to pay for that */
.hub-orb { flex: none; height: clamp(180px, 28vh, 300px); }
@media (min-width: 960px) { .hub-orb { height: clamp(220px, 34vh, 360px); } }
.hub-body {
  flex: 1; margin-inline: calc(-1 * var(--gutter)); padding: var(--space-6) var(--gutter) calc(var(--mini-h) + var(--hub-gap));
  background: linear-gradient(180deg, rgba(var(--veil), 0), rgba(var(--veil), 0.78) 64px);
}

/* One line where there's room; on phones the header icons share the row, so it wraps evenly */
.hub .page-sub { text-wrap: balance; }
@media (min-width: 960px) { .hub .page-sub { white-space: nowrap; } }
.page-head > div { min-width: 0; }
.hub section { margin-top: 0; }
/* Home's spacing rules, on the 4px scale:
   --hub-gap   between sections (and between the groups at the top)
   --hub-head  from a section heading down to its content
   --hub-inner between the parts inside one section */
.hub { --hub-gap: 56px; --hub-head: var(--space-4); --hub-inner: var(--space-4); }
@media (min-width: 960px) { .hub { --hub-gap: 72px; } }
.hub .hub-body > * + * { margin-top: var(--hub-gap); }
.hub-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--hub-gap); }
.hub-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--hub-head); }
.hub-title { margin: 0; font-weight: 300; font-size: var(--fs-xl); line-height: 1.2; }
.hub-aside { color: var(--ink-2); font-size: var(--fs-xs); }
.hub-link { display: inline-flex; align-items: center; min-height: 44px; margin-block: -12px; color: var(--accent); font-size: var(--fs-sm); }
.hub-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.week-card { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: var(--space-4) 0; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, 0.045); }
.week-stat { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 4px; padding: 0 var(--space-3); text-align: center; }
.week-stat + .week-stat { border-left: 1px solid var(--line); }
.week-stat dd { margin: 0; font-size: var(--fs-xl); line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.week-stat dt { color: var(--ink-2); font-size: var(--fs-xs); line-height: 1.25; }
.week-hint { margin: var(--space-3) 2px 0; }
.week-strip { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--hub-inner); }
.week-dots { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; flex: none; }
.week-dots li { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); color: var(--ink-2); font-size: 0.7rem; }
.week-dots li.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 500; }
.week-dots li.today:not(.on) { border-color: var(--ink-3); color: var(--ink); }
.week-streak { margin: 0; color: var(--ink-2); font-size: var(--fs-xs); line-height: 1.35; }
.recent-list { border-top: 0; }
/* Hub rows of cover cards */
.hub-row { display: flex; gap: var(--space-4); margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) var(--space-2); list-style: none; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter); }
.hub-row::-webkit-scrollbar { display: none; }
.hub-row > li { flex: none; scroll-snap-align: start; }
.tile-card { position: relative; display: flex; flex-direction: column; gap: var(--space-1); width: 148px; text-align: left; color: inherit; }
.cover { display: block; width: 148px; aspect-ratio: 1; border-radius: 14px; background: var(--surface, #17123a) center / cover; border: 1px solid var(--line); transition: transform var(--dur-press) var(--ease); }
.tile-card:active .cover { transform: scale(0.98); }
.tile-card-title { margin-top: var(--space-2); font-size: var(--fs-sm); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-card-meta { color: var(--ink-2); font-size: var(--fs-xs); }
.continue-card { width: 100%; display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3); text-align: left; color: inherit; border: 1px solid var(--line-2); border-radius: 18px; background: var(--glass); }
.continue-card .cover { width: 88px; border-radius: 12px; flex: none; }
.continue-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.continue-text strong { font-weight: 400; font-size: var(--fs-md); }
.continue-text small { color: var(--ink-2); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-bar { display: block; height: 3px; margin-top: 6px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.continue-bar span { display: block; height: 100%; background: var(--accent); }
.pick-card { padding-left: 34px; width: 182px; }
.pick-num { position: absolute; left: -4px; top: 74px; font-family: var(--display); font-size: 5.2rem; line-height: 1; font-weight: 300; color: var(--ink); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45); pointer-events: none; z-index: 1; }
.browse-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.browse-tile { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); min-height: 72px; padding: var(--space-4); border: 1px solid var(--line-2); border-radius: 14px; text-align: left; color: inherit; transition: background-color 0.2s, transform 0.15s var(--ease); }
.browse-tile:hover { background: rgba(255, 255, 255, 0.05); }
.browse-tile:active { transform: scale(0.97); }
.browse-tile span { font-size: var(--fs-sm); }
.browse-tile small { color: var(--ink-2); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
@media (min-width: 960px) { .browse-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
/* A mouse can't swipe: show the rows' scrollbar where there's a fine pointer */
@media (hover: hover) and (pointer: fine) { .hub-row { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; padding-bottom: var(--space-3); } }
/* First visit on desktop: the guide and Your week side by side */
.hub-first { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--hub-gap); }
.hub-first > section { margin-top: 0; }
@media (min-width: 960px) { .hub-first { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; gap: var(--space-10); } }
.hub-recent:empty, .hub-continue:empty { display: none; }
.hub-top > .hub-continue > section { margin-top: 0; }
.hub-top > .hub-recent > section { margin-top: 0; }
.timer-btn { position: relative; }
.timer-badge { position: absolute; right: -2px; bottom: 2px; padding: 1px 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 0.62rem; font-weight: 500; line-height: 1.4; white-space: nowrap; pointer-events: none; }
.timer-badge:empty { display: none; }
.mini-close svg { width: 20px; height: 20px; }

.finder-card { position: relative; display: block; width: 100%; min-height: 128px; text-align: left; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface); transition: border-color 0.2s; }
.finder-card:hover { border-color: var(--line-2); }
.finder-art { position: absolute; inset: 0; background: center / cover; opacity: 0.9; -webkit-mask-image: linear-gradient(100deg, transparent 32%, #000 78%); mask-image: linear-gradient(100deg, transparent 32%, #000 78%); }
.finder-copy { position: relative; display: flex; flex-direction: column; padding: var(--space-4) 18px; }
.finder-title { font-size: var(--fs-xl); line-height: 1.2; }
.finder-sub { color: var(--ink-2); font-size: var(--fs-sm); margin-top: 4px; }
.finder-start { display: inline-flex; align-items: center; gap: 8px; margin-top: var(--space-3); color: var(--accent); }
.finder-start svg { width: 24px; height: 24px; }
/* Returning visitors get the guide as a single line, below what they were already doing */
.finder-card.compact { min-height: 0; background: none; border-color: var(--line); }
.finder-card.compact .finder-copy { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: var(--space-3); padding: var(--space-3) var(--space-4); }
.finder-card.compact .finder-title { font-size: var(--fs-md); flex: 1; }
.finder-card.compact .finder-sub { display: none; }
.finder-card.compact .finder-start { margin-top: 0; }

.hub-feature { display: block; color: inherit; }
.hub-feature .feature-img { aspect-ratio: 16 / 7; border-radius: 16px; }
.hub-feature:hover .feature-img { filter: brightness(1.05); }
.hub-feature-text { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) 2px; border-bottom: 1px solid var(--line); }
.hub-feature-text .feature-title { font-size: var(--fs-lg); line-height: 1.25; }
.hub-feature-text .row-meta { display: block; }
.hub-feature-text svg { width: 22px; height: 22px; color: var(--ink-2); flex: none; }
.hub-feature:hover .feature-title { color: #fff; }

/* Meditation finder */
.finder-sheet { height: min(78dvh, 720px); }
.finder-sheet .sheet-head { padding-top: 22px; }
.finder-sheet .sheet-head::before { content: ''; position: absolute; top: 9px; left: 50%; width: 44px; height: 4px; margin-left: -22px; border-radius: 2px; background: var(--line-2); }
.finder-sheet .sheet-head h2 { display: flex; align-items: center; gap: 12px; }
.finder-sheet .sheet-head h2 svg { width: 28px; height: 28px; }
.finder-sheet .sheet-body { flex: 1; min-height: 0; overflow: hidden; padding: 0; }
.finder { height: 100%; display: flex; flex-direction: column; }
.fm-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-2) 16px var(--space-4); }
.fm-log { display: flex; flex-direction: column; gap: var(--space-3); }
.fm { margin: 0; padding: 10px 16px; border-radius: 16px; border: 1px solid var(--line); line-height: 1.35; overflow-wrap: anywhere; white-space: pre-line; }
.fm-bot { background: rgba(255, 255, 255, 0.07); }
.fm-me { align-self: flex-end; max-width: 82%; background: var(--accent-soft); }
.fm-row { display: flex; align-items: flex-start; gap: 12px; }
.fm-row > :last-child { max-width: min(100%, 420px); }
.fm-row .fm-card { flex: 1; min-width: 0; }
.fm-orb { flex: none; width: 36px; height: 36px; margin-top: 4px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
.fm-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, 0.05); }
.fm-eyebrow { margin: 0 0 8px; color: var(--accent); font-size: var(--fs-2xs); font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; }
.fm-pick { display: flex; align-items: center; gap: 10px; }
.fm-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; }
.fm-art { flex: none; width: 60px; height: 60px; border-radius: 12px; background: center / cover; }
.fm-text { min-width: 0; display: flex; flex-direction: column; }
.fm-title { font-size: var(--fs-md); line-height: 1.25; }
.fm-reason { margin: 0 0 0 48px; line-height: 1.4; }
.fm-note { margin: 0 0 0 48px; color: var(--ink-2); font-size: var(--fs-xs); line-height: 1.4; }
.fm-options { display: flex; flex-wrap: wrap; gap: 8px; margin: var(--space-3) 0 0 48px; }
.fm-opt { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); font-size: var(--fs-sm); transition: border-color 0.2s, background 0.2s; }
.fm-opt:hover { border-color: var(--ink-3); background: rgba(255, 255, 255, 0.05); }
.fm-opt.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 400; }
.fm-form { display: flex; align-items: flex-end; gap: 4px; margin: var(--space-2) 16px calc(16px + env(safe-area-inset-bottom)); padding: 2px 4px 2px 18px; border: 1px solid var(--line-2); border-radius: 24px; background: rgba(255, 255, 255, 0.05); }
.fm-form:focus-within { border-color: var(--ink-3); }
.fm-form input, .fm-form textarea { flex: 1; min-width: 0; align-self: center; padding: 11px 0; border: 0; outline: 0; background: none; color: var(--ink); font: inherit; font-size: 16px; resize: none; }
.fm-form ::placeholder { color: var(--ink-3); }
.fm-send { flex: none; width: 44px; height: 44px; display: grid; place-items: center; color: var(--accent); }
.fm-send svg { width: 24px; height: 24px; }
.enter { animation: fm-enter 0.28s var(--ease) both; }
@keyframes fm-enter { from { opacity: 0; transform: translateY(8px); } }

/* ── Account ────────────────────────────────────────────────────────────── */
.account { max-width: 680px; }
/* Text pages share the browse screens' left edge instead of centring in the space */
.account, .article, .insights { margin-left: 0; }
.profile { display: flex; flex-direction: column; align-items: center; text-align: center; margin: var(--space-6) 0 var(--space-6); }
.avatar {
  position: relative; width: 112px; height: 112px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--surface) center / cover;
  font-size: 2.5rem; font-weight: 300; letter-spacing: 0.02em;
}
.avatar::before { content: ''; position: absolute; inset: 0; background: rgba(8, 6, 22, 0.35); }
.avatar > span { position: relative; display: grid; place-items: center; }
.avatar svg { width: 44px; height: 44px; }
.profile-name { font-size: var(--fs-2xl); font-weight: 300; margin: 16px 0 4px; }
.settings { list-style: none; margin: 0 0 28px; padding: 0; border-top: 1px solid var(--line); }
.settings .option-row { border-bottom: 1px solid var(--line); }
.muted-row { color: var(--ink-3); cursor: default; }
.account-foot { text-align: center; margin-top: 8px; }
.social-links { list-style: none; display: flex; gap: 14px; margin: 4px 0 28px; padding: 0; }
.social-links .icon-btn { color: var(--ink-2); transition: color 0.2s, background 0.2s, border-color 0.2s; }
.social-links .icon-btn:hover, .social-links .icon-btn:focus-visible { color: var(--ink); border-color: var(--ink-2); }
.social-links svg { width: 19px; height: 19px; fill: currentColor; stroke: none; }
.avatar.has-photo::before { display: none; }
.avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.profile-email { margin: 0 0 8px; }
.signed-in-row { color: var(--ink); }
.signed-in-row svg { color: var(--accent-2); }

/* Sign-in buttons follow each provider's brand rules: Apple white, Google dark, Facebook blue. */
.auth-card {
  margin: 0 0 var(--space-8); padding: var(--space-6) 20px 20px; border-radius: 22px;
  background: var(--glass); border: 1px solid var(--line-2);
}
.auth-title { margin: 0; font-size: var(--fs-lg); font-weight: 400; }
.auth-buttons { display: grid; gap: 10px; margin-top: var(--space-4); }
.auth-legal { margin-top: var(--space-4); color: var(--ink-2); }
.hint .link, .disclaimer .link { font-size: inherit; }
.auth-btn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 52px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent;
  font: 500 1rem/1 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; letter-spacing: 0;
  transition: transform var(--dur-press) var(--ease), filter var(--dur-ui) ease;
}
.auth-btn svg.brand { position: absolute; left: 18px; width: 20px; height: 20px; stroke: none; }
.auth-btn:hover:not(:disabled) { filter: brightness(1.06); }
.auth-btn:active:not(:disabled) { transform: scale(0.98); }
.auth-btn:disabled { opacity: 0.6; cursor: progress; }
.auth-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-apple { background: #fff; color: #000; }
.auth-apple svg.brand { width: 19px; height: 19px; margin-top: -2px; }
.auth-google { background: #131314; color: #e3e3e3; border-color: #8e918f; }
.auth-facebook { background: #1877f2; color: #fff; }
.text-input {
  width: 100%; margin-top: 12px; padding: var(--space-4) 16px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-2); color: var(--ink); font: inherit; font-size: var(--fs-md);
}
.text-input:focus { outline: none; border-color: var(--accent); }
.chip.danger { margin-top: var(--space-4); color: #ffb3c8; border-color: rgba(255, 140, 170, 0.4); }

/* ── Toast ──────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; left: calc(50% + var(--side-w) / 2); bottom: calc(var(--mini-h) + var(--tab-h) + 20px); z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 20px; border-radius: 22px; width: max-content; max-width: min(calc(100vw - var(--side-w) - 32px), 480px);
  background: rgba(24, 18, 54, 0.92); border: 1px solid var(--line-2); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; visibility: hidden;
  transition: transform var(--dur-sheet) var(--ease), opacity var(--dur-sheet) var(--ease), visibility var(--dur-sheet);
}
#toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; visibility: visible; }
#toast .link { color: var(--accent); }
#toast:has(.link) { padding-block: 2px; }

@keyframes rise { from { transform: translateY(100%); } }
@keyframes placeholder { 50% { opacity: 0.55; } }
@keyframes view-enter { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
@keyframes breathe { 50% { filter: brightness(1.35); } }
@keyframes heart-pop { 40% { transform: scale(1.28); } }
@keyframes row-arrive { from { opacity: 0; transform: translateY(8px); } }
.list > li.arrive { animation: row-arrive 280ms var(--ease) both; animation-delay: calc(var(--i) * 30ms); }

/* ── Screen transitions (View Transitions; see navigate() in app.js) ───────────
   Only the page itself takes part, so the sky and orb keep moving underneath. Names are set only
   while a transition runs: a named element stops glass inside it from blurring what's behind. */
:root { view-transition-name: none; }
html[data-vt] #app { view-transition-name: page; }
html[data-vt] .mini { view-transition-name: mini; }
html[data-vt] .page-title { view-transition-name: page-title; }
html[data-vt] .player-title { view-transition-name: hero-title; }
html[data-vt] .night-clock { view-transition-name: night-clock; }
::view-transition-group(page), ::view-transition-group(mini) { animation: none; }
::view-transition-old(page) { animation: vt-out 150ms var(--ease) both; }
::view-transition-new(page) { animation: vt-in var(--dur-move) var(--ease) 80ms both; }
/* The tapped title moves into place rather than stretching */
::view-transition-group(hero-title) { animation-duration: 300ms; animation-timing-function: var(--ease-in-out); }
::view-transition-old(hero-title), ::view-transition-new(hero-title) { height: 100%; object-fit: none; object-position: left top; }
::view-transition-old(hero-title) { animation: vt-out 150ms var(--ease) both; }
::view-transition-new(hero-title) { animation: vt-in var(--dur-move) var(--ease) 60ms both; }

/* Changing section: the old screen steps back, the new title settles in with the sky */
html[data-vt="section"]::view-transition-old(page) { animation: vt-out 150ms var(--ease) both; }
html[data-vt="section"]::view-transition-new(page) { animation: vt-rise 280ms var(--ease) 60ms both; }
::view-transition-group(page-title) { animation: none; }
html[data-vt="section"]::view-transition-old(page-title) { animation: vt-out 120ms var(--ease) both; }
html[data-vt="section"]::view-transition-new(page-title) { animation: vt-title 300ms var(--ease) 60ms both; }

/* Lights down: the room goes dark before the clock comes up */
/* Lights-down is the one deliberate, once-a-night moment, so it is allowed to take its time */
html[data-vt="night-in"]::view-transition-old(page) { animation: vt-sink 0.6s var(--ease) both; }
html[data-vt="night-in"]::view-transition-new(page) { animation: vt-in 1.4s var(--ease) 0.5s both; }
html[data-vt="night-in"]::view-transition-old(mini) { animation: vt-sink 0.4s var(--ease) both; }
html[data-vt="night-in"]::view-transition-new(night-clock) { animation: vt-clock 1.6s var(--ease) 0.8s both; }
html[data-vt="night-out"]::view-transition-old(page), html[data-vt="night-out"]::view-transition-old(night-clock) { animation: vt-out 150ms var(--ease) both; }
html[data-vt="night-out"]::view-transition-new(page) { animation: vt-in var(--dur-move) var(--ease) 80ms both; }

/* Reduced motion: a short crossfade, nothing moves */
html[data-vt="fade"]::view-transition-old(*) { animation: vt-out 150ms ease both; }
html[data-vt="fade"]::view-transition-new(*) { animation: vt-in var(--dur-ui) ease both; }
html[data-vt="fade"]::view-transition-group(*) { animation: none; }

@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }
@keyframes vt-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes vt-title { from { opacity: 0; filter: blur(6px); transform: translateY(6px); } }
@keyframes vt-sink { to { opacity: 0; transform: translateY(18px) scale(0.985); } }
@keyframes vt-clock { from { opacity: 0; filter: blur(8px); transform: scale(0.94); } }

/* ── Wider screens ──────────────────────────────────────────────────────── */
.list-hint { margin: -6px 0 var(--space-3); }
.list-col .tiles { padding-inline: 0; }
.alarm-arm { border-bottom: 1px solid var(--line); }
.alarm-arm small { display: block; }
.alarm-need { margin: 0; padding-bottom: var(--space-2); }
.after-timer { padding: var(--space-1) 0 var(--space-4); }
.alarm-missed { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.alarm-missed p { margin: 0; font-size: var(--fs-xs); }
.alarm-missed .link { flex: none; }

/* The orb's voice: big titles only, in a soft, slightly wonky serif. Everything else stays Outfit. */
.page-title, .player-title, .intro-title, .article-title {
  font-family: var(--display); font-weight: 300; letter-spacing: -0.02em; font-synthesis: none;
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
}

/* ── After dark: js/palette.js quiets the colours so selected states no longer outshine everything ── */
body.after-dark .page-title { color: var(--ink); }
body.after-dark .cta { background: var(--grad); }

@media (min-width: 680px) {
  .hub-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: 'continue recent' 'guide recent'; align-items: start; gap: var(--space-8) var(--space-10); }
  .hub-top > .hub-continue { grid-area: continue; }
  .hub-top > .hub-recent { grid-area: recent; }
  .hub-top > .finder-card { grid-area: guide; }
  .hub-top:not(:has(.continue-card)) > .finder-card { grid-area: continue; }
  .hub-articles { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 var(--space-8); align-items: start; }
  .hub-feature-text { border-bottom: 0; }
  .hub .article-row:first-child { padding-top: 0; }
  .finder-card { min-height: 133px; }
}

@media (min-width: 960px) {
  :root { --side-w: 240px; --tab-h: 0px; }
  body.has-mini { --mini-h: 96px; }
  body[data-view="night"], body[data-view="ring"] { --side-w: 0px; }
  #tabbar { display: none; }
  #sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 6; width: var(--side-w);
    display: flex; flex-direction: column; gap: 4px; padding: var(--space-8) var(--space-4) 24px;
    background: rgba(8, 6, 22, 0.6); border-right: 1px solid var(--line);
    backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
  }
  body[data-view="night"] #sidebar, body[data-view="ring"] #sidebar { display: none; }
  .side-brand { padding: 0 16px var(--space-10); font-size: var(--fs-xs); letter-spacing: 0.5em; text-transform: uppercase; color: var(--ink-2); }
  .side-link {
    position: relative; display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 16px;
    border-radius: 14px; color: var(--ink-2); font-size: var(--fs-md); transition: color 0.2s, background 0.2s;
  }
  .side-link svg { width: 26px; height: 26px; }
  .side-link:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }
  .side-link[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
  .side-link[aria-current="page"]::before { content: ''; position: absolute; left: -4px; top: 15px; bottom: 15px; width: 3px; border-radius: 2px; background: var(--accent); }
  .side-ind { margin-left: auto; display: inline-flex; }
  .side-ind .dot { width: 9px; height: 9px; }
  .side-account { margin-top: auto; }
  /* The sidebar has Favorites and Account; the header keeps the finder, Sleep mode and Save */
  .head-actions > a { display: none; }
  .head-actions:not(:has(button)) { display: none; }
  .page-clock { display: block; margin-left: auto; }
  .page-head { padding-top: var(--space-8); }
  .account .topbar { visibility: hidden; height: 24px; }
  .card-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 500px); grid-template-rows: minmax(0, 1fr); overflow: hidden; }
  .card-body .stage { height: 100%; }
  .list-col { overflow-y: auto; background: none; padding-top: 4px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
  .list-col .eyebrow, .list-col .list-title { margin-top: var(--space-4); }
  .card-body .list-col { background: linear-gradient(90deg, rgba(8, 6, 22, 0), rgba(8, 6, 22, 0.72) 22%); }
  .wide-only { display: inline-grid; }

  .favorites .card-body { flex: 1; min-height: 0; }
  .insights:not(.hub) { max-width: 1100px; }
  .hub > .page-head, .hub-body > * { max-width: 1100px; }
  .insights .feature { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: end; }
  .insights .feature-body { border-bottom: 0; padding-bottom: 6px; }

  .player { padding-bottom: 32px; }
  .player-grid {
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 460px);
    grid-template-rows: auto 1fr; column-gap: 56px;
  }
  .player .stage { grid-column: 1; grid-row: 1 / span 2; min-height: 0; }
  .player-titles { grid-column: 2; padding-top: 6vh; position: static; }
  .controls { position: static; }
  .player-titles::before, .controls::before { display: none; }
  /* Side by side, one veil covers the whole text column and feathers toward the orb */
  .player-grid { position: relative; }
  .player-grid::before {
    content: ''; position: absolute; z-index: -1; pointer-events: none; grid-column: 2; grid-row: 1 / -1;
    top: -120px; bottom: -48px; left: -56px; right: calc(-1 * var(--gutter));
    background: linear-gradient(90deg, rgba(var(--veil), 0), rgba(var(--veil), var(--veil-a)) 56px);
  }
  .controls { grid-column: 2; justify-content: flex-end; }
  .player-sounds .controls { justify-content: center; }
}
/* Small desktops: a slimmer text column, so the orb beside it isn't squeezed to a thin strip */
@media (min-width: 960px) and (max-width: 1199px) {
  .player-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); column-gap: 32px; }
}

@media (max-width: 959px) {
  .favorites .card-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .favorites .list-col { flex: 1; }
  /* Phones: the orb is the star, so it keeps real room; the first rows still start above the fold */
  .screen .stage { height: clamp(240px, 40vh, 420px); }
  /* Favorites is usually a short list, so the orb can have most of the screen above it */
  .screen .stage-short { height: clamp(200px, 32vh, 340px); }
  /* A little shorter on Wake, where the alarm also needs the first screen */
  .screen[data-section="wake"] .stage { height: clamp(200px, 32vh, 320px); }
  /* Sleep player: a smaller hero, so what happens after you fall asleep is on the first screen */
  .player-sleep .stage { min-height: 150px; }
  /* Tighter control spacing on phones hands ~45px back to the orb; every row stays a 56px+ target */
  .player .seek { padding-top: 0; }
  .player .transport { padding: 4px 0 var(--space-2); }
  .player .option-row { padding-block: var(--space-3); }
  .player .settings-bar { padding-top: var(--space-4); }
  .list-col { background: linear-gradient(180deg, rgba(6, 4, 18, 0) 0, rgba(6, 4, 18, 0.82) 48px); }
  .card-body { scrollbar-width: none; }
  .card-body::-webkit-scrollbar { display: none; }
}

@media (max-width: 420px) {
  .row-title { font-size: var(--fs-md); }
  .transport { gap: 28px; }
}

@media (max-height: 700px) and (max-width: 959px) {
  .page-title { font-size: 2.8rem; }
  .player .stage { min-height: 180px; }
}

/* Reduced motion (the device setting or the app's own): nothing travels, scales or blurs, but
   colour and opacity changes stay as short fades so it's still clear what changed */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-property: opacity, color, background-color, border-color, fill, stroke !important; transition-duration: 0.15s !important;
  }
  .night-clock { animation: none !important; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
  transition-property: opacity, color, background-color, border-color, fill, stroke !important; transition-duration: 0.15s !important;
}
html.reduce-motion .night-clock { animation: none !important; }

/* ── Sounds deck: the Sounds page is the player ──────────────────────────── */
.deck-col { display: flex; flex-direction: column; }
.deck { display: flex; flex-direction: column; gap: var(--space-4); width: 100%; max-width: 440px; margin: 0 auto; }
.deck-card { text-align: center; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; }
.deck-card:active { cursor: grabbing; }
.deck-card .eyebrow { margin: 0 0 6px; }
.deck-pos { color: var(--ink-3); letter-spacing: 0.12em; margin-left: 0.6em; }
.deck-title { font-size: clamp(1.6rem, 6vw, 2.4rem); font-weight: 200; line-height: 1.1; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
.deck-under { margin: 6px 0 0; color: var(--tint); font-size: var(--fs-xs); }
.deck-under:empty { display: none; }
/* One row: favorite · previous · play · next · sleep mode */
.deck-transport { display: flex; align-items: center; justify-content: center; gap: var(--space-6); }
.deck-transport .icon-btn svg { width: 26px; height: 26px; }
.deck-step { width: 52px; height: 52px; }
.deck-step svg { width: 28px; height: 28px; }
.deck-transport .big-play { width: 76px; height: 76px; }
.deck-transport .big-play svg { width: 30px; height: 30px; }
/* One row: volume · timer · all sounds */
.deck-volume { display: flex; align-items: center; gap: 10px; }
.deck-vol-icon { display: inline-grid; color: var(--ink-2); }
.deck-vol-icon svg { width: 22px; height: 22px; }
.deck-timer {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--ink); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; transition: background 0.2s;
}
.deck-timer svg { width: 20px; height: 20px; }
.deck-timer:hover { background: rgba(255, 255, 255, 0.06); }
.deck-list svg { width: 24px; height: 24px; }
.sheet-sounds .sheet-group { margin-top: var(--space-6); }
.sheet-sounds .sheet-group:first-child { margin-top: var(--space-2); }
/* The phone bar: one row in the same glass as the meditation mini player */
.deck-bar {
  display: none; align-items: center; gap: 4px; height: 72px; padding: 0 8px 0 var(--space-4);
  border-radius: 20px; border: 1px solid var(--line-2);
  background: rgba(12, 9, 30, 0.7); backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.deck-bar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; padding: 8px 4px 8px 0; }
.deck-bar-text strong { font-weight: 300; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-bar-text small { color: var(--ink-2); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-bar .deck-step { width: 44px; height: 44px; }
.deck-bar .deck-step svg { width: 24px; height: 24px; }
.deck-more-actions { display: flex; align-items: center; gap: var(--space-3); }
.deck-more-actions .option-row { flex: 1; }
@media (min-width: 960px) {
  .deck-col { justify-content: center; }
}
/* Phones and tablets: just the bar, and the orb takes every other pixel */
@media (max-width: 959px) {
  .screen[data-section="sounds"] .card-body { display: flex; flex-direction: column; overflow: hidden; }
  .screen[data-section="sounds"] .stage { flex: 1; height: auto; min-height: 200px; }
  .screen[data-section="sounds"] .deck-col { flex: none; padding-top: var(--space-2); padding-bottom: calc(var(--mini-h) + var(--space-3)); background: none; }
  .deck-bar { display: flex; }
  .deck { display: none; }
}

/* Favorites category with nothing saved, in place of the deck */
.deck-empty { display: flex; flex-direction: column; gap: 6px; padding: var(--space-6) var(--space-2); color: var(--ink-2); text-align: center; }
.deck-empty strong { font-weight: 400; color: var(--ink); font-size: var(--fs-md); }
/* The top heart rests until there is something to save */
.head-actions .icon-btn:disabled { opacity: 0.35; cursor: default; }
.head-actions .icon-btn:disabled:hover { background: none; }

/* ── Short landscape screens (phones on their side) ─────────────────────────
   Stacked, the orb and the content fought over 390px of height: the sleep player's controls and
   the Sounds bar fell off the screen, and the orb sat behind the clock and the welcome title.
   Side by side, the orb gets the full height on the left and the content keeps the right half. */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 959px) {
  .page-head { padding-top: 12px; }
  .page-title { font-size: 2.2rem; }
  .tiles { padding-top: 8px; padding-bottom: 8px; }
  .card-body, .favorites .card-body, .screen[data-section="sounds"] .card-body {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 50%); grid-template-rows: minmax(0, 1fr); overflow: hidden;
  }
  .screen .stage, .screen .stage-short, .screen[data-section="wake"] .stage, .screen[data-section="sounds"] .stage { height: 100%; min-height: 0; }
  .list-col { overflow-y: auto; padding-bottom: calc(var(--mini-h) + 16px); background: linear-gradient(90deg, rgba(6, 4, 18, 0), rgba(6, 4, 18, 0.78) 40px); }
  .screen[data-section="sounds"] .deck-col { justify-content: center; padding-bottom: calc(var(--mini-h) + 12px); }

  .player-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 50%); grid-template-rows: auto minmax(0, 1fr); column-gap: 24px; position: relative; }
  .player .stage, .player-sleep .stage, .player-sounds .stage { grid-column: 1; grid-row: 1 / span 2; min-height: 0; }
  .player-titles { grid-column: 2; position: static; }
  .player-title { font-size: 2rem; }
  .controls { grid-column: 2; position: static; overflow-y: auto; min-height: 0; justify-content: flex-start; }
  .player-titles::before, .controls::before { display: none; }
  .player-grid::before {
    content: ''; position: absolute; z-index: -1; pointer-events: none; grid-column: 2; grid-row: 1 / -1;
    top: -80px; bottom: -48px; left: -24px; right: calc(-1 * var(--gutter));
    background: linear-gradient(90deg, rgba(var(--veil), 0), rgba(var(--veil), var(--veil-a)) 40px);
  }
  .transport { padding: 4px 0 var(--space-2); }

  /* The mini player stays in the content column, so the orb keeps the full height on the left;
     it never gets narrower than a portrait phone's, so its title and buttons still fit */
  #mini { left: min(50%, calc(100% - 400px)); }
  /* Home is one column, so its mini player keeps the full width and the orb band sits above it */
  body[data-view="insights"] #mini { left: 0; }
  .hub-orb { height: clamp(140px, 40vh, 200px); }
}
/* The smallest phones on their side: drop the player's eyebrow and subtitle so Play stays on screen */
@media (orientation: landscape) and (max-height: 340px) {
  .player-titles .eyebrow, .player-sub { display: none; }
  .player-title { font-size: 1.6rem; }
}
/* Welcome, sleep mode and the alarm on any short, wide screen (phones on their side, small laptop
   windows): orb on the left at full height, words and controls on the right, so they never overlap */
@media (orientation: landscape) and (max-height: 700px) and (min-aspect-ratio: 3/2) {
  .night-stage { inset: 0 50% 0 0; }
  .night-center { left: 50%; top: 38%; }
  .night-clock { font-size: clamp(3.5rem, 12vw, 6rem); }
  .night-info { align-self: flex-end; width: 50%; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .night-controls { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .night-controls .big-play.small { margin: 0; }

  .ring-stage { inset: 0 50% 0 0; }
  .ring-center, .ring-actions { align-self: flex-end; width: 50%; }
  .ring-center { padding-top: var(--space-6); }
  .ring-clock { font-size: clamp(3.5rem, 12vw, 5rem); }
  #intro { align-items: flex-end; justify-content: center; padding: 0 var(--gutter); background: linear-gradient(270deg, rgba(5, 4, 13, 0.85), rgba(5, 4, 13, 0) 60%); }
  .intro-stage { inset: 0 50% 0 0; }
  .intro-copy { width: 50%; }
  #intro .wordmark { position: static; margin-bottom: var(--space-2); }
  .intro-title { font-size: clamp(2.2rem, 5vw, 3.6rem); margin-top: 0; }
  .intro-begin { margin-top: var(--space-4); }
}
