/* Токены вида — из bodyglow-design.html (коричневые акценты, Lora + Manrope); 28.10: стекло и жемчужный фон */
@font-face { font-family: "Lora"; font-weight: 500 600; font-display: swap; src: url(../fonts/lora-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Lora"; font-weight: 500 600; font-display: swap; src: url(../fonts/lora-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-weight: 400 700; font-display: swap; src: url(../fonts/manrope-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-weight: 400 700; font-display: swap; src: url(../fonts/manrope-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #fbf9f6; --surface: #efe6dc; --fg: #2e231c; --muted: #76665a; --accent: #7a4e33; --line: #ded1c4;
  --on-accent: #fbf7f3; --danger: #a3402c; --ok: #4f6b3c; --warn: #8a5a00;
  --display: "Lora", Georgia, serif; --body: "Manrope", system-ui, -apple-system, sans-serif;
  --r: 12px; --r-lg: 18px; --tap: 44px; --gap: 16px;
  /* безопасные зоны: в полноэкранном Mini App Telegram отдаёт статус-бар (safe area) и свои кнопки «Закрыть»/«⋯»
     (content safe area) переменными --tg-*; в браузере и старых клиентах их нет — остаётся env() */
  --safe-t: calc(max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px))
    + var(--tg-content-safe-area-inset-top, 0px));
  --safe-b: calc(max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px))
    + var(--tg-content-safe-area-inset-bottom, 0px));
  /* жемчуг: светлый крем → холодный перламутр → тёплый беж; founder 29.10: белее и свежее, без розового (было
     #f5efe9 с пятном #f7e5e2) */
  --pearl: radial-gradient(120% 70% at 0% 0%, #fffcf7 0%, transparent 60%),
    radial-gradient(90% 60% at 100% 35%, #edf0f6 0%, transparent 65%),
    radial-gradient(110% 70% at 20% 100%, #f5f0e8 0%, transparent 60%), #f9f7f3;
  /* стекло: полупрозрачная заливка, блик по верхнему краю, мягкая тень */
  --glass: linear-gradient(180deg, rgb(255 255 255 / .72), rgb(255 255 255 / .5));
  --glass-flat: rgb(255 255 255 / .55);
  --glass-edge: rgb(255 255 255 / .9);
  --glass-line: rgb(122 78 51 / .1);
  --glass-shadow: 0 1px 2px rgb(46 35 28 / .05), 0 10px 28px -12px rgb(46 35 28 / .18);
  --gloss: linear-gradient(180deg, #96664a 0%, #7a4e33 55%, #6c432b 100%);
  --gloss-shadow: inset 0 1px 0 rgb(255 255 255 / .3), inset 0 -1px 0 rgb(0 0 0 / .12), 0 8px 18px -8px rgb(92 55 33 / .55);
  /* лак (founder 29.10, как капсулы «Монтажа» TrueGenFlow): светлая заливка, перламутровая кромка, мягкая тень */
  --lac: linear-gradient(180deg, #fffdfa, #f5ede4) padding-box,
    linear-gradient(125deg, rgb(255 255 255 / .95), rgb(122 78 51 / .1) 40%, rgb(122 78 51 / .06) 62%, rgb(201 160 130 / .4)) border-box;
  --lac-shadow: 0 1px 1px rgb(46 35 28 / .06), 0 8px 18px -10px rgb(92 55 33 / .45);
  /* круглая кнопка на фоне экрана (founder 30.10: «сливаются»): та же лаковая заливка, но кромка и тень касания видны —
     у --lac кромка 6–10 % и тень только снизу, на фоне #fbf9f6 круга не видно */
  --lac-btn: linear-gradient(180deg, #fffdfa, #f3e9de) padding-box,
    linear-gradient(160deg, rgb(255 255 255 / .95), rgb(122 78 51 / .22) 55%, rgb(122 78 51 / .3)) border-box;
  --lac-float: 0 1px 2px rgb(46 35 28 / .12), 0 6px 14px -6px rgb(92 55 33 / .35);
  --track: rgb(122 78 51 / .07); --track-edge: rgb(122 78 51 / .06); --track-inset: inset 0 1px 2px rgb(46 35 28 / .08);
}
:root[data-theme="dark"] {
  --bg: #1d1814; --surface: #28211b; --fg: #efe5da; --muted: #b3a294; --accent: #d4a27f; --line: #3a3029;
  --on-accent: #1d1814; --warn: #e0b25c; color-scheme: dark;
  --pearl: radial-gradient(120% 70% at 0% 0%, #2a211b 0%, transparent 60%),
    radial-gradient(90% 60% at 100% 35%, #1f1f25 0%, transparent 65%),
    radial-gradient(110% 70% at 20% 100%, #2a1d1d 0%, transparent 60%), #1a1613;
  --glass: linear-gradient(180deg, rgb(255 255 255 / .09), rgb(255 255 255 / .05));
  --glass-flat: rgb(255 255 255 / .07);
  --glass-edge: rgb(255 255 255 / .14);
  --glass-line: rgb(255 255 255 / .06);
  --glass-shadow: 0 10px 28px -12px rgb(0 0 0 / .6);
  --gloss: linear-gradient(180deg, #e2b694 0%, #d4a27f 55%, #c4906c 100%);
  --gloss-shadow: inset 0 1px 0 rgb(255 255 255 / .35), inset 0 -1px 0 rgb(0 0 0 / .15), 0 8px 18px -8px rgb(0 0 0 / .7);
  --lac: linear-gradient(180deg, #342a22, #261f19) padding-box,
    linear-gradient(125deg, rgb(255 238 220 / .4), rgb(255 255 255 / .05) 45%, rgb(230 198 170 / .25)) border-box;
  --lac-shadow: 0 8px 18px -10px rgb(0 0 0 / .7);
  --lac-btn: linear-gradient(180deg, #3a2f26, #29211b) padding-box,
    linear-gradient(160deg, rgb(255 238 220 / .35), rgb(255 255 255 / .08) 50%, rgb(230 198 170 / .3)) border-box;
  --lac-float: 0 1px 2px rgb(0 0 0 / .5), 0 6px 14px -6px rgb(0 0 0 / .7);
  --track: rgb(255 255 255 / .05); --track-edge: rgb(255 255 255 / .06); --track-inset: inset 0 1px 2px rgb(0 0 0 / .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
/* display у .card, .row, .dock перебивает display:none браузера — скрытое и закрытый диалог иначе видны */
[hidden], dialog:not([open]) { display: none !important; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
/* жемчужный фон — отдельным неподвижным слоем: background-attachment: fixed на iOS не работает */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--pearl); pointer-events: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; text-wrap: balance; }
h1 { font-size: 1.9rem; line-height: 1.15; }
h2 { font-size: 1.35rem; line-height: 1.2; }
h3 { font-size: 1.05rem; line-height: 1.3; }
p { margin: 0; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }

#screen {
  padding: calc(20px + var(--safe-t)) max(16px, env(safe-area-inset-left)) calc(96px + var(--safe-b)) max(16px, env(safe-area-inset-right));
  display: flex; flex-direction: column; gap: 20px; max-width: 640px; margin: 0 auto;
}
.meta { color: var(--muted); font-size: .9rem; }
.label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
/* стекло без backdrop-filter: под карточкой плавный фон, а размытие десятков слоёв тормозит слабые телефоны */
.card { background: var(--glass); border: 1px solid var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
  border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.card.row { flex-direction: row; }
.row > .grow { display: flex; flex-direction: column; gap: 2px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }

.btn {
  min-height: var(--tap); border-radius: var(--r); padding: 0 18px; border: 1px solid var(--line);
  background: transparent; color: var(--fg); font: 600 1rem var(--body); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
/* Иерархия кнопок (задача 141): главная — глянец акцента, одна на экран или блок; обычная — стекло и тёмный текст;
   мягкая — бледный акцент для повторяющихся «+ Добавить»; значок — без рамки и фона (←, ⋯, ✕). Размер (.btn-small)
   важность не задаёт. Выбранное (вкладка, чип) — тёмным, не акцентом: акцент остаётся за действием. */
.btn { background: var(--glass-flat); border-color: var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-edge); }
.btn-primary { background: var(--gloss); color: var(--on-accent); border-color: transparent; box-shadow: var(--gloss-shadow);
  text-shadow: 0 1px 0 rgb(0 0 0 / .12); width: 100%; }
.btn-tint { background: color-mix(in srgb, var(--accent) 11%, transparent); color: var(--accent); border-color: transparent; box-shadow: none; }
.btn-icon { min-width: var(--tap); padding: 0; background: transparent; border-color: transparent; box-shadow: none; color: var(--muted);
  font-size: 1.25rem; }
.btn-icon .ico { width: 22px; height: 22px; }
.btn-primary.btn-small, .row > .btn-primary { width: auto; }
/* отклик на нажатие у всего нажимаемого (founder 28.10): элемент чуть утопает под пальцем */
:where(button, a[href], [role="button"], [role="menuitem"], summary, label.check) {
  transition: transform 100ms ease-out, filter 100ms ease-out;
}
:where(button, a[href], [role="button"], [role="menuitem"], summary, label.check):not(:disabled, [aria-disabled="true"]):active {
  transform: scale(.97);
}
.btn-primary:active { filter: brightness(.94); }
.btn[disabled] { opacity: .5; }
.dock {
  /* своя подложка: текст, уходящий под кнопку, растворяется, а не просвечивает сквозь неё */
  position: sticky; bottom: 0; z-index: 5;
  margin: 0 calc(-1 * max(16px, env(safe-area-inset-left)));
  padding: 24px max(16px, env(safe-area-inset-left)) calc(12px + var(--safe-b));
  /* матовое стекло, как у меню; края растворяются — на градиентном фоне страницы нет шва */
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 24px);
  mask-image: linear-gradient(to bottom, transparent, #000 24px);
}
/* у участницы снизу меню (--tabs-h над safe-area): панель стоит над ним */
:root { --tabs-h: 63px; }
body:has(#tabs:not([hidden])) .dock { bottom: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: 12px; }

/* founder 29.10 (вариант Б): меню прибито к нижнему краю, как у Telegram и iOS — матовое стекло во всю ширину уходит
   под полоску «домой», страница идёт под ним; выбранный раздел — лаковая плашка со значком и подписью */
.tabs {
  position: fixed; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(5, 1fr); z-index: 10;
  padding: 5px max(8px, env(safe-area-inset-right)) calc(5px + var(--safe-b)) max(8px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 72%, transparent); -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%); border-top: 1px solid var(--glass-edge);
  box-shadow: 0 -10px 28px -20px rgb(46 35 28 / .35);
}
.tabs a {
  position: relative; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; border-radius: 16px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600;
  transition: color .2s ease, background .25s ease, box-shadow .25s ease;
}
.tabs a:active { transform: none; }
/* нажатие у самого края экрана (под вкладкой, над полоской «домой») — тоже по вкладке */
.tabs a::after { content: ""; position: absolute; inset: 100% 0 auto; height: calc(5px + var(--safe-b)); }
.tabs svg { width: 22px; height: 22px; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.tabs a:active svg { transform: scale(.92); transition-duration: .1s; }
.tabs a[aria-current="page"] { background: var(--lac); box-shadow: var(--lac-shadow); color: var(--fg); font-weight: 700; }
.tabs a[aria-current="page"] svg { stroke-width: 2.1; color: var(--accent); }

.fatal { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 12px; }
.skeleton { background: var(--glass-flat); border-radius: var(--r-lg); min-height: 120px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  /* нажатие без движения: элемент чуть темнеет */
  :where(button, a[href], [role="button"], [role="menuitem"], summary, label.check):not(:disabled, [aria-disabled="true"]):active {
    transform: none; filter: brightness(.94);
  }
  /* без движения: иконка не сжимается */
  .tabs svg, .tabs a:active svg, .tabs a[aria-current="page"] svg { transform: none; transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .tabs, .dock { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .card { background: var(--surface); }
}
.screen-box { display: contents; }
