/* ---------- Home ---------- */
.home-head { padding: 1.25rem 0 0.5rem; }
.home-title { font-family: var(--font-body); font-size: 1.3125rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.home-tagline { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; }
/* The "Up next" heading stays for assistive tech; the card's own kicker is the visible label */
.home-continue > h2 { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The hero: a soft glow in the world accent over a green-tinted panel */
.card-continue {
  display: grid; grid-template-columns: minmax(0, 1fr) 5.75rem; column-gap: 1rem; row-gap: 0.5rem; align-content: start; align-items: start;
  padding: 1.25rem; margin: 0.75rem 0 0.5rem;
  background:
    radial-gradient(ellipse at 90% 5%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 48%),
    linear-gradient(135deg, var(--surface), var(--surface-deep));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  color: inherit; text-decoration: none;
}
.card-continue-text { display: contents; }
.card-continue .cover { grid-column: 2; grid-row: 1 / span 2; width: 5.75rem; aspect-ratio: 1; border-radius: 20px; }
.card-continue-label { grid-column: 1; grid-row: 1; margin: 0.25rem 0 0; color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.card-continue-title { grid-column: 1; grid-row: 2; font-family: var(--font-display); font-size: 1.75rem; line-height: 1.06; font-weight: 500; margin: 0 0 0.25rem; overflow-wrap: anywhere; }
.card-continue .btn { grid-column: 1 / -1; justify-self: start; margin-top: 0.5rem; }
.card-continue-bar {
  grid-column: 1 / -1; display: block; width: 100%; height: 6px; margin: 0.5rem 0 0.25rem;
  border: 0; border-radius: var(--radius-pill); overflow: hidden;
  background: color-mix(in srgb, var(--text) 14%, transparent); accent-color: var(--accent);
}
.card-continue-bar::-webkit-progress-bar { background: color-mix(in srgb, var(--text) 14%, transparent); }
.card-continue-bar::-webkit-progress-value { background: var(--accent); border-radius: var(--radius-pill); }
.card-continue-bar::-moz-progress-bar { background: var(--accent); }

.lately { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.lately-item { display: block; color: inherit; text-decoration: none; min-width: 0; }
.lately-item .cover { aspect-ratio: 1; border-radius: 18px; }
.lately-state { display: block; color: var(--muted); font-size: 0.8125rem; }
.lately-title { display: block; margin-top: 0.5rem; font-size: var(--text-small); font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.lately-item[data-state="in-progress"] .lately-state { color: var(--accent); }
/* No history yet: hide the whole section */
section:has(> .lately-root:empty) { display: none; }

/* World picker (Home): compact tiles, three across. More than three worlds: two tiles
   and an "All N worlds" tile that opens a sheet of every world. */
.world-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.world-tile {
  --tile: var(--accent);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0.35rem;
  min-height: 6.25rem; padding: 0.65rem 0.4rem 0.6rem; width: 100%;
  background: linear-gradient(135deg, var(--surface), var(--raised));
  color: var(--text);
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  font: inherit; text-align: center; text-decoration: none; cursor: pointer;
}
.world-picker > .world-tile { max-width: none; } /* the no-script link tile */
.world-tile > svg, .world-tile > b {
  flex: none; width: 2.9rem; height: 2.9rem; padding: 0.4rem; border-radius: 14px;
  color: var(--tile);
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--tile) 32%, transparent), transparent 64%),
    linear-gradient(145deg, color-mix(in srgb, var(--tile) 28%, var(--surface)), var(--raised));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tile) 20%, transparent);
}
.world-tile .tile-all { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.world-tile .icon-main { fill: color-mix(in srgb, var(--tile) 26%, transparent); }
.world-tile > span { font-size: 0.9375rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.world-tile[aria-pressed="true"], .world-tile[aria-current="true"] { border-color: var(--tile); background: linear-gradient(135deg, color-mix(in srgb, var(--tile) 14%, var(--surface)), var(--raised)); }
/* "All N worlds": a count in place of an icon, dashed so it reads as a door to the rest */
.world-tile-all { --tile: var(--muted); border-style: dashed; border-color: var(--line); }
.world-tile > b { display: flex; align-items: center; justify-content: center; padding: 0; font-size: 1.15rem; background: var(--raised); color: var(--text); }
/* The no-script link tile has no icon or data-world */
.world-tile:not([data-world]):not(.world-tile-all) { flex-direction: row; justify-content: center; min-height: var(--tap-lg); font-weight: 700; }

/* ===== Library (grouped browse): start ===== */
.page-head { padding: 1.25rem 0 0.75rem; }
.page-head .page-title { padding: 0.35rem 0 0; }
.page-title { padding: 1.25rem 0 0.75rem; font-size: 1.75rem; }

.search-box {
  display: block; width: 100%; min-height: var(--tap-lg);
  padding: 0 1rem 0 2.9rem;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23abb5aa' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E") no-repeat 0.95rem 50% / 1.4rem;
  color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit;
}
.search-box::placeholder { color: var(--muted); opacity: 1; }

/* Chip rows scroll sideways instead of wrapping. They run to the screen edge so a
   half-visible chip shows there is more. The world switcher and the filters module
   each fill one row; the world switcher's group and the chip rows are the scrollers. */
.chip-bleed { --bleed: var(--gutter); }
.world-filter { margin: 0.75rem calc(var(--bleed, var(--gutter)) * -1) 0; }

/* Search box and the Filters button share a row. */
.search-row { display: flex; gap: 0.5rem; align-items: stretch; }
.search-row .search-box { flex: 1 1 auto; min-width: 0; }
.filters-host { flex: none; display: flex; }
.filters-open { min-height: var(--tap-lg); padding: 0 1rem; border-radius: var(--radius-sm); background: var(--surface); border-color: var(--line); }
.filters-open svg { fill: none; }
.filters-open b {
  display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 0.3rem; box-sizing: border-box;
  background: var(--accent); color: var(--accent-ink); border-radius: var(--radius-pill); font-size: 0.8rem; font-weight: 750;
}
.filters-open b[hidden] { display: none; }
.filters-open[data-active="true"] { border-color: var(--accent); }
.active-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.active-filters:empty { display: none; }
.active-chip { padding: 0 0.85rem; font-size: 0.9375rem; }
.sheet-wrap { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sheet .btn, .filters-open, .active-chip { -webkit-tap-highlight-color: transparent; }
.sheet-wrap .btn { background: var(--surface); }
.sheet-wrap .btn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.filters { display: grid; gap: 0.5rem; }
.world-filter:empty, .filters:empty { display: none; }
.world-chips, .chip-row {
  display: flex; flex-wrap: nowrap; gap: 0.5rem; overflow-x: auto; overscroll-behavior-x: contain;
  position: relative; padding: 0 var(--bleed, var(--gutter)) 2px; scroll-padding: 0 var(--bleed, var(--gutter));
  scrollbar-width: none;
}
.world-chips::-webkit-scrollbar, .chip-row::-webkit-scrollbar { display: none; }
.world-chips .btn, .chip-row .btn { flex: none; background: transparent; color: var(--muted); padding: 0 1rem; font-size: 1rem; white-space: nowrap; }
.world-chips .btn[aria-pressed="true"], .chip-row .btn[aria-pressed="true"] { color: var(--text); }

.library-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 0.5rem; margin: 0.5rem 0 0.25rem; min-height: var(--tap); }
.library-status { margin: 0; color: var(--muted); font-size: var(--text-small); font-weight: 600; }
.library-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; min-width: 0; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--accent); padding: 0 0.75rem; }
.filter-select {
  min-height: var(--tap); padding: 0 1rem; max-width: 100%;
  background: var(--raised); color: var(--text);
  border: 1px solid var(--line-soft); border-radius: var(--radius-pill);
  font: inherit; font-size: 1rem; font-weight: 600;
}
.library-tools .filter-select { min-width: 0; max-width: 9rem; padding: 0 0.6rem 0 0.9rem; font-size: 0.9375rem; text-overflow: ellipsis; }
.filter-select[data-active="true"] { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); border-color: var(--accent); }
.empty { padding: 2rem 0; text-align: center; color: var(--muted); }

/* Series cards: a tappable header (name, count, heard), a next-up link, then the ordered list */
.series-list { display: grid; gap: 0.75rem; margin-top: 0.5rem; }
.series-group {
  background: linear-gradient(135deg, var(--surface), var(--raised));
  border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden;
}
.series-head { margin: 0; font-family: inherit; }
.series-toggle {
  display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) 1.25rem; gap: 0 0.9rem; align-items: center;
  width: 100%; min-height: 5rem; padding: 0.75rem 1rem;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.series-toggle::after {
  content: ""; width: 0.6rem; height: 0.6rem; margin-right: 0.2rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform 0.15s;
}
.series-toggle[aria-expanded="true"]::after { transform: rotate(-135deg); }
.series-cover { width: 3.5rem; height: 3.5rem; border-radius: 14px; }
.series-text { display: block; min-width: 0; }
.series-eyebrow { display: block; color: var(--muted); font-family: var(--font-body); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.series-name { display: block; font-family: var(--font-display); font-size: 1.3125rem; font-weight: 500; line-height: 1.2; overflow-wrap: anywhere; }
.series-summary { display: block; margin-top: 0.1rem; color: var(--muted); font-family: var(--font-body); font-size: var(--text-small); }
.series-bar { height: 4px; margin-top: 0.5rem; }
.series-next-slot:empty { display: none; }
.series-next {
  display: block; min-height: var(--tap); padding: 0.6rem 1rem; box-sizing: border-box;
  border-top: 1px solid var(--line-soft);
  font-size: 1rem; line-height: 1.3; text-decoration: none;
}
.series-next-label { color: var(--muted); font-weight: 600; }
.series-next-title { color: var(--accent); font-weight: 700; overflow-wrap: anywhere; }
.series-body { padding: 0 1rem 0.5rem; border-top: 1px solid var(--line-soft); }
.series-body .row:last-child { border-bottom: 0; }
/* A scope with one series: no card, the stories sit straight on the page. */
.series-list[data-solo="true"] .series-group { background: none; border: 0; border-radius: 0; overflow: visible; }
.series-list[data-solo="true"] .series-body { padding: 0; border-top: 0; }
.show-more { width: 100%; margin: 0.5rem 0 0.25rem; color: var(--accent); background: transparent; }
.library-view > .show-more { width: auto; margin: 0.75rem auto 0; display: flex; }
.flat-results .show-more { margin-top: 0.75rem; }

/* Rows. Inside a series the series name is redundant; the story number takes its place. */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto; gap: 0 0.9rem; align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.row .cover { width: 3.5rem; height: 4rem; border-radius: 14px; }
.row-text { min-width: 0; }
.row-title {
  display: inline-flex; align-items: center; min-height: var(--tap);
  font-weight: 700; font-size: 1.0625rem; line-height: 1.25; text-decoration: none; overflow-wrap: anywhere;
}
.row-title:hover { text-decoration: underline; }
.row-meta { margin: 0; color: var(--muted); font-size: var(--text-small); }
.row-order { display: none; }
.series-body .row-series { display: none; }
.series-body .row-order { display: inline; }
/* The New marker is emitted hidden-by-CSS; the filters module sets
   data-new="true" on the row when the story is new and unplayed. */
.row .badge-new { display: none; margin-left: 0.5rem; }
.row[data-new="true"] .badge-new { display: inline-flex; }
/* Thin progress bar: filters.mjs sets data-state and --progress on every row */
.row-bar { display: none; margin-top: 0.25rem; }
.row[data-state="in-progress"] .row-bar { display: block; }
.row-bar > i { width: var(--progress, 0%); }
/* The play button reflects the story's state (play-button.mjs sets data-state on it) */
.row [data-mount="play-button"] { gap: 0.4rem; }
.row .play-glyph-again { display: none; }
.row [data-mount="play-button"][data-state="finished"] .play-glyph { display: none; }
.row [data-mount="play-button"][data-state="finished"] .play-glyph-again { display: block; }
.row .play-label { display: none; font-size: 0.9375rem; }
.row [data-mount="play-button"][data-state="in-progress"], .row [data-mount="play-button"][data-state="finished"] { padding: 0 1rem 0 0.85rem; }
.row [data-mount="play-button"][data-state="in-progress"] .play-label, .row [data-mount="play-button"][data-state="finished"] .play-label { display: inline; }
.row [data-mount="play-button"][data-state="finished"] { background: transparent; color: var(--accent); }
@media (min-width: 720px) { .chip-bleed { --bleed: 1.5rem; } } /* main's side padding widens here */
/* ===== Library (grouped browse): end ===== */

/* ---------- Story ---------- */
.story-hero {
  margin: 0 calc(var(--gutter) * -1);
  padding: 1rem var(--gutter) 1.5rem;
  background:
    radial-gradient(ellipse at 85% 0%, color-mix(in srgb, var(--series) 24%, transparent), transparent 55%),
    linear-gradient(160deg, var(--surface), var(--surface-sunk));
  color: var(--text);
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0 0 var(--radius) var(--radius);
}
.story-series { margin: 0 0 0.6rem; color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.crumbs { display: flex; flex-wrap: wrap; gap: 0 0.5rem; align-items: center; margin: 0 0 0.5rem; color: var(--muted); font-size: var(--text-small); font-weight: 600; }
.crumbs a { display: inline-flex; align-items: center; min-height: var(--tap); }
.story-cover {
  width: 100%; height: 13rem; aspect-ratio: auto; margin: 0 auto 1.25rem; border-radius: 26px;
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--series) 34%, transparent), transparent 58%),
    linear-gradient(145deg, color-mix(in srgb, var(--series) 18%, var(--raised)), var(--surface));
}
.story-cover svg { width: 44%; max-height: 80%; filter: drop-shadow(0 0 14px color-mix(in srgb, var(--series) 60%, transparent)); }
.story-hero h1 { font-size: 2rem; line-height: 1.08; }
.story-description { margin: 0.9rem 0 0.75rem; }
.story-meta { margin: 0.6rem 0 0.9rem; color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }

.story-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }

/* Text size: a real radio group, pure CSS, works without script */
.textsize { position: relative; display: inline-flex; border: 0; margin: 0; padding: 0; gap: 0.25rem; align-items: center; }
.textsize legend { padding: 0; }
/* The radios are visually hidden and take no touches: an absolutely positioned input with no
   offsets sits at the fieldset's start, so the three of them stack over the first label (A-) and
   the last one (A+) caught every tap meant for it. The labels are the targets; keyboard and
   screen readers still use the radios. */
.textsize input { position: absolute; opacity: 0; width: var(--tap); height: var(--tap); margin: 0; pointer-events: none; }
.textsize label {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap);
  border: 1px solid var(--line-soft); border-radius: var(--radius-pill); background: var(--raised);
  font-family: var(--font-display); font-weight: 700; cursor: pointer;
}
.textsize label[for="ts-sm"] { font-size: 0.9rem; }
.textsize label[for="ts-md"] { font-size: 1.1rem; }
.textsize label[for="ts-lg"] { font-size: 1.4rem; }
.textsize input:checked + label { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); border-color: var(--accent); }
.textsize input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 3px; }
.story:has(#ts-sm:checked) { --reading-scale: 0.9; }
.story:has(#ts-lg:checked) { --reading-scale: 1.25; }

/* Parts: rows divided by hairlines, a tick for parts heard, a marker for the current one */
.parts-details { margin-top: 1.25rem; }
.parts-details summary {
  display: flex; align-items: center; gap: 0.75rem; min-height: var(--tap);
  cursor: pointer; list-style: none; color: var(--muted);
}
.parts-details summary::-webkit-details-marker { display: none; }
.parts-details summary::after { content: "▾"; margin-left: auto; transition: transform 0.15s; }
.parts-details[open] summary::after { transform: rotate(180deg); }
.parts-details summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.parts-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.parts-now { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); font-size: var(--text-small); }
.parts-details[open] .parts-now { display: none; }
@media (prefers-reduced-motion: reduce) { .parts-details summary::after { transition: none; } }
.parts-list { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.parts-list li { border-bottom: 1px solid var(--line-soft); }
.parts-list button { width: 100%; justify-content: flex-start; }

.story-body {
  max-width: 65ch; margin: 1.5rem auto 0;
  font-family: var(--font-display);
  font-size: calc(1.25rem * var(--reading-scale));
  line-height: 1.7; color: var(--text-reading);
}
.story-body h2, .story-body h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.3em; margin: 2em 0 0.5em; }
.story-body hr { border: 0; border-top: 1px solid var(--line-soft); margin: 2rem 0; }
.story-body .part-current { background: color-mix(in srgb, var(--accent) 22%, transparent); }

.story-audio { margin: 1rem 0 0; }
.story-audio audio { width: 100%; }

.series-nav { display: grid; gap: 0.75rem; max-width: 65ch; margin: 2rem auto 0; }
.series-nav a {
  display: flex; align-items: center; min-height: var(--tap-lg);
  padding: 0.5rem 1.25rem;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  font-weight: 600; text-decoration: none;
}
.series-nav a.next { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 750; }

.resume-prompt {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  margin: 1rem 0 0; padding: 0.75rem 1rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
}
.resume-note { flex: 1 1 100%; margin: 0; }

/* Phone: a small cover tile beside the title, Play and text size straight under it. */
@media (max-width: 719px) {
  .story-hero { display: grid; grid-template-columns: 4.25rem minmax(0, 1fr); column-gap: 0.9rem; align-items: center; }
  .story-hero > * { grid-column: 1 / -1; }
  .story-hero > .story-cover { grid-column: 1; width: 4.25rem; height: 4.25rem; margin: 0; border-radius: 16px; }
  .story-hero > .story-cover svg { width: 62%; }
  .story-hero > h1 { grid-column: 2; margin: 0; font-size: 1.75rem; line-height: 1.05; }
}

/* The floating Play pill (play-float.mjs): above the dock, and above the mini player when one is showing. */
.play-float {
  position: fixed; z-index: 25; min-height: var(--tap-lg); padding: 0 1.4rem; font-size: 1.0625rem;
  right: max(var(--gutter), calc((100vw - var(--page-max)) / 2 + var(--gutter)));
  bottom: calc(var(--dock-h) + 0.9rem);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.play-float[hidden] { display: none; }
body.has-mini-player .play-float { bottom: calc(var(--dock-h) + var(--dock-mini-h) + 0.9rem); }
@media (min-width: 720px) {
  main { padding-left: 1.5rem; padding-right: 1.5rem; }
  .story-hero { margin: 1rem 0 0; border-radius: var(--radius); padding: 1.5rem; display: grid; grid-template-columns: 16rem 1fr; gap: 0 1.5rem; align-items: start; border: 1px solid var(--line-soft); }
  .story-cover { grid-column: 1; grid-row: 1 / span 7; width: 100%; height: auto; aspect-ratio: 1; margin: 0; }
  .story-hero > :not(.story-cover) { grid-column: 2; }
  .card-continue { grid-template-columns: minmax(0, 1fr) 8rem; }
  .card-continue .cover { width: 8rem; }
}

.parts-root:empty { display: none; }

/* Play count in a row's meta line ("· Heard 3 times"); empty until the story has been heard */
.row-plays { white-space: nowrap; }
.row-plays:empty { display: none; }

/* "Pick a story" row: the Surprise me tile is a button that looks like its two neighbours */
.lately-surprise { width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lately-surprise .cover {
  aspect-ratio: 1; border-radius: 18px; color: var(--accent);
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 62%),
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), var(--raised));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.lately-surprise .cover svg {
  width: 46%; height: auto; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--accent) 55%, transparent));
}
.lately-surprise .cover circle { fill: currentColor; stroke: none; }
.lately-surprise .lately-state { color: var(--accent); }
.lately-item[data-state="new"] .lately-state { color: var(--muted); }

/* Bottom sheets made by sheet.mjs (Surprise me, All worlds). Above the dock (30) and player sheet (40). */
.sheet-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, 0.6); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  max-width: var(--page-max); margin: 0 auto; max-height: 88vh; overflow-y: auto;
  padding: 1rem var(--gutter) calc(1.25rem + env(safe-area-inset-bottom, 0px));
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sheet-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.4rem; font-weight: 500; }
.sheet-label { margin: 1rem 0 0.5rem; color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.sheet-chips {
  display: flex; flex-wrap: nowrap; gap: 0.5rem; overflow-x: auto; overscroll-behavior-x: contain; position: relative;
  margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter) 2px; scroll-padding: 0 var(--gutter); scrollbar-width: none;
}
.sheet-chips::-webkit-scrollbar { display: none; }
.sheet-chips .btn { flex: none; background: var(--surface); white-space: nowrap; }
.sheet .world-tiles { margin-top: 0.75rem; }
.surprise-result {
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1rem; align-items: center;
  margin-top: 1.25rem; padding: 1rem; min-height: 8.5rem;
  background:
    radial-gradient(ellipse at 90% 5%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 50%),
    linear-gradient(135deg, var(--surface), var(--raised));
  border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.surprise-result .cover { width: 5.5rem; aspect-ratio: 1; border-radius: 18px; }
.surprise-result .empty { grid-column: 1 / -1; padding: 0.5rem 0; }
.surprise-status { margin: 0 0 0.2rem; color: var(--accent); font-size: var(--text-small); font-weight: 600; }
.surprise-title { margin: 0 0 0.25rem; font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; line-height: 1.12; overflow-wrap: anywhere; }
.surprise-meta { margin: 0; color: var(--muted); font-size: var(--text-small); }
.sheet-actions { display: flex; gap: 0.6rem; margin-top: 1rem; }
/* A long sheet (many traditions) keeps its actions in reach. */
.sheet-body > .sheet-actions { position: sticky; bottom: calc(-1.25rem - env(safe-area-inset-bottom, 0px)); margin: 1rem calc(var(--gutter) * -1) calc(-1.25rem - env(safe-area-inset-bottom, 0px)); padding: 0.75rem var(--gutter) calc(1.25rem + env(safe-area-inset-bottom, 0px)); background: var(--bg); border-top: 1px solid var(--line-soft); }
.sheet-actions .btn { flex: 1 1 0; white-space: nowrap; padding: 0 1rem; }
.sheet-actions .btn:last-child { flex-grow: 1.3; }
