@layer od-layout {
  /* OD-LAYOUT-PRIMITIVES v1 — structure only: display, flex/grid, overflow, wrapping, ratio, geometry.
     Put this @layer first; product CSS outside the layer wins ordinary layout rules.
     Native hidden and closed-dialog states take precedence over component display rules. */
  [hidden]:not([hidden="until-found" i]) { display: none !important; }
  dialog:not([open]) { display: none !important; }

  :where(.od-stack,.od-row,.od-row-top,.od-cluster,.od-grid,.od-field,.od-stat,.od-cell,.od-tile) > :where(*) { min-width: 0; }

  /* containers */
  .od-stack   { display: flex; flex-direction: column; gap: var(--od-gap, 8px); }
  .od-row     { display: flex; align-items: center; gap: var(--od-gap, 8px); }
  .od-row-top { display: flex; align-items: flex-start; gap: var(--od-gap, 8px); }
  .od-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--od-gap, 8px); }
  .od-fill    { flex: 1 1 0; min-width: 0; }
  .od-fixed   { flex: none; }
  .od-grid    { display: grid; gap: var(--od-gap, 12px); grid-template-columns: repeat(var(--od-cols, 3), minmax(0, 1fr)); }

  /* stacked information: each piece is its own line — never sibling inline spans */
  .od-stat, .od-field, .od-cell { display: grid; gap: var(--od-gap, 2px); }
  :where(.od-stat,.od-field,.od-cell) > :where(*) { display: block; }
  .od-tile { display: grid; grid-template-rows: auto 1fr; }
  :where(.od-tile) > :where(*) { display: block; }

  /* media keeps its intrinsic ratio by default; never a distorted or cropped
     cover by accident. height:auto lets the ratio win over an <img height="…">
     attribute. Cropping to a uniform box is an explicit opt-in: set --od-ratio
     AND add .od-media-cover together. */
  .od-media { display: block; width: 100%; height: auto; aspect-ratio: var(--od-ratio, auto); }
  .od-media-cover { object-fit: cover; }

  /* functional inline SVG icons opt into bounded geometry; content SVGs keep their own */
  .od-icon { display: inline-block; inline-size: var(--od-icon-size, 1em); block-size: var(--od-icon-size, 1em); flex: none; }

  /* data text only — authored copy is rewritten to its budget instead */
  .od-truncate { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .od-clamp-2, .od-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  .od-clamp-2 { -webkit-line-clamp: 2; }
  .od-clamp-3 { -webkit-line-clamp: 3; }
  .od-lines-2 { min-height: calc(2 * 1.4em); }
  .od-nowrap  { white-space: nowrap; }
  .od-keep    { word-break: keep-all; overflow-wrap: anywhere; }

  /* screen skeleton (optional): bars take their own space, the middle scrolls */
  .od-screen { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
  .od-scroll { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }

  /* horizontal rail: the next item peeks at the edge; trailing room survives overflow */
  .od-rail { display: flex; gap: var(--od-gap, 8px); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
             padding-inline: var(--od-rail-pad, 16px); scroll-padding-inline: var(--od-rail-pad, 16px); }
  .od-rail::-webkit-scrollbar { display: none; }
  :where(.od-rail) > :where(*) { flex: none; scroll-snap-align: start; }
  :where(.od-rail) > :where(:last-child) { margin-inline-end: var(--od-rail-pad, 16px); }

  .od-spacer { flex: none; visibility: hidden; pointer-events: none; }
  .od-touch  { min-width: 44px; min-height: 44px; }
}
:root [hidden]:where(:not([hidden="until-found" i])) { display: none; }
/* /OD-LAYOUT-PRIMITIVES v1 */

/* ============================================================
   Skandy Stories — brand tokens
   ============================================================ */

:root {
  --ink: #342C25;
  --ink-70: rgba(52, 44, 37, 0.78);
  --ink-55: rgba(52, 44, 37, 0.7);
  --ink-12: rgba(52, 44, 37, 0.12);
  --ink-08: rgba(52, 44, 37, 0.08);

  --moss: #657057;
  --terracotta: #B66E52;
  --bark: #765744;
  --sand: #D8C5A5;
  --parchment: #EEE5D5;
  --cream: #F8F4EA;
  --berry: #8F4E4A;

  --hairline: rgba(118, 87, 68, 0.22);
  --hairline-soft: rgba(118, 87, 68, 0.14);

  --font-display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-ui: "Karla", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-plate: 6px;

  --shadow-soft: 0 1px 0 rgba(52, 44, 37, 0.05), 0 14px 28px -22px rgba(52, 44, 37, 0.55);
  --shadow-raised: 0 18px 34px -24px rgba(52, 44, 37, 0.6);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ============================================================
   Base
   ============================================================ */

body {
  font-family: var(--font-ui);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.phone-screen { background: var(--cream); }
.phone-content {
  background: var(--cream);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-top: var(--phone-safe-top, 50px);
  padding-bottom: var(--phone-safe-bottom, 29px);
}

#app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled { cursor: default; }

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

.screen {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--cream);
  color: var(--ink);
}

.screen-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.screen-body::-webkit-scrollbar { display: none; }

/* ============================================================
   Shared type
   ============================================================ */

.eyebrow {
  margin: 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bark);
}
.eyebrow--moss { color: var(--moss); }

.ornament { display: block; color: var(--bark); opacity: 0.75; margin: 0 auto; }

.cover-svg { display: block; width: 100%; height: auto; }

/* ============================================================
   Top bar
   ============================================================ */

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 10px 20px 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--moss);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: var(--ink);
}

.topbar-mark { display: flex; align-items: center; color: var(--bark); opacity: 0.8; }

.topbar--page { align-items: baseline; padding-top: 16px; }

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.page-count {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--moss);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 180ms var(--ease), background-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.btn--block { display: flex; width: 100%; }

.btn--primary {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
  box-shadow: 0 10px 22px -18px rgba(52, 44, 37, 0.9);
}
.btn--primary:active { transform: translateY(1px); }

.btn--secondary {
  background: var(--moss);
  color: var(--cream);
  border-color: var(--moss);
}
@media (hover: hover) {
  .btn--secondary:hover { background: #586249; }
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 10px 0 4px;
  background: none;
  border: 0;
  color: var(--bark);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.ghost-btn--icon { padding: 0; width: 44px; justify-content: center; border-radius: 999px; }

.link-btn {
  background: none;
  border: 0;
  padding: 6px 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--moss);
  border-bottom: 1px solid rgba(101, 112, 87, 0.35);
  line-height: 1.4;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--ink-12);
  background: transparent;
  color: var(--ink);
  transition: background-color 160ms var(--ease);
}
.tool-btn--lg { width: 40px; height: 40px; border-color: var(--hairline); }
.tool-btn:disabled { opacity: 0.32; }
@media (hover: hover) {
  .tool-btn:hover:not(:disabled) { background: rgba(216, 197, 165, 0.35); }
}

/* ============================================================
   Welcome
   ============================================================ */

.screen--welcome {
  background: var(--cream);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.welcome-art-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--ink);
}
.welcome-art-wrap .welcome-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.welcome-art-wrap::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 104px;
  pointer-events: none;
  background: linear-gradient(to top, var(--cream) 6%, rgba(248, 244, 234, 0.55) 52%, rgba(248, 244, 234, 0) 100%);
}

.welcome-body {
  position: relative;
  flex: none;
  padding: 2px 24px 26px;
  text-align: center;
  background: var(--cream);
}

.welcome-title {
  margin: 8px 0 6px;
  font-family: var(--font-display);
  font-size: 46px;
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.welcome-sub {
  margin: 0 0 26px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--bark);
  letter-spacing: 0.005em;
}

.welcome-orn { display: flex; justify-content: center; margin-top: 20px; color: var(--bark); opacity: 0.55; }

/* ============================================================
   Foreword
   ============================================================ */

.screen--foreword { background: var(--parchment); }
.screen--foreword::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(52, 44, 37, 0.5) 0.6px, transparent 0.6px);
  background-size: 4px 4px;
  opacity: 0.06;
}

.fw-top {
  flex: none;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 6px 12px 4px;
}

.fw-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bark);
}
.fw-top-spacer { display: block; }

.fw-body { position: relative; padding: 6px 22px 26px; }

.fw-page { max-width: 34rem; margin: 0 auto; }

.fw-vignette { width: 156px; margin: 6px auto 22px; }
.fw-vignette .vignette { display: block; width: 100%; height: auto; }

.fw-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.16;
  font-weight: 600;
  letter-spacing: -0.008em;
  text-align: center;
  color: var(--ink);
}

.fw-orn { display: flex; justify-content: center; margin-bottom: 22px; color: var(--bark); opacity: 0.7; }

.fw-text p {
  margin: 0 0 15px;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink-70);
}
.fw-text p:first-child {
  font-size: 17px;
  line-height: 1.68;
  color: var(--ink);
}
.fw-text p:last-child {
  margin-top: 22px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.4;
  font-style: italic;
  color: var(--bark);
}

.fw-end { display: flex; justify-content: center; margin: 24px 0 8px; color: var(--bark); opacity: 0.5; }

.fw-foot {
  flex: none;
  padding: 12px 22px 14px;
  background: linear-gradient(to top, var(--parchment) 62%, rgba(238, 229, 213, 0));
  position: relative;
}

/* ============================================================
   Home
   ============================================================ */

.home-body { padding: 0 20px 26px; }

.greeting {
  margin: 2px 0 20px;
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  max-width: 22ch;
}

.feature {
  padding: 16px 18px 18px;
  border: 1px solid rgba(118, 87, 68, 0.2);
  border-radius: var(--r-lg);
  background: var(--parchment);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.feature-plate {
  display: block;
  width: 148px;
  margin: 2px auto 18px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: var(--r-plate);
  box-shadow: var(--shadow-raised);
  overflow: hidden;
  transition: transform 220ms var(--ease);
}
@media (hover: hover) {
  .feature-plate:hover { transform: translateY(-2px); }
}

.feature .eyebrow { color: var(--moss); font-size: 10px; }

.feature-title {
  margin: 8px 0 8px;
  font-family: var(--font-display);
  font-size: 25px;
  line-height: 1.14;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.feature-desc {
  margin: 0 auto 14px;
  max-width: 30ch;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-70);
}

.feature-meta { display: flex; justify-content: center; margin-bottom: 16px; }

.meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--bark);
}
.meta svg { color: var(--terracotta); }
.meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: var(--ink-55);
  margin: 0 3px;
  display: inline-block;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 12px;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}

/* rail */
.rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  margin: 0 -20px;
  padding: 2px 20px 4px;
}
.rail::-webkit-scrollbar { display: none; }

.rail-card {
  flex: none;
  width: 124px;
  scroll-snap-align: start;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}

.rail-cover {
  display: block;
  border-radius: var(--r-plate);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  margin-bottom: 8px;
}

.rail-title {
  display: block;
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.24;
  font-weight: 600;
  color: var(--ink);
}

.rail-meta {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bark);
}

/* list rows */
.rows { display: block; }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--hairline-soft);
}
.row:last-child { border-bottom: 0; }

.row-open {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  background: none;
  border: 0;
  text-align: left;
}

.row-cover {
  display: block;
  width: 54px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 6px 14px -12px rgba(52, 44, 37, 0.8);
}

.row-main { display: block; min-width: 0; }

.row-cat {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--moss);
  margin-bottom: 3px;
}

.row-title {
  display: block;
  font-family: var(--font-display);
  font-size: 17.5px;
  line-height: 1.26;
  font-weight: 600;
  color: var(--ink);
}

.row-desc {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-70);
}

.row-meta {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-55);
}

.fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-55);
  transition: color 160ms var(--ease), transform 160ms var(--ease);
}
.fav-btn .od-icon { transition: transform 180ms var(--ease); }
.fav-btn.is-on { color: var(--berry); }
.fav-btn.is-on .od-icon { fill: var(--berry); stroke: var(--berry); }

/* categories */
.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.cat-tile {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: rgba(238, 229, 213, 0.5);
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease);
}
@media (hover: hover) {
  .cat-tile:hover { background: rgba(238, 229, 213, 0.9); border-color: var(--bark); }
}

.cat-glyph { grid-row: 1 / 3; color: var(--moss); display: flex; align-items: center; }
.cat-name {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}
.cat-count {
  display: block;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--ink-55);
}

.home-foot { margin-top: 30px; text-align: center; }
.home-foot p {
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--bark);
}

/* ============================================================
   Bottom navigation
   ============================================================ */

.tabbar {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--cream);
  border-top: 1px solid var(--hairline);
  box-shadow: 0 -14px 22px -22px rgba(52, 44, 37, 0.8);
  padding: 6px 6px 4px;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 50px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--ink-55);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 160ms var(--ease);
}
.tab span { line-height: 1.2; white-space: nowrap; }
.tab.is-on { color: var(--moss); }

/* ============================================================
   Library
   ============================================================ */

.lib-body { padding: 4px 20px 24px; }

.field { margin-bottom: 16px; }

.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--bark);
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  height: 48px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--parchment);
  color: var(--bark);
}
.input-wrap:focus-within { border-color: var(--moss); box-shadow: 0 0 0 3px rgba(101, 112, 87, 0.12); }

.input-wrap input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.input-wrap input::placeholder { color: rgba(52, 44, 37, 0.62); }
.input-wrap input::-webkit-search-cancel-button { -webkit-appearance: none; }

.chip-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -20px 18px;
  padding: 2px 20px 4px;
}
.chip-rail::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-70);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background-color 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}
.chip.is-on {
  background: var(--moss);
  border-color: var(--moss);
  color: var(--cream);
}

/* ============================================================
   Empty state
   ============================================================ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 12px 30px;
}

.wreath { display: block; width: 132px; height: 132px; margin-bottom: 10px; }

.empty-title {
  margin: 4px 0 8px;
  font-family: var(--font-display);
  font-size: 23px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--ink);
}

.empty-body {
  margin: 0 0 20px;
  max-width: 28ch;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-70);
}

/* ============================================================
   Story detail
   ============================================================ */

.detail-body { padding: 10px 22px 36px; }

.detail-plate {
  position: relative;
  width: 100%;
  max-width: 252px;
  margin: 4px auto 22px;
  border-radius: var(--r-plate);
  overflow: hidden;
  box-shadow: var(--shadow-raised);
}

.plate-btn {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(52, 44, 37, 0.12);
  background: rgba(248, 244, 234, 0.94);
  color: var(--ink);
  box-shadow: 0 6px 14px -10px rgba(52, 44, 37, 0.7);
}
.plate-btn--back { top: 10px; left: 10px; }
.plate-btn--fav { top: 10px; right: 10px; }
.plate-btn--fav.is-on { color: var(--berry); }
.plate-btn--fav.is-on .od-icon { fill: var(--berry); stroke: var(--berry); }

.detail-cat {
  margin: 0 0 6px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--moss);
}

.detail-title {
  margin: 0 0 10px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 31px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.detail-meta { display: flex; justify-content: center; margin-bottom: 14px; }

.detail-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}
.detail-progress-bar {
  display: block;
  width: 96px;
  height: 3px;
  border-radius: 999px;
  background: var(--sand);
  overflow: hidden;
}
.detail-progress-bar span {
  display: block;
  height: 100%;
  background: var(--moss);
  border-radius: 999px;
}
.detail-progress-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--moss);
}

.rule { display: flex; justify-content: center; margin: 16px 0 18px; color: var(--bark); opacity: 0.6; }

.detail-intro {
  margin: 0 0 24px;
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--ink-70);
}

.detail-actions { display: block; }

.detail-foot {
  margin: 22px 0 0;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13.5px;
  color: var(--bark);
  opacity: 0.85;
}

/* ============================================================
   Reader
   ============================================================ */

.screen--reader { background: var(--parchment); }

.reader-top {
  flex: none;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 6px;
  border-bottom: 1px solid var(--hairline-soft);
}

.reader-top .ghost-btn { color: var(--ink); }

.reader-top-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-70);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.reader-tools { display: inline-flex; align-items: center; gap: 6px; }

.reader-track {
  flex: none;
  height: 2px;
  background: rgba(52, 44, 37, 0.1);
  position: relative;
}
.reader-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--moss);
  transition: width 120ms linear;
}

.reader-body { padding: 20px 20px 26px; }

.reader-cat {
  margin: 0 0 8px;
  text-align: center;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--moss);
}

.reader-title {
  margin: 0 0 10px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.reader-meta { display: flex; justify-content: center; }
.reader-meta .meta { color: var(--bark); }

.reader-rule { display: flex; justify-content: center; margin: 16px 0 20px; color: var(--bark); opacity: 0.55; }

.reader-text { color: var(--ink); }
.reader-text p {
  margin: 0 0 1.05em;
  font-size: var(--r-size, 20px);
  line-height: 1.78;
  letter-spacing: 0.002em;
}
.reader-text p:first-child::first-letter {
  font-family: var(--font-display);
  font-size: 2.5em;
  line-height: 0.9;
  float: left;
  padding: 0.06em 0.08em 0 0;
  color: var(--moss);
  font-weight: 600;
}

.reader-end { display: flex; justify-content: center; margin: 26px 0 10px; color: var(--bark); opacity: 0.5; }

.reader-fin {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--bark);
}

.reader-foot {
  flex: none;
  border-top: 1px solid var(--hairline-soft);
  padding: 8px 12px 10px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
}

.pager-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: left;
}
.pager-btn--next { justify-content: flex-end; text-align: right; }
.pager-btn:disabled { opacity: 0.28; }

.reader-pct {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--moss);
  white-space: nowrap;
}

/* night reading */
.screen--reader.is-night { background: #241E18; color: #EFE4D2; }
.screen--reader.is-night .reader-top { border-bottom-color: rgba(239, 228, 210, 0.14); }
.screen--reader.is-night .reader-top .ghost-btn { color: #EFE4D2; }
.screen--reader.is-night .reader-top-title { color: rgba(239, 228, 210, 0.72); }
.screen--reader.is-night .tool-btn { border-color: rgba(239, 228, 210, 0.2); color: #EFE4D2; }
.screen--reader.is-night .tool-btn:disabled { opacity: 0.3; }
.screen--reader.is-night .reader-track { background: rgba(239, 228, 210, 0.14); }
.screen--reader.is-night .reader-fill { background: #C6B392; }
.screen--reader.is-night .reader-cat { color: #C6B392; }
.screen--reader.is-night .reader-title { color: #F6ECDA; }
.screen--reader.is-night .reader-meta .meta { color: #C6B392; }
.screen--reader.is-night .reader-meta .meta svg { color: var(--terracotta); }
.screen--reader.is-night .reader-rule,
.screen--reader.is-night .reader-end { color: #C6B392; }
.screen--reader.is-night .reader-text { color: #E9DCC6; }
.screen--reader.is-night .reader-text p:first-child::first-letter { color: #C6B392; }
.screen--reader.is-night .reader-fin { color: #B7A488; }
.screen--reader.is-night .reader-foot { border-top-color: rgba(239, 228, 210, 0.14); }
.screen--reader.is-night .pager-btn { color: #EFE4D2; }
.screen--reader.is-night .reader-pct { color: #C6B392; }

.phone-screen.is-immersive .phone-content { padding-top: 0; }
.phone-screen.is-immersive .status-bar { color: #F3EADB; }

.phone-screen.is-night { background: #241E18; }
.phone-screen.is-night .phone-content { background: #241E18; }
.phone-screen.is-night .status-bar { color: #F0E5D3; }
.phone-screen.is-night .gesture-indicator { background: #F0E5D3; }

/* ============================================================
   Favourites
   ============================================================ */

.fav-body { padding: 4px 20px 26px; }

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

.fav-card { position: relative; }

.fav-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}

.fav-cover {
  display: block;
  border-radius: var(--r-plate);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  margin-bottom: 8px;
}

.fav-title {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.24;
  font-weight: 600;
  color: var(--ink);
  padding-right: 26px;
}

.fav-meta {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--bark);
}

.fav-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(248, 244, 234, 0.92);
  color: var(--berry);
}
.fav-remove .od-icon { fill: var(--berry); stroke: var(--berry); }

.empty--fav { padding-top: 40px; }

/* ============================================================
   Settings
   ============================================================ */

.set-body { padding: 2px 20px 26px; }

.set-group { margin-bottom: 26px; }

.set-heading {
  margin: 0 0 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--moss);
}

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline-soft);
}
.set-row--stack { display: block; }
.set-row--stack .set-label { display: block; margin-bottom: 10px; }

.set-label {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.size-control { display: flex; align-items: center; gap: 14px; }

.size-sample {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  min-width: 44px;
  text-align: center;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--parchment);
  border: 1px solid var(--hairline-soft);
}
.segmented--wide { width: 100%; }

.seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-70);
  font-size: 13px;
  font-weight: 600;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.seg.is-on {
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(52, 44, 37, 0.06), 0 6px 12px -10px rgba(52, 44, 37, 0.7);
}
.seg.is-on svg { color: var(--terracotta); }

.set-hint {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-55);
}

.set-about {
  margin: 8px 0 12px;
  font-size: 13.5px;
  line-height: 1.68;
  color: var(--ink-70);
}

.set-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 6px 0;
  border: 0;
  border-top: 1px solid var(--hairline-soft);
  background: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}
.set-link svg:first-child { color: var(--moss); }
.set-link svg:last-child { margin-left: auto; color: var(--ink-55); }

.set-link--danger { color: var(--berry); }
.set-link--danger svg:first-child { color: var(--berry); }
.set-link--danger.is-confirming { font-weight: 700; }
.set-link--danger.is-confirming .od-icon { transform: rotate(180deg); }

.set-foot { margin-top: 30px; text-align: center; }
.set-foot p {
  margin: 10px 0 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-55);
}

/* ============================================================
   Motion preferences
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Language picker
   ============================================================ */

.lang-list {
  margin-top: 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
  background: rgba(238, 229, 213, 0.45);
}

.lang-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid var(--hairline-soft);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: left;
  transition: background-color 160ms var(--ease);
}
.lang-row:last-child { border-bottom: 0; }
.lang-row.is-on { background: var(--parchment); }

.lang-name { display: block; }
.lang-check { display: flex; align-items: center; color: var(--moss); }

.lang-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bark);
}

.lang-row.is-disabled { color: rgba(52, 44, 37, 0.45); cursor: default; }
.lang-row.is-disabled .lang-tag { color: var(--ink-55); }

@media (hover: hover) {
  .lang-row:not(.is-disabled):not(.is-on):hover { background: rgba(216, 197, 165, 0.3); }
}
