/* Shanyrak v8 — app layer. Loaded AFTER css/shanyrak.css (the untouched handoff drop-in).
   Only what the real app needs on top of the handoff: states, skeletons, a destructive button,
   sheet/list details that the prototype hard-coded inline, and page-specific bits shared by 2+ pages. */

/* ── destructive (confirm sheets only) ── */
.btn--danger{color:var(--error);border-color:rgba(126,46,29,.35);background:var(--page)}
.btn--danger:hover{border-color:var(--error);color:var(--error)}

/* ── sheets: rows rendered as <button class="sheet-item"> ── */
.sheet-item{cursor:pointer;font:inherit;font-size:18px}
.sheet-item>span:not(.sheet-ico):not(.ring):not(.chev){flex:1;min-width:0}
.sheet-item .ring{flex:none}
.sheet-body{display:block}
/* review r1: the page behind an open sheet stays put (book-ui.js lockPage/unlockPage); the sheet's own scroll never
   chains to the page */
html.sheet-lock{overflow:hidden}
html.sheet-lock body{position:fixed;left:0;right:0;width:100%;padding-right:var(--sheet-sb,0px)}
.sheet{overscroll-behavior:contain}

/* ── loading (README §6 States): skeleton in the shape of the content, visible only after 300 ms ── */
.skel-wait{animation:skelShow 1ms linear 300ms both}
@keyframes skelShow{from{visibility:hidden;opacity:0}to{visibility:visible;opacity:1}}
.skel{display:flex;flex-direction:column;gap:14px;padding:6px 0}
.skel-line{height:18px;border-radius:9px;background:linear-gradient(90deg,var(--sand) 0,#F4ECDC 40%,var(--sand) 80%) 0 0/200% 100%;animation:skelShine 1.6s linear infinite}
.skel-block{border-radius:var(--r-xl);background:linear-gradient(90deg,var(--sand) 0,#F4ECDC 40%,var(--sand) 80%) 0 0/200% 100%;animation:skelShine 1.6s linear infinite}
.skel-ring{border-radius:50%;border:8px solid var(--sand);flex:none}
@keyframes skelShine{to{background-position:-200% 0}}

/* review r1: page titles filled after the data keep their line from the first paint (no vertical jump either) */
.hm-kicker:empty::before,.hm-hello:empty::before,.me10-h1:empty::before,.tr-h:empty::before,.tr-sub:empty::before,.fm10-h1:empty::before,.fm10-sub:empty::before{content:"\a0"}

/* ── error / empty / offline: what happened · what is safe · one way out ── */
.state-card{display:flex;flex-direction:column;align-items:flex-start;gap:12px;padding:22px 20px;border-radius:var(--r-lg);background:var(--page);border:1px solid var(--line)}
.state-card .state-ico{width:48px;height:48px;border-radius:50%;display:grid;place-items:center;background:var(--ochre-soft);color:var(--ochre-ink)}
.state-card--center{align-items:center;text-align:center}
.offline-bar{position:sticky;top:calc(var(--appbar) + 8px + env(safe-area-inset-top));z-index:9;display:flex;align-items:center;gap:10px;margin:10px auto;padding:10px 16px;border-radius:16px;width:max-content;max-width:calc(100% - 32px);background:var(--ochre-soft);color:var(--ochre-ink);border:1px solid rgba(156,107,31,.3);font-weight:700;font-size:15px;line-height:1.3;box-shadow:var(--sh-card)}
body:not(.has-tabbar) .offline-bar{top:calc(8px + env(safe-area-inset-top))}
@media (min-width:1000px){body.has-side .offline-bar{top:8px}}
.page-record .offline-bar{position:static;width:auto;max-width:none;box-shadow:none;margin:0 0 14px}

/* ── misc shared ── */
.link-strong{font-weight:700;min-height:44px;display:inline-flex;align-items:center;text-decoration:none}
.chev{color:var(--ink-4);flex:none}
.row-btn{width:100%;background:none;border:0;border-bottom:1px solid rgba(36,27,18,.08);text-align:left;font:inherit;cursor:pointer}
.row-btn:last-child{border-bottom:0}
.muted{color:var(--ink-3)}
.center{text-align:center}
.mt-0{margin-top:0}
.pending-pill{display:inline-flex;align-items:center;gap:8px;min-height:36px;padding:4px 14px;border-radius:999px;background:var(--ochre-soft);color:var(--ochre-ink);font-weight:700;font-size:15px;text-decoration:none}
.pending-pill .dot{animation:blink 1.6s steps(2) infinite}
.fact-grid{display:grid;gap:10px}
.photo-img img{width:100%;height:100%;object-fit:cover;display:block;border-radius:2px}
.cam video{width:100%;height:100%;object-fit:cover;transform:scaleX(-1)}
.cam .cam-hint{display:flex;flex-direction:column;align-items:center;gap:10px;padding:20px;text-align:center}
.lang-switch{display:inline-grid;grid-auto-flow:column;gap:4px;background:var(--sand);border-radius:14px;padding:4px}
.lang-switch button{min-width:56px;min-height:48px;border:0;border-radius:10px;background:none;font-weight:700;color:var(--ink-2)}
.lang-switch [aria-pressed="true"]{background:var(--page);color:var(--ink);box-shadow:0 1px 3px rgba(36,27,18,.15)}
.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
/* grid items default to min-width:auto, so a horizontally scrolling child (the whose-book strip) would widen the column */
.cols>*,.stack>*{min-width:0}
/* desktop: the whose-book strip sits in a grid column, so it must not bleed into the gap */
@media (min-width:960px){.who-strip{margin:0;padding:4px 2px 10px}}

/* player that couldn't load its voice: ochre, never red (README §6 States) */
.player.is-error{border-color:rgba(156,107,31,.4)}
.player.is-error .player-btn{background:var(--ochre-soft);color:var(--ochre)}
.player.is-error .player-label{color:var(--ink)}

/* README §9 «no text below 16 px except captions (15), tab labels and print micro text (13)»: a few handoff
   components were drawn at 13–14 px — lifted to the caption size here, the drop-in file stays untouched */
.who-flag,.pill,.tnode-sub,.tnode .you,.news-when{font-size:15px}
.cover-toc button{min-height:48px}
.tnode .you{height:auto;min-height:22px;top:-12px}
/* tap targets (§9: controls ≥ 48, inline text links ≥ 44 high) */
.appbar-end .btn--quiet{min-width:48px}
.row .row-main .cap a{display:inline-flex;align-items:center;min-height:48px}
/* inline name links in headings and relation lines: a 44 px hit area without moving the text */
.hero-rel a,.h3>a{padding-block:12px}
/* the handoff's .hero-in padding shorthand wipes .wrap's side gutter (also in the handoff) — restore it */
.wrap.hero-in{padding-inline:var(--page-x)}

/* ── taste pass (2026-09-29): the paper feels like paper, every tap answers, the shelf settles once ── */
/* paper grain: a static tile on the desk only (cards/pages stay clean), no fixed layer, no repaint on scroll */
body:not(.rd):not(.page-print):not(.wl){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .33 0 0 0 0 .24 0 0 0 0 .14 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")}
html{-webkit-tap-highlight-color:rgba(43,40,35,.08)}
/* tactile rows: lists and question rows answer a press, not only buttons */
a.row,.row-btn,.bk-q,.bk-toc-row,.bk-acc-head{transition:background-color var(--d-fast,150ms) var(--ease-press,ease)}
a.row:active,.row-btn:active,.bk-q:active,.bk-toc-row:active,.bk-acc-head:active{background:rgba(43,40,35,.06)}
.chip,.hm-chip{transition:transform var(--d-fast,150ms) var(--ease-press,ease)}
.chip:active,.hm-chip:active{transform:scale(.97)}
/* first Дом visit of a session: the books settle onto the shelf, left to right */
@media (prefers-reduced-motion:no-preference){
  .hm-shelf.arrive .hm-book{animation:shelfIn 420ms var(--ease-out,ease) both;animation-delay:calc(min(var(--n,0),11) * 45ms)}
}
/* review r1: held until the splash is gone and the shelf is on screen (index.html armArrive) */
.hm-shelf.arrive.hold .hm-book{animation-play-state:paused}
@keyframes shelfIn{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.chip:active,.hm-chip:active{transform:none}}

/* review r3: phones reserve the brand bar's height until mountChrome draws it (it's inserted after auth) — no jump */
@media (max-width:999px){body.has-tabbar:not(.chrome-on)::before{content:"";display:block;height:calc(var(--appbar) + 1px + env(safe-area-inset-top))}}

/* life profile form (2026-09-30): label above its chips, one row per fact */
.lf-row{padding:12px 0;border-bottom:1px solid var(--line,rgba(36,27,18,.1))}
.lf-row:last-of-type{border-bottom:0}
.lf-k{font:500 17px/1.3 var(--serif);margin:0 0 10px}
.lf-row .chip{font-size:15px;padding:0 16px}
.bk-life-v{font:400 17px/1.4 var(--serif);color:var(--ink-2);margin:4px 0 0}
.bk-life-ask{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;padding:18px 20px;margin-bottom:16px}
.bk-life-ask .bk-p{margin:4px 0 0}

/* «Нашли в рассказах» (2026-09-30): AI-found places waiting for a yes/no, above the map */
.bk-sugg{padding:18px 20px;margin-bottom:16px}
.bk-sugg .bk-p{margin:4px 0 8px}
.bk-sugg-row{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:12px 0;border-top:1px dotted var(--dots)}
.bk-sugg-t{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1 1 220px}
.bk-sugg-t b{font:500 19px/1.3 var(--serif)}
.bk-sugg-m{font-size:15px;color:var(--ink-2)}
.bk-sugg-q{font:italic 400 16px/1.4 var(--serif);color:var(--ink-2)}
.bk-sugg-a{display:flex;gap:8px}
[data-tab][data-count]:not([data-count=""])::after{content:attr(data-count);display:inline-grid;place-items:center;min-width:20px;height:20px;margin-left:6px;padding:0 6px;border-radius:999px;background:var(--ochre,#9C6B1F);color:#fff;font:700 12px/1 var(--sans,sans-serif);vertical-align:2px}
.bk-sugg-a .btn{white-space:nowrap;min-height:44px;padding:0 18px}

/* Bengü Iz brand (handoff_bengu_iz spec 01): symbol-small + the outlined wordmark (Cormorant Garamond italic) */
.brand img.brand-wm{width:auto;height:24px;display:block}
.side .brand img.brand-wm{width:auto;height:28px}

/* ── Bengü Iz chrome (handoff_bengu_iz spec 05 §2–3, §8) ──
   top bar: symbol-small 30 + wordmark 22 · RU | ҚАЗ segmented switch (40 px drawn, 48 px hit) · avatar 40 (48 hit) = «Я».
   Записать = --accent (icon + label) on every screen. The «Я» sheet / me.html share .me-list. No demo banner (§1). */
.appbar-in{gap:10px}
.appbar .brand{gap:8px;flex:none}
.appbar .brand img.brand-sym{width:30px;height:30px}
.appbar .brand img.brand-wm{height:22px}
.appbar-end{margin-left:auto;display:flex;align-items:center;gap:4px}
.lang-sw{position:relative;flex:none;display:flex;height:48px;padding:0 3px}
.lang-sw::before{content:"";position:absolute;inset:4px 0;border-radius:12px;background:var(--linen)}
.lang-sw button{position:relative;z-index:1;min-width:48px;height:48px;padding:0 10px;border:0;background:none;font:700 17px/1 var(--sans);color:var(--ink-3);cursor:pointer}
.lang-sw button::before{content:"";position:absolute;z-index:-1;inset:7px 0;border-radius:9px;transition:background-color var(--d-fast,150ms) var(--ease-press,ease)}
.lang-sw button[aria-pressed="true"]{color:var(--ink)}
.lang-sw button[aria-pressed="true"]::before{background:#fff;box-shadow:0 1px 2px rgba(60,40,20,.22)}
.lang-sw button:not([aria-pressed="true"]):hover{color:var(--ink)}
.lang-sw button:focus-visible{outline-offset:-2px;border-radius:12px}
.me-av{flex:none;width:48px;height:48px;padding:0;border:0;border-radius:50%;background:none;display:grid;place-items:center;cursor:pointer}
.me-av-in{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;font:500 16px/1 var(--serif);letter-spacing:.02em;color:var(--gold-2)}
.side-me .me-av-in{flex:none}
.me-av[aria-current="page"] .me-av-in,.side-me[aria-current="page"] .me-av-in{box-shadow:0 0 0 2px var(--page),0 0 0 4px var(--ochre)}
.me-av:active .me-av-in{transform:scale(.96)}
.tab.tab--rec,.tab.tab--rec[aria-current="page"]{color:var(--accent,#A6322A);font-weight:700}
@media (min-width:1000px){
  .side-lang{padding:18px 6px 0}
  .side-lang .lang-sw{display:inline-flex}
  .side-rule{margin-top:16px}
  .side-item.side-item--rec,.side-item.side-item--rec:hover{color:var(--accent,#A6322A)}
  .side-me{width:100%;border:0;font:inherit;text-align:left;cursor:pointer;min-height:64px}
  .side-me-chev{flex:none;color:var(--ink-3)}
}
/* the «Я» sheet (and me.html): four rows, the logout one in error red, then where the language lives */
.me-list{display:flex;flex-direction:column;margin-top:8px;border-radius:16px;background:var(--page);box-shadow:inset 0 0 0 1px var(--line);overflow:hidden}
.me-row{width:100%;min-height:58px;padding:10px 16px;display:flex;align-items:center;gap:12px;border:0;border-bottom:1px solid var(--line);background:none;text-align:left;font:700 18px/1.25 var(--sans);color:var(--ink);text-decoration:none;cursor:pointer}
.me-row:last-child{border-bottom:0}
.me-row:hover{background:rgba(35,32,28,.03);color:var(--ink)}
.me-row:active{background:rgba(43,40,35,.06)}
.me-row-t{flex:1;min-width:0}
.me-row-m{flex:none;font:400 17px/1.2 var(--sans);color:var(--ink-3)}
.me-chev{flex:none;width:20px;height:20px;color:var(--ink-3)}
.me-row--out,.me-row--out:hover{color:var(--error)}
.me-note{margin:14px 2px 0;font:400 17px/1.4 var(--sans);color:var(--ink-3);text-wrap:pretty}
@media (max-width:379px){.me-row-m{display:none}}
