@font-face{font-family:"Lora";font-style:normal;font-weight:500;font-display:swap;src:url(fonts/lora-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:"Lora";font-style:normal;font-weight:500;font-display:swap;src:url(fonts/lora-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:"Lora";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/lora-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:"Lora";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/lora-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:"Manrope";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/manrope-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:"Manrope";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/manrope-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:"Manrope";font-style:normal;font-weight:500;font-display:swap;src:url(fonts/manrope-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:"Manrope";font-style:normal;font-weight:500;font-display:swap;src:url(fonts/manrope-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:"Manrope";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/manrope-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:"Manrope";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/manrope-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:"Manrope";font-style:normal;font-weight:700;font-display:swap;src:url(fonts/manrope-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:"Manrope";font-style:normal;font-weight:700;font-display:swap;src:url(fonts/manrope-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:#F2F0EB; --card:#FFFFFF; --ink:#1F1E1C; --ink-2:#33312D; --muted:#66625B; --line:#DEDAD2;
  --nav:#FBFAF7; --field:#FFFFFF; --field-line:#CFCAC0; --dash:#8C877E; --dot-off:#EEEBE4; --photo:#E4E0D7;
  --accent:#4E5A2C; --on-accent:#FFFFFF; --accent-text:#4E5A2C; --soft:#E3E6D6; --soft-ink:#3A4420;
  --danger:#A23B2A; --stone-empty:#EDEAE3; --stone-shadow:rgba(0,0,0,.22);
  --f-head:"Lora", Georgia, "Times New Roman", serif;
  --f-body:"Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --col:520px;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){
  --bg:#171815; --card:#23241F; --ink:#ECEAE3; --ink-2:#D9D6CE; --muted:#A39F95; --line:#36372F;
  --nav:#1D1E1A; --field:#2A2B25; --field-line:#4A4B41; --dash:#76736A; --dot-off:#34352E; --photo:#2E2F29;
  --accent:#A9B972; --on-accent:#1B1F0E; --accent-text:#B9C77F; --soft:#30361F; --soft-ink:#CFDB9E;
  --danger:#E58A78; --stone-empty:#8D8A80; --stone-shadow:rgba(0,0,0,.5);
  color-scheme:dark;
}}
:root[data-theme="dark"]{
  --bg:#171815; --card:#23241F; --ink:#ECEAE3; --ink-2:#D9D6CE; --muted:#A39F95; --line:#36372F;
  --nav:#1D1E1A; --field:#2A2B25; --field-line:#4A4B41; --dash:#76736A; --dot-off:#34352E; --photo:#2E2F29;
  --accent:#A9B972; --on-accent:#1B1F0E; --accent-text:#B9C77F; --soft:#30361F; --soft-ink:#CFDB9E;
  --danger:#E58A78; --stone-empty:#8D8A80; --stone-shadow:rgba(0,0,0,.5);
  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}
[hidden]{display:none!important}
img{max-width:100%}
button,input,select,textarea{font:inherit;color:inherit}
h1,h2,h3{margin:0;line-height:1.2}
p{margin:0}
a{color:var(--accent-text)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.muted{color:var(--muted)}
.grow{flex:1}

/* Колонка по центру и нижнее меню */
main{max-width:var(--col);margin:0 auto;padding:calc(16px + env(safe-area-inset-top,0px)) 20px calc(100px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:14px}
.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(10px + env(safe-area-inset-bottom,0px))}
.tab{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 0;min-height:44px;text-decoration:none;color:var(--muted);font-size:12px;font-weight:600}
.tab svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.tab[aria-current="page"]{color:var(--accent-text);font-weight:700}
.loading{color:var(--muted);padding:48px 0;text-align:center}
.notice,.update-bar{max-width:var(--col);margin:12px auto 0;padding:0 20px}
.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:25px;font-weight:600}
.me{width:44px;height:44px;flex:none;border-radius:50%;background:var(--accent);color:var(--on-accent);display:grid;place-items:center;font-weight:700;font-size:17px;text-decoration:none}
.nav-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:-4px -8px -4px -8px}
.back{min-height:44px;display:inline-flex;align-items:center;gap:2px;padding:0 8px 0 4px;font-size:16px;font-weight:600;text-decoration:none;color:var(--accent-text);background:none;border:0;cursor:pointer;min-width:0}
.back span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.back svg{width:22px;height:22px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.form-head{display:grid;grid-template-columns:90px 1fr 90px;align-items:center;margin:-4px -8px 0}
.form-head h1{text-align:center;font-size:17px;font-weight:700;font-family:var(--f-body)}
.title{font-family:var(--f-head);font-size:27px;font-weight:600;overflow-wrap:anywhere}
.lead{font-size:14px;line-height:1.45;color:var(--muted)}
.label{margin:6px 0 0;font-size:13px;font-weight:700;letter-spacing:.6px;text-transform:uppercase;color:var(--muted);display:flex;align-items:center;justify-content:space-between;gap:8px}
.label .side{text-transform:none;letter-spacing:0;font-weight:600;font-size:12.5px;display:inline-flex;align-items:center;gap:4px}
.label .side svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* Кнопки */
.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:700;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.outline{border-color:var(--accent);color:var(--accent-text);background:var(--card)}
.btn.soft{background:var(--soft);border-color:var(--accent);color:var(--soft-ink)}
.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}
.btn.sm{min-height:36px;padding:0 12px;font-size:14px;border-radius:10px}
.btn:disabled{opacity:.55;cursor:default}
.btn svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
.dashed{appearance:none;min-height:46px;border-radius:14px;border:1.5px dashed var(--dash);background:transparent;color:var(--accent-text);font-weight:700;font-size:15px;cursor:pointer;width:100%;padding:0 14px}
.dashed:disabled{opacity:.5;cursor:default}
.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;font-size:24px;line-height:1;flex:none}
.icon-btn svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.icon-btn .fill{fill:currentColor;stroke:none}
.icon-btn:hover{background:color-mix(in srgb,var(--ink) 7%,transparent)}
.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}

/* Карточки */
.card{background:var(--card);border-radius:16px;padding:16px;display:flex;flex-direction:column;gap:12px}
.card h2{font-size:16px;font-weight:700}
.empty{color:var(--muted);font-size:14px;line-height:1.5}
.pill{align-self:flex-start;display:inline-flex;align-items:center;gap:4px;font-size:12px;font-weight:700;color:var(--soft-ink);background:var(--soft);border-radius:999px;padding:2px 9px;white-space:nowrap}

/* Стих на главной */
.verse{display:flex;flex-direction:column;gap:8px;padding:16px;border-radius:16px;background:var(--card);text-decoration:none;color:var(--ink)}
.verse .top{display:flex;justify-content:space-between;gap:8px;font-size:12px;font-weight:700;letter-spacing:.6px;text-transform:uppercase;color:var(--muted)}
.verse .top span + span{text-transform:none;letter-spacing:0;font-weight:600}
.verse .text{font-family:var(--f-head);font-size:17px;line-height:1.45;white-space:pre-line;overflow-wrap:anywhere}
.verse .ref{font-size:13px;font-weight:600;color:var(--muted)}
button.verse{width:100%;text-align:left;font:inherit;cursor:pointer}
.verse.empty-verse{background:transparent;border:1.5px dashed var(--dash)}
.verse.empty-verse .text{font-size:16px;color:var(--muted)}

/* Неделя */
.week-top{display:flex;justify-content:space-between;align-items:baseline;gap:8px}
.week-top b{font-size:15px}
.week-top span{font-size:13px;color:var(--muted);white-space:nowrap}
.week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px}
.day{display:flex;flex-direction:column;align-items:center;gap:6px}
.day span{font-size:12px;font-weight:600;color:var(--muted)}
.day i{width:30px;height:30px;border-radius:50%;background:var(--dot-off);border:2px solid transparent;display:block}
.day.on i{background:var(--accent);border-color:var(--accent)}
.day.today i{border-color:var(--accent)}
.day.today span{color:var(--ink);font-weight:700}

/* Камни */
.stones{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));column-gap:10px;row-gap:16px}
.stone-btn{position:relative;aspect-ratio:5/3;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:20% 8px 0;text-decoration:none;cursor:pointer;border:0;background:none;font:inherit;min-width:0;width:100%}
.stone-btn.ink-light{color:#FFFFFF}
.stone-btn.ink-dark{color:#1F1E1C}
.stone-btn.add{color:var(--accent-text)}
.stone{position:absolute;inset:0;background-image:url(img/stone.webp);background-size:100% 100%;background-blend-mode:multiply;-webkit-mask-image:url(img/stone.webp);mask-image:url(img/stone.webp);-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;background-repeat:no-repeat}
.stone-shadow{position:absolute;left:8%;right:6%;bottom:-3px;height:10px;border-radius:50%;background:var(--stone-shadow);filter:blur(4px)}
.stone.empty{background-color:var(--stone-empty);opacity:.6}
.stone-name,.stone-count{position:relative;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.stone-name{font-size:15px;font-weight:700;line-height:1.25}
.stone-name.long{font-size:13px}
.stone-count{font-size:11.5px;font-weight:600}
.ink-light .stone-name,.ink-light .stone-count{text-shadow:0 1px 3px rgba(0,0,0,.75)}
.ink-dark .stone-name,.ink-dark .stone-count{text-shadow:0 0 3px rgba(255,255,255,.8)}
.stone-btn svg{position:relative;width:28px;height:28px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;margin-top:-6%}
.stone-cell{display:flex;flex-direction:column;gap:6px;min-width:0}
.move{display:flex;justify-content:center;gap:6px}
.move .icon-btn{width:40px;height:40px;background:var(--card);border:1px solid var(--line)}
.move .icon-btn:disabled{opacity:.35}
.hint{font-size:14px;line-height:1.5;color:var(--muted)}
.row-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap}

/* Раздел */
.sec-title{display:flex;align-items:center;gap:12px;min-width:0}
.sec-title .mini{position:relative;width:58px;height:28px;flex:none}
.sec-title h1{font-family:var(--f-head);font-size:28px;font-weight:600;overflow-wrap:anywhere}
.sec-title div{display:flex;flex-direction:column;gap:2px;min-width:0}
.sec-title span{font-size:13px;color:var(--muted)}

/* Список нужд */
.needs{display:flex;flex-direction:column;gap:8px}
.need-row{display:flex;gap:12px;align-items:center;padding:12px;border-radius:14px;background:var(--card);text-decoration:none;color:var(--ink);min-width:0}
.need-row .pic{width:52px;height:52px;flex:none;border-radius:50%;background:var(--dot-off);color:var(--muted);display:grid;place-items:center;overflow:hidden}
.need-row .pic img{width:100%;height:100%;object-fit:cover;display:block}
.need-row .pic svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.need-row .pic.ok{background:var(--soft);color:var(--soft-ink)}
.need-row .txt{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.need-row b{font-size:16px;overflow-wrap:anywhere}
.need-row .desc{font-size:14px;color:var(--ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.need-row .when{font-size:12.5px;color:var(--muted)}
.need-row.answered b{color:var(--ink-2)}

/* Нужда */
.photo{display:block;width:100%;height:200px;border-radius:16px;background:var(--photo);border:0;padding:0;overflow:hidden;cursor:zoom-in}
.photo img{width:100%;height:100%;object-fit:cover;display:block}
.photo-add{min-height:44px;border-radius:14px;border:1.5px dashed var(--dash);background:transparent;color:var(--muted);display:flex;align-items:center;justify-content:center;gap:8px;font-weight:600;font-size:14px;cursor:pointer}
.photo-add svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.need-head{display:flex;flex-direction:column;gap:6px}
.need-head h1{font-family:var(--f-head);font-size:25px;font-weight:600;line-height:1.2;overflow-wrap:anywhere}
.need-head span{font-size:13px;color:var(--muted)}
.prose{font-size:15px;line-height:1.5;color:var(--ink-2);white-space:pre-line;overflow-wrap:anywhere}
.btn-row{display:flex;gap:8px}
.btn-row .btn{flex:1;min-height:48px}
.answer{background:var(--soft);color:var(--soft-ink);border-radius:14px;padding:12px 14px;display:flex;flex-direction:column;gap:4px}
.answer b{font-size:13px}
.answer p{font-size:15px;line-height:1.45;white-space:pre-line;overflow-wrap:anywhere}
.entries{display:flex;flex-direction:column;gap:8px}
.entry{appearance:none;text-align:left;border:0;cursor:pointer;background:var(--card);border-radius:14px;padding:12px 14px;display:flex;flex-direction:column;gap:4px;color:var(--ink);width:100%}
.entry small{font-size:12.5px;font-weight:700;color:var(--muted)}
.entry span{font-size:15px;line-height:1.45;white-space:pre-line;overflow-wrap:anywhere}
.fold{background:var(--card);border-radius:14px}
.fold > summary{list-style:none;min-height:48px;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 span{display:flex;align-items:center;gap:8px}
.fold > summary svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
.fold > summary .chev{stroke:var(--muted);stroke-width:2;transition:transform .15s}
.fold[open] > summary .chev{transform:rotate(90deg)}
.fold-body{padding:0 14px 14px;display:flex;flex-direction:column;gap:10px}
.file{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px solid var(--line)}
.file:first-child{border-top:0}
.file-ext{font-size:11px;font-weight:700;text-transform:uppercase;background:var(--dot-off);color:var(--muted);border-radius:8px;width:44px;height:44px;display:grid;place-items:center;flex:none}
.file-main{flex:1;min-width:0;display:flex;flex-direction:column}
.file-main .fname{appearance:none;border:0;background:none;padding:0;text-align:left;font-weight:600;color:var(--ink);cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.file-main b{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.file-main span{font-size:12.5px;color:var(--muted)}
.upload input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}


/* Новый раздел */
.preview{position:relative;align-self:center;width:min(280px,82%);aspect-ratio:2.1;display:flex;align-items:center;justify-content:center;padding-top:7%}
.preview .stone-shadow{height:14px;bottom:-5px}
.preview .pv-name{position:relative;font-family:var(--f-head);font-size:28px;font-weight:600;max-width:80%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.preview.ink-light{color:#fff}.preview.ink-light .pv-name{text-shadow:0 1px 4px rgba(0,0,0,.8)}
.preview.ink-dark{color:#1F1E1C}.preview.ink-dark .pv-name{text-shadow:0 0 4px rgba(255,255,255,.85)}
.field{display:flex;flex-direction:column;gap:8px}
.field > label,.field > .flabel{font-size:13px;font-weight:700;color:var(--muted)}
input[type=text],input[type=email],input[type=password],input[type=date],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)}
.swatches{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.swatch{height:58px;border-radius:14px;border:2px solid transparent;background:transparent;padding:10px 7px 8px;cursor:pointer}
.swatch span{position:relative;display:block;width:100%;height:100%}
.swatch[aria-pressed="true"]{border-color:var(--ink);background:var(--card)}
.choice{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.choice.four{grid-template-columns:repeat(2,minmax(0,1fr))}
.choice button{min-height:44px;border-radius:12px;border:1.5px solid var(--field-line);background:var(--card);color:var(--ink);font-weight:600;font-size:15px;cursor:pointer;padding:4px 8px}
.choice button[aria-pressed="true"]{border-color:var(--accent);background:var(--soft);color:var(--soft-ink);font-weight:700}
.choice button:disabled{opacity:.5;cursor:default}
.parents{display:flex;flex-direction:column;gap:6px}
.parents label{display:flex;align-items:center;gap:10px;min-height:44px;padding:0 12px;border-radius:12px;background:var(--card);border:1.5px solid transparent;cursor:pointer}
.parents input{width:20px;height:20px;accent-color:var(--accent);flex:none}
.parents label:has(input:checked){border-color:var(--accent)}
.parents .dot{position:relative;width:36px;height:18px;flex:none}

/* Стихи */
.verse-item{display:flex;gap:6px;align-items:flex-start;background:var(--card);border-radius:14px;padding:12px 4px 12px 14px;border:1.5px solid transparent}
.verse-item.current{border-color:var(--accent)}
.verse-item .vi{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}
.verse-item .vt{font-family:var(--f-head);font-size:15px;line-height:1.45;white-space:pre-line;overflow-wrap:anywhere}
.verse-item .vr{font-size:12.5px;font-weight:600;color:var(--muted)}
.verse-item .vbtns{display:flex;flex-direction:column}
.verse-item .icon-btn{color:var(--muted)}
.verse-item .icon-btn:disabled{opacity:.3}

/* Профиль */
.me-card{flex-direction:row;align-items:center;gap:14px}
.me-card .me{width:56px;height:56px;font-size:22px}
.me-card .who{flex:1;min-width:0;display:flex;flex-direction:column}
.me-card .who b{font-size:17px;overflow-wrap:anywhere}
.me-card .who span{font-size:14px;color:var(--muted);overflow-wrap:anywhere}
.links{background:var(--card);border-radius:16px;overflow:hidden}
.links a{display:flex;align-items:center;gap:10px;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;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
.links a .chev{stroke:var(--muted);stroke-width:2}
.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}
.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}
.form-err{color:var(--danger);font-size:14px}
.form-ok{color:var(--accent-text);font-size:14px}
.answers{display:flex;flex-direction:column;gap:8px}
.ans{display:flex;flex-direction:column;gap:4px;padding:14px;border-radius:14px;background:var(--card);text-decoration:none;color:var(--ink)}
.ans small{font-size:12.5px;font-weight:700;color:var(--muted)}
.ans b{font-size:16px;overflow-wrap:anywhere}
.ans p{font-size:14px;color:var(--ink-2);white-space:pre-line;overflow-wrap:anywhere}

/* Меню «⋯» */
.menu{position:fixed;z-index:60;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(480px,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}
.dlg-body{padding:6px 20px 14px;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}
.ph-pick{display:flex;align-items:center;gap:12px}
.ph-pick .thumb{width:64px;height:64px;border-radius:12px;background:var(--photo);overflow:hidden;flex:none;display:grid;place-items:center;color:var(--muted)}
.ph-pick .thumb img{width:100%;height:100%;object-fit:cover;display:block}
.ph-pick .thumb svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.ph-pick .acts{display:flex;gap:6px;flex-wrap:wrap}

/* Просмотр файлов и фото */
#viewer{width:min(900px,calc(100vw - 16px));height:calc(100dvh - 32px);max-height:none;background:var(--card)}
#viewer[open]{display:flex;flex-direction:column}
.v-head{display:flex;align-items:center;gap:8px;padding:8px 8px 8px 18px;border-bottom:1px solid var(--line)}
.v-head h2{font-size:15px;font-weight:700;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.v-body{flex:1;overflow:auto;padding:20px clamp(12px,4vw,48px)}
.v-msg{color:var(--muted);text-align:center;padding:40px 0;display:grid;gap:12px;justify-items:center}
.v-img{display:block;max-width:100%;max-height:100%;margin:0 auto;border-radius:8px;object-fit:contain}
.v-body.is-img{display:grid;place-items:center;padding:8px}
.doc-view{max-width:72ch;margin:0 auto;font-family:var(--f-head);font-size:16px;line-height:1.65}
.doc-view p{margin:0 0 .8em}
.doc-view table{border-collapse:collapse;margin:1em 0;display:block;overflow-x:auto}
.doc-view td,.doc-view th{border:1px solid var(--line);padding:4px 8px}
.v-body.is-pdf{background:var(--bg);padding:12px;display:grid;gap:12px;align-content:start;justify-items:center}
.pdf-page{width:100%;max-width:820px;background:#fff;box-shadow:0 1px 3px rgb(0 0 0 / .2);display:grid;place-items:center;color:#9a958b;font-size:13px}
.pdf-page canvas{display:block;width:100%;height: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)}

/* Вход и регистрация */
.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}
.auth-brand{display:flex;flex-direction:column;gap: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:10px;font-size:14px}

@media (min-width:700px){
  main{padding-top:28px}
}
@media (prefers-reduced-motion: reduce){ *{transition:none!important} }
