/* One theme for the whole app, chosen by the phone clock or the menu's day/night switch (app.js themeFor); screens never repaint themselves. */
:root {
  /* Literata tells the story, the system sans runs the interface (design book §4); its files and @font-face are in book.css. */
  --story-font: 'Literata', Georgia, 'Times New Roman', serif;
  --ui-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  /* The radius scale (design book §5): 8 thumbnails, badges and small tiles; 14 pictures, covers, inputs and the rows of a list;
     18 cards, sheets and panels; 999px every button and chip. Bars of 3-4px and the paper frame's 4px stay as drawn. */
  --r-s: 8px; --r-m: 14px; --r-l: 18px;
  --radius: var(--r-l);
  /* Text lettered over a picture reads the same by day and by night. */
  --on-picture: #fff8e7;
  --picture-shade: rgba(0,0,0,.7);
  /* The paper a scroll's words are set on where a webtoon strip or a comic page has no picture: light, like the strips
     themselves, in both themes. (A book's words are lettered boxes, book.css.) */
  /* One cream for everything read on paper, both themes (design book §3): the book's frame and open leaf, the strips' missing
     pictures, the day's cards and the quiz's page. Ink on it 14.6:1, the muted ink 4.8:1, the accent 7.3:1. */
  --paper: #f8f1e2;
  --paper-ink: #1f1f26;
  --paper-muted: #6f695e;
  --paper-accent: #3b4a8f;

  /* The day's paper (the owner, 22.11: «серый поменять на чуть бежевый, песочный, чтобы было больше как книга»): the
     ground of a picture book's page, our ink blue for what is pressed («по-дневному песочно-синий», the evening stays
     blue with gold). One home for the day's colours: the app's day below, the landing's day (landing/landing.css) and its
     tours take these, and nothing on a day screen is a grey of its own. Palette A, «песок». Every text pair is WCAG AA or
     more: ink on the ground 11.6:1, on a card 13.6:1; the quiet ink on the ground 5.4:1, on a chip 4.8:1; the blue on
     the ground 6.3:1, white on the blue 8.2:1 (test/day-palette.test.ts keeps them so). */
  --day-bg: #ebe0c9;          /* the page */
  --day-bg-rgb: 235 224 201;  /* the same, for the veils laid over pictures (rgb(var(--day-bg-rgb) / .9)) */
  --day-end: #e3d6bb;         /* a step deeper: the landing's foot and the canvas under Safari's bars */
  --day-card: #f8f1e2;        /* the same cream as --paper (test/day-palette.test.ts keeps them equal) */
  --day-line: #d9cbae;
  --day-soft: #e2d5b9;
  --day-field: #fffcf5;
  --day-tile: #d8c9aa;        /* a picture not loaded yet on the paper */
  --day-desk: #e0d3b7;        /* the desk under the open book (its leaf is the book's own cream, book.css) */
  --day-ink: #2a2520;         /* ink, a touch of sepia: the book's own words are #1f1f26 */
  --day-ink-rgb: 42 37 32;    /* the same, for the shadows and veils cast in ink */
  --day-ink-soft: #62574a;
  --day-ink-strong: #1f1b17;  /* the landing's big headline over the pictures */
  --day-accent: #3b4a8f;      /* the blue of the book's own dashes and drop cap, unchanged */
  /* The sun behind the hero picture by day: where the picture's night sky is, a warm glow (landing.css .lp-feature-sky). */
  --day-sun: 238 200 128;
  /* Palette B, «сливочная бумага», the other one shown to the owner (scratchpad sand-theme/compare.png): lighter, a cream
     close to the book's leaf, so the page and the book read as one sheet; ink 12.9:1, quiet ink 5.2:1, blue 7.0:1.
  --day-bg: #f3ecde; --day-bg-rgb: 243 236 222; --day-end: #ebe2cf; --day-card: #fffaf0; --day-line: #e3d8c3;
  --day-soft: #ebe1cc; --day-field: #fffdf8; --day-tile: #e2d6bf; --day-desk: #e7dcc6; --day-ink-soft: #6a6052;
  --day-sun: 240 208 146; */
}
:root, :root[data-theme=day] {
  color-scheme: light;
  /* «Чернила и свеча» by day: sand paper, ink-blue for what is pressed, a candle-yellow glow for the moon and stars. */
  --bg: var(--day-bg);
  --bg-end: var(--bg);
  --bg-image: none;
  --card: var(--day-card);
  --line: var(--day-line);
  --ink: var(--day-ink);
  --ink-soft: var(--day-ink-soft);
  --accent: var(--day-accent);
  --accent-ink: #fff;
  --glow: #d9a53a;
  --soft: var(--day-soft);
  --field: var(--day-field);
  --danger: #b3261e;
  --danger-ink: #fff;
  --cover-bg: linear-gradient(160deg, #5d6aa8, #e8c77c);
  --scrim: rgb(var(--day-ink-rgb) / .4);
  /* The choice scheme (chips, tiles, picture cards: see the «Choice controls» block below). */
  --choice-bg: var(--day-card);
  --choice-hover: var(--day-soft);
  --choice-line: #8b7d62;          /* 3.6:1 on a card, 3.1:1 on the page */
  --choice-ink: var(--ink);
  --choice-quiet-ink: var(--ink-soft);
  --choice-on-bg: var(--accent);
  --choice-on-ink: var(--accent-ink);
  --choice-ring: var(--ink);
}
:root[data-theme=evening] {
  color-scheme: dark;
  --bg: #1d2347;
  /* Where the evening gradient ends: also the canvas colour Safari shows below the page. */
  --bg-end: #2d2a55;
  --bg-image: linear-gradient(var(--bg), var(--bg-end));
  --card: rgba(255,255,255,.08);
  --line: rgba(255,255,255,.14);
  --ink: #f3ead8;
  --ink-soft: #c7bda9;
  --accent: #f0b65f;
  --glow: var(--accent);
  --accent-ink: #2a2140;
  --soft: rgba(255,255,255,.1);
  --field: rgba(255,255,255,.1);
  --danger: #ffb4ab;
  --danger-ink: #2a2140;
  --cover-bg: linear-gradient(160deg, #3a4280, #7a5f86);
  --scrim: rgba(8,10,30,.55);
  --choice-bg: rgba(255,255,255,.08);
  --choice-hover: rgba(255,255,255,.16);
  --choice-line: rgba(243,234,216,.5);
  --choice-ink: var(--ink);
  --choice-quiet-ink: var(--ink-soft);
  --choice-on-bg: var(--accent);
  --choice-on-ink: var(--accent-ink);
  --choice-ring: var(--ink);
}

/* «Liquid glass» (.lg-glass, .lg-prominent below): the tokens per theme. Clear glass is a fill of the theme's ground
   under a light sheen, a hairline of light round its edge (brighter where the light falls, at the top) and the shadow it
   casts; prominent glass is the accent tinted through. The fill alone keeps the words above 4.5:1 whatever passes under
   (the blur averages it), --glass-solid and --prom-solid stand in where there is no blur. */
:root, :root[data-theme=day] {
  --glass-fill: rgba(255,252,244,.55);
  --glass-tint: linear-gradient(180deg, rgba(255,253,247,.72), rgba(255,253,247,.28) 60%, rgba(255,253,247,.4));
  --glass-edge: rgba(255,253,247,.85);
  --glass-spec: #fff;
  --glass-ink: var(--day-ink);
  --glass-solid: var(--day-card);
  --glass-shadow: 0 0 0 .5px rgb(var(--day-ink-rgb) / .14), 0 10px 26px -12px rgb(var(--day-ink-rgb) / .38);
  --prom-top: rgba(76,92,164,.95);
  --prom-mid: rgba(59,74,143,.93);
  --prom-low: rgba(44,56,116,.96);
  --prom-foot: rgba(10,16,60,.28);
  --prom-ink: #fff;
  --prom-solid: #3b4a8f;
  --prom-glow: rgba(59,74,143,.45);
  --prom-rim: rgba(190,200,255,.35);
}
:root[data-theme=evening] {
  --glass-fill: rgba(24,28,64,.46);
  --glass-tint: linear-gradient(180deg, rgba(255,255,255,.17), rgba(255,255,255,.05) 55%, rgba(255,255,255,.09));
  --glass-edge: rgba(255,255,255,.22);
  --glass-spec: rgba(255,255,255,.6);
  --glass-ink: #fff8e7;
  --glass-solid: #2b3166;
  --glass-shadow: 0 10px 28px -12px rgba(3,4,18,.8);
  --prom-top: rgba(250,204,130,.95);
  --prom-mid: rgba(240,182,95,.94);
  --prom-low: rgba(226,158,72,.95);
  --prom-foot: rgba(140,80,0,.22);
  --prom-ink: #2a2140;
  --prom-solid: #f0b65f;
  --prom-glow: rgba(240,182,95,.45);
  --prom-rim: rgba(255,244,222,.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* The canvas past the page (under Safari's toolbars, below the fixed layer) is the colour the gradient ends with. */
html { background-color: var(--bg-end); }
body {
  /* Its own stacking context, so the fixed layer below paints over body's background, not under it. */
  isolation: isolate;
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-attachment: fixed;
  color: var(--ink);
  font: 16px/1.45 var(--ui-font);
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
/* The page background as a fixed layer overscanning the largest viewport by a quarter screen each way: Safari's toolbars,
   the status bar, the home indicator and an overscroll bounce all show the page itself, never a band. The gradient
   still runs from --bg at the screen's top to --bg-end at its bottom; past those edges it holds its end colours. */
body { --bg-layer: linear-gradient(var(--bg) 25vh, var(--bg-end) calc(25vh + 100lvh)); }
body::before {
  content: ''; position: fixed; top: -25vh; left: 0; right: 0; height: calc(100vh + 50vh); height: calc(100lvh + 50vh);
  z-index: -1; pointer-events: none;
  background-color: var(--bg-end); background-image: var(--bg-layer);
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 24px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100dvh;
}

h1, h2 { font-family: var(--story-font); margin: 0; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 400; }
h2 { font-size: 21px; font-weight: 600; }
p { margin: 0; }
a { color: inherit; font-weight: 600; }
.muted { color: var(--ink-soft); font-size: 14px; }
.spacer { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.center { text-align: center; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

/* .btn-ghost shares the base: it is also an <a> (home's «Добавить близких»), which without it kept the link's underline and inline box
   (the owner, 26.11: «по вёрстке не совпадает» with «Новая история»). */
/* The four kinds of button (design book §6, all pills): PRIMARY is this base (52px: 17px/1.2 sans 600 + 16px padding), one
   per screen; SECONDARY is .btn-ghost (48px, a 1.5px --ink-soft edge); GLASS is .lg-glass over a picture or in the header;
   QUIET is .link (text only). .btn-small only makes a button as wide as its words (the height stays its kind's); controls that
   are not one of the four (chips and tiles: the choice scheme below; the menu's rows; icon buttons) say their own size. */
button, .btn, .btn-ghost {
  font: 600 17px/1.2 var(--ui-font);
  border: 0;
  border-radius: 999px;
  padding: 16px 22px;
  background: var(--accent);
  color: var(--accent-ink);
  width: 100%;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:disabled { opacity: .45; cursor: default; }
/* Lucide icons from icons.svg: thin line, the colour and (unless sized) the size of the text around them. */
.icon { width: 1.2em; height: 1.2em; flex: none; vertical-align: -.2em; margin-inline-end: .35em; }
button .icon, .badge .icon, h1 .icon, .sc-cover .icon, .hero-cover .icon, .face .icon, .streak .icon { margin-inline-end: 0; }
.shelf-label .icon { width: 1em; height: 1em; margin: 0 0 0 .2em; }
.badge { display: inline-flex; align-items: center; gap: 4px; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink-soft);
  padding: 13px 22px;
  font-size: 16px;
}
/* A destructive secondary takes its edge from its words. */
.btn-ghost.danger { border-color: currentColor; }
/* Google's sign-in button rules: white, dark text, a thin grey border, in the day and the evening alike. */
.btn-google {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #747775;
  font-weight: 500;
}
/* The sign-in screens (a guest's: «Продолжить», «Создать аккаунт», «Войти», the invite, «Забыли пароль?», the terms):
   always the landing's evening (app.js applyTheme, index.html's first paint), so the step from the landing or a tour to a
   form stays in the same world (the owner, 23.11). The top row as on the landing (a glass «‹ Назад», the moon mark), the
   landing's picture of a family's evening, one candle-yellow main action per screen, the rest glass or small links. One
   column on a phone; on a wide screen the picture stands to the left of it. */
:root:has(#app.auth) { --bg-end: #141836; }
#app.auth { max-width: 460px; padding-top: calc(env(safe-area-inset-top) + 12px); }
.auth-screen { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.auth-back { display: inline-flex; align-items: center; gap: 2px; height: 44px; padding: 0 16px 0 10px; border-radius: 999px; font: 600 15px var(--ui-font); }
.auth-back .icon { width: 20px; height: 20px; margin: 0; }
.auth-brand { display: inline-flex; align-items: center; gap: 8px; font: 400 21px/1 var(--story-font); color: var(--ink); text-decoration: none; }
.auth-brand .icon { width: 20px; height: 20px; margin: 0; color: var(--accent); }
.auth-main { display: flex; flex-direction: column; gap: 16px; }
.auth-error { color: var(--danger); font-size: 15px; }
.auth-error:empty { display: none; }

/* ── The cover wall behind the join and sign-in screens (#app.join) (the owner's pick, 24.11: a dense wall of our covers, tilted, drifting slowly, under a
   vignette and a warm glow). One layer pinned to the screen; the content stands on it dimmed so the fields read. ── */
.auth-bg { display: none; position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh; z-index: -1; overflow: hidden; pointer-events: none; background: #0a0c20; }
:root:has(#app.join) .auth-bg { display: block; }
:root:has(#app.join) { background: #0a0c20; }
:root:has(#app.join) body { background: transparent; }
:root:has(#app.join) body::before { display: none; }
.auth-mosaic, .auth-shade, .auth-dim { position: absolute; inset: 0; }
.auth-tilt { position: absolute; inset: -35% -60%; display: flex; gap: 8px; justify-content: center; transform: rotate(-16deg); }
.auth-col { flex: none; width: 86px; display: flex; flex-direction: column; gap: 8px; }
.auth-col:nth-child(n+9) { display: none; }
.auth-tile { flex: none; display: block; aspect-ratio: 2 / 3; border-radius: var(--r-s); overflow: hidden; background: #262b55; }
.auth-tile img { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(.72) saturate(.95); }
@media (prefers-reduced-motion: no-preference) {
  .auth-col { animation: auth-drift var(--d, 90s) linear infinite; }
  .auth-col.down { animation-direction: reverse; }
}
@keyframes auth-drift { from { transform: translateY(0); } to { transform: translateY(calc(-50% - 4px)); } }
.auth-shade {
  background:
    radial-gradient(90% 30% at 50% 22%, rgba(240,182,95,.16), transparent 75%),
    linear-gradient(rgba(8,9,26,.72), rgba(8,9,26,.18) 12%, rgba(8,9,26,.1) 30%, rgba(8,9,26,.55) 52%, rgba(8,9,26,.9) 72%, #0a0c20 92%);
}
.auth-dim { background: rgba(8,9,26,.28); }
@media (min-width: 900px) {
  .auth-col { width: 130px; gap: 10px; }
  .auth-col:nth-child(n+9) { display: flex; }
  .auth-tile { border-radius: var(--r-s); }
}
#app.join .auth-back { background: rgba(14,16,40,.78); }

#app.join { max-width: 460px; }
/* The covers show clear in the upper part of the screen; everything to read or press stands on one sheet at the foot (the
   owner, 25.11: text straight over the covers read as a pile). A tall sheet (the plans) simply scrolls under the top row. */
.join-screen { gap: 8px; }
.join-screen::before { content: ''; order: 1; flex: 1 1 0; min-height: 20px; }
.join-screen .auth-top { order: 0; }
.join-screen .auth-main {
  order: 2; gap: 12px; padding: 22px 18px 18px; border-radius: var(--r-l);
  background: rgba(13,15,38,.9); border: 1px solid rgba(255,255,255,.1); box-shadow: 0 -10px 50px rgba(4,5,18,.55);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.join-screen .auth-title { font-size: 24px; line-height: 1.12; }
@media (min-width: 900px) {
  .auth-screen.join-screen:not(.with-art) .auth-main { margin: auto; padding: 28px 26px 24px; }
  .join-screen::before { display: none; }
}
.join-screen .auth-lead { margin-top: -4px; font-size: 15px; line-height: 1.35; }

/* The picture: the figures cut out with real alpha (solid to half its height, gone by 60%), so only that part is shown,
   over a faint candle glow; decoration only. */
.auth-art { position: relative; isolation: isolate; display: flex; justify-content: center; pointer-events: none; }
.auth-art::before {
  content: ''; position: absolute; z-index: -1; inset: 6% 12% 18%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(240,182,95,.26), rgba(240,182,95,.08) 60%, transparent);
}
.auth-art img { display: block; width: auto; aspect-ratio: 1066 / 960; object-fit: cover; object-position: 50% 0; }
.auth-art-big img { height: min(36svh, 320px); }
.auth-art-small img { height: min(16svh, 136px); }
.auth-art-small { margin-bottom: -10px; }

.auth-title { font-size: 30px; font-weight: 400; line-height: 1.15; letter-spacing: -.01em; text-align: center; text-wrap: balance; color: #fff8e7; }
/* «Сказки про вашего ребёнка» over the picture's foot, as the landing's headline stands over its picture. */
.auth-title.auth-hello { font-size: 34px; line-height: 1.08; margin-top: -30px; text-shadow: 0 2px 24px rgba(8,10,30,.7); }
.auth-title.auth-from { font-size: 24px; line-height: 1.25; }
.auth-lead { color: var(--ink-soft); font-size: 16px; line-height: 1.45; text-align: center; text-wrap: balance; max-width: 36ch; margin: -6px auto 0; }
.auth-closed .auth-lead, .auth-invite .auth-lead { margin-top: 0; }
/* «Первая сказка — бесплатно» (and the child's name from tour 2): a candle-lit pill. */
.auth-free {
  align-self: center; display: inline-flex; align-items: center; gap: 8px; max-width: 36ch; margin: -4px 0 0; padding: 7px 14px;
  border-radius: 999px; background: rgba(240,182,95,.13); box-shadow: inset 0 0 0 1px rgba(240,182,95,.34);
  color: #f7dcae; font-weight: 600; font-size: 15px; line-height: 1.3; text-align: center; text-wrap: balance;
}
.auth-free .icon { margin: 0; color: var(--accent); }
.auth-doors { display: flex; flex-direction: column; gap: 12px; }
.auth-screen .btn-google { min-height: 52px; }
/* «Быстрый вход»: Apple's, Google's and the passkey button, one under another at the same size and weight (neither provider
   lets its button be less prominent than another's), then «или по почте» over the form. Apple's is the white one of its guidelines
   (the screen stands on a dark evening); Google's is its light one (.btn-google). See the sources in screens/auth.js. */
.auth-quick { display: flex; flex-direction: column; gap: 12px; }
.auth-quick-title { margin: 0; font: 600 13px var(--ui-font); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); text-align: center; }
.auth-quick-buttons { display: flex; flex-direction: column; gap: 10px; }
.auth-quick-buttons button {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; padding: 12px 20px;
  font: 500 16px/1.2 var(--ui-font); text-align: center;
}
.quick-logo { display: inline-flex; flex: none; align-items: center; }
.btn-apple { background: #fff; color: #000; border: 1px solid #fff; }
.btn-passkey { background: rgba(255,255,255,.1); color: var(--ink); border: 1px solid rgba(255,255,255,.28); }
.auth-quick .auth-terms { margin-top: 0; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.18); }
/* While a form is sent: the button is off and turns a small ring after its words. */
.auth-primary[aria-busy=true] { opacity: .75; }
.auth-primary[aria-busy=true]::after {
  content: ''; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: auth-spin .8s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .auth-primary[aria-busy=true]::after { animation: none; opacity: .5; } }
.auth-link { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; color: var(--ink); text-underline-offset: 3px; }
.auth-link .icon { margin: 0; color: var(--accent); }
.auth-link-small { padding: 4px; font-size: 15px; font-weight: 500; color: var(--ink-soft); }
.auth-terms { margin-top: auto; padding-top: 4px; font-size: 13px; color: var(--ink-soft); text-align: center; text-wrap: balance; }
.auth-terms a { color: var(--ink); font-weight: 500; text-underline-offset: 2px; }
.auth-switch { color: var(--ink-soft); text-align: center; }
.auth-switch a { color: var(--accent); text-underline-offset: 3px; }

/* What a new parent gets: three short lines on a faint card. */
.auth-perks {
  list-style: none; margin: 0; padding: 14px 16px; display: grid; gap: 10px; border-radius: var(--radius);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; line-height: 1.35;
}
.auth-perks li { display: flex; align-items: flex-start; gap: 10px; }
.auth-perks .icon { width: 20px; height: 20px; margin: 1px 0 0; color: var(--accent); }

.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-form label { font-size: 15px; }
.auth-form input[type=email], .pw-box input { font-size: 17px; padding: 14px; }
#app.auth input[type=email], #app.auth input[type=text], #app.auth input[type=password] {
  padding: 14px 16px; border-radius: var(--r-m); background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.2);
}
#app.auth .pw-box input { padding-right: 52px; }
#app.auth input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.auth-form .check.auth-adult { align-items: flex-start; font-size: 15px; line-height: 1.35; }
.auth-adult input { flex: none; margin: 0; }
.auth-adult-box { display: flex; flex-direction: column; gap: 6px; }
.auth-legal-links { padding-left: 32px; font-size: 14px; }
.auth-legal-links a { color: var(--ink-soft); font-weight: 500; text-underline-offset: 2px; }

/* A screen that says rather than asks: a round glow with its icon, the title, the words. */
.auth-closed { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.auth-closed > .btn { align-self: stretch; }
.auth-badge {
  align-self: center; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; color: var(--accent);
  background: radial-gradient(circle at 50% 35%, rgba(240,182,95,.24), rgba(240,182,95,.06) 70%);
  box-shadow: inset 0 0 0 1px rgba(240,182,95,.32), 0 0 44px rgba(240,182,95,.18);
}
.auth-badge .icon { margin: 0; }
.auth-soon-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; font-size: 14px; }
.auth-soon-item { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-weight: 600; }
.auth-soon-item .icon { margin: 0; }
.auth-soon { padding: 0 6px; border-radius: var(--r-s); background: var(--soft); font-size: 12px; font-weight: 500; }
.auth-soon-chip { padding: 2px 12px; border-radius: 999px; background: var(--soft); color: var(--ink-soft); font-size: 13px; }
.auth-cover { display: flex; justify-content: center; margin-top: 6px; }
.auth-cover img { width: 132px; height: auto; aspect-ratio: 400 / 601; border-radius: var(--r-m); transform: rotate(-3deg); box-shadow: 0 18px 40px rgba(3,4,18,.7), 0 0 60px rgba(240,182,95,.16); }
.auth-invite { display: flex; flex-direction: column; gap: 14px; }
.auth-tip { text-align: center; text-wrap: pretty; }

/* A short phone (or one with the keyboard up): the picture steps back so the form is on the screen whole. */
@media (max-height: 700px) and (max-width: 899px) {
  .auth-art-small img { height: 84px; }
  .auth-art-big img { height: 30svh; }
}
/* A wide screen: the picture to the left, large; the column to the right; the screens without a picture centred. */
@media (min-width: 900px) {
  #app.auth { max-width: 1040px; padding-inline: 32px; }
  .auth-screen.with-art { display: grid; grid-template-columns: minmax(0, 1fr) 440px; grid-template-rows: auto 1fr; column-gap: 64px; align-items: center; }
  .auth-screen.with-art .auth-top { grid-column: 1 / -1; }
  .auth-screen.with-art .auth-art { grid-area: 2 / 1; margin: 0; }
  .auth-screen.with-art .auth-main { grid-area: 2 / 2; padding-block: 24px; }
  .auth-art img, .auth-art-big img, .auth-art-small img { width: 100%; max-width: 560px; height: auto; }
  .auth-title.auth-hello { margin-top: 0; }
  .auth-screen:not(.with-art) .auth-main { width: 440px; margin: auto; padding-bottom: 8vh; }
}
/* A password: an eye inside the field to show it, «Забыли пароль?» by the label, «Придумать пароль» under it. */
.pw-field { display: flex; flex-direction: column; }
.pw-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pw-forgot { font-size: 14px; font-weight: 500; color: var(--ink-soft); text-underline-offset: 3px; }
.pw-box { position: relative; }
.pw-box input { padding-right: 52px; }
.pw-eye { position: absolute; top: 1px; right: 1px; bottom: 1px; width: 48px; padding: 0; background: transparent; color: var(--ink-soft); border-radius: 0 13px 13px 0; }
.pw-hint { margin-top: 6px; }
button.link.pw-generate { align-self: flex-start; display: inline-flex; gap: 6px; margin-top: 4px; padding: 8px 0; color: var(--accent); text-decoration: none; font-weight: 600; }
.profile-password { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
/* Screens for relatives (grandparents): large text, large buttons. */
.relative, .relative p, .relative button { font-size: 20px; }
.relative h2 { font-size: 26px; }
.relative button { min-height: 60px; }
.relative h1 { font-size: 30px; }
.relative label { font-size: 19px; color: var(--ink); margin-bottom: 6px; }
.relative input[type=text], .relative textarea { font-size: 20px; padding: 14px; }
.relative .muted { font-size: 19px; }
.relative .error { font-size: 19px; }
.relative .error:empty { display: none; }
.relative .chips { gap: 10px; }
.relative .chip { min-height: 52px; padding: 12px 18px; font-size: 19px; }
.relative .link { min-height: 48px; padding: 10px 6px; font-size: 19px; }
.relative .dictate .mic { min-height: 52px; }
/* Hints on her screens read a step darker (lighter at night) than the parent's quiet ink. */
.relative { --ink-soft: #4f463a; }
:root[data-theme=evening] .relative { --ink-soft: #ddd3c0; }
/* A field with its «Надиктовать» beside the label: the input, then the dictation's status and help, full width under them. */
.me-field { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; }
.me-field > label { grid-column: 1; grid-row: 1; margin: 0; }
.me-field > .dictate { display: contents; }
.me-field .dictate > .mic { grid-column: 2; grid-row: 1; width: auto; margin-bottom: 8px; }
.me-field > input, .me-field > textarea, .me-field .dictate > :not(.mic) { grid-column: 1 / -1; }
.me-field .dictate > p:empty { display: none; }
/* «Сохранить» stays at the bottom of the screen while her long profile scrolls under it. */
.me-sticky { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg-end) 30%); }
.me-sticky > button { width: 100%; }
/* «Как оформить»: the gift's look, folded; its line says what is chosen. */
.me-more { gap: 16px; }
.me-more summary { cursor: pointer; display: flex; flex-direction: column; gap: 2px; list-style: none; }
.me-more summary::-webkit-details-marker { display: none; }
.me-more summary strong { font-size: 20px; display: flex; align-items: center; gap: 6px; }
.me-more summary .icon { color: var(--ink-soft); transition: transform .2s; }
.me-more[open] summary .icon { transform: rotate(180deg); }
/* A tile that waits for her: an accent edge and the note in accent. */
.card.me-tile.attention { border: 2px solid var(--accent); }
.me-note { font-size: 19px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.me-tile.attention .me-note { color: var(--accent); }
/* The profile's list (#/profile, #/about): each row a card that leads to a page; the touch target is 56px or more. */
.settings-list { display: flex; flex-direction: column; gap: 8px; }
.card.settings-row { flex-direction: row; align-items: center; gap: 14px; min-height: 56px; padding: 8px 14px; color: inherit; text-decoration: none; text-align: left; font: inherit; width: 100%; }
.settings-row > .icon { color: var(--accent); margin: 0; flex: none; }
.settings-row > .icon:last-child { color: var(--ink-soft); margin-left: auto; }
.settings-row > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.settings-row strong { font-size: 17px; font-weight: 600; }
.settings-row .muted { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-soon { color: var(--ink-soft); }
.settings-soon strong { font-weight: 500; }
.settings-row .lp-soon, .about-card .lp-soon { margin-left: 8px; padding: 0 6px; border-radius: var(--r-s); background: var(--soft); font-size: 12px; font-weight: 500; }
/* «Выйти»: the profile's last row, quieter than the others; the menu's last item. */
.card.settings-signout { background: transparent; color: var(--ink); margin-top: 8px; }
.settings-signout > .icon:first-child { color: var(--ink-soft); }
.signout-box { display: flex; flex-direction: column; }
.card.signout-ask { margin-top: 8px; }
.signout-menu .signout-ask { padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.notice { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: var(--r-m); background: var(--soft); }
.notice .icon { flex: none; margin-top: 2px; }
.menu-legal { margin: auto 10px 0; padding-top: 14px; text-align: center; font-size: 13px; color: var(--ink-soft); }
.menu-legal a { color: inherit; text-decoration: none; padding: 8px 4px; }
/* The relative's space: its pages stack with room between them; dictation leads the memory editor. */
.me { display: flex; flex-direction: column; gap: 18px; flex: 1; }
.memory-editor .dictate .mic { width: 100%; min-height: 64px; }
.card.me-tile { flex-direction: row; align-items: center; gap: 14px; padding: 18px 16px; color: inherit; text-decoration: none; }
.me-tile > span { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.me-tile strong { font-size: 22px; }
.me-tile > .icon { color: var(--accent); margin: 0; }
.me-tile > .icon:last-child { color: var(--ink-soft); }
.me-memory { font-family: var(--story-font); line-height: 1.5; }
.me-list { display: flex; flex-direction: column; gap: 12px; }
.me-list:empty { display: none; }
.card.me-row { flex-direction: row; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.me-cover { width: 72px; height: 96px; flex: none; border-radius: var(--r-m); object-fit: cover; background: var(--cover-bg); display: grid; place-items: center; color: var(--on-picture); }
.me-row-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.me-row-text strong { font-size: 20px; }
/* Where a book stands: a calm pill; the one waiting for her stands out. */
.me-badge { align-self: flex-start; font-size: 17px; padding: 4px 12px; border-radius: var(--r-m); background: var(--soft); color: var(--ink); }
.me-badge.author { background: var(--accent); color: var(--accent-ink); }
.end-relative { display: flex; flex-direction: column; gap: 12px; }
/* The parent's side of relatives: «Новое от родных» on home and its list, the profile fields and the relative's link in «Семья». */
.review-list { display: flex; flex-direction: column; gap: 12px; }
.review-item > .row { gap: 12px; align-items: center; flex-wrap: nowrap; }
.review-cover { width: 60px; height: 80px; flex: none; border-radius: var(--r-m); object-fit: cover; background: var(--cover-bg); display: grid; place-items: center; color: var(--on-picture); }
.review-reject { display: flex; flex-direction: column; gap: 10px; }
.review-said { font-family: var(--story-font); line-height: 1.5; }
.card.profile-more { display: block; }
.profile-more > * + * { margin-top: 12px; }
.profile-more summary { cursor: pointer; font-weight: 600; }
.invite-out { display: flex; flex-direction: column; gap: 10px; }
.btn-small { width: auto; }
/* Quiet: text only, underlined in the accent; 44px to touch. */
.link { background: none; color: var(--ink-soft); padding: 10px 8px; min-height: 44px; width: auto; font: 500 16px/1.2 var(--ui-font); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
/* A way back (an arrow, then where it goes) is a button in a top row, like the icons beside it: not underlined. */
button.link:has(> .icon:first-child) { text-decoration: none; }

/* «Liquid glass» controls (the landing's first, 20.11; any screen may use them): a pane of frosted glass over whatever
   passes under it. .lg-glass is clear glass, .lg-prominent the main action, .lg-round either one as a round icon button.
   The specular (::before) is light caught across the upper part, as on a curved pane, under the words (z-index -1 in the
   control's own stacking context), so it never thins them. Without backdrop-filter, and with «Понижение прозрачности»,
   they are solid; with forced colours, a border. */
.lg-glass, .lg-prominent {
  position: relative; isolation: isolate; border: 0; text-decoration: none;
  -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
  transition: transform .18s ease, box-shadow .2s ease;
}
.lg-glass {
  color: var(--glass-ink);
  background: var(--glass-tint), var(--glass-fill);
  box-shadow: inset 0 0 0 1px var(--glass-edge), inset 0 1px .5px var(--glass-spec), inset 0 -1px 1px rgba(255,255,255,.1), var(--glass-shadow);
}
.lg-prominent {
  color: var(--prom-ink);
  background: linear-gradient(180deg, var(--prom-top), var(--prom-mid) 55%, var(--prom-low));
  box-shadow: inset 0 0 0 1px var(--prom-rim), inset 0 1px .5px rgba(255,255,255,.9), inset 0 -3px 6px -2px var(--prom-foot),
    0 14px 34px -14px var(--prom-glow), 0 3px 10px -6px rgba(0,0,0,.45);
}
.lg-glass::before, .lg-prominent::before {
  content: ''; position: absolute; inset: 1px; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 90% at 50% -30%, rgba(255,255,255,.26), transparent 62%);
}
.lg-prominent::before { background: radial-gradient(100% 90% at 50% -45%, rgba(255,255,255,.38), transparent 58%); }
.lg-glass:active, .lg-prominent:active { transform: scale(.97); }
.lg-glass:focus-visible, .lg-prominent:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lg-round { width: 44px; height: 44px; padding: 0; flex: none; border-radius: 50%; display: grid; place-items: center; }
.lg-round .icon { margin: 0; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .lg-glass { background: var(--glass-solid); }
  .lg-prominent { background: var(--prom-solid); }
}
@media (prefers-reduced-transparency: reduce) {
  .lg-glass, .lg-prominent { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .lg-glass { background: var(--glass-solid); }
  .lg-prominent { background: var(--prom-solid); }
  .lg-glass::before, .lg-prominent::before { display: none; }
}
@media (forced-colors: active) {
  .lg-glass, .lg-prominent { border: 1px solid ButtonText; }
  .lg-glass::before, .lg-prominent::before { display: none; }
}
@media (prefers-reduced-motion: reduce) { .lg-glass, .lg-prominent { transition: none; } .lg-glass:active, .lg-prominent:active { transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cover {
  border-radius: var(--r-m);
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  background: var(--cover-bg);
  display: block;
}

label { font-size: 14px; color: var(--ink-soft); display: block; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%;
  font: 16px var(--ui-font);
  padding: 12px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
}
::placeholder { color: var(--ink-soft); opacity: .8; }
textarea { min-height: 84px; resize: vertical; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
/* Holding an own chip asks to remove it: no text selection or callout in the way. */
.chip { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.offer-card h2 { display: flex; align-items: center; gap: 8px; }
.offer-card .offer-dismiss { align-self: center; min-height: 44px; }

/* ===== Choice controls: one scheme for every «pick among options» (the owner, 26.11: one look for active and inactive choices).
   Not selected: the raised surface, a hairline, the normal text. Selected: the accent fill with its ink (a tick only where
   several can be chosen: aria-pressed; a single choice is role=radio + aria-checked and the fill says it). Unavailable: the
   same surface, quiet ink, a note or a lock, never dashed. Already there / in progress is not a choice: .chip-status, a quiet
   label. Dashed is only «+ add» (.chip.add, .avatar.add). 44px, a pill, an 18px icon, 8px gaps, one focus ring. */
:root { --choice-h: 44px; --choice-r: 999px; --choice-icon: 18px; --choice-gap: 8px; }
.chip {
  width: auto; min-height: var(--choice-h); padding: 0 12px; border-radius: var(--choice-r);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--choice-gap);
  background: var(--choice-bg); color: var(--choice-ink); border: 1px solid var(--choice-line);
  font: 500 15px var(--ui-font); transition: background-color .15s, color .15s, border-color .15s;
}
.chip .icon { width: var(--choice-icon); height: var(--choice-icon); margin: 0; }
.chip[aria-pressed=true], .chip[aria-checked=true], .btn-ghost[aria-pressed=true] { background: var(--choice-on-bg); color: var(--choice-on-ink); border-color: var(--choice-on-bg); opacity: 1; }
.chip[aria-pressed=true]::before {
  content: ''; flex: none; width: 16px; height: 16px; background: currentColor;
  -webkit-mask: var(--choice-tick) center / contain no-repeat; mask: var(--choice-tick) center / contain no-repeat;
}
:root { --choice-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
.chip:disabled, .chip[aria-disabled=true] { color: var(--choice-quiet-ink); opacity: 1; cursor: default; }
@media (hover: hover) {
  .chip:not([aria-pressed=true], [aria-checked=true], :disabled, [aria-disabled=true]):hover { background: var(--choice-hover); }
}
.chip:active:not(:disabled) { transform: scale(.98); }
.chip:focus-visible, .avatar:focus-visible, .style-card:focus-visible { outline: 2px solid var(--choice-ring); outline-offset: 2px; }
.chip.noted { flex-direction: column; gap: 1px; line-height: 1.2; padding-block: 6px; }
.chip.noted small { font-size: 12px; font-weight: 400; }
/* «+ свой» / «+ добавить»: an empty slot to fill, the only dashed outline. */
.chip.add { background: none; color: var(--ink-soft); border: 1.5px dashed var(--ink-soft); gap: 4px; }
/* The format the story already has or is being made in: a status, not an option (no border, no fill, not focusable). */
.chip-status { display: inline-flex; align-items: center; gap: var(--choice-gap); min-height: var(--choice-h); padding: 0 4px; color: var(--ink-soft); font: 500 15px var(--ui-font); }
.chip-status .icon { width: var(--choice-icon); height: var(--choice-icon); margin: 0; }

/* Picture cards (a drawing style) and the cast's faces: the same marks as a ring, since a fill would cover the picture. */
.style-card img { box-shadow: 0 0 0 1px var(--choice-line); }
.style-card[aria-checked=true] img, .style-card[aria-pressed=true] img { box-shadow: 0 0 0 3px var(--choice-on-bg); }
.style-card[aria-checked=true] span, .style-card[aria-pressed=true] span { font-weight: 700; }
.avatar { position: relative; }
.avatar:disabled { opacity: 1; }
.avatar .face { box-shadow: 0 0 0 1px var(--choice-line); }
.avatar[aria-pressed=true] .face { border-color: var(--choice-on-bg); box-shadow: none; }
.avatar[aria-pressed=true]::before, .avatar[aria-pressed=true]::after { content: ''; position: absolute; top: 34px; right: 5px; width: 18px; height: 18px; border-radius: 50%; }
.avatar[aria-pressed=true]::before { background: var(--choice-on-bg); }
.avatar[aria-pressed=true]::after {
  background: var(--choice-on-ink); transform: scale(.55);
  -webkit-mask: var(--choice-tick) center / contain no-repeat; mask: var(--choice-tick) center / contain no-repeat;
}
/* ===== end of the choice controls */
/* «Стиль рисунка»: a strip of picture cards, the next one peeking in; the chosen one has a ring (room for it above). */
.style-track {
  display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain;
  margin: 0 -16px; padding: 4px 16px 2px; scroll-padding: 0 16px; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.style-track::-webkit-scrollbar { display: none; }
.style-track .style-card {
  flex: none; width: min(38vw, 160px); min-height: 0; padding: 0; border-radius: 0; background: none; color: var(--ink);
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; scroll-snap-align: start;
  font: 500 14px/1.2 var(--ui-font);
}
.style-card img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; display: block; border-radius: var(--r-m); background: var(--soft); }
.relative .style-track .style-card { font-size: 17px; }

.avatars { display: flex; gap: 10px; flex-wrap: wrap; }
.avatar {
  width: 64px; padding: 0; background: none; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 500;
}
.avatar .face {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--soft) center/cover; display: grid; place-items: center; color: var(--ink-soft); object-fit: cover;
  border: 3px solid transparent;
}
.avatar.add { color: var(--ink-soft); }
.avatar.add .face { box-shadow: none; background: none; border: 1.5px dashed var(--ink-soft); color: var(--ink-soft); }

.thumbs { display: flex; gap: 8px; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--r-m); }

/* A person's photo set (SK-2.7): tiles of up to five, the main one first with its badge, tools under each. */
.photo-hints { margin: 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.photo-tile { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.photo-frame { position: relative; }
.photo-frame img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-m); background: var(--field); }
.photo-tile[data-main=true] .photo-frame img { outline: 2.5px solid var(--accent); outline-offset: -2.5px; }
.photo-main.badge { left: 5px; bottom: 5px; }
.photo-tools { display: flex; gap: 4px; }
.photo-tools .btn-small { flex: 1; justify-content: center; }
.photo-tile .link { font-size: 13px; text-align: start; padding: 0; }
.photo-hint { display: flex; gap: 4px; align-items: flex-start; margin: 0; font-size: 12px; color: var(--ink-soft); }

.sheet-img { width: 100%; border-radius: var(--r-m); background: var(--field); }
/* The hero card (hero design §5): the face close-up beside the master sheet, then the fields. */
.hero-pictures { display: grid; grid-template-columns: 2fr 3fr; gap: 8px; align-items: start; }
.hero-pictures .sheet-img:only-child { grid-column: 1 / -1; }
.hero-fields { display: grid; gap: 10px; }
.hero-looks { display: grid; gap: 10px; }
.hero-looks[open] > summary { margin-bottom: 6px; }
.hero-fix { display: grid; gap: 8px; }
.hero-state { margin: 0; }

/* home: the poster slider and the shelves */
/* Format badges sit bottom-left on every card: posters letter their titles across the top. */
.badge {
  position: absolute; left: 7px; bottom: 7px; z-index: 1; background: var(--bg); color: var(--ink);
  border-radius: 999px; padding: 1px 7px; font-size: 12px; font-weight: 600; opacity: .92;
}
.hero { display: flex; flex-direction: column; gap: 8px; }
.hero-track {
  display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain;
  margin: 0 -16px; padding: 0 16px; scroll-padding: 0 16px; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.hero-track::-webkit-scrollbar { display: none; }
/* The next poster peeks in from the right; a lone one takes the whole width. On a short screen the poster narrows so
   its buttons (and the dots) stay above the fold: the bar, the heading and the dots take about 150px. */
.hero { --hero-max: calc((100svh - env(safe-area-inset-top) - 150px) * 2 / 3); }
.hero-slide {
  position: relative; flex: none; width: min(calc(100% - 24px), var(--hero-max)); aspect-ratio: 2 / 3;
  scroll-snap-align: start; scroll-snap-stop: always;
  border-radius: var(--radius); overflow: hidden; background: var(--cover-bg);
}
.hero-track.single { justify-content: center; }
.hero-track.single .hero-slide { width: min(100%, var(--hero-max)); }
.hero-art { position: absolute; inset: 0; display: block; }
.hero-cover { width: 100%; height: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; }
.hero-cover.comic { object-position: top; }
.hero-cover.blank { display: grid; place-items: center; color: var(--ink-soft); }
.hero-slide::after {
  content: ''; position: absolute; inset: 58% 0 0; pointer-events: none;
  background: linear-gradient(transparent, var(--picture-shade));
}
.hero-slide:not(.has-poster)::after { inset: 35% 0 0; }
.hero-foot {
  position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 1; pointer-events: none;
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
}
.hero-foot .cover-title { position: static; font-size: 26px; }
.hero-foot .badge { position: static; font-size: 13px; padding: 2px 9px; }
.hero-btns { display: flex; gap: 8px; align-self: stretch; }
.hero-btns button { flex: 1; pointer-events: auto; }
.hero-btns .btn-ghost {
  color: var(--on-picture); border-color: var(--on-picture); background: var(--scrim); opacity: 1;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.hero-dots { display: flex; justify-content: center; }
.hero-dot { width: 22px; height: 16px; padding: 0; background: none; border-radius: var(--r-s); display: grid; place-items: center; }
.hero-dot::before { content: ''; width: 7px; height: 7px; border-radius: 4px; background: var(--line); transition: width .2s, background-color .2s; }
.hero-dot[aria-current]::before { width: 16px; background: var(--accent); }

.shelf-sec { display: flex; flex-direction: column; gap: 8px; }
.shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
.shelf-label { font-size: 13px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px 5px 9px; border-radius: 999px;
  background: var(--soft); color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none;
}
.pill .icon { margin: 0; width: 1.1em; height: 1.1em; }
.shelf {
  display: flex; align-items: flex-start; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain;
  margin: 0 -16px; padding: 0 16px 4px; scroll-padding: 0 16px; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.shelf::-webkit-scrollbar { display: none; }
/* Every card on every shelf is the same 2:3 picture, nothing under it. */
.story-card {
  flex: none; width: 150px; scroll-snap-align: start; display: block;
  background: var(--cover-bg); border-radius: var(--r-l); overflow: hidden;
  color: inherit; font-weight: inherit; text-decoration: none;
}
.sc-art { position: relative; display: block; }
.sc-cover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; }
.sc-cover.comic { object-position: top; }
.sc-cover.blank { display: grid; place-items: center; background: var(--cover-bg); color: var(--ink-soft); }
/* Without a poster (and while drawing) the title is lettered along the bottom, on a shade so it reads on any picture. */
.story-card:not(.has-poster) .sc-art::after {
  content: ''; position: absolute; inset: 40% 0 0; background: linear-gradient(transparent, var(--picture-shade)); pointer-events: none;
}
.cover-title {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 1;
  font: 700 16px/1.15 var(--story-font); color: var(--on-picture); text-shadow: 0 1px 4px var(--picture-shade);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.sc-art .cover-title { bottom: 34px; -webkit-line-clamp: 3; }
.sc-foot { position: absolute; left: 7px; right: 6px; bottom: 7px; z-index: 1; display: flex; flex-direction: column; gap: 6px; }
.sc-title {
  font: 700 15px/1.18 var(--story-font); color: var(--on-picture); text-shadow: 0 1px 4px var(--picture-shade);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.sc-status { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sc-status .badge { position: static; flex: none; padding: 1px 5px; }
/* The status is the words alone (the brush in the middle already says it is being drawn), so it fits beside the badge. */
.sc-chip {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; font-weight: 600; color: var(--ink); background: var(--bg); opacity: .92; border-radius: 999px; padding: 1px 6px;
}
.sc-chip.failed { color: var(--danger); }
/* A read story says so in the corner opposite its format badge; the slider and shelves no longer split read from unread. */
.sc-read {
  position: absolute; right: 7px; bottom: 7px; z-index: 1; display: inline-flex; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 600; color: var(--ink); background: var(--bg); opacity: .92; border-radius: 999px; padding: 1px 6px 1px 4px;
}
.sc-read .icon { width: 1.1em; height: 1.1em; margin: 0; }
.more-link {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; border-radius: var(--radius);
  background: var(--soft); color: var(--ink); font-weight: 600; text-decoration: none;
}
.more-link .icon { margin: 0; }

/* The character (web/mascot.js, B-2011-01). Its colours and its wait and error poses are in index.html's inline style (the
   first paint is the same character); here are the sparks and the shading of the turning page, the empty pose and where
   it stands. Reduced motion stills it there too. */
.bk .sh { fill: var(--pe); opacity: 0; animation: bk-shade 4s -1.2s ease-in-out infinite; }
@keyframes bk-shade { 8% { opacity: 0; } 19% { opacity: .5; } 30% { opacity: 0; } }
.bk .sp { fill: var(--st); transform-box: fill-box; transform-origin: center; opacity: 0; animation: bk-spark 4s -1.2s ease-out infinite; }
@keyframes bk-spark { 0%, 30% { opacity: 0; transform: scale(0); } 40% { opacity: 1; transform: scale(1); } 60%, 100% { opacity: 0; transform: scale(.3) translateY(-8px); } }
.bk .hl { fill: #fff; }
.bk .dash { fill: none; stroke: var(--st); stroke-width: 2; stroke-dasharray: 3 5; stroke-linecap: round; }
.bk .peek { animation: bk-peek 4.4s ease-in-out infinite; }
@keyframes bk-peek { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.bk .look { animation: bk-look 4.4s ease-in-out infinite; }
@keyframes bk-look { 0%, 18% { transform: translateX(0); } 26%, 46% { transform: translateX(-2.2px); } 56%, 76% { transform: translateX(2.2px); } 86%, 100% { transform: translateX(0); } }
.bk .plus { transform-box: fill-box; transform-origin: center; animation: bk-plus 2.2s ease-in-out infinite; }
@keyframes bk-plus { 50% { transform: scale(1.12); opacity: .55; } }
/* On a screen of its own (waiting, a draft, the hero being drawn), above the title. */
#app > .bk { display: block; width: 200px; height: 170px; margin: 8px auto 0; flex: none; }
/* A screen about the character (an error, an empty shelf): it and its words in the middle, the one button at the bottom. */
.mascot-screen { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; }
.mascot-screen::before, .mascot-action { content: ''; flex: 1; }
.mascot-screen .bk { width: 230px; height: 196px; flex: none; }
.mascot-screen :is(h1, h2) { font-size: 23px; margin: 18px 0 8px; }
.mascot-line { color: var(--ink-soft); font-size: 15px; max-width: 300px; }
.mascot-action { display: flex; flex-direction: column; justify-content: flex-end; width: 100%; padding-top: 28px; }
/* Inside a card or under other things: smaller, and no stretching to the screen's bottom. */
.card .mascot-screen, .me .mascot-screen { flex: none; }
.card .mascot-screen::before, .me .mascot-screen::before { content: none; }
.card .bk, .me .mascot-screen .bk { width: 170px; height: 145px; display: block; margin: 0 auto; }
.card .mascot-action:empty, .me .mascot-action:empty { display: none; }
/* The timer of a wait (wait-meter.js): a bar that fills to 90% over the usual time and waits there; used on home's hero card and the story's waiting screen. */
.wait-meter { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.wm-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.wm-fill { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--glow, var(--accent)); transition: width .9s linear; }
.wm-text { margin: 0; text-align: center; font-variant-numeric: tabular-nums; }
/* Home's cards about the first drawing and the account (hero-status.js, welcome-block.js): the cards' own look, the title with its icon. */
.hero-status h2, .welcome-card h2, .mail-banner h2 { display: flex; align-items: center; gap: 8px; }
.hero-status h2 .icon, .welcome-card h2 .icon, .mail-banner h2 .icon { margin: 0; color: var(--accent); }
.hero-status[data-state=drawing] { border-color: var(--accent); }
.mail-banner [role=status] { display: flex; gap: 8px; align-items: flex-start; }
.mail-banner .error:empty { display: none; }
/* waiting: the pages drawn so far, one pip each, the one being drawn breathing. */
.pips { display: flex; gap: 6px; justify-content: center; width: 100%; max-width: 300px; margin: -4px auto 0; }
.pips span { flex: 0 1 22px; height: 6px; border-radius: 3px; background: var(--line); }
.pips span.on { background: var(--glow); }
.pips span.now { background: var(--glow); animation: pip 1.6s ease-in-out infinite; }
@keyframes pip { 50% { opacity: .35; } }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.65); } 50% { opacity: 1; transform: scale(1); } }
.stage { color: var(--ink-soft); font-size: 15px; min-height: 1.45em; }
.qa { gap: 8px; }
.qa-q { font-family: var(--story-font); font-size: 19px; line-height: 1.3; }
.qa label { margin: 4px 0 0; }
.qa textarea { min-height: 64px; }
.qa-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qa-actions > .dictate { display: contents; }
.qa-actions > .dictate > :not(button) { flex-basis: 100%; order: 1; }
.qa-actions button { width: auto; }
.wait-home { font-size: 15px; padding-inline: 12px; }
.wait-library { align-self: center; }
.wait-error { font-size: 15px; }
.wait-error:empty { display: none; }

/* «Пока ждёте»: ready stories on a waiting screen (wait-shelf.js). A quiet heading and a row of covers that snaps; the row
   is the only thing that scrolls sideways, edge to edge across the screen. */
.ws { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; min-width: 0; }
.ws-title { font: 600 15px/1.3 var(--ui-font); color: var(--ink-soft); }
.ws-row { list-style: none; margin: 0 -16px; padding: 2px 16px 6px; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; scrollbar-width: none; overscroll-behavior-x: contain; }
.ws-row::-webkit-scrollbar { display: none; }
.ws-row > li { flex: none; scroll-snap-align: start; }
.ws-cover { display: block; width: 112px; aspect-ratio: 2 / 3; border-radius: var(--r-m); overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.ws-cover:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ws-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ws-cover-title { display: flex; align-items: flex-end; width: 100%; height: 100%; padding: 10px; font-weight: 600; line-height: 1.2; color: #1d2347; }
/* A cover opened to read: the sample over the waiting screen, which waits under it (the page's own scroll, the screen's width). */
html.wait-reading :is(#app, #bar) { display: none !important; }
.wait-reader { position: relative; z-index: 5; max-width: 520px; margin: 0 auto; padding: 0 16px calc(env(safe-area-inset-bottom) + 32px); display: flex; flex-direction: column; gap: 12px; min-height: 100dvh; overflow-x: clip; }
.wait-reader > .sample-app { display: contents; }
.wait-reader .sample-view { width: auto; margin-inline: -16px; margin-top: 4px; }
.wait-notice { position: fixed; z-index: 30; inset-inline: 12px; top: calc(env(safe-area-inset-top) + 60px); max-width: 496px; margin-inline: auto; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: var(--r-l); background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 24px rgba(0,0,0,.35); font-weight: 600; font-size: 15px; }
.wait-notice span { flex: 1; min-width: 0; }
.wait-notice button { flex: none; width: auto; background: var(--accent-ink); color: var(--accent); }

/* A shared link's reader names the app where «Домой» would be. */
.reader-brand { padding: 6px 4px; color: var(--ink-soft); font-size: 15px; letter-spacing: .02em; }
/* The one scroll every story reads as on a phone: the beats edge to edge across the screen, one under another. From
   700px wide (a tablet, a computer) it is a centred column, as a phone's screen would be. */
#app.scroll { padding-top: 0; gap: 0; max-width: none; }
.scroll-view { display: flex; flex-direction: column; margin: 0 -16px; }
@media (min-width: 700px) { .scroll-view { width: 100%; max-width: 640px; margin-inline: auto; } }
/* The reader's top row (the scroll's, the spread's, the sample's): a translucent bar the pages pass under, frosted (the
   theme's ground at about three quarters, the pictures blurred and a little richer under it) with a hairline at its foot, the
   progress line on that hairline (B-1911-07, the owner on 19.11: «верхнюю полоску сделать лёгким градиентом, чтобы когда
   листается… или прозрачный фон с кнопочками и небольшой линией — чтобы интерфейс выглядел чуть более проработанным»).
   Frosted rather than a gradient: a gradient leaves the buttons over a bright picture's own colours. What reads as a
   gradient upright is the pictures' blurred colours under it; the open book has no picture under its row, so book.css
   gives that row a gradient of its own out of the same --bg and --ink (the owner, 26.11). */
.webtoon-top {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; min-height: 44px;
  padding: calc(env(safe-area-inset-top) + 6px) 16px 6px;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}
.webtoon-top .link { padding: 6px 4px; min-height: 0; }
.webtoon-count { font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
/* How far down the scroll is. */
.webtoon-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.webtoon-title { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.webtoon-title h1 { margin: 12px 16px 20px; }
.webtoon-title.signed { padding-bottom: 20px; }
/* The poster is as wide as the strips, square-cornered; its foot dissolves into the white the strips begin with, as one
   strip does into the next. (Under a signature it stays whole: the line is set on the page's own ground.) */
.webtoon-cover { position: relative; width: 100%; background: #fff; }
.webtoon-poster { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; object-position: top; background: var(--cover-bg); }
/* The first strip goes over the poster's foot and fades in there, as a strip does over the one above, so no ground shows
   between them (white by day would be a band at night). */
.webtoon-title:not(.signed):has(.webtoon-poster) + .webtoon-strips > .webtoon-strip:first-child {
  position: relative; margin-top: -12.5%;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 calc(100% / 12));
  mask-image: linear-gradient(to bottom, transparent, #000 calc(100% / 12));
}
/* A round translucent button-like mark over the poster's foot, a chevron sliding down in a loop; dark glass with a light
   icon reads on any picture. It leaves (and does not return) when the reader scrolls, see .scrolled. */
.scroll-hint {
  position: absolute; left: 50%; bottom: 13%; width: 46px; height: 46px; margin-left: -23px; display: grid; place-items: center;
  border-radius: 50%; color: #fff; background: rgba(20, 20, 30, .42); border: 1px solid rgba(255, 255, 255, .45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); pointer-events: none;
  transition: opacity .3s, visibility 0s .3s;
}
.scroll-hint .icon { width: 24px; height: 24px; margin: 0; animation: nudge 1.4s ease-in-out infinite; }
.scroll.scrolled .scroll-hint { opacity: 0; visibility: hidden; }
@keyframes nudge { 0%, 100% { transform: translateY(-4px); opacity: .6; } 50% { transform: translateY(5px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .scroll-hint .icon { animation: none; } }
/* Strips are drawn borderless, their top and bottom tenth only background: each goes over the end of the one above by
   a twelfth of its height (an eighth of its width) and fades in there, so the scroll is one canvas with no seam.
   A strip not loaded yet keeps a 2:3 place, so the ones further down wait to be scrolled near. */
.webtoon-strips { display: flex; flex-direction: column; background: #fff; }
.webtoon-strip { display: block; width: 100%; height: auto; aspect-ratio: auto 2 / 3; }
/* A comic's page in the scroll: the whole page across the column, under the one before; a 2:3 place until it loads.
   Comic pages join edge to edge on the pages' own white: a page's white margin (≈12 px of 1066) and the next one's make
   about one gutter between panels, so a page's edge is not seen; each page goes over the one above by a hair, so the two
   margins are no wider than a gutter. The poster dissolves at its foot into the white, and page 1 goes over its end. */
.comic-page { display: block; width: 100%; height: auto; aspect-ratio: auto 2 / 3; }
.scroll-view[data-format=comic] .scroll-beats { background: #fff; position: relative; }
.comic-page + .comic-page { margin-top: -0.6%; }
.scroll-view[data-format=comic] .webtoon-title:not(.signed) .webtoon-poster {
  -webkit-mask-image: linear-gradient(#000 88%, transparent); mask-image: linear-gradient(#000 88%, transparent);
  margin-bottom: -6%;
}
/* By night the white gutters are drawn into the pages and cannot be repainted: the pages are dimmed, and the ground under
   them is the grey their white becomes. */
:root[data-theme=evening] .scroll-view[data-format=comic] .scroll-beats,
:root[data-theme=evening] .scroll-view[data-format=comic] .webtoon-cover { background: #dbdbdb; }
:root[data-theme=evening] .scroll-view[data-format=comic] :is(.comic-page, .webtoon-poster) { filter: brightness(.86); }
/* By night a strip not loaded yet is a dark place, not a white block: a loading picture paints nothing of its own, so it
   is the ground under the strips that shows (the strips themselves cover it as they fade over each other). */
:root[data-theme=evening] .webtoon-strips { background: var(--bg-end); }
.webtoon-strip + .webtoon-strip {
  margin-top: -12.5%;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 calc(100% / 12));
  mask-image: linear-gradient(to bottom, transparent, #000 calc(100% / 12));
}
/* A strip without its picture takes a strip's place, so nothing below moves when it arrives; on the white strips its
   own paper colours in both themes. */
.webtoon-missing {
  aspect-ratio: 2 / 3; overflow-y: auto; display: grid; place-items: center; padding: 24px;
  background: var(--paper); color: var(--paper-ink);
}
.webtoon-missing .muted { color: var(--paper-muted); }
.webtoon-missing .text { margin: 0; font: 19px/1.6 var(--story-font); white-space: pre-wrap; }
.webtoon-end { display: flex; flex-direction: column; gap: 14px; padding: 24px 16px 0; }
.webtoon-end .the-end { min-height: 60vh; }
/* listening */
.listen .pic { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r-l); object-fit: cover; display: block; background: var(--soft); }
/* The poster whole, 2:3, its title on it, as tall as leaves the player and both ways on in view. */
.listen .pic.poster { width: auto; height: min(52dvh, 140vw); aspect-ratio: 2 / 3; align-self: center; border-radius: var(--r-l); }

.player { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.play {
  width: 96px; height: 96px; border-radius: 50%; font-size: 36px; padding: 0;
  display: grid; place-items: center;
}

/* finish */
.streak { display: flex; gap: 6px; justify-content: center; }
.streak span {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px;
  background: var(--soft);
}
.streak span.on { background: var(--accent); color: var(--accent-ink); }
button.ordered:disabled { opacity: .8; }
.reward { border: 1px dashed var(--accent); border-radius: var(--r-m); padding: 12px; text-align: center; }
/* «Конец»: lettered like the last line of a book, under a moon among twinkling stars. In the scroll it comes after the
   last beat, filling most of the screen, with the question and the rest below it. */
.end-cards { display: flex; flex-direction: column; gap: 10px; }
.guest-card { display: flex; flex-direction: column; gap: 10px; }
.guest-card p { margin: 0; color: var(--ink-soft); text-align: center; font-size: 13px; }
.the-end {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8px;
  position: relative; isolation: isolate;
}
/* The poster, faint behind the lettering and gone before any of its edges: the ellipse touches the box's sides. */
.end-art {
  position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; pointer-events: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 35%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 35%, transparent 100%);
}
img.end-art.fade-in.loaded { opacity: .2; }
:root[data-theme=evening] img.end-art.fade-in.loaded { opacity: .3; }
.end-sky { position: relative; width: 230px; height: 86px; color: var(--glow); }
.end-sky .icon { margin: 0; }
.end-moon { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); }
.end-star { position: absolute; animation: twinkle 3.2s ease-in-out infinite; }
.end-star.s1 { left: 22px; top: 44px; animation-delay: -.4s; }
.end-star.s2 { left: 64px; top: 6px; animation-delay: -1.3s; }
.end-star.s3 { right: 58px; top: 2px; animation-delay: -2.1s; }
.end-star.s4 { right: 16px; top: 50px; animation-delay: -.9s; }
.end-star.s5 { right: 84px; top: 64px; animation-delay: -2.6s; }
.end-word { font: italic 400 66px/1 var(--story-font); letter-spacing: .02em; margin-top: 6px; }
.end-sub { font: italic 20px/1.2 var(--story-font); color: var(--ink-soft); margin: 6px 0 0; }
.end-name { font: 700 22px/1.25 var(--story-font); margin: 4px 0 0; max-width: 24ch; text-wrap: balance; }
.end-flourish { display: flex; align-items: center; gap: 10px; width: min(220px, 70%); margin-top: 14px; color: var(--glow); }
.end-flourish .icon { margin: 0; }
.end-flourish span { flex: 1; height: 1px; background: linear-gradient(to right, transparent, var(--glow)); }
.end-flourish span:last-child { background: linear-gradient(to left, transparent, var(--glow)); }
.end-hook { font: 18px/1.4 var(--story-font); margin: 12px 0 0; max-width: 30ch; }
/* A relative's gift or book says who made it, as a book's dedication does. */
.end-sign { font: italic 18px/1.3 var(--story-font); color: var(--ink-soft); margin: 10px 0 0; }
.title-sign { flex: none; margin: 0; text-align: center; font: italic 18px/1.3 var(--story-font); color: var(--ink-soft); }
.more-card h2 { text-align: center; }
.more-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.more-answers[hidden], .more-done[hidden] { display: none; }
/* One centred column, as the title above it is: the status icon over its line, the line balanced so a wrapped one stays
   centred under the icon. (It was a row, icon then text: a line that wrapped filled the row's width and the icon was left alone at the edge.) */
.more-done { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; font: 18px/1.3 var(--story-font); text-align: center; }
.more-done .icon { margin: 0; }
.more-done span { max-width: 26ch; text-wrap: balance; overflow-wrap: anywhere; }
.more-card .link { align-self: center; text-align: center; }
.more-card [hidden] { display: none; }
.series-box:empty { display: none; }
.series { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.series-label { margin: 0; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); text-align: center; }
/* Sideways, one finger; the row never widens the page. */
.series-list { position: relative; display: flex; justify-content: safe center; gap: 10px; margin: 0; padding: 4px 2px 6px; list-style: none; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; }
.ep { flex: none; width: 64px; scroll-snap-align: center; }
.ep-link { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink); text-decoration: none; border-radius: var(--r-m); }
.ep-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ep-pic { position: relative; display: block; width: 64px; aspect-ratio: 3 / 4; }
.ep-cover { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-m); background: var(--cover-bg); box-sizing: border-box; border: 2px solid transparent; }
.here .ep-cover { border-color: var(--accent); }
.ep-blank { display: flex; align-items: center; justify-content: center; border: 1.5px dashed var(--ink-soft); background: transparent; }
.ep-big { font: 700 22px/1 var(--story-font); color: var(--ink-soft); }
.ep-num { position: absolute; left: 4px; bottom: 4px; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; background: rgba(20, 16, 40, .78); color: #fff; font: 700 12px/20px var(--ui-font); text-align: center; }
.here .ep-num { background: var(--accent); color: var(--accent-ink); }
/* The state word wraps inside its cell when a language makes it wider than the cover («en marcha»), never past it. */
.ep-state { align-self: stretch; min-width: 0; min-height: 14px; font-size: 12px; line-height: 14px; color: var(--ink-soft); text-align: center; overflow-wrap: anywhere; }
a.ep-link:hover .ep-cover { filter: brightness(1.06); }
/* «Почитать ещё»: the series row's cells, a little wider so a title fits under the cover in two lines. */
.also-card[hidden] { display: none; }
.also .ep, .also .ep-pic { width: 84px; }
.also-title { display: block; min-height: 28px; max-height: 28px; color: var(--ink); overflow: hidden; overflow-wrap: anywhere; word-break: break-word; hyphens: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }

.error { color: var(--danger); font-size: 14px; }
.danger { color: var(--danger); }
/* «Удалить навсегда»: the one filled red button of the app. */
.btn-danger { background: var(--danger); color: var(--danger-ink); border-color: var(--danger); }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 16px); background: var(--ink); color: var(--bg); border-radius: var(--r-m); padding: 12px 14px; text-align: center; }

/* dictation */
.dictate { margin-top: 8px; }
.dictate .mic { width: auto; }
.dictate .mic.recording { background: var(--danger); color: var(--danger-ink); border-color: var(--danger); animation: pulse 1.2s ease-in-out infinite; }
.dictate .muted:empty { display: none; }
/* Live dictation: the words being said, greyed until the phrase is done and goes into the field. */
.dictate-live { margin: 8px 0 0; font-size: 16px; line-height: 1.4; }
.dictate-live .interim { color: var(--ink-soft); }
.dictate-live .interim:empty::before { content: '…'; }
.relative .dictate-live { font-size: 19px; }
.mic-help ol { padding-left: 20px; margin: 8px 0; }
.mic-help li { margin: 4px 0; }
@keyframes pulse { 50% { opacity: .7; } }

/* The operator's voice lab (screens/lab.js): one card per engine, side by side where the screen is wide enough. */
.lab-group { margin: 16px 0 8px; font-size: 15px; }
.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.lab-grid .card { margin: 0; }
.lab-engine h3 { margin: 0; font-size: 17px; }
.lab-engine button, [data-testid=lab-record], [data-testid=lab-run-all] { width: auto; }
[data-testid=lab-record].recording { background: var(--danger); color: var(--danger-ink); border-color: var(--danger); animation: pulse 1.2s ease-in-out infinite; }
.lab-recording audio { width: 100%; margin-top: 4px; }
.lab-text { margin: 0; font: 17px/1.4 var(--story-font); overflow-wrap: anywhere; }
.lab-error { margin: 0; color: var(--danger); }
.lab-result:empty, [data-testid=lab-status]:empty { display: none; }

/* top bar and the side menu */
/* Sticky, so the menu is in reach on long screens; painted in the page colour under the status bar too (the top of the
   evening gradient is that colour), and it fades into the page below instead of ending in an edge. */
#bar {
  position: sticky; top: 0; z-index: 10;
  max-width: 520px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) 16px 0;
  display: flex; align-items: center; gap: 12px; min-height: calc(env(safe-area-inset-top) + 52px);
  background-color: var(--bg);
}
#bar::after {
  content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 12px; pointer-events: none;
  background-image: linear-gradient(var(--bg), transparent);
}
[tabindex="-1"]:focus { outline: none; }
/* The fade lies over this top padding, so it only ever softens what scrolls under the bar. */
#bar:not([hidden]) + #app { padding-top: 12px; min-height: calc(100dvh - env(safe-area-inset-top) - 52px); }
.icon-btn {
  width: 44px; height: 44px; padding: 0; flex: none; border-radius: 50%;
  background: var(--soft); color: var(--ink);
}
.bar-hello { color: var(--ink-soft); font-size: 15px; display: flex; align-items: center; }
.bar-title { font-size: 22px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-extra { display: flex; align-items: center; min-width: 0; }
/* One line while it fits (ru at 390 px); with longer words (the streak chip) it wraps in its own corner instead of pushing the page sideways. */
.bar-extra p { white-space: normal; text-wrap: balance; text-align: end; line-height: 1.2; overflow-wrap: anywhere; }
/* The menu lies under the page; opening pins the page (it keeps its own scroll) and slides it aside, full height
   (no scaling, so no band of the menu shows above or below it), with a shadow on its left edge.
   Everything is fixed to the viewport edges, so no strip of anything shows whatever Safari's toolbars do. */
:root { --menu-w: min(78vw, 340px); }
/* A whole pixel: at a fraction the page's edge shows a hairline of its own pictures beside the menu. */
@supports (width: round(down, 10.5px, 1px)) { :root { --menu-w: round(down, min(78vw, 340px), 1px); } }
html.menu-open, html.menu-open body { overflow: hidden; }
html.menu-open body::before { background-image: linear-gradient(var(--soft), var(--soft)), var(--bg-layer); }
html.menu-open #page {
  position: fixed; inset: 0; z-index: 2; overflow: hidden;
  background-color: var(--bg); background-image: var(--bg-image);
  transition: transform .32s cubic-bezier(.3,.7,.2,1), box-shadow .32s;
}
html.menu-shown #page { transform: translateX(var(--menu-w)); box-shadow: -10px 0 40px var(--scrim); }
html.menu-open #page.dragging { transition: none; }
.drawer {
  position: fixed; inset: 0; z-index: 1; min-height: 100dvh;
  background-color: var(--bg); background-image: linear-gradient(var(--soft), var(--soft)), var(--bg-image); color: var(--ink);
  padding: calc(env(safe-area-inset-top) + 18px) calc(100% - var(--menu-w) + 16px) calc(env(safe-area-inset-bottom) + 18px) 14px;
  display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
}
.menu-edge {
  position: fixed; top: 0; bottom: 0; left: var(--menu-w); right: 0; z-index: 3; width: auto;
  padding: 0; border-radius: 0; background: transparent;
}
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 0 4px 6px; }
.drawer-face {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font: 700 19px var(--ui-font);
}
.drawer-face .icon { margin: 0; }
.drawer-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.drawer-who strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-head .icon-btn { background: transparent; color: var(--ink-soft); }
.menu-section { display: flex; flex-direction: column; gap: 2px; }
.menu-heading {
  margin: 20px 10px 6px; font: 600 12px var(--ui-font); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft);
}
/* One look for every row of the menu, whatever element it is (a link, a button, a plain line). A <button> would otherwise take
   the app's own button (a filled accent, centred); stating the plain row here, once, keeps every item a quiet left-aligned row. */
.menu-item {
  display: flex; align-items: center; justify-content: flex-start; gap: 14px; width: 100%; padding: 12px 10px; border-radius: 12px;
  background: transparent; color: var(--ink); font: 500 16px var(--ui-font); text-align: left; text-decoration: none; box-shadow: none; cursor: pointer;
}
.menu-item .icon { margin: 0; color: var(--ink-soft); }
.menu-item[aria-current=page] { background: var(--card); font-weight: 600; }
.menu-item[aria-current=page] .icon { color: var(--accent); }
.menu-check { margin-left: auto; display: flex; }
/* «Новое от родных»: the count beside the menu item and, small, on the menu button. */
.menu-count { margin-left: auto; min-width: 26px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 700 14px/1.4 var(--ui-font); text-align: center; }
.menu-count + .menu-check { margin-left: 8px; }
#bar .icon-btn { position: relative; }
.menu-badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font: 700 11px/18px var(--ui-font); text-align: center; pointer-events: none;
}
/* The settings rows (the language, the theme) and «Выйти» are one more group of the list: set off by a hairline, the rows with
   the same 2px rhythm as the items above. The documents close the panel at its bottom. */
.menu-prefs { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--line); }
.menu-signout-section:empty { display: none; }

/* «Все сказки»: a poster wall */
.poster-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.poster-card {
  position: relative; display: block; aspect-ratio: 2 / 3; border-radius: var(--r-m); overflow: hidden;
  background: var(--cover-bg); color: inherit; text-decoration: none;
}
.poster-img { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; }
.poster-img.comic { object-position: top; }
/* Without a poster the title is lettered over the first page, on a shade so it reads on any picture. */
.no-poster::after { content: ''; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, var(--picture-shade)); }
.poster-title {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 1;
  font: 700 18px/1.15 var(--story-font); color: var(--on-picture); text-shadow: 0 1px 4px var(--picture-shade);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.no-poster .poster-title { bottom: 36px; }
.card.center > .icon { align-self: center; color: var(--ink-soft); margin: 0; }
/* The finished pictures to long-press and save: full width, one under another, the phone's own image menu on hold. */
.share-gallery { display: flex; flex-direction: column; gap: 12px; }
[data-testid=share-link-box] textarea { min-height: 0; resize: none; }
.share-gallery img { width: 100%; height: auto; display: block; border-radius: var(--r-m); -webkit-touch-callout: default; user-select: auto; -webkit-user-select: auto; }

/* Bottom sheet: add a hero, a genre or a mood without leaving the new-story screen. */
html.sheet-open, html.sheet-open body { overflow: hidden; }
.sheet-shade { position: fixed; inset: 0; z-index: 20; background: var(--scrim); opacity: 0; transition: opacity .26s; }
.sheet-shade.shown { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 520px; margin: 0 auto;
  max-height: calc(100dvh - env(safe-area-inset-top) - 24px); overflow-y: auto; overscroll-behavior: contain;
  background-color: var(--bg); background-image: linear-gradient(var(--soft), var(--soft));
  border-radius: var(--r-l) 22px 0 0; box-shadow: 0 -8px 30px var(--scrim);
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 18px);
  transform: translateY(100%); transition: transform .26s cubic-bezier(.3,.7,.2,1);
}
.sheet.shown { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 6px; }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sheet-head h2 { flex: 1; }
.sheet-head .icon-btn { width: 44px; height: 44px; background: transparent; color: var(--ink-soft); }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }
.sheet-body .spacer, .sheet-body .error:empty { display: none; }
.counted { display: flex; flex-direction: column; }
.count { align-self: flex-end; font-size: 12px; color: var(--ink-soft); margin-top: 3px; font-variant-numeric: tabular-nums; }
.note { margin-top: 6px; }
.check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 16px; margin: 0; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* Motion between screens: the next screen is swapped in whole (app.js route), crossfading; never an empty frame. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
/* Without view transitions the old screen is pinned where it stood and fades out over the new one. */
#app.leaving { position: fixed; left: 0; right: 0; z-index: 5; pointer-events: none; animation: leave .15s ease-out forwards; }
@keyframes leave { to { opacity: 0; } }
/* The first-paint loader (index.html) fading out over the first screen (app.js swap). */
.boot.gone { animation: leave .25s ease forwards; pointer-events: none; z-index: 40; }
/* A screen still loading after a moment: a thin line along the top, so the tap is seen to have worked. */
body::after {
  content: ''; position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 30; pointer-events: none;
  background: var(--accent); border-radius: 0 2px 2px 0; opacity: 0;
}
html.routing body::after { opacity: .9; width: 70%; transition: width 2.4s cubic-bezier(.1,.6,.2,1), opacity .2s; }
/* Pictures: their place is kept before they arrive (aspect-ratio above), and they fade in once there. */
img.fade-in { opacity: 0; transition: opacity .25s ease; }
img.fade-in.loaded { opacity: 1; }
/* Until it is there, its place is a starry backdrop with an open book and a slow gleam, not a bare gradient. Painted
   under the picture, so a slow network shows it and a cached picture covers it at once; gone once the picture is in. */
.story-card { position: relative; }
.hero-slide, .story-card, .poster-card { isolation: isolate; }
:is(.hero-slide, .story-card, .poster-card)::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-opacity='.7' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 7v14'/%3E%3Cpath d='M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z'/%3E%3C/svg%3E"),
    linear-gradient(105deg, transparent 40%, rgba(255,255,255,.3) 50%, transparent 60%),
    radial-gradient(circle at 20% 25%, rgba(255,255,255,.6) 0 1.2px, transparent 2px),
    radial-gradient(circle at 72% 58%, rgba(255,255,255,.45) 0 1px, transparent 1.7px),
    radial-gradient(circle at 42% 88%, rgba(255,255,255,.35) 0 .8px, transparent 1.5px);
  background-size: 44px, 250% 100%, 67px 67px, 97px 97px, 131px 131px;
  background-position: center 42%, 100% 0, 0 0, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, repeat, repeat, repeat;
  animation: gleam 2.4s ease-in-out infinite;
}
/* A story still being drawn shows its brush instead; a picture that has arrived (or failed) needs no backdrop. */
:is(.hero-slide, .story-card, .poster-card):is(:has(img.loaded), :has(.blank))::before { content: none; }
@keyframes gleam { 0% { background-position: center 42%, 100% 0, 0 0, 0 0, 0 0; } 70%, 100% { background-position: center 42%, 0% 0, 0 0, 0 0, 0 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  #app.leaving { animation: none; display: none; }
  .pips span.now { animation: none; }
  :is(.hero-slide, .story-card, .poster-card)::before { animation: none; }
  .end-star { animation: none; }
}

/* «Образы» in the person editor. */
.looks { display: flex; flex-direction: column; gap: 12px; }
.look-row { display: flex; align-items: center; gap: 8px; }
.look-text { flex: 1; min-width: 0; }
.look-text p { margin: 2px 0 0; }
.look-form { display: flex; flex-direction: column; gap: 12px; }

/* «Что-то не так с картинкой»: the story's pictures to pick from, then the one picked above the note. */
.fix-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fix-thumb { padding: 0; border: 1px solid var(--line, transparent); border-radius: var(--r-m); overflow: hidden; background: var(--cover-bg); aspect-ratio: 2 / 3; display: flex; align-items: center; justify-content: center; }
.fix-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fix-preview { display: block; max-width: 100%; max-height: 32vh; margin: 0 auto; border-radius: var(--r-m); }

/* «Подробнее о сюжете» on the create screen */
.plot-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.plot-panel summary { cursor: pointer; font-weight: 600; }
.plot-panel[open] summary { margin-bottom: 10px; }
.plot-fields { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.plot-fields[hidden] { display: none; }
/* «Я автор»: a disabled chip says why under its name. */
/* «Я автор»: the scenes, each with its number, its tools and its ideas. */
.scene-list { display: flex; flex-direction: column; gap: 18px; }
.scene { display: flex; flex-direction: column; gap: 6px; }
.scene-head { display: flex; align-items: center; gap: 4px; }
.scene-head label { flex: 1; margin: 0; font-weight: 600; color: var(--ink); }
.scene-head .icon-btn { width: 44px; height: 44px; background: transparent; color: var(--ink-soft); }
/* The sprite has no chevron-up: the down one, turned over. */
.scene-head .up .icon { transform: rotate(180deg); }
.scene-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.scene-tools > .dictate { display: contents; }
.scene-tools > .dictate > :not(button) { flex-basis: 100%; order: 1; }
.scene-tools button { width: auto; }
.scene-options { display: flex; flex-direction: column; gap: 8px; }
.scene-options:empty { display: none; }
.card.scene-option { color: var(--ink); font: 400 15px/1.35 var(--ui-font); text-align: left; justify-content: flex-start; align-items: flex-start; }

/* The draft: each page's words under «Сцена N», then the bar with «Изменить сцены» and «Рисовать». */
.draft-page { display: grid; gap: 8px; margin-bottom: 12px; }
.draft-text { display: grid; gap: 14px; }
.draft-plate { display: grid; gap: 6px; padding-left: 10px; border-left: 3px solid var(--line, rgba(128, 128, 128, 0.35)); }
.draft-plate p { margin: 0; }
.draft-plate p.speech { font-style: italic; }
.draft-page > button { justify-self: start; }
.draft-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.draft-actions > button { width: 100%; }
.draft-bar > .link { display: block; width: auto; margin: 0 auto; }

/* A folded settings row of the menu (the language, the theme): an ordinary menu row (its icon or flag in the icon column) with a
   small chevron at the right that turns up when it is open. */
.fold-toggle .fold-now { flex: 1; min-width: 0; }
.fold-toggle .fold-chevron { flex: none; transition: transform .2s ease; }
.fold-toggle[aria-expanded=true] .fold-chevron { transform: rotate(180deg); }
/* The flag takes the icon column: the icon's 22px wide, its 15px centred in the icon's 22px height, so the row is as tall as the others. */
.menu-item .flag { flex: none; width: 22px; height: 15px; margin-block: 3.5px; }
/* What the row opens: directly under it, indented to the label, growing to its own height (the box is a grid whose one row
   goes from 0 to its content), so only what lies below is pushed down, smoothly. Closed, it is neither focusable nor seen. */
.fold { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .22s ease, visibility 0s .22s; }
.fold[data-open=true] { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .22s ease, visibility 0s; }
.fold > * { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 2px; padding-left: 36px; }
.fold > * > :first-child { margin-top: 2px; }
.menu-prefs > .menu-section { gap: 0; }
@media (prefers-reduced-motion: reduce) { .fold, .fold[data-open=true] { transition: none; } }
.fold .menu-item[aria-current=true], .fold .menu-item[aria-checked=true] { background: var(--card); font-weight: 600; }
.fold .menu-item[aria-current=true] .icon, .fold .menu-item[aria-checked=true] .icon { color: var(--accent); }
.fold .theme-opt:not([aria-checked=true]) .menu-check { display: none; }
/* The menu's chosen row keeps its row look; its mark is the choice scheme's selected pair (accent fill, its ink). */
.fold .menu-item[aria-current=true] .menu-check, .fold .menu-item[aria-checked=true] .menu-check {
  width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center; background: var(--choice-on-bg);
}
.fold .menu-item[aria-current=true] .menu-check .icon, .fold .menu-item[aria-checked=true] .menu-check .icon { width: 14px; height: 14px; color: var(--choice-on-ink); }

/* The story page (#/story/<id>): its cover, title and format, the actions, its versions and its continuations. */
.story-head { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.story-cover { width: min(70%, 300px); aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--r-m); background: var(--cover-bg); display: block; }
.story-head .muted { display: flex; align-items: center; justify-content: center; gap: 2px; }
.story-list { display: flex; flex-direction: column; gap: 10px; }
.card.story-row { flex-direction: row; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.story-row-art { width: 56px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--r-s); flex: none; background: var(--cover-bg); display: block; }
.story-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.story-row-title { font: 700 17px/1.2 var(--story-font); }
.story-row-wish { overflow-wrap: anywhere; }

/* The owner's admin (#/admin; plan 2026-11-26-admin-v1, Task 9): a phone first (390 px wide), in the theme's own tokens by
   day and by night. The tabs are one row of chips that scrolls sideways under the bar; the numbers are two cards a row;
   a wide table scrolls in its own box (.admin-scroll), never the page. */
.admin-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs .chip { flex: none; white-space: nowrap; text-decoration: none; }
.admin-tabs .chip[aria-current=page] { background: var(--accent); color: var(--accent-ink); }
.admin-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
label.admin-all { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; color: var(--ink); font-size: 15px; }
.admin-all input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
.admin-tab { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.admin-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.admin-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.admin-stat-label { font-size: 13px; color: var(--ink-soft); }
.admin-stat-value { font: 700 24px/1.15 var(--ui-font); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.admin-stat .muted { font-size: 13px; overflow-wrap: anywhere; }
/* The bars sit at the card's foot, so the two cards of a row show theirs on one line. */
.admin-strip { display: flex; align-items: flex-end; gap: 6px; margin-top: auto; padding-top: 2px; }
.admin-bars { display: flex; align-items: flex-end; gap: 1px; flex: 1; min-width: 0; height: 28px; border-bottom: 1px solid var(--line); }
.admin-bar { flex: 1; min-width: 0; background: var(--accent); border-radius: 1px 1px 0 0; }
.admin-strip-total { flex: none; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.admin-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 15px; }
.admin-day { margin: 6px 0 2px; font: 600 14px var(--ui-font); color: var(--ink-soft); }
.admin-row { overflow-wrap: anywhere; }
.admin-scroll { overflow-x: auto; max-width: 100%; }
/* The families table and a family's card (Task 10). The table keeps each cell on one line and scrolls sideways in its
   .admin-scroll box; numbers line up right. The card's active days are 90 small squares, 30 to a row, oldest first. */
.admin-table { font-variant-numeric: tabular-nums; }
.admin-table th, .admin-table td { white-space: nowrap; padding: 8px 6px; }
.admin-table th { font-weight: 600; font-size: 13px; color: var(--ink-soft); }
.admin-table .num { text-align: right; }
.admin-table tbody tr { cursor: pointer; }
.admin-table td a { display: inline-block; padding: 4px 1px; }
.admin-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 2px; min-height: 44px; text-decoration: none; }
.admin-back .icon { width: 20px; height: 20px; margin: 0; }
.admin-card-head h2 { margin: 0; }
.admin-card-head p { margin: 2px 0 0; }
.admin-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 0; }
.admin-facts dt { color: var(--ink-soft); }
.admin-facts dd { margin: 0; overflow-wrap: anywhere; }
.admin-cal { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 2px; }
.admin-day-cell { aspect-ratio: 1; border-radius: 2px; background: var(--line); }
.admin-day-cell.on { background: var(--accent); }
/* A console command: one tap selects it whole, to copy into the server's console. */
.admin-code { display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; -webkit-user-select: all; user-select: all; }
/* The funnel, the health, the money and the tools (Task 11). Their tables open nothing, so a row is not a link. The money's
   days are a stacked bar each, a provider a colour in a fixed order: the first four slots of the categorical palette the
   charts follow (the dataviz method's validated set), checked on this theme's day card and evening card for neighbours
   in a stack; the legend's sums beside them name every colour, so colour is never the only key. */
.admin-table.admin-plain tbody tr { cursor: auto; }
.admin-money { --admin-s1: #2a78d6; --admin-s2: #eb6834; --admin-s3: #1baf7a; --admin-s4: #eda100; }
:root[data-theme=evening] .admin-money { --admin-s1: #3987e5; --admin-s2: #d95926; --admin-s3: #199e70; --admin-s4: #c98500; }
.admin-stack { display: flex; align-items: flex-end; gap: 1px; flex: 1; min-width: 0; height: 72px; border-bottom: 1px solid var(--line); }
.admin-stack-day { display: flex; flex-direction: column-reverse; gap: 1px; flex: 1; min-width: 0; }
.admin-seg { flex: 1 1 0; min-height: 1px; }
.admin-stack-day > .admin-seg:last-child { border-radius: 2px 2px 0 0; }
.admin-s1 { background: var(--admin-s1); }
.admin-s2 { background: var(--admin-s2); }
.admin-s3 { background: var(--admin-s3); }
.admin-s4 { background: var(--admin-s4); }
.admin-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; font-size: 14px; font-variant-numeric: tabular-nums; }
.admin-legend li { display: inline-flex; align-items: center; gap: 6px; }
.admin-swatch { flex: none; width: 10px; height: 10px; border-radius: 2px; }
.admin-links { display: flex; flex-wrap: wrap; gap: 8px; }
/* A line of a list may hold a model's id or an error code, one long word: it breaks rather than widen the page. */
.admin-list li { overflow-wrap: anywhere; }
