/* Reset + base */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #050610;
  color: #e4e4e7;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  display: block;
  width: 100vw;
  height: 100dvh;
}

/* Feed container — owns the two-card deck. Only the current and next
   card live in the DOM; advancement is a CSS transform transition, not
   native scrolling (tech-spec §4.5). */
#feed {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  touch-action: none; /* gestures are handled in swipe.js */
}

.deck {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.deck__slot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100dvh;
  transition: transform 250ms cubic-bezier(0.32, 0.72, 0.24, 1);
  will-change: transform;
}

/* Three slots — prev (above), current (visible), next (below). All three
   are mounted simultaneously so a drag gesture has cards already laid out
   above and below the viewport. The commit transition is driven by inline
   transforms set in app.js (single property mutation per element); these
   class transforms are the resting state before/after the gesture and the
   target the inline values match at cleanup time. */
.deck__slot--prev     { transform: translateY(-100%); z-index: 1; }
.deck__slot--current  { transform: translateY(0);     z-index: 2; }
.deck__slot--next     { transform: translateY(100%);  z-index: 1; }

/* While the user's finger is on the screen, transitions are suppressed —
   the deck tracks the pointer 1:1 via inline transforms set in app.js. */
.deck--dragging .deck__slot { transition: none; }

/* Motion backgrounds (Session 20d, tech spec §4.8): a canvas and a black
   overlay inside the slot, beneath the card. While a scene runs the card
   drops its own palette background and CSS texture (the scene is both). */
.deck__slot > .scene,
.deck__slot > .scene-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.deck__slot > .scene { display: block; }
.deck__slot > .scene-overlay { background: #000; }
.card.card--scene { background: transparent; background-image: none; }
.card.card--scene[class*="texture-"]::before { display: none; }

.perf-readout {
  position: fixed;
  left: 0.5rem;
  bottom: 0.5rem;
  z-index: 30;
  font: 0.65rem "IBM Plex Mono", ui-monospace, monospace;
  color: #9fe0a0;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.15rem 0.4rem;
  pointer-events: none;
}

/* Card frame */
.card {
  position: relative;
  width: 100%;
  height: 100dvh;
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.card__inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 33.75rem; /* 540px — matches mockup */
  padding: clamp(1.75rem, 6vw, 2.5rem) clamp(1.25rem, 5vw, 2rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
}

.card__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.card__text {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text);
}

/* Type-specific typography. Session 20: every size is multiplied by the
   card's type scale (--ts) and capped against the card's own width (cqi)
   so large type never overflows a narrow phone.

   Larger text (Session 21a): the settings toggle puts data-text="larger"
   on <html> (app.js) and --text-size folds into every --ts, so one factor
   scales all card type; the type floors in card-renderer.js and app.js
   rise with it. */

:root { --text-size: 1; }
:root[data-text="larger"] { --text-size: 1.2; }

.card { --ts: var(--text-size); container-type: inline-size; }
.scale-display { --ts: calc(1.28 * var(--text-size)); }
.scale-page    { --ts: calc(0.94 * var(--text-size)); }

.type-verse           .card__text { font-size: min(calc(2.2rem * var(--ts)), 11.5cqi); }
.type-classical_quote .card__text { font-size: calc(2.05rem * var(--ts)); font-style: italic; }
.type-prayer          .card__text { font-size: calc(1.9rem * var(--ts)); line-height: 1.5; }
.type-hymn            .card__text { font-size: calc(1.9rem * var(--ts)); line-height: 1.5; }
/* One block per hymn line: a wrapped line sits tight, lines sit apart. */
.hymn__line { display: block; line-height: 1.28; }
.hymn__line + .hymn__line { margin-top: 0.3em; }
.scale-page .hymn__line { padding-left: 1em; text-indent: -1em; }
.type-breath          .card__text { font-size: min(calc(4rem * var(--ts)), 15.5cqi); font-weight: 300; letter-spacing: 0.02em; }

/* Length overrides */

.length-micro  .card__text { font-size: min(calc(4rem * var(--ts)), 15.5cqi); line-height: 1.1; }
.length-medium .card__text { font-size: calc(1.85rem * var(--ts)); }

.type-breath.length-micro .card__text { font-size: min(calc(4.5rem * var(--ts)), 16.5cqi); }

/* Scale: Display — big and tight; the pipeline gives it only to short cards
   whose longest word fits (pipeline/assign_visuals.py). */
.scale-display .card__text { line-height: 1.12; letter-spacing: -0.02em; }
.scale-display.length-micro .card__text,
.scale-display.type-breath  .card__text { font-size: min(calc(4rem * var(--ts)), 20cqi); }
.scale-display.type-verse   .card__text { font-size: min(calc(2.2rem * var(--ts)), 14cqi); }
.scale-display.register-gentle .card__text,
.scale-display.register-stirring .card__text { font-weight: 500; }

/* Scale: Page — a book page, left-aligned, for longer prose and stanzas. */
.scale-page .card__inner { align-items: stretch; text-align: left; max-width: 27rem; }
.scale-page .card__body  { align-items: flex-start; }
.scale-page .card__text  { line-height: 1.5; }
.scale-page .plate       { align-items: flex-start; text-align: left; }
.scale-page .plate__rule { justify-content: flex-start; }

/* Register typography overrides */

.register-bracing .card__text { font-weight: 500; letter-spacing: -0.02em; }
.register-still   .card__text { font-weight: 300; }
.register-glad    .card__text { font-weight: 500; }

/* Metadata row (media cards) */

.card__meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1rem;
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.card__reference, .card__credit {
  font-family: inherit;
  font-size: inherit;
  color: var(--text-muted);
}

/* Statement cards (brief §5.6, tech spec §4.4.1): the god line first and
   larger, the you line below and lighter, the verse a tap away. Specific
   enough to win over the length and scale rules above. */
.card.type-statement .card__text.statement__god {
  font-size: min(calc(2.5rem * var(--ts)), 12cqi);
  line-height: 1.15;
  font-weight: 500;
}
.card.type-statement .statement__you {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: min(calc(1.6rem * var(--ts)), 8cqi);
  line-height: 1.3;
  margin: 0.55rem 0 0;
  color: var(--text);
  opacity: 0.8;
}
.statement { text-align: center; }
.statement__god, .statement__you { text-wrap: balance; }
.card.type-statement .statement__verse {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: min(calc(1.15rem * var(--ts)), 6cqi);
  line-height: 1.45;
  margin: 1.1rem auto 0;
  max-width: 30em;
  color: var(--text);
  opacity: 0.9;
  animation: statement-verse-in 200ms ease-out;
}
@keyframes statement-verse-in { from { opacity: 0; } to { opacity: 0.9; } }
@media (prefers-reduced-motion: reduce) {
  .card.type-statement .statement__verse { animation: none; }
}
@media (hover: hover) and (pointer: fine) {
  .card--has-verse .card__body { cursor: pointer; }
}

/* Source plate (Session 20): the card's signature — who, what, when, and
   for modernised cards "modernised from …" plus the original on tap. */

.plate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.6rem;
  color: var(--text-muted);
  text-align: center;
}
.plate__rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  margin-bottom: 0.25rem;
}
.plate__rule::before, .plate__rule::after {
  content: "";
  width: 1.6rem;
  height: 1px;
  background: currentColor;
  opacity: 0.45;
}
.plate__rule span {
  width: 0.32rem;
  height: 0.32rem;
  transform: rotate(45deg);
  background: var(--accent);
  opacity: 0.8;
}
.plate__who {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.plate__work {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  opacity: 0.95;
}
.plate__note {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.plate--faint { opacity: 0.65; }
/* Session 20b: findable, not prominent. Pointer devices only. */
@media (hover: hover) and (pointer: fine) {
  .card--has-original .card__body { cursor: pointer; }
  .card--has-original .card__body:hover .plate__note { opacity: 1; text-decoration: underline; text-underline-offset: 0.2em; }
}
.card--showing-original .card__text { font-style: normal; opacity: 0.92; }

/* Textures (Session 20): one layer above the palette, below the text. */

.card[class*="texture-"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.texture-grain::before {          /* T1 fine film grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  1.7 0 0 0 -0.72'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  opacity: 0.13;
}

.texture-paper::before {          /* T2 mottled laid paper */
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 7px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.035' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  background-size: auto, 600px 600px;
  opacity: 0.22;
  mix-blend-mode: soft-light;
}

.texture-cracked::before {        /* T3 hairline cracked paint (craquelure) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='560'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.016' numOctaves='4' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  1 0 0 0 0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23c)'/%3E%3C/svg%3E");
  background-size: 560px 560px;
  opacity: 0.05;
}

.texture-vignette::before {       /* T4 darkened edges, the eye drawn in */
  background: radial-gradient(ellipse 85% 75% at 50% 46%, transparent 40%, rgba(0,0,0,0.62) 100%);
}

.texture-light::before {          /* T5 a single point of light */
  background:
    radial-gradient(circle at 50% 14%,
      color-mix(in srgb, var(--accent) 35%, #fff) 0,
      color-mix(in srgb, var(--accent) 60%, transparent) 0.18rem,
      color-mix(in srgb, var(--accent) 12%, transparent) 1.6rem,
      transparent 9rem);
  opacity: 0.8;
}

/* Treatment-specific tweaks */

.treatment-symbolic .card__mark {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 4.25rem;
  height: 4.25rem;
  color: var(--accent);
  opacity: 0.9;
}
.card__mark svg { width: 100%; height: 100%; display: block; overflow: visible; }
.treatment-symbolic .card__mark--below { width: 9rem; height: 1.5rem; }

/* A geometric mark as a large faint watermark behind the text. */
.treatment-symbolic .card__mark--background_faint {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: min(80cqi, 26rem);
  height: min(80cqi, 26rem);
  transform: translate(-50%, -50%);
  opacity: 0.07;
  pointer-events: none;
}

/* Illuminated capital: the card's first letter set in an ornamental frame. */
.card__initial {
  float: left;
  position: relative;
  width: 4.1rem;
  height: 4.1rem;
  margin: 0.35rem 0.7rem 0 0;
  color: var(--accent);
}
.card__initial svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.card__initial::after {
  content: attr(data-letter);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-style: normal;
  font-size: 2.9rem;
  line-height: 1;
  padding-top: 0.15rem;
  color: var(--accent);
}
.card__initial--cap_lozenge::after,
.card__initial--cap_star::after { font-size: 2.3rem; }
.card__initial--cap_arch::after { padding-top: 0.6rem; }
.has-initial .card__inner { align-items: stretch; text-align: left; }
.has-initial .card__body  { align-items: stretch; display: block; }
.has-initial .card__text  { font-size: calc(1.95rem * var(--text-size)); }
.has-initial .plate       { clear: both; padding-top: 0.8rem; }

.card__initial-src { font-size: 0; }

.treatment-image_led .card__image {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
}

.treatment-image_led .card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.treatment-image_led .card__inner .card__text {
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.85);
}

.treatment-image_led .card__credit {
  position: absolute;
  bottom: 0.5rem;
  right: 0.75rem;
  font-size: 0.6rem;
  opacity: 0.55;
  z-index: 3;
}

/* ============================================================
   v3 MEDIA KINDS — photo, art, video
   The .card frame normally paints a palette gradient; media kinds
   replace that with a full-bleed image/video and a gradient overlay
   for caption legibility. CSS contract per mixed-media-mockup.html.
   ============================================================ */

.kind-photo, .kind-video {
  background: #050610;
  background-image: none;
}

.kind-photo > .card__media,
.kind-video > .card__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.45) 60%,
    rgba(0, 0, 0, 0.85) 100%
  );
  z-index: 1;
  pointer-events: none;
}

.card__content--over-media {
  position: absolute;
  bottom: 8vh;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 0 clamp(1.25rem, 5vw, 2rem);
  text-align: center;
  color: #fff;
}

.card__content--over-media .card__caption {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.4rem, 4.4vw, 1.6rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 auto;
  max-width: 33.75rem;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.85);
  color: #fff;
}

.card__content--over-media .card__meta {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  margin-top: 0.6rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}

.card__content--over-media .card__reference {
  color: inherit;
}

.card__content--over-media .card__credit {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.55);
  margin: 0.4rem auto 0;
  max-width: 28.75rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}

/* ART — the work is the focus, framed not cropped */

.kind-art {
  background: radial-gradient(ellipse at center, #1a1410 0%, #050201 90%);
  background-image: radial-gradient(ellipse at center, #1a1410 0%, #050201 90%);
}

.kind-art .card__art-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
  padding: 6vh 0 28vh 0;
}

.kind-art .card__art-img {
  max-width: 92vw;
  max-height: 100%;
  object-fit: contain;
  filter: brightness(0.85) contrast(1.05);
  box-shadow: 0 8px 60px rgba(0, 0, 0, 0.6);
}

.kind-art .card__art-img--full-bleed {
  width: 100vw;
  max-width: 100vw;
  height: 100%;
  max-height: 100%;
  object-fit: cover;
  box-shadow: none;
}

.kind-art .card__content--art {
  position: absolute;
  bottom: 5vh;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 0 clamp(1.25rem, 5vw, 2rem);
  text-align: center;
  color: #f0e8d8;
}

.kind-art .card__content--art .card__caption {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.25rem, 3.8vw, 1.4rem);
  line-height: 1.35;
  margin: 0 auto;
  max-width: 33.75rem;
  color: #f0e8d8;
}

.kind-art .card__content--art .card__meta {
  color: rgba(240, 232, 216, 0.7);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  margin-top: 0.4rem;
}

.kind-art .card__content--art .card__reference {
  color: inherit;
}

.kind-art .card__content--art .card__credit {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: rgba(240, 232, 216, 0.5);
  margin: 0.3rem auto 0;
  max-width: 28.75rem;
}

/* Floating UI buttons (wired in later sessions) */

#topic-button, #settings-button {
  position: fixed;
  bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.4);
  color: rgba(228, 228, 231, 0.7);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

#topic-button:hover, #settings-button:hover,
#topic-button:focus-visible, #settings-button:focus-visible {
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.55);
  outline: none;
}

#topic-button { left: 1rem; }
#settings-button { right: 1rem; }

/* Active-topic chip */

.active-topic-chip {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top, 0.75rem));
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.9);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
}

.active-topic-chip[hidden] { display: none; }

.active-topic-chip__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
  transition: opacity 120ms ease, background-color 120ms ease;
}

.active-topic-chip__close:hover,
.active-topic-chip__close:focus-visible {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

/* Bottom sheet */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

.sheet__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  margin: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0);
  transition: background-color 200ms ease;
  cursor: pointer;
  pointer-events: auto;
}

.sheet--open .sheet__backdrop { background: rgba(0, 0, 0, 0.5); }
.sheet--closing .sheet__backdrop { background: rgba(0, 0, 0, 0); }

.sheet__panel {
  position: relative;
  width: 100%;
  max-width: 33.75rem;
  margin: 0 auto;
  padding: 0.5rem clamp(1rem, 4vw, 1.5rem) max(1rem, env(safe-area-inset-bottom, 1rem));
  background: #121319;
  border-top-left-radius: 1.25rem;
  border-top-right-radius: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #e4e4e7;
  max-height: 85dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 200ms cubic-bezier(0.32, 0.72, 0.24, 1);
  pointer-events: auto;
}

.sheet--open .sheet__panel { transform: translateY(0); }
.sheet--closing .sheet__panel { transform: translateY(100%); }

.sheet__handle {
  width: 2.5rem;
  height: 0.25rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0.5rem auto 0.75rem;
}

.sheet__title {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  margin: 0 0 1rem;
  text-align: center;
}

.sheet__content { padding-bottom: 1rem; }

/* Topic picker */

.topic-picker__tier {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin: 1.25rem 0 0.5rem;
}

.topic-picker__list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.topic-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.7rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.topic-row:hover:not(:disabled),
.topic-row:focus-visible {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  outline: none;
}

.topic-row--selected {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.topic-row--all {
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.5rem 0.5rem 0 0;
  padding-bottom: 0.85rem;
}

.topic-row--disabled {
  opacity: 0.4;
  cursor: default;
}

.topic-row__sub {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

/* Settings sheet */

.settings-section { margin: 0 0 1.5rem; }

.settings-section__title {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin: 0 0 0.5rem;
}

.settings-section__body {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.45;
  color: rgba(228, 228, 231, 0.85);
  margin: 0;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.05rem;
  color: rgba(228, 228, 231, 0.85);
  cursor: pointer;
}
.settings-toggle__input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: #c9a875;
  cursor: pointer;
}

.settings-pack-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-pack {
  padding: 0.85rem 0.9rem;
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-pack__title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 500;
  margin: 0 0 0.25rem;
}

.settings-pack__description {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.4;
  color: rgba(228, 228, 231, 0.8);
  font-family: "Cormorant Garamond", Georgia, serif;
}

.settings-pack__action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.settings-pack__price {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.6);
}

.settings-pack__buy {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.settings-pack__buy:hover:not(:disabled),
.settings-pack__buy:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.28);
  outline: none;
}

.settings-pack__buy:disabled {
  opacity: 0.6;
  cursor: default;
}

.settings-pack__buy--owned {
  border-color: rgba(150, 220, 170, 0.32);
  color: rgba(190, 230, 200, 0.85);
  opacity: 0.9;
}

.settings-pack__note {
  margin: 0.5rem 0 0;
  padding: 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  line-height: 1.35;
  letter-spacing: 0.04em;
  color: rgba(245, 180, 180, 0.85);
}

/* iOS install hint (re-uses sheet primitive) */

.ios-install-hint__body,
.ios-install-hint__note {
  font-family: "Cormorant Garamond", Georgia, serif;
  line-height: 1.5;
  margin: 0 0 0.75rem;
}

.ios-install-hint__body { font-size: 1.1rem; }
.ios-install-hint__note { font-size: 0.95rem; color: rgba(228, 228, 231, 0.7); }

/* Install banner */

.install-banner {
  position: fixed;
  left: 50%;
  bottom: max(4rem, calc(env(safe-area-inset-bottom, 0px) + 4rem));
  transform: translate(-50%, 1rem);
  width: min(28rem, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(18, 19, 25, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  color: #e4e4e7;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
  z-index: 15;
}

.install-banner--in {
  transform: translate(-50%, 0);
  opacity: 1;
}

.install-banner--out {
  transform: translate(-50%, 1rem);
  opacity: 0;
}

.install-banner__text {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1rem;
  line-height: 1.4;
}
.install-banner__text--line {
  margin-top: -0.4rem;
  font-style: italic;
  color: rgba(228, 228, 231, 0.75);
}

.install-banner__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.install-banner__dismiss,
.install-banner__install {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.install-banner__install {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.install-banner__dismiss:hover,
.install-banner__install:hover,
.install-banner__dismiss:focus-visible,
.install-banner__install:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

/* Empty state */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  color: #6a6a64;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
