/* Multimedia Lab — стиль соседей (Audio Lab, в духе iOS): системный шрифт, крупный заголовок, группы. Ниже — свои блоки */
:root {
  --bg: #ffffff; --bg2: #f2f2f7; --card: #ffffff; --text: #000000; --muted: #8a8a8e; --line: #c6c6c8;
  --red: #ff3b30; --blue: #007aff; --green: #34c759; --orange: #ff9500; --fill: #7676801f; --sheet: #f2f2f7; --toast: #ffffff;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000000; --bg2: #1c1c1e; --card: #1c1c1e; --text: #ffffff; --muted: #8d8d93; --line: #38383a;
    --red: #ff453a; --blue: #0a84ff; --green: #30d158; --orange: #ff9f0a; --fill: #7676803d; --sheet: #1c1c1e; --toast: #3a3a3c; }
}
/* manipulation: без зума по двойному тапу; text-size-adjust: iOS не раздувает шрифт (#24) */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--text); height: 100%; overflow: hidden; overscroll-behavior: none; }

body { font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; }
/* оболочка: прокручивается только содержимое — нижняя панель и шапка телефона не ездят при оттяжке */
.app-scroll { position: fixed; inset: 0; bottom: calc(-1 * var(--vgap, 0px)); overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain; }
.app-in { max-width: 720px; margin: 0 auto; padding: calc(var(--safe-t) + 8px) 16px calc(var(--pad-b, var(--safe-b)) + 140px); }
/* главная: шапка (название, папки, поиск) закреплена — прокручивается только список */
body.page-home .app-scroll, body.page-fixed .app-scroll { overflow: hidden; }
body.page-home .app-in, body.page-fixed .app-in { height: 100%; display: flex; flex-direction: column; padding-bottom: 0; box-sizing: border-box; }
body.page-home .listwrap, body.page-fixed .listwrap { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  margin: 0 -16px; padding: 0 16px calc(var(--pad-b, var(--safe-b)) + 140px); }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* навигация: круглые кнопки со значками (как в Telegram) */
.nav .round, .round { width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; border: 0; padding: 0;
  background: var(--fill); color: var(--text); cursor: pointer; }
.round:active, .pill:active { opacity: .6; }
.nav .pill, .pill { border: 0; border-radius: 21px; height: 42px; padding: 0 16px; background: var(--fill); color: var(--text);
  font-size: 16px; font-weight: 500; }
.pill:disabled { opacity: .4; }
.nav-r { display: flex; gap: 8px; align-items: center; }
/* папки — полоса чипов */
.folders { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; margin: 0 -16px; padding-left: 16px; padding-right: 16px;
  scrollbar-width: none; }
.folders::-webkit-scrollbar { display: none; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 16px; padding: 6px 12px;
  background: var(--fill); color: var(--text); font-size: 15px; white-space: nowrap; }
.fchip span { color: var(--muted); font-size: 13px; }
.fchip.on { background: var(--text); color: var(--bg); }
.fchip.on span { color: var(--bg); opacity: .7; }
.fchip.add { color: var(--blue); }
/* выбор записей */
.list a { display: flex; gap: 10px; align-items: center; }
.list .body { flex: 1; min-width: 0; }
.list .tick { display: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none;
  place-items: center; color: transparent; }
body.selecting .list .tick { display: grid; }
body.selecting .list li.sel .tick { background: var(--blue); border-color: var(--blue); color: #fff; }
.selbar { grid-template-columns: 1fr auto auto; gap: 8px; }
.selbar select { border: 0; border-radius: 10px; background: var(--fill); padding: 9px 10px; max-width: 46vw; }
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.nav a, .nav button { background: none; border: 0; color: var(--blue); padding: 8px 0; font-size: 17px; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; font-size: 22px; }
h1.large { font-size: 34px; font-weight: 700; letter-spacing: .3px; margin: 2px 0 10px; }
.search { width: 100%; border: 0; border-radius: 10px; background: var(--fill); padding: 8px 12px 8px 34px;
  margin-bottom: 8px; font-size: 17px; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238a8a8e'%3E%3Ccircle cx='6.5' cy='6.5' r='5.2' stroke='%238a8a8e' stroke-width='1.6' fill='none'/%3E%3Cpath d='M10.4 10.4l4 4' stroke='%238a8a8e' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center; }

/* список записей */
.list { margin: 0; padding: 0; list-style: none; }
.list li { border-bottom: .5px solid var(--line); }
.list a { display: block; padding: 11px 0; color: var(--text); }
.list .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .m { display: flex; justify-content: space-between; color: var(--muted); font-size: 15px; margin-top: 2px; }
.badge { font-size: 12px; padding: 1px 7px; border-radius: 9px; background: var(--fill); color: var(--muted); margin-left: 6px; }
.badge.warn { background: #ff950026; color: var(--orange); }
.badge.err { background: #ff3b3026; color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }

/* нижняя панель с кнопкой записи */
.dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(var(--safe-b) + 14px);
  /* цвет панели = цвет страницы: зона под полоской «домой» (iOS иногда не даёт туда рисовать) не видна как граница */
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: .5px solid var(--line); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; z-index: 5; }
/* iOS на экране «Домой» иногда ставит fixed-низ выше зоны полоски «домой» — фон панели тянем вниз за край */
.dock::after, .sheet::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 160px; background: var(--bg); }
.sheet::after { background: var(--sheet); }
.dock .side { font-size: 13px; color: var(--muted); }
.dock .side.r { text-align: right; }
.rec-btn { width: 74px; height: 74px; border-radius: 50%; border: 4px solid var(--text); background: transparent;
  display: grid; place-items: center; padding: 0; opacity: .95; }
.rec-btn::after { content: ""; width: 60px; height: 60px; border-radius: 50%; background: var(--red); transition: all .25s; }
.rec-btn.on::after { width: 30px; height: 30px; border-radius: 7px; }
.chip.conv.on { background: #0a84ff26; color: var(--blue); }
.who { font-weight: 600; margin-right: 4px; }
.who.s1 { color: #0a84ff; } .who.s2 { color: #ff9500; } .who.s3 { color: #34c759; } .who.s4 { color: #af52de; } .who.s5 { color: #ff2d55; }
.dock .chip { white-space: nowrap; }
.chip { display: inline-block; border: 0; background: var(--fill); border-radius: 14px; padding: 4px 10px; font-size: 13px; color: var(--text); }

/* шторка записи */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--sheet); border-radius: 14px 14px 0 0;
  padding: 10px 20px calc(var(--safe-b) + 18px); transform: translateY(105%); transition: transform .3s ease; z-index: 10;
  box-shadow: 0 -8px 30px #0003; max-width: 720px; margin: 0 auto; }
.sheet.open { transform: none; }
.sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { text-align: center; font-size: 20px; margin: 4px 0 0; }
.sheet .sub { text-align: center; color: var(--muted); font-size: 14px; min-height: 19px; }
.timer { text-align: center; font: 300 48px/1.1 -apple-system, "SF Pro Display", sans-serif; font-variant-numeric: tabular-nums; margin: 14px 0 6px; }
canvas.wave { width: 100%; height: 96px; display: block; }
.sheet .info { text-align: center; color: var(--muted); font-size: 13px; margin: 8px 0 14px; min-height: 36px; }
.sheet .stop { display: grid; place-items: center; }
.backdrop { position: fixed; inset: 0; background: #0006; opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 9; }
.backdrop.open { opacity: 1; pointer-events: auto; }
.blackout { position: fixed; inset: 0; background: #000; z-index: 20; color: #555; display: grid; place-items: center;
  text-align: center; font-size: 15px; }

/* выбор качества */
.picker { margin: 0; padding: 0; list-style: none; background: var(--card); border-radius: 12px; overflow: hidden; }
.picker label { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: .5px solid var(--line); }
.picker li:last-child label { border-bottom: 0; }
.picker input { accent-color: var(--blue); width: 20px; height: 20px; }
.picker .q { flex: 1; }
.picker .q small { display: block; color: var(--muted); font-size: 13px; }

/* карточка записи */
.rtitle { font-size: 24px; font-weight: 700; margin: 2px 0 2px; word-break: break-word; line-height: 1.2; }
.rmeta { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.player { display: flex; align-items: center; gap: 2px; background: var(--card); border-radius: 14px; padding: 6px 8px 6px 4px; margin-bottom: 10px; }
@media (prefers-color-scheme: light) { .player { background: var(--bg2); } }
.player .pb { flex: none; width: 34px; height: 40px; padding: 0; border: 0; background: none; color: var(--text); font-size: 21px; }
.player .play { width: 40px; font-size: 26px; }
.player .pmid { flex: 1; min-width: 0; margin: 0 6px; }
.player input[type=range] { display: block; width: 100%; accent-color: var(--muted); margin: 4px 0 0; }
.times { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.player .speed { flex: none; width: 38px; height: 40px; padding: 0; border: 0; background: none; font-size: 14px; font-weight: 600; color: var(--blue); }
.seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; margin: 4px 0 10px; }
.seg button { flex: 1; border: 0; background: none; padding: 6px; border-radius: 7px; font-size: 14px; font-weight: 500; }
.seg button.on { background: var(--card); box-shadow: 0 1px 4px #0002; }
@media (prefers-color-scheme: dark) { .seg button.on { background: #636366; } }
.transcript p { margin: 0 0 10px; cursor: pointer; border-radius: 6px; padding: 2px 4px; }
.transcript p .ts { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; margin-right: 6px; }
.transcript p.now { background: #ffcc0040; }
.group { background: var(--card); border-radius: 12px; margin: 0 0 18px; overflow: hidden; }
@media (prefers-color-scheme: light) { .group { background: var(--bg2); } }
.group .row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: .5px solid var(--line); }
.group .row:last-child { border-bottom: 0; }
.group .row > span:last-child { color: var(--muted); text-align: right; overflow-wrap: anywhere; }
.group .row > span:only-child { text-align: left; }  /* строка-пояснение — обычный текст слева */
/* строка-переключатель как в Настройках iOS: название (+ подпись серым) слева, тумблер справа */
.group .row.sw { align-items: center; cursor: pointer; }
.group .row .lbl { color: var(--text); text-align: left; }
.group .row .lbl small { display: block; color: var(--muted); font-size: 13px; margin-top: 1px; }
.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 51px; height: 31px; margin: 0;
  border-radius: 16px; background: #78788052; cursor: pointer; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px #0003; transition: transform .2s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.group-title { color: var(--muted); font-size: 13px; text-transform: uppercase; margin: 0 0 6px 14px; letter-spacing: .3px; }
.group input[type=text], .group input[type=password], .group input[type=datetime-local], .group input[type=email] {
  border: 0; background: transparent; outline: none; width: 100%; padding: 11px 14px; font-size: 17px; }
.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 13px; font-size: 17px; font-weight: 600;
  background: var(--blue); color: #fff; text-align: center; margin: 8px 0; }
.btn.plain { background: var(--card); color: var(--blue); font-weight: 400; }
@media (prefers-color-scheme: light) { .btn.plain { background: var(--bg2); } }
.btn.danger { background: var(--card); color: var(--red); font-weight: 400; }
@media (prefers-color-scheme: light) { .btn.danger { background: var(--bg2); } }
.note { font-size: 13px; color: var(--muted); margin: -10px 14px 18px; }
.warn { border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; background: #ff950022; border: 1px solid #ff950055; font-size: 15px; }
.warn.err { background: #ff3b3018; border-color: #ff3b3055; }
/* сообщения — снизу, над панелью записи (сверху закрывали «назад»); тап — скрыть */
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--pad-b, var(--safe-b)) + 118px); z-index: 30; padding: 12px 14px;
  max-width: 688px; margin: 0 auto;
  border-radius: 14px; background: var(--toast); border: .5px solid var(--line); box-shadow: 0 8px 30px #0007;
  font-size: 15px; animation: toast 6s forwards; }
.toast.error { border-left: 4px solid var(--red); }
@keyframes toast { 0%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--fill); border-radius: 12px; padding: 2px 10px; font-size: 14px; }
.menu { list-style: none; margin: 0; padding: 0; }
.menu a, .menu button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--blue);
  padding: 13px 14px; border-bottom: .5px solid var(--line); font-size: 17px; }
.menu li:last-child a, .menu li:last-child button { border-bottom: 0; }
.login { max-width: 380px; margin: 12vh auto 0; text-align: center; }
.login img { width: 84px; height: 84px; border-radius: 19px; }

/* iPhone «Домой» (iOS 18): окно страницы на --vgap короче экрана (768 из 812) — низ панелей тянем до края экрана,
   содержимое держим над полоской «домой». --vgap считает base.html (как JyotishView 9862724). */
html.pwa { --pad-b: max(var(--safe-b), calc(var(--vgap, 0px) - 10px)); }
/* iOS 26 «Домой»: 100%/100dvh короче экрана, 100lvh — весь экран (иначе ниже окна — чёрная полоса) */
html.ios-sa { height: 100lvh; }
html.pwa body { height: max(100%, var(--sh, 0px)); }
html.pwa .dock, html.pwa .sheet { bottom: calc(-1 * var(--vgap, 0px)); padding-bottom: calc(var(--pad-b) + 14px); }
html.pwa .sheet { padding-bottom: calc(var(--pad-b) + 18px); }
html.pwa .blackout { bottom: calc(-1 * var(--vgap, 0px)); }


/* 🐞 панель отладки (владелец) — как в JyotishView */
#dev-bar { position: fixed; left: 0; top: 58%; z-index: 61; pointer-events: none; }  /* язычок не двигается: меню — absolute сбоку */
#dev-bar > * { pointer-events: auto; }
#dev-bar .dvtab { display: block; position: relative; width: 30px; height: 34px; padding: 0; border: 0; border-radius: 0 10px 10px 0;
  background: #2f6f4ee6; color: #fff; font-size: 16px; box-shadow: 0 2px 8px #0007; touch-action: none; user-select: none; -webkit-user-select: none; }
#dev-bar .dvtab.drag { width: 36px; box-shadow: 0 4px 14px #000a; }
#dev-bar .dvtab i { position: absolute; top: -5px; right: -6px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
  background: #e5534b; color: #fff; font: 600 10px/15px -apple-system, sans-serif; font-style: normal; }
#dev-bar .dvbtns { position: absolute; left: 34px; top: 0; display: none; flex-direction: column; gap: 4px; padding: 5px; border-radius: 12px; background: #1d2a23f2; box-shadow: 0 2px 10px #0008; }
#dev-bar.open .dvbtns { display: flex; }
#dev-bar .dvbtns { min-width: 170px; }
#dev-bar.low .dvbtns { top: auto; bottom: 0; }  /* в нижней половине — вверх от язычка */
#dev-bar .dvbtns button { height: 36px; padding: 0 12px; border: 0; border-radius: 9px; background: #ffffff1f; color: #fff;
  font-size: 14px; text-align: left; white-space: nowrap; }
#dev-bar .dvbtns button.on { background: #e5a24b; color: #111; }
body:has(.dvpop) #dev-bar { display: none; }
body.dv-aim, body.dv-aim * { cursor: crosshair !important; }
/* прицел: язычок оранжевый 🎯 и «дышит»; тап по нему — отмена */
#dev-bar.aiming .dvtab { background: #e5a24b; color: #111; width: 36px; animation: dvaim 1.2s ease-in-out infinite; }
@keyframes dvaim { 50% { box-shadow: 0 0 0 6px #e5a24b55; } }
#dv-hl { position: fixed; z-index: 59; pointer-events: none; border: 2px solid #e5a24b; border-radius: 6px; background: #e5a24b22; transition: all .08s; }
#dv-hl.blink { animation: dvblink .5s steps(2, start) 1; }
@keyframes dvblink { to { visibility: hidden; } }
.dvpop { position: fixed; inset: 0 0 calc(-1 * var(--vgap, 0px)); z-index: 70; display: flex; align-items: flex-end; justify-content: center;
  background: #0008; padding: 16px 10px calc(var(--safe-b) + var(--vgap, 0px) + 10px); }
.dvcard { width: 100%; max-width: 620px; max-height: 80vh; overflow: auto; background: var(--sheet); border-radius: 16px; padding: 12px 14px; }
.dvhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.dvx { border: 0; background: var(--fill); border-radius: 50%; width: 30px; height: 30px; }
.dvwhere { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.dvq { margin: 0 0 8px; padding: 4px 10px; border-left: 3px solid var(--line); color: var(--muted); font-size: 13px; }
.dvf textarea { width: 100%; min-height: 120px; font: inherit; font-size: 16px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; resize: vertical; }
/* лист правки — как в JyotishView: высота 80% экрана, поле на всю высоту, управление одной строкой */
.dvcard.dvsheet { display: flex; flex-direction: column; height: min(80dvh, 720px); max-height: none; overflow: hidden; }
.dvsheet .dvf { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.dvsheet .dvf textarea { flex: 1; resize: none; }
.dvfb { display: flex; gap: 8px; margin-top: 8px; flex-wrap: nowrap; align-items: center; }
.dvfb .dvmsg { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dvf.recording .dvmsg, .dvf.busy .dvmsg { display: flex; }
.dvfb button { height: 38px; border: 0; border-radius: 10px; padding: 0 14px; background: var(--fill); font-size: 15px; }
.dvfb .dvsave { margin-left: auto; background: var(--blue); color: #fff; }
.dvfb .dvsave:disabled { opacity: .35; }
.dvfb .dvsave { margin-left: 0; }
.dvf.busy .dvmore, .dvf.busy .dvsave { display: none; }
.dvfb .dvmic { width: 44px; padding: 0; display: grid; place-items: center; border-radius: 50%; height: 44px; }
.dvfb .dvmic.on { background: var(--red); color: #fff; }
.dvfb .dvcancel { display: none; }
.dvf.recording .dvcancel { display: inline-block; }
.dvf.recording .dvmore, .dvf.recording .dvsave { display: none; }
.dvfb .dvmic { flex: none; margin-left: auto; }
.dvfb .recind { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.recdot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: dvblink 1s steps(2, start) infinite; flex: none; }
.rectime { font-variant-numeric: tabular-nums; font-weight: 500; font-size: 14px; }
.recind .lvl { flex: 1; height: 26px; display: flex; align-items: center; gap: 2px; overflow: hidden; }
.recind .lvl i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--red); height: 12%; }

.dvlist { max-height: 55vh; overflow: auto; }
.dvn { padding: 7px 0; border-bottom: .5px solid var(--line); }
.dvn.done { opacity: .75; }
.dvnh { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.dvnh button { border: 0; background: none; font-size: 15px; padding: 1px 7px; }
.dvnw { font-size: 12px; color: var(--muted); margin: 1px 0 2px; }
.dvnt { font-size: 14px; white-space: pre-wrap; }
.dvnd { margin-top: 3px; font-size: 12px; color: var(--green); }
.dvseg { margin: 2px 0 8px; }
/* вход: почта + «Вставить» */
.login .withbtn { display: flex; align-items: center; }
.login .withbtn input { flex: 1; }
.login .withbtn button { border: 0; background: none; color: var(--blue); font-size: 15px; padding: 0 14px; white-space: nowrap; }
.login .saved { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: -6px 0 10px; }

/* загрузка / импорт — строкой в списке: название, статус, тонкая полоса */
.list li.imp { padding: 11px 0; }
.imp .ih { display: flex; gap: 8px; align-items: center; }
.imp .it { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.imp .ix { border: 0; background: var(--fill); border-radius: 50%; width: 24px; height: 24px; font-size: 12px; flex: none; color: var(--muted); }
.imp .m { font-size: 15px; }
.imp .is { color: var(--muted); }
.imp.err .is { color: var(--red); }
.imp .bar { height: 3px; border-radius: 2px; background: var(--fill); margin-top: 7px; overflow: hidden; }
.imp .bar i { display: block; height: 100%; width: 0; background: var(--blue); border-radius: 2px; transition: width .4s; }
.imp.indet .bar i { width: 30% !important; animation: impslide 1.2s ease-in-out infinite; }
@keyframes impslide { 0% { transform: translateX(-100%); } 100% { transform: translateX(330%); } }
.linkform { padding: 10px 12px; }
.linkform textarea { width: 100%; border: 0; border-radius: 10px; background: var(--fill); padding: 10px 12px; font: inherit;
  font-size: 16px; resize: none; outline: none; }
.linkform .row { display: flex; gap: 8px; justify-content: flex-end; padding: 8px 0 0; }
.pill.primary { background: var(--blue); color: #fff; display: inline-flex; gap: 6px; align-items: center; }
.menu button svg { vertical-align: -3px; margin-right: 6px; }
/* ключи: строка — название, есть/нет, «Добавить/Заменить»; раскрывается поле */
.keys .krow { border-bottom: .5px solid var(--line); }
.keys .krow:last-child { border-bottom: 0; }
.keys summary { list-style: none; cursor: pointer; align-items: center; gap: 10px; border-bottom: 0 !important; }
.keys summary::-webkit-details-marker { display: none; }
.keys summary .lbl { flex: 1; }
.keys .kst { color: var(--muted); font-size: 15px; min-width: 22px; text-align: right; }
.keys .kst.ok { color: var(--green); font-weight: 600; }
.keys .kact { color: var(--blue); font-size: 15px; white-space: nowrap; }
.keys .krow[open] .kact { color: var(--muted); }
.keys .kform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 0 14px 12px; }
.keys .kform input { flex: 1; width: auto; min-width: 0; border: 0; border-radius: 10px; background: var(--fill); padding: 10px 12px !important;
  font-size: 16px; outline: none; }
.keys .kform .pill { height: 40px; background: var(--blue); color: #fff; }
.keys .kfoot { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.keys .kdel { border: 0; background: none; color: var(--red); font-size: 14px; padding: 4px 0; }

/* расшифровка: статус в карточке, текст — отдельным окном с таймлайном */
.tstat { border-radius: 12px; background: var(--card); padding: 10px 12px; margin-bottom: 10px; }
@media (prefers-color-scheme: light) { .tstat { background: var(--bg2); } }
.tstat .tl { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.tstat .tl .ok { color: var(--green); }
.tstat .topen { margin-left: auto; border: 0; border-radius: 14px; background: var(--fill); color: var(--blue); font-size: 15px;
  font-weight: 600; padding: 5px 12px; white-space: nowrap; }  /* «Текст ›» справа в заголовке (#18) */
.tstat .tp[data-open] { cursor: pointer; }
.tstat .td { color: var(--muted); font-size: 14px; margin-top: 2px; }
.tstat .tp { color: var(--muted); font-size: 14px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tstat .bar { height: 3px; border-radius: 2px; background: var(--fill); margin-top: 10px; overflow: hidden; }
.tstat .bar i { display: block; height: 100%; width: 30%; background: var(--blue); animation: impslide 1.2s ease-in-out infinite; }
.tstat .bar.det i { animation: none; transition: width 1.8s linear; }  /* известен прогресс */
.tstat .tl .pct { margin-left: auto; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.tview { position: fixed; inset: 0 0 calc(-1 * var(--vgap, 0px)); z-index: 40; background: var(--bg); display: none; flex-direction: column;
  padding-top: var(--safe-t); }
.tview.open { display: flex; }
.tview .th { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: .5px solid var(--line); }
.tview .th b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 17px; }
.tview .tt { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tview .tbody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 12px 16px calc(var(--pad-b, var(--safe-b)) + 24px); max-width: 720px; width: 100%; margin: 0 auto; box-sizing: border-box; }

/* просмотр экспорта: как в редакторе */
pre.code { font: 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; word-break: break-word;
  background: var(--card); border-radius: 12px; padding: 12px 14px; margin: 0; user-select: text; -webkit-user-select: text; }
@media (prefers-color-scheme: light) { pre.code { background: var(--bg2); } }
.exbar { grid-template-columns: 1fr auto auto; gap: 10px; }
.exext { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.menu .mi { display: flex !important; justify-content: space-between; }
.menu .mi span { color: var(--muted); }

/* свайп влево по записи → «Удалить» */
.list li[data-id] { position: relative; overflow: hidden; }
.list li[data-id] > a { position: relative; z-index: 1; background: var(--bg); transition: transform .2s ease; }
.list .swdel { position: absolute; right: 0; top: 0; bottom: 0; width: 88px; border: 0; background: var(--red); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; }
body.selecting .list .swdel { display: none; }
/* панель папок слева */
.dback { position: fixed; inset: 0; background: #0006; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 50; }
.dback.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; left: 0; bottom: calc(-1 * var(--vgap, 0px)); width: min(82vw, 340px); z-index: 51;
  background: var(--sheet); transform: translateX(-102%); transition: transform .28s ease; overflow-y: auto;
  padding: calc(var(--safe-t) + 10px) 12px calc(var(--pad-b, var(--safe-b)) + 20px); box-shadow: 8px 0 30px #0006; }
.drawer.open { transform: none; }
.drawer .dhead { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 10px; }
.drawer .dhead b { font-size: 22px; }
.drow { display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 10px; border-radius: 10px; color: var(--text);
  border: 0; background: none; font-size: 17px; text-align: left; }
.drow > a, .drow > span { flex: 1; min-width: 0; color: var(--text); display: flex; align-items: center; gap: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drow svg { color: var(--blue); flex: none; }
.drow i { font-style: normal; color: var(--muted); font-size: 15px; }
.drow.on { background: var(--fill); }
.drow .dedit { border: 0; background: none; color: var(--muted); padding: 4px; }
.drow.add { color: var(--blue); margin-top: 6px; }

/* «Первые шаги», «Друзья»: поле + кнопка в строке */
.group .row.kform1 { align-items: center; }
.group .row.kform1 input { flex: 1; min-width: 0; width: auto; border: 0; border-radius: 10px; background: var(--fill); padding: 10px 12px; font: inherit; color: var(--text); }
.group .row.kform1 .pill { height: 40px; }
.group .row form { margin: 0; }
.group .row small.muted { color: var(--muted); font-size: 13px; }
.keys .elbal { color: var(--green); }
.group .row > span.txt { color: var(--text); line-height: 1.45; }
.group .row .kdel { border: 0; background: none; color: var(--red); font-size: 15px; padding: 4px 0; }
.keys .elbal.bad { color: var(--orange, #ff9500); }
a.btn { text-align: center; text-decoration: none; }

/* вторичная кнопка на карточке — компактная */
.btn.sm { font-size: 15px; padding: 10px 12px; border-radius: 10px; }
.btn small.bsub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ✨ агент по записи: снизу; свёрнут — язычок + строка ввода, развёрнут — переписка */
.agent { position: fixed; left: 0; right: 0; bottom: calc(-1 * var(--vgap, 0px)); z-index: 8; display: flex; flex-direction: column;  /* под листом «Поделиться» */
  max-width: 720px; margin: 0 auto; background: var(--sheet);
  border-radius: 14px 14px 0 0; box-shadow: 0 -2px 16px #0006; padding: 0 12px calc(var(--pad-b, var(--safe-b)) + 8px); }
.aggrip { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; color: var(--muted); font-size: 13px;
  padding: 14px 4px 8px; position: relative; touch-action: none; }
.aggrip i { position: absolute; top: 5px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--line); }
.aggrip b { margin-left: auto; font-weight: 500; }
/* лента: края мягко тают — у шапки и у поля сообщения не обрезаются углом */
.aglog { display: none; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 10px 0 14px;
  -webkit-mask-image: linear-gradient(transparent, #000 12px, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(transparent, #000 12px, #000 calc(100% - 14px), transparent); }
.agent.open .aglog { display: block; }
/* развёрнут — лист почти на весь экран (#19): верх ниже шапки, лента тянется, поле внизу */
.agent.open { top: calc(var(--safe-t) + 56px); }
/* клавиатура открыта — лист над ней, по высоте видимой части */
.agent.kb { top: auto; bottom: var(--kb, 0px); height: calc(var(--vvh, 100dvh) - 8px); padding-bottom: 8px; }
.agempty { color: var(--muted); font-size: 14px; padding: 4px 2px; }
.agsug { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.agsug button { border: 0; border-radius: 10px; background: var(--fill); color: var(--text); font-size: 14px; padding: 9px 12px; text-align: left; }
/* сообщения во всю ширину; кто написал — цветом */
.agm { margin: 6px 0; padding: 8px 12px; border-radius: 12px; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.agm.me { background: color-mix(in srgb, var(--blue) 26%, var(--card)); }
.agm.bot { background: var(--fill); }
.agm.err { background: #ff3b3022; }
.agm.wait { color: var(--muted); animation: dvaim 1.4s ease-in-out infinite; }
.agm p, .agdoc p { margin: 0; }
.agm .sp, .agdoc .sp { height: 8px; }
.agm .li, .agdoc .li { display: flex; gap: 6px; }
.agm .li > span, .agdoc .li > span { flex: none; min-width: 14px; color: var(--muted); }
.agm h3, .agm h4, .agm h5, .agm h6 { font-size: 15px; margin: 4px 0 2px; }
.agm hr, .agdoc hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.agm code, .agdoc code { font-size: 13px; background: var(--fill); border-radius: 4px; padding: 0 4px; }
/* файл результата — одна строка: 📄 имя · размер › */
.agfile { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 8px; padding: 9px 10px; border: 0; border-radius: 10px;
  background: var(--card); color: var(--text); font-size: 14px; text-align: left; text-decoration: none; }
.agfile i { font-style: normal; }
.agfile span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agfile small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.agfile b { color: var(--blue); font-weight: 600; }
/* просмотр файла — окно как у расшифровки */
.agview { z-index: 45; }
.agview .th a.round { display: grid; place-items: center; text-decoration: none; color: var(--blue); }
.agdoc { font-size: 16px; line-height: 1.5; }
.agdoc h3 { font-size: 20px; margin: 14px 0 6px; } .agdoc h4 { font-size: 17px; margin: 12px 0 4px; } .agdoc h5, .agdoc h6 { font-size: 16px; margin: 10px 0 4px; }
.agdoc blockquote { margin: 4px 0; padding: 2px 10px; border-left: 3px solid var(--line); color: var(--muted); }
/* строка ввода как в чатах: поле · 🎙 · ↑ в одной «таблетке»; растёт с текстом */
.agform { display: flex; align-items: flex-end; gap: 4px; flex: none; background: var(--bg); border: 1px solid var(--line);
  border-radius: 20px; padding: 3px 4px 3px 4px; }
.agform:focus-within { border-color: color-mix(in srgb, var(--blue) 55%, var(--line)); }
.agfield { position: relative; flex: 1; min-width: 0; display: flex; }
.agform textarea { flex: 1; min-width: 0; height: 36px; resize: none; border: 0; background: transparent; color: var(--text); outline: none;
  font: inherit; font-size: 16px; padding: 8px 10px; line-height: 1.3; overflow-y: hidden; }
.agmic, .agsend, .agcancel { flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; }
.agmic { background: none; color: var(--text); }
.agmic.on { background: var(--red); color: #fff; }
.agsend { background: var(--blue); color: #fff; font-size: 18px; font-weight: 700; transition: opacity .15s; }
.agsend:disabled { opacity: .3; }
.agcancel { display: none; background: none; color: var(--muted); font-size: 16px; }
/* запись / распознавание / ошибка — на месте поля */
.agmsg { position: absolute; inset: 0; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: 16px;
  background: var(--bg); font-size: 14px; color: var(--muted); pointer-events: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.agmsg:empty { display: none; }
.agmsg .recind { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 8px; }
.agmsg .rectime { color: var(--text); min-width: 50px; }
.agform.recording .agcancel { display: grid; }
.agform.recording .agsend { display: none; }

/* ===================== Multimedia Lab ===================== */
.brandmini { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--muted); }
.brandmini img { width: 26px; height: 26px; border-radius: 6px; }
.round.sm { width: 34px; height: 34px; font-size: 14px; }
.tools { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
.tools::-webkit-scrollbar { display: none; }
.tool { flex: none; border-radius: 16px; padding: 6px 12px; background: var(--fill); font-size: 15px; white-space: nowrap; }
.tool.on { background: var(--text); color: var(--bg); }
.tool.soon { opacity: .45; }
.newp { display: flex; gap: 8px; margin: 0 0 14px; }
.newp input { flex: 1; min-width: 0; border: 0; border-radius: 21px; background: var(--fill); padding: 0 16px; height: 42px; font-size: 16px; outline: none; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.pcard { color: var(--text); display: block; }
.pcover { aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: linear-gradient(135deg, #6c48ff33, #ff608033);
  display: grid; place-items: center; font-size: 40px; }
.pcover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard .pt { font-weight: 600; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .pm { color: var(--muted); font-size: 13px; }

/* страница проекта: шире для кадров */
body.page-project .app-in, body.page-sheet .app-in { max-width: 1100px; }
.ptitle { outline: none; border-radius: 8px; }
.ptitle:focus { background: var(--fill); }
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; text-align: center; transition: all .15s; }
.drop.over { border-color: var(--blue); background: #0a84ff14; }
.dropt { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.dropb { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.dropb .pill { display: inline-flex; align-items: center; cursor: pointer; }
.dropmsg { margin-top: 8px; }
.drop .linkform { padding: 10px 0 0; }
.files .frow { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.fthumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: none; background: var(--fill); }
.fthumb.ico { display: grid; place-items: center; font-size: 24px; }
.fbody { flex: 1; min-width: 0; }
.fbody .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fbody .m { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.fnote { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts { display: flex; gap: 6px; align-items: center; flex: none; }
.fdel { border: 0; background: var(--fill); border-radius: 50%; width: 28px; height: 28px; color: var(--muted); }
.files li.empty { padding: 20px; border: 0; }

/* шаги комикса */
.substep { font-weight: 700; font-size: 20px; margin: 18px 0 8px; }
.cstep .row { align-items: center; }
.cstep select, .cstep input[type=number] { border: 0; background: var(--fill); border-radius: 8px; padding: 6px 8px; font-size: 15px; max-width: 55vw; }
.cstep input[type=number] { width: 70px; text-align: center; }
.photos { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px 10px; }
.photos .ph { flex: none; border: 3px solid transparent; border-radius: 12px; padding: 0; background: none; }
.photos .ph.on { border-color: var(--blue); }
.photos .ph img { display: block; width: 96px; height: 72px; object-fit: cover; border-radius: 9px; }
.hero .dot { flex: none; width: 24px; height: 24px; border-radius: 50%; color: #fff; display: grid; place-items: center; font: 600 13px/1 -apple-system, sans-serif; font-style: normal; }
.hero .lbl { flex: 1; min-width: 0; }
.hero input { color: var(--text); border: 0 !important; background: var(--fill) !important; border-radius: 8px; padding: 7px 10px !important; font-size: 16px; width: 100%; }
.errt { color: var(--red); }
.bar.ind { height: 3px; margin: 0 14px 10px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.bar.ind i { display: block; height: 100%; width: 30%; background: var(--blue); animation: impslide 1.2s ease-in-out infinite; }
.bbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.bbtns .btn { flex: 1 1 220px; width: auto; }
.btn:disabled { opacity: .4; }
.note2 { color: var(--muted); font-size: 14px; margin: 4px 2px; }
.bmeta { margin: 6px 2px 10px; }
.nmchk { white-space: nowrap; }

/* кадры */
.panels { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-top: 8px; }
.panel { min-width: 0; }
.pframe { position: relative; width: 100%; overflow: hidden; border-radius: 6px; border: 3px solid #111; background: #f4f1fb;
  container-type: inline-size; user-select: none; -webkit-user-select: none; }
.pframe img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.psketch { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 12px;
  color: #444; font-size: 14px; background: repeating-linear-gradient(-45deg, #ece8f6, #ece8f6 10px, #f6f3fc 10px, #f6f3fc 20px); }
.psketch b { text-transform: uppercase; font-size: 12px; letter-spacing: .5px; color: #777; }
.pwho { display: flex; gap: 4px; flex-wrap: wrap; }
.pwho i { font-style: normal; color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 12px; }
.tails { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tails polygon, .tails circle { fill: #fff; stroke: #111; stroke-width: .5; vector-effect: non-scaling-stroke; }
.tails polygon, .tails circle { stroke-width: 2px; }
.bub { position: absolute; transform: translateX(-50%); max-width: 46%; background: #fff; color: #111; border: 2px solid #111;
  border-radius: 1.2em; padding: .35em .7em; font: 500 clamp(10px, 3.1cqw, 19px)/1.22 -apple-system, "Comic Sans MS", sans-serif;
  text-align: center; cursor: grab; touch-action: none; box-shadow: 0 1px 0 #0002; z-index: 2; }
.bub.shout { border-width: 3.5px; font-weight: 800; }
.bub.whisper { border-style: dashed; font-style: italic; }
.bub.thought { border-radius: 50% / 45%; padding: .55em .9em; }
.bwho { display: block; font-size: .7em; font-weight: 700; color: var(--c, #06c); margin-bottom: 1px; }
.pcap { position: absolute; left: 0; bottom: 0; max-width: 70%; background: #fff6c8; color: #111; border: 2px solid #111; border-width: 2px 2px 0 0;
  padding: .3em .6em; font: italic clamp(9px, 2.6cqw, 16px)/1.25 -apple-system, sans-serif; z-index: 2; }
.pbusy { position: absolute; inset: 0; display: grid; place-items: center; background: #0007; color: #fff; font-size: 16px; z-index: 3; }
.pn { position: absolute; right: 6px; bottom: 6px; background: #111; color: #fff; border-radius: 10px; padding: 0 8px; font: 600 12px/20px -apple-system, sans-serif; z-index: 3; }
.perr { color: var(--red); font-size: 13px; margin-top: 4px; }
.pmeta { margin-top: 6px; font-size: 13px; color: var(--muted); }
.pmeta b { color: var(--text); font-weight: 600; }
.pact { font-size: 14px; margin: 2px 0 4px; }
.pedit { font-size: 14px; margin: 4px 0; }
.pedit > summary { color: var(--blue); cursor: pointer; padding: 4px 0; list-style: none; }
.pedit > summary::-webkit-details-marker { display: none; }
.pedit textarea, .pedit input[type=text] { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 6px 8px; font-size: 15px; resize: vertical; }
.pedit label { display: block; margin-top: 8px; }
.brow { padding: 6px 0; border-bottom: .5px solid var(--line); }
.bsel { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.bsel select { border: 0; background: var(--fill); border-radius: 8px; padding: 4px 6px; font-size: 14px; max-width: 34%; }
.bsel .bx { margin-left: auto; border: 0; background: none; color: var(--muted); }
.pbtns { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.pbtns .pill { height: 36px; font-size: 15px; }
.panel.dragging .bub { cursor: grabbing; }

/* ✨ пожелания — строка внизу (стиль чата Audio Lab) */
.ml-ask .aggrip span { font-weight: 600; color: var(--text); }
@media (min-width: 900px) { .ml-ask { left: auto; right: 16px; width: 420px; border-radius: 14px 14px 0 0; } }

/* лист комикса */
.sheet-title { text-align: center; font: 800 30px/1.15 -apple-system, "Comic Sans MS", sans-serif; margin: 8px 0 16px; }
.sheetgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 640px) { .sheetgrid { grid-template-columns: 1fr; } }
.sheetgrid .pframe .bub { cursor: default; }
@media print {
  .nav, .toast, #dev-bar, .noprint { display: none !important; }
  html, body { height: auto; overflow: visible; background: #fff; }
  .app-scroll { position: static; overflow: visible; }
  .sheetgrid { gap: 6px; }
  .sheetgrid .panel { break-inside: avoid; }
}
