@font-face{font-family:"Literata";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/literata-cyrillic-400-normal.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Literata";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/literata-latin-400-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Literata";font-style:italic;font-weight:400;font-display:swap;src:url(fonts/literata-cyrillic-400-italic.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Literata";font-style:italic;font-weight:400;font-display:swap;src:url(fonts/literata-latin-400-italic.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Literata";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/literata-cyrillic-600-normal.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Literata";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/literata-latin-600-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Literata";font-style:italic;font-weight:600;font-display:swap;src:url(fonts/literata-cyrillic-600-italic.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Literata";font-style:italic;font-weight:600;font-display:swap;src:url(fonts/literata-latin-600-italic.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/golos-text-cyrillic-400-normal.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/golos-text-latin-400-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:500;font-display:swap;src:url(fonts/golos-text-cyrillic-500-normal.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:500;font-display:swap;src:url(fonts/golos-text-latin-500-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/golos-text-cyrillic-600-normal.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/golos-text-latin-600-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:700;font-display:swap;src:url(fonts/golos-text-cyrillic-700-normal.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:700;font-display:swap;src:url(fonts/golos-text-latin-700-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

/* Цвета: тёплая бумага и тёмно-синий переплёт. Светлая тема по умолчанию, тёмная по системе или по выбору (data-theme) */
:root{
  --bg:#F4EFE6; --card:#FFFCF6; --ink:#26231F; --ink-2:#3A362F; --muted:#6E665A; --line:#E4DCCD;
  --nav:#FAF6EE; --field:#FFFFFF; --field-line:#D3C9B7; --dash:#A39885; --chip:#ECE5D8;
  --accent:#2C4A66; --on-accent:#FFFFFF; --accent-text:#2C4A66; --soft:#E3E8EC; --soft-ink:#21384E;
  --ochre:#A8742F; --ochre-soft:#F3E6CF; --ochre-ink:#6B4715;
  --danger:#A33A2C; --shadow:0 1px 2px rgb(60 45 20 / .08), 0 2px 8px rgb(60 45 20 / .06);
  --cover-shadow:0 1px 2px rgb(40 30 10 / .25), 0 4px 10px rgb(40 30 10 / .12);
  --reader-bg:#E8E2D6; --reader-bar:#FAF6EE;
  --f-head:"Literata", Georgia, "Times New Roman", serif;
  --f-body:"Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --col:560px;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){
  --bg:#15181B; --card:#1E2226; --ink:#ECE6DA; --ink-2:#D8D1C3; --muted:#A39B8D; --line:#2E343A;
  --nav:#1A1E21; --field:#23282D; --field-line:#3E464E; --dash:#6C746E; --chip:#2A3036;
  --accent:#8DB3D6; --on-accent:#0F1A24; --accent-text:#9DBEDC; --soft:#23313D; --soft-ink:#C9DCEC;
  --ochre:#D8A660; --ochre-soft:#3A2F1E; --ochre-ink:#EBC98F;
  --danger:#E58A78; --shadow:none; --cover-shadow:0 1px 3px rgb(0 0 0 / .5);
  --reader-bg:#101315; --reader-bar:#1A1E21;
  color-scheme:dark;
}}
:root[data-theme="dark"]{
  --bg:#15181B; --card:#1E2226; --ink:#ECE6DA; --ink-2:#D8D1C3; --muted:#A39B8D; --line:#2E343A;
  --nav:#1A1E21; --field:#23282D; --field-line:#3E464E; --dash:#6C746E; --chip:#2A3036;
  --accent:#8DB3D6; --on-accent:#0F1A24; --accent-text:#9DBEDC; --soft:#23313D; --soft-ink:#C9DCEC;
  --ochre:#D8A660; --ochre-soft:#3A2F1E; --ochre-ink:#EBC98F;
  --danger:#E58A78; --shadow:none; --cover-shadow:0 1px 3px rgb(0 0 0 / .5);
  --reader-bg:#101315; --reader-bar:#1A1E21;
  color-scheme:dark;
}

/* Основа */
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;min-height:100vh;background:var(--bg);color:var(--ink);font-family:var(--f-body);font-size:15px;line-height:1.5;-webkit-tap-highlight-color:transparent}
html.reading body{overflow:hidden}
[hidden]{display:none!important}
img{max-width:100%}
button,input,select,textarea{font:inherit;color:inherit}
h1,h2,h3{margin:0;line-height:1.25}
p{margin:0}
a{color:var(--accent-text)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.muted{color:var(--muted)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
svg{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
svg .fill{fill:currentColor;stroke:none}

/* Колонка, нижнее меню на телефоне, боковое на компьютере */
main{max-width:var(--col);margin:0 auto;padding:calc(14px + env(safe-area-inset-top,0px)) 16px calc(100px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:16px}
.side{display:none}
.tabbar{position:fixed;left:0;right:0;bottom:0;z-index:30;background:var(--nav);border-top:1px solid var(--line)}
.tabbar-in{max-width:var(--col);margin:0 auto;display:flex;padding:6px 8px calc(8px + env(safe-area-inset-bottom,0px))}
.tab{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 2px;min-height:48px;text-decoration:none;color:var(--muted);font-size:11.5px;font-weight:600}
.tab span{white-space:nowrap}
.tab svg{width:24px;height:24px}
.tab[aria-current="page"]{color:var(--accent-text);font-weight:700}
@media (min-width: 900px){
  :root{--col:1080px}
  #app{display:grid;grid-template-columns:232px minmax(0,1fr);min-height:100vh}
  .tabbar{display:none}
  .side{display:flex;flex-direction:column;gap:4px;position:sticky;top:0;height:100vh;padding:20px 12px;background:var(--nav);border-right:1px solid var(--line)}
  .side-brand{display:flex;align-items:center;gap:10px;padding:4px 10px 18px;font-family:var(--f-head);font-size:20px}
  .side .tab{flex:none;flex-direction:row;justify-content:flex-start;gap:12px;font-size:15px;padding:0 12px;border-radius:12px;min-height:46px}
  .side .tab[aria-current="page"]{background:var(--soft);color:var(--soft-ink)}
  main{padding:28px 32px 48px}
  .uploads{right:24px!important;bottom:24px!important}
  .toast{bottom:32px!important}
  .note-edit,.note-view,.files{width:100%;max-width:820px}
}
.side-logo,.auth-logo{width:34px;height:34px;border-radius:9px;background:#2C4A66 url(icons/logo.svg) center/72% no-repeat;flex:none}
.loading{color:var(--muted);padding:48px 0;text-align:center}
.notice,.update-bar{max-width:var(--col);margin:12px auto 0;padding:0 16px}
.notice > div{background:color-mix(in srgb,var(--danger) 12%,var(--card));border:1px solid color-mix(in srgb,var(--danger) 35%,var(--line));border-radius:12px;padding:12px 14px}
.update-bar > div{display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:var(--soft);color:var(--soft-ink);border-radius:12px;padding:6px 6px 6px 14px}
.update-bar span{flex:1;min-width:150px;font-weight:600}

/* Шапки экранов */
.head{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px}
.head h1{font-family:var(--f-head);font-size:27px;font-weight:600;overflow-wrap:anywhere}
.head > div{min-width:0}
.n-head{color:var(--muted);font-weight:600}
.crumbs{font-size:13px;color:var(--muted);overflow-wrap:anywhere}
.crumbs a{color:var(--muted)}
.back{align-self:flex-start;min-height:44px;display:inline-flex;align-items:center;gap:2px;padding:0 8px 0 0;margin:-6px 0 -10px -4px;font-size:15px;font-weight:600;text-decoration:none;color:var(--accent-text);max-width:100%}
.back span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.back svg{width:22px;height:22px;flex:none;stroke-width:2}
.block{display:flex;flex-direction:column;gap:10px}
.block h2,.card h2,.letter h2{font-size:17px;font-weight:700}
.block-h{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.more-link{font-weight:600;font-size:14px;text-decoration:none}
.row-acts{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.sub-h{font-size:15px;font-weight:700;margin-top:6px;color:var(--ochre-ink)}

/* Кнопки */
.btn{appearance:none;min-height:44px;border-radius:12px;border:1.5px solid var(--field-line);background:var(--card);color:var(--ink);padding:0 16px;font-weight:600;font-size:15px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;line-height:1.2}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.btn.ghost{background:none;border-color:transparent;color:var(--accent-text)}
.btn.danger{color:var(--danger)}
.btn.danger-fill{background:var(--danger);border-color:var(--danger);color:#fff}
.btn.wide{width:100%}
.btn.big{min-height:52px;border-radius:14px;font-size:16px;padding:0 20px}
.btn.sm{min-height:40px;padding:0 12px;font-size:14px;border-radius:10px}
.btn:disabled{opacity:.55;cursor:default}
.btn svg{width:20px;height:20px;flex:none}
.icon-btn{appearance:none;width:44px;height:44px;border-radius:50%;border:0;background:transparent;color:var(--ink);display:inline-grid;place-items:center;cursor:pointer;flex:none;padding:0}
.icon-btn svg{width:22px;height:22px}
.icon-btn:hover{background:color-mix(in srgb,var(--ink) 7%,transparent)}
.icon-btn:disabled{opacity:.3;cursor:default}
.linkbtn{appearance:none;border:0;background:none;padding:0;color:var(--accent-text);font-weight:600;cursor:pointer;text-decoration:underline;text-underline-offset:3px;min-height:44px}

/* Карточки, списки, метки */
.card{background:var(--card);border-radius:16px;padding:16px;display:flex;flex-direction:column;gap:12px;box-shadow:var(--shadow)}
.empty{color:var(--muted);font-size:14px;line-height:1.5}
.hint{color:var(--muted);font-size:13.5px;line-height:1.5}
.tag{display:inline-flex;align-items:center;align-self:flex-start;border-radius:999px;padding:2px 9px;font-size:12px;font-weight:600;background:var(--ochre-soft);color:var(--ochre-ink);white-space:nowrap}
.tag.wait{background:var(--soft);color:var(--soft-ink)}
.badge{position:absolute;top:6px;left:6px;border-radius:6px;padding:1px 6px;font-size:11px;font-weight:700;background:rgb(255 255 255 / .9);color:#26231F}
.badge.wait{top:auto;bottom:calc(100% - 6px);left:6px;transform:translateY(100%)}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{display:inline-flex;align-items:center;gap:6px;min-height:40px;padding:0 12px;border-radius:999px;background:var(--chip);color:var(--ink);text-decoration:none;font-weight:600;font-size:14px}
.chip svg{width:18px;height:18px}
.chip.sm{min-height:32px;font-size:13px;padding:0 10px}
.links{background:var(--card);border-radius:16px;overflow:hidden;box-shadow:var(--shadow)}
.links a{display:flex;align-items:center;gap:12px;min-height:52px;padding:0 14px;text-decoration:none;color:var(--ink);font-weight:600;border-top:1px solid var(--line)}
.links a:first-child{border-top:0}
.links a .n{margin-left:auto;font-weight:500;color:var(--muted);font-size:14px}
.links a svg{width:20px;height:20px;flex:none}
.links a .chev,.chev{stroke:var(--muted);stroke-width:2;width:18px;height:18px;flex:none}
.letter{display:flex;flex-direction:column;gap:8px}
.letter h2{font-family:var(--f-head);color:var(--ochre)}

/* Поиск и панель фильтров */
.search{position:relative;display:block}
.search svg{position:absolute;left:14px;top:50%;transform:translateY(-50%);width:20px;height:20px;color:var(--muted)}
.search input{width:100%;min-height:48px;border-radius:14px;border:1.5px solid var(--field-line);background:var(--field);padding:0 14px 0 44px;font-size:16px}
.toolbar{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.sel select{min-height:42px;border-radius:10px;border:1.5px solid var(--field-line);background:var(--field);padding:0 10px;font-size:14px;max-width:220px}
.check-chip{display:inline-flex;align-items:center;gap:8px;min-height:42px;padding:0 12px;border-radius:10px;border:1.5px solid var(--field-line);font-size:14px;cursor:pointer}
.check-chip input{width:18px;height:18px;accent-color:var(--accent)}
.seg2{display:inline-flex;border:1.5px solid var(--field-line);border-radius:10px;overflow:hidden;margin-left:auto}
.seg2 button{appearance:none;border:0;background:none;width:44px;height:40px;display:grid;place-items:center;cursor:pointer;color:var(--muted)}
.seg2 button svg{width:20px;height:20px}
.seg2 button[aria-pressed="true"]{background:var(--soft);color:var(--soft-ink)}
.seg{display:flex;gap:6px;flex-wrap:wrap}
.seg button{appearance:none;min-height:40px;padding:0 14px;border-radius:999px;border:1.5px solid var(--field-line);background:none;font-weight:600;font-size:14px;cursor:pointer}
.seg button[aria-checked="true"]{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}

/* Обложки: своя картинка или «переплёт» с названием */
.cover{position:relative;display:block;aspect-ratio:2/3;border-radius:4px 7px 7px 4px;overflow:hidden;background:var(--chip);box-shadow:var(--cover-shadow)}
.cover img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;-webkit-user-drag:none;-webkit-touch-callout:none}
.cover-ph{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:space-between;padding:12% 10% 10% 14%;background:linear-gradient(90deg,rgb(0 0 0 / .22) 0 5%,rgb(255 255 255 / .06) 5% 7%,transparent 7%),var(--spine);color:#F4EBD8}
.cover-ph b{font-family:var(--f-head);font-weight:600;font-size:13px;line-height:1.25;display:-webkit-box;-webkit-line-clamp:6;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
.cover-ph small{font-size:10px;opacity:.8;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.cover.sm{width:52px;flex:none}
.cover.xs{width:34px;flex:none;border-radius:2px 4px 4px 2px}
.cover.sm .cover-ph b,.cover.xs .cover-ph b{font-size:7px}
.cover.sm .cover-ph small,.cover.xs .cover-ph small{display:none}
.cover.lg{width:100%}
.cover.lg .cover-ph b{font-size:19px}
.cover.lg .cover-ph small{font-size:13px}

/* Сетка книг */
.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px 12px}
@media (min-width: 560px){ .grid{grid-template-columns:repeat(auto-fill,minmax(130px,1fr))} }
@media (min-width: 900px){ .grid{grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:24px 18px} }
.tile{position:relative;display:flex;flex-direction:column;gap:6px;text-decoration:none;color:var(--ink);min-width:0}
.tile .t-title{font-size:13.5px;font-weight:600;line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
.tile .t-author{font-size:12.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:-4px}
.prog{display:block;height:4px;border-radius:2px;background:var(--line);overflow:hidden}
.prog i{display:block;height:100%;background:var(--ochre)}
.prog.wide{width:100%;margin:6px 0 2px}
.rows{display:flex;flex-direction:column;gap:2px}
.brow{display:flex;gap:12px;align-items:center;padding:8px 6px;border-radius:12px;text-decoration:none;color:var(--ink);min-height:56px}
.brow:hover{background:color-mix(in srgb,var(--ink) 5%,transparent)}
.brow-t{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
.brow-t b{font-weight:600;overflow-wrap:anywhere}
.brow-t span{font-size:13.5px;color:var(--muted)}
.brow-t small{font-size:12.5px;color:var(--muted)}

/* «Продолжить чтение» и карточки полок */
.cont{display:grid;gap:10px}
@media (min-width: 900px){ .cont{grid-template-columns:repeat(3,minmax(0,1fr))} }
.cont-item{display:flex;gap:12px;align-items:center;background:var(--card);border-radius:14px;padding:10px 12px;text-decoration:none;color:var(--ink);box-shadow:var(--shadow)}
.cont-item > span:last-child{flex:1;min-width:0;display:flex;flex-direction:column}
.cont-item b{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cont-item small{font-size:12.5px;color:var(--muted)}
.shelf-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
@media (min-width: 700px){ .shelf-cards{grid-template-columns:repeat(auto-fill,minmax(190px,1fr))} }
.shelf-card{display:flex;flex-direction:column;gap:4px;background:var(--card);border-radius:14px;padding:12px;text-decoration:none;color:var(--ink);box-shadow:var(--shadow);min-width:0}
.shelf-card b{font-weight:600;overflow-wrap:anywhere;line-height:1.3}
.shelf-card small{font-size:12.5px;color:var(--muted)}
.sc-covers{display:flex;gap:4px;align-items:flex-end;height:56px;margin-bottom:6px;border-bottom:3px solid var(--ochre-soft);padding-bottom:2px}
.sc-covers .cover.xs{width:34px}
.sc-empty{color:var(--dash)}
.sc-empty svg{width:28px;height:28px}

/* Дерево полок */
.tree{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.tree .tree{padding-left:22px;border-left:1.5px solid var(--line);margin-left:10px}
.tree-row{display:flex;align-items:center;gap:4px}
.tree-row a{flex:1;min-width:0;display:flex;align-items:center;gap:10px;min-height:46px;text-decoration:none;color:var(--ink);font-weight:600}
.tree-row a span{overflow-wrap:anywhere}
.tree-row a small{margin-left:auto;color:var(--muted);font-weight:500}
.tree-row svg,.sub svg{width:19px;height:19px;flex:none;color:var(--ochre)}
.lvl2 .tree-row a,.lvl3 .tree-row a{font-weight:500}
.arrows{display:inline-flex}
.sub-list{display:flex;flex-direction:column;background:var(--card);border-radius:14px;overflow:hidden;box-shadow:var(--shadow)}
.sub-row{display:flex;align-items:center;border-top:1px solid var(--line)}
.sub-row:first-child{border-top:0}
.sub{flex:1;display:flex;align-items:center;gap:10px;min-height:50px;padding:0 14px;text-decoration:none;color:var(--ink);font-weight:600;min-width:0}
.sub small{margin-left:auto;color:var(--muted);font-weight:500}

/* Карточка книги */
.book{display:grid;grid-template-columns:120px minmax(0,1fr);gap:16px;align-items:start}
.book-cover{position:relative}
.book-info{display:flex;flex-direction:column;gap:8px;min-width:0}
.book-info h1{font-family:var(--f-head);font-size:23px;font-weight:600;overflow-wrap:anywhere}
.book-authors{font-size:15px}
.book-authors a{color:var(--ink-2);font-weight:600}
.facts{font-size:13.5px;color:var(--muted)}
.book-acts{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:4px}
.soon{background:var(--soft);color:var(--soft-ink);border-radius:12px;padding:10px 12px;font-size:14px}
.on-shelves{font-size:13.5px;color:var(--muted);display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.desc summary{cursor:pointer;font-weight:600;color:var(--accent-text);min-height:40px;display:flex;align-items:center}
.desc p{font-size:14.5px;line-height:1.6;color:var(--ink-2)}
@media (max-width: 599px){
  .book{grid-template-columns:1fr}
  .book-cover{width:140px;margin:0 auto}
  .book-info{text-align:center;align-items:center}
  .book-acts{justify-content:center}
  .on-shelves{justify-content:center}
  .desc{text-align:left;align-self:stretch}
}
@media (min-width: 900px){ .book{grid-template-columns:200px minmax(0,1fr);gap:28px} .book-info h1{font-size:30px} }
.tabs{display:flex;gap:4px;border-bottom:1.5px solid var(--line)}
.tabs a{min-height:44px;display:flex;align-items:center;padding:0 14px;text-decoration:none;color:var(--muted);font-weight:600;border-bottom:2.5px solid transparent;margin-bottom:-1.5px}
.tabs a[aria-selected="true"]{color:var(--accent-text);border-color:var(--accent)}
.notes-card > .btn{align-self:flex-start}

/* Строка заметки */
.note-row{display:flex;gap:12px;align-items:flex-start;padding:10px 6px;border-radius:12px;text-decoration:none;color:var(--ink);border-top:1px solid var(--line)}
.rows .note-row:first-child{border-top:0}
.note-row > svg:first-child{width:20px;height:20px;flex:none;margin-top:2px;color:var(--ochre)}
.note-row > .chev{align-self:center}
.nr-t{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.nr-t b{font-weight:600;overflow-wrap:anywhere}
.nr-x{font-size:13.5px;color:var(--ink-2);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.nr-t small{font-size:12.5px;color:var(--muted)}

/* Заметка и урок */
.note-top{display:flex;align-items:center;gap:8px;margin:-6px -6px 0 0}
.note-kind{font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--ochre)}
.note-top .tag{margin-left:2px}
.ed-state{margin-left:auto;font-size:12.5px;color:var(--muted);text-align:right}
.note-edit input.ed-title{width:100%;border:0;border-radius:0;background:none;font-family:var(--f-head);font-size:24px;font-weight:600;padding:4px 0;min-height:44px;color:var(--ink)}
.note-edit input.ed-title:focus{outline:none;box-shadow:0 2px 0 var(--accent)}
.note-meta{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;font-size:14px;color:var(--muted)}
.note-meta a{font-weight:600}
.ed-page{display:inline-flex;align-items:center;gap:6px}
.note-meta .ed-page input{width:84px;min-height:40px;border-radius:10px;border:1.5px solid var(--field-line);background:var(--field);padding:0 10px;font-size:15px}
.page-link{font-weight:700}
.note-view h1{font-family:var(--f-head);font-size:25px;font-weight:600}
.prose,.ed-box .ql-editor{font-family:var(--f-head);font-size:17.5px;line-height:1.65;color:var(--ink)}
.prose{display:flex;flex-direction:column;gap:.7em;overflow-wrap:anywhere}
.prose h2,.ql-editor h2{font-size:1.3em;font-weight:600;margin:.4em 0 0}
.prose h3,.ql-editor h3{font-size:1.1em;font-weight:600;margin:.3em 0 0}
.prose ul,.prose ol{margin:0;padding-left:1.4em}
.prose blockquote,.ql-editor blockquote{margin:0;padding:.2em 0 .2em 1em;border-left:3px solid var(--ochre)!important;color:var(--ink-2);font-style:italic}

/* Редактор Quill: свои цвета и русские подписи */
.ed-box{margin:0 -4px}
.ed-box .ql-toolbar.ql-snow{position:sticky;top:0;z-index:5;background:var(--card);border:0;border-bottom:1px solid var(--line);padding:4px 0;display:flex;flex-wrap:wrap;gap:2px;font-family:var(--f-body)}
.ed-box .ql-toolbar .ql-formats{margin-right:6px!important;display:inline-flex}
.ed-box .ql-snow.ql-toolbar button{width:40px;height:40px;padding:9px;border-radius:8px;color:var(--ink)}
.ed-box .ql-snow.ql-toolbar button:hover,.ed-box .ql-snow.ql-toolbar button.ql-active{background:var(--soft);color:var(--soft-ink)}
.ed-box .ql-snow .ql-stroke{stroke:currentColor}
.ed-box .ql-snow .ql-fill{fill:currentColor}
.ed-box .ql-snow.ql-toolbar button.ql-active .ql-stroke{stroke:var(--accent-text)}
.ed-box .ql-snow.ql-toolbar button.ql-active .ql-fill{fill:var(--accent-text)}
.ed-box .ql-header b{font-family:var(--f-head);font-size:17px;line-height:1}
.ed-box .ql-header[value="3"] b{font-size:14px}
.ed-box .ql-undo svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8}
.ed-box .ql-container.ql-snow{border:0;font-family:var(--f-head)}
.ed-box .ql-editor{min-height:40vh;padding:14px 4px 40px}
.ed-box .ql-editor.ql-blank::before{color:var(--muted);font-style:normal;left:4px}
.ed-box .ql-editor a{color:var(--accent-text)}
.ed-box .ql-snow .ql-tooltip{background:var(--card);color:var(--ink);border-color:var(--line);box-shadow:0 8px 24px rgb(0 0 0 / .2);border-radius:12px;font-family:var(--f-body);z-index:10;padding:8px 12px}
.ed-box .ql-snow .ql-tooltip input[type=text]{background:var(--field);color:var(--ink);border-color:var(--field-line);height:36px;border-radius:8px}
.ed-box .ql-snow .ql-tooltip::before{content:"Ссылка:"}
.ed-box .ql-snow .ql-tooltip[data-mode=link]::before{content:"Адрес ссылки:"}
.ed-box .ql-snow .ql-tooltip a.ql-action::after{content:"Изменить"}
.ed-box .ql-snow .ql-tooltip.ql-editing a.ql-action::after{content:"Сохранить"}
.ed-box .ql-snow .ql-tooltip a.ql-remove::before{content:"Убрать"}
.ed-box .ql-snow a{color:var(--accent-text)}

/* Файлы урока */
.file-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px solid var(--line)}
.file-row:first-of-type{border-top:0}
.file-row > svg{width:22px;height:22px;flex:none;color:var(--ochre)}
.fr-t{flex:1;min-width:0;display:flex;flex-direction:column}
.fr-t b{font-weight:600;overflow-wrap:anywhere}
.fr-t small{font-size:12.5px;color:var(--muted)}

/* Профиль */
.me-card{flex-direction:row;align-items:center;gap:14px}
.me{width:64px;height:64px;flex:none;border-radius:50%;background:var(--accent);color:var(--on-accent);display:grid;place-items:center;font-weight:700;font-size:26px;font-family:var(--f-head)}
.who{flex:1;min-width:0;display:flex;flex-direction:column}
.who b{font-size:17px;overflow-wrap:anywhere}
.who span,.who small{font-size:14px;color:var(--muted);overflow-wrap:anywhere}
.seg3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.seg3 input{position:absolute;opacity:0;pointer-events:none}
.seg3 label{min-height:44px;border-radius:12px;border:1.5px solid var(--field-line);display:grid;place-items:center;text-align:center;font-weight:600;font-size:14px;cursor:pointer;padding:4px}
.seg3 input:checked + label{border-color:var(--accent);background:var(--soft);color:var(--soft-ink);font-weight:700}
.seg3 input:focus-visible + label{outline:2px solid var(--accent);outline-offset:2px}
.fold{background:var(--card);border-radius:14px;box-shadow:var(--shadow)}
.fold > summary{list-style:none;min-height:52px;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 14px;cursor:pointer;font-weight:600}
.fold > summary::-webkit-details-marker{display:none}
.fold > summary .chev{transition:transform .15s}
.fold[open] > summary .chev{transform:rotate(90deg)}
.fold-body{padding:0 14px 14px;display:flex;flex-direction:column;gap:10px}
.inv{display:flex;flex-direction:column;gap:6px;padding:10px 0;border-top:1px solid var(--line)}
.inv:first-child{border-top:0}
.inv code{font-size:17px;font-weight:700;letter-spacing:.08em;font-family:ui-monospace,Menlo,Consolas,monospace}
.inv .muted{font-size:13px}
.inv .acts{display:flex;gap:6px;flex-wrap:wrap}

/* Журнал */
.log-day{gap:0}
.log-day h2{margin-bottom:6px}
.log-row{display:grid;grid-template-columns:92px minmax(0,1fr) auto;gap:10px;padding:10px 0;border-top:1px solid var(--line);font-size:14px;align-items:start}
.log-day h2 + .log-row{border-top:0}
.lr-time{color:var(--muted);font-variant-numeric:tabular-nums}
.lr-main{overflow-wrap:anywhere}
.lr-main .muted{font-size:12.5px}
.lr-num{text-align:right;color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}
.log-row.bad{background:color-mix(in srgb,var(--danger) 9%,transparent);border-radius:10px;padding:10px 8px;margin:2px -8px}
.log-row.bad .lr-num,.log-row.bad .lr-time{color:var(--danger);font-weight:700}
@media (max-width: 420px){ .log-row{grid-template-columns:minmax(0,1fr) auto} .lr-time{grid-column:1/-1;margin-bottom:-6px} }

/* Поля форм */
input[type=text],input[type=email],input[type=password],input[type=date],input[type=number],input[type=search]:not(.search input),select,textarea{min-height:48px;border-radius:12px;border:1.5px solid var(--field-line);background:var(--field);padding:0 14px;font-size:16px;color:var(--ink);width:100%;min-width:0}
textarea{padding:12px 14px;line-height:1.5;resize:vertical;min-height:96px}
input:focus,select:focus,textarea:focus{outline:2px solid color-mix(in srgb,var(--accent) 50%,transparent);outline-offset:0;border-color:var(--accent)}
.field{display:flex;flex-direction:column;gap:8px}
.field > label,.flabel{font-size:13px;font-weight:700;color:var(--muted)}
.form-err{color:var(--danger);font-size:14px}
.form-ok{color:var(--accent-text);font-size:14px}
.checks{border:0;margin:0;padding:0;min-width:0;display:flex;flex-direction:column;gap:4px}
.checks legend{padding:0;margin-bottom:8px}
.check-row{display:flex;gap:12px;align-items:center;min-height:46px;padding:8px 12px;border-radius:12px;background:var(--card);border:1.5px solid transparent;cursor:pointer}
.check-row:has(input:checked){border-color:var(--accent)}
.check-row input{width:20px;height:20px;margin:0;flex:none;accent-color:var(--accent)}
.check-row span{display:flex;flex-direction:column;gap:2px;min-width:0}
.check-row b{font-size:15px;font-weight:600;overflow-wrap:anywhere}
.check-row small{font-size:12.5px;color:var(--muted);line-height:1.4}
.check-row.lvl2{margin-left:22px}
.check-row.lvl3{margin-left:44px}
.pick-list{display:flex;flex-direction:column;gap:4px;max-height:50vh;overflow:auto}
.pick-row{appearance:none;display:flex;gap:12px;align-items:center;text-align:left;border:0;background:var(--card);border-radius:12px;padding:8px 12px;min-height:56px;cursor:pointer}
.pick-row span{display:flex;flex-direction:column;min-width:0}
.pick-row small{color:var(--muted);font-size:12.5px}
.toc{display:flex;flex-direction:column}
.toc-row{appearance:none;border:0;background:none;text-align:left;min-height:44px;padding:8px 6px;border-bottom:1px solid var(--line);cursor:pointer;font-size:15px}
.toc-row.lvl2{padding-left:22px;font-size:14.5px}
.toc-row.lvl3{padding-left:40px;font-size:14px;color:var(--ink-2)}

/* Меню «⋯», окна, всплывающие сообщения */
.menu{position:fixed;z-index:80;min-width:220px;background:var(--card);border:1px solid var(--line);border-radius:14px;box-shadow:0 12px 40px rgb(0 0 0 / .18);padding:6px;display:flex;flex-direction:column}
.menu button{appearance:none;border:0;background:none;text-align:left;min-height:44px;padding:0 12px;border-radius:10px;font-weight:600;font-size:15px;cursor:pointer;color:var(--ink)}
.menu button:hover,.menu button:focus-visible{background:color-mix(in srgb,var(--ink) 7%,transparent)}
.menu button.danger{color:var(--danger)}
dialog{border:0;padding:0;border-radius:18px;width:min(520px,calc(100vw - 24px));max-height:calc(100dvh - 32px);background:var(--bg);color:var(--ink);box-shadow:0 20px 60px rgb(0 0 0 / .3)}
dialog::backdrop{background:rgb(20 18 12 / .5)}
dialog form{display:flex;flex-direction:column;max-height:calc(100dvh - 32px)}
.dlg-head{display:flex;align-items:center;gap:10px;padding:12px 8px 6px 20px}
.dlg-head h2{font-size:18px;font-weight:700;flex:1;overflow-wrap:anywhere}
.dlg-body{padding:6px 20px 16px;overflow:auto;display:flex;flex-direction:column;gap:14px}
.dlg-text{font-size:15px;line-height:1.5;color:var(--ink-2)}
.dlg-err{color:var(--danger);font-size:14px;padding:0 20px 10px}
.dlg-foot{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:12px 20px calc(14px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--line)}
.dlg-foot .btn{flex:1 1 auto}
.toast{position:fixed;left:50%;bottom:calc(92px + env(safe-area-inset-bottom,0px));transform:translateX(-50%) translateY(20px);background:var(--ink);color:var(--bg);padding:10px 16px;border-radius:12px;font-size:14px;font-weight:600;opacity:0;pointer-events:none;transition:opacity .2s, transform .2s;z-index:100;max-width:calc(100vw - 32px);text-align:center}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}

/* Загрузка книг */
.uploads{position:fixed;right:12px;left:12px;bottom:calc(84px + env(safe-area-inset-bottom,0px));z-index:40;max-width:420px;margin-left:auto;background:var(--card);border:1px solid var(--line);border-radius:16px;box-shadow:0 12px 40px rgb(0 0 0 / .2);padding:10px 12px;display:flex;flex-direction:column;gap:6px;max-height:55vh}
.up-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:-4px -6px -4px 0}
.up-list{overflow:auto;display:flex;flex-direction:column;gap:2px}
.up-row{display:flex;align-items:center;gap:8px;padding:6px 0;border-top:1px solid var(--line)}
.up-row:first-child{border-top:0}
.up-t{flex:1;min-width:0;display:flex;flex-direction:column}
.up-t b{font-size:14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.up-t small{font-size:12.5px;color:var(--muted)}
.up-row.err small{color:var(--danger)}
.up-row.done .prog i{background:var(--accent)}
.up-row.err .prog,.up-row.skip .prog{display:none}

/* Читалка */
.reader{position:fixed;inset:0;z-index:50;background:var(--reader-bg);display:flex;flex-direction:column;color:var(--ink);-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.reader.reader-free{-webkit-user-select:auto;user-select:auto}
.rd-top,.rd-bottom{display:flex;align-items:center;gap:4px;background:var(--reader-bar);padding:4px 8px;flex:none;transition:transform .2s,opacity .2s;z-index:2}
.rd-top{padding-top:calc(4px + env(safe-area-inset-top,0px));border-bottom:1px solid var(--line)}
.rd-bottom{padding-bottom:calc(4px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--line)}
.rd-title{flex:1;min-width:0;font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--f-body)}
.rd-sp{flex:1}
.rd-num{appearance:none;border:0;background:none;min-height:44px;min-width:96px;padding:0 10px;border-radius:10px;font-weight:600;font-variant-numeric:tabular-nums;cursor:pointer}
.rd-num:hover{background:color-mix(in srgb,var(--ink) 7%,transparent)}
.rd-slider{position:absolute;left:12px;right:12px;bottom:calc(58px + env(safe-area-inset-bottom,0px));z-index:3;accent-color:var(--ochre);opacity:.9}
.reader.bars-off .rd-top{transform:translateY(-100%);opacity:0;pointer-events:none}
.reader.bars-off .rd-bottom{transform:translateY(100%);opacity:0;pointer-events:none}
.reader.bars-off .rd-slider{display:none}
.reader.bars-off .rd-stage{margin:-52px 0}
.rd-stage{flex:1;min-height:0;overflow:hidden;display:flex;touch-action:none;position:relative}
.rd-stage.zoomed{overflow:auto;touch-action:pan-x pan-y}
.rd-pagebox{margin:auto;padding:8px;display:flex}
.rd-pagebox.busy{opacity:.6}
.rd-page{position:relative;background:#fff;box-shadow:0 2px 12px rgb(0 0 0 / .25);transform-origin:center;flex:none}
.rd-page canvas{display:block;width:100%;height:100%;-webkit-user-drag:none;pointer-events:none}
.reader.dark-pages .rd-page canvas{filter:invert(.9) hue-rotate(180deg)}
.rd-msg{position:absolute;inset:0;display:grid;place-items:center;padding:24px;z-index:4;background:color-mix(in srgb,var(--reader-bg) 70%,transparent)}
.rd-msg-box{background:var(--card);border-radius:16px;padding:20px;max-width:360px;display:flex;flex-direction:column;gap:12px;text-align:center;box-shadow:0 12px 40px rgb(0 0 0 / .2)}
.rd-msg-box .btn{align-self:center}
.rd-top .btn svg{width:18px;height:18px}
@media (min-width: 900px){ .rd-top,.rd-bottom{padding-left:20px;padding-right:20px} }
/* текстовый слой pdf.js: только у администратора (и у читателей, когда включат READER_TEXT_LAYER) */
.textLayer{position:absolute;text-align:initial;inset:0;overflow:clip;opacity:1;line-height:1;-webkit-text-size-adjust:none;text-size-adjust:none;forced-color-adjust:none;transform-origin:0 0;caret-color:CanvasText;z-index:0}
.textLayer :is(span,br){color:transparent;position:absolute;white-space:pre;cursor:text;transform-origin:0% 0%}
.textLayer > :not(.markedContent),.textLayer .markedContent span:not(.markedContent){z-index:1}
.textLayer span.markedContent{top:0;height:0}
.textLayer ::selection{background:rgb(44 74 102 / .3)}
.textLayer br::selection{background:transparent}
.textLayer .endOfContent{display:block;position:absolute;inset:100% 0 0;z-index:0;cursor:default;user-select:none}
.textLayer.selecting .endOfContent{top:0}
/* текстовый слой выделяется (у читателя он есть только при READER_TEXT_LAYER), копирование запрещает код */
.reader .textLayer,.reader .textLayer *{-webkit-user-select:text;user-select:text}
.reader:not(.reader-free) .textLayer{-webkit-touch-callout:none}

/* Вход и регистрация */
.auth{min-height:100vh;display:grid;place-items:center;padding:32px 16px calc(32px + env(safe-area-inset-bottom,0px))}
.auth-card{width:min(420px,100%);background:var(--card);border-radius:18px;padding:28px 22px;display:flex;flex-direction:column;gap:18px;box-shadow:var(--shadow)}
.auth-brand{display:flex;flex-direction:column;gap:6px}
.auth-brand .auth-logo{width:48px;height:48px;border-radius:12px;margin-bottom:6px}
.auth-brand h1{font-family:var(--f-head);font-size:28px;font-weight:600}
.auth-brand p{color:var(--muted)}
.stack{display:flex;flex-direction:column;gap:12px}
.stack > label{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:700;color:var(--muted)}
.check{flex-direction:row!important;align-items:flex-start;gap:10px!important;font-weight:500!important;color:var(--ink)!important;font-size:14px!important}
.check input{margin-top:2px;width:20px;height:20px;flex:none;accent-color:var(--accent)}
.auth-links{display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px 10px;font-size:14px}
.auth-title{font-family:var(--f-head);font-size:22px;font-weight:600}
.auth-note{background:var(--soft);color:var(--soft-ink);border-radius:12px;padding:10px 12px;font-size:14px;line-height:1.45}
.pass{position:relative;display:block}
.pass input{padding-right:52px}
.eye{appearance:none;position:absolute;right:2px;top:50%;transform:translateY(-50%);width:44px;height:44px;border:0;background:none;border-radius:10px;color:var(--muted);cursor:pointer;display:grid;place-items:center}
.eye svg{width:22px;height:22px}
.eye[aria-pressed="true"]{color:var(--accent-text)}

/* Печать приложения выключена: книги и их страницы не печатаются */
@media print{
  body > *{display:none!important}
  body::before{content:"Печать отключена.";display:block;padding:40px;font:16px sans-serif}
}
