/* Share: стиловете. Основа: Open Props (MIT, vendor/open-props.min.css: easing, сенки, радиуси, keyframes).
   Теми: data-theme на <html> = light | dark | sepia | auto. Шрифт за четене: data-font = serif | pt | sans | mono.
   Първо за телефон (375 px), после по-широко. Акцент: синьо-зелено и кехлибар. */
:root {
  --accent: #0d7f6f; --accent-2: #12a58f; --accent-ink: #fff; --accent-soft: #d9f2ec; --amber: #f2a516; --danger: #d64545;
  --bg: #f4f7f6; --surface: #ffffff; --surface-2: #eef3f1; --text: #13221f; --muted: #5d706b; --line: rgba(19, 34, 31, .1);
  --shadow: 0 1px 2px rgba(10, 40, 34, .05);
  --glass: rgba(255, 255, 255, .78);
  --r-size: 19px; --r-lh: 1.65; --r-width: 680px;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --spring: var(--ease-spring-3, cubic-bezier(.5, 1.4, .5, 1));
  --out: var(--ease-out-4, cubic-bezier(0, 0, .1, 1));
  --mark-y: #ffe58a; --mark-g: #b7f0c6; --mark-b: #b9dcff; --mark-o: #ffc9a3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --accent: #2fc2a8; --accent-2: #5fdcc4; --accent-ink: #06201b; --accent-soft: #123b34; --amber: #f7b733;
    --bg: #0d1413; --surface: #151f1d; --surface-2: #1c2826; --text: #e6efec; --muted: #93a6a1; --line: rgba(230, 239, 236, .1);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35); --glass: rgba(21, 31, 29, .8);
    --mark-y: #6a5a12; --mark-g: #1f5a32; --mark-b: #1d4570; --mark-o: #6e3c1b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #2fc2a8; --accent-2: #5fdcc4; --accent-ink: #06201b; --accent-soft: #123b34; --amber: #f7b733;
  --bg: #0d1413; --surface: #151f1d; --surface-2: #1c2826; --text: #e6efec; --muted: #93a6a1; --line: rgba(230, 239, 236, .1);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35); --glass: rgba(21, 31, 29, .8);
  --mark-y: #6a5a12; --mark-g: #1f5a32; --mark-b: #1d4570; --mark-o: #6e3c1b;
  color-scheme: dark;
}
:root[data-theme="sepia"] {
  --accent: #8a5a12; --accent-2: #b07a26; --accent-ink: #fff; --accent-soft: #eadcbc; --amber: #c27c0e;
  --bg: #f4ecd8; --surface: #fbf5e6; --surface-2: #ede2c6; --text: #3b2f1e; --muted: #7a6a50; --line: rgba(59, 47, 30, .14);
  --shadow: 0 1px 2px rgba(80, 60, 20, .07); --glass: rgba(251, 245, 230, .85);
}
:root[data-font="serif"] { --r-font: "Literata", Georgia, "Times New Roman", serif; }
:root[data-font="pt"] { --r-font: "PT Serif", Georgia, serif; }
:root[data-font="sans"] { --r-font: var(--ui); }
:root[data-font="mono"] { --r-font: ui-monospace, "Cascadia Code", "Consolas", monospace; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font: 16px/1.5 var(--ui);
  -webkit-tap-highlight-color: transparent; overflow-x: hidden; text-wrap: pretty; overflow-wrap: break-word;
  transition: background .35s var(--out), color .35s var(--out);
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.25em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.break { word-break: break-all; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: var(--surface-2); }
.err { color: var(--danger); white-space: pre-line; margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack { display: grid; gap: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- зареждане ---------- */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 22px; }
.boot img { animation: var(--animation-float, none); filter: drop-shadow(0 10px 20px rgba(13, 127, 111, .35)); }
.boot h1 { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- бутони, полета, чипове ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .18s var(--spring), background .2s, box-shadow .2s; text-align: center;
}
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent;  }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.big { width: 100%; min-height: 52px; font-size: 1.05rem; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .9rem; }
.btn.busy { pointer-events: none; opacity: .8; }
.btn.busy::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 1px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn:disabled { opacity: .6; }
.link { background: none; border: 0; color: var(--accent); padding: 4px 0; text-decoration: underline; cursor: pointer; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--text); cursor: pointer;
  transition: background .2s, transform .2s var(--spring); text-decoration: none;
}
.icon-btn:active { transform: scale(.88); background: var(--surface-2); }
.icon-btn.small { width: 34px; height: 34px; }
.icon-btn.big { width: 56px; height: 56px; background: var(--accent); color: var(--accent-ink); }
.icon-btn[aria-pressed="true"] { color: var(--amber); }
.icon-btn[aria-pressed="true"] .i { fill: currentColor; }
.fld { display: grid; gap: 6px; margin: 0 0 14px; position: relative; }
.fld > span { font-size: .88rem; font-weight: 600; color: var(--muted); }
.fld input, .fld textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); font-size: 16px;
  transition: border-color .2s, box-shadow .2s, background .2s; outline: none;
}
.fld textarea { resize: vertical; }
.fld input:focus, .fld textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.eye { position: absolute; right: 2px; bottom: 1px; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.fld input[data-eye] { padding-right: 44px; }
.pre { white-space: pre-line; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 3px 11px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-size: .85rem; text-decoration: none; cursor: pointer; transition: transform .15s var(--spring);
}
.chip:active { transform: scale(.94); }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.chip.ghost { border-style: dashed; background: transparent; }
.chip .i { width: 1em; height: 1em; }
select { border: 0; background: transparent; cursor: pointer; }

/* ---------- вход ---------- */
.auth { min-height: 100dvh; padding: max(28px, env(safe-area-inset-top)) 16px 28px; display: grid; align-content: start; justify-items: center; gap: 22px;
  background: radial-gradient(1200px 520px at 50% -180px, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%), var(--bg); }
.auth-hero { text-align: center; animation: rise .7s var(--out) both; }
.auth-hero h1 { font-size: 2.3rem; letter-spacing: -.03em; margin-top: 10px; }
.auth-hero .tag { color: var(--muted); margin: 6px auto 0; max-width: 32ch; white-space: pre-line; }
.logo-big { display: inline-grid; place-items: center; width: 108px; height: 108px; border-radius: 6px; background: var(--surface); box-shadow: var(--shadow);
  animation: bob 5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }
.card { background: var(--surface); border-radius: 6px; padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-card { width: 100%; max-width: 420px; animation: rise .6s .08s var(--out) both; }
.auth-card h2 { font-size: 1.35rem; margin-bottom: 16px; }
.auth-card p { white-space: pre-line; }
.auth-card.center p, .auth-card.center h2 { margin: 0; }
.auth-card.center { text-align: center; display: grid; gap: 12px; justify-items: center; }
.auth-card.center .i { width: 44px; height: 44px; color: var(--danger); }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: .95rem; }
.auth-links a { padding: 6px 0; }
.feats { width: 100%; max-width: 420px; display: grid; gap: 10px; }
.feat { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 6px; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line);
  animation: rise .6s calc(.2s + var(--d) * .07s) var(--out) both; }
.feat .i { width: 30px; height: 30px; color: var(--accent); padding: 4px; }
.feat b { display: block; }
.feat span { color: var(--muted); font-size: .9rem; }
.foot { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: center; font-size: .9rem; color: var(--muted); padding: 10px 0 20px; }
.langsel { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; background: var(--surface); }
.langsel select { min-height: 32px; }
.mail-anim .i, .ok-anim .i { width: 64px !important; height: 64px !important; }
.mail-anim { color: var(--accent); animation: bob 2.4s ease-in-out infinite; }
.mail-anim .i { color: var(--accent) !important; }
.ok-anim { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); animation: popin .6s var(--spring) both; }
.ok-anim .i { color: var(--accent-ink) !important; stroke-width: 1.6; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .5s .25s var(--out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes popin { from { transform: scale(.3); opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.pop { animation: popin .45s var(--spring) both; }

/* ---------- горна лента ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(6px + env(safe-area-inset-top)) 8px 6px 16px; background: var(--glass); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.top-tools { display: flex; align-items: center; }
.searchbar { display: none; position: absolute; inset: auto 8px 6px 8px; align-items: center; gap: 4px; }
.searchbar input { flex: 1; min-width: 0; min-height: 44px; border-radius: 6px; border: 1px solid var(--accent); background: var(--surface); padding: 8px 14px; font-size: 16px; outline: none; box-shadow: 0 0 0 1px var(--accent); }
.top.searching .searchbar { display: flex; animation: rise .25s var(--out); }
.top.searching .brand, .top.searching .top-tools { visibility: hidden; }
.netbar { display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: color-mix(in srgb, var(--amber) 22%, var(--surface)); font-size: .9rem; white-space: pre-line; }

/* ---------- списък ---------- */
.main { padding: 8px 12px calc(110px + env(safe-area-inset-bottom)); max-width: 820px; margin: 0 auto; }
.list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; padding: 12px 4px 12px; }
.list-head h1 { font-size: 1.7rem; letter-spacing: -.02em; }
.list-head p { margin: 2px 0 0; font-size: .9rem; }
.sortsel { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: .9rem; border-radius: 6px; padding: 2px 6px 2px 10px; background: var(--surface); border: 1px solid var(--line); }
.sortsel select { min-height: 34px; color: var(--text); }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.card-item { position: relative; border-radius: 6px; animation: rise .5s calc(var(--i) * 45ms) var(--out) both; }
.card-item.gone { animation: none; transition: opacity .25s; opacity: 0; }
.card-body {
  position: relative; z-index: 1; display: flex; gap: 12px; padding: 14px 44px 16px 16px; background: var(--surface); border-radius: 6px; border: 1px solid var(--line);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: transform .35s var(--spring), box-shadow .2s; touch-action: pan-y;
}
.card-body:active { box-shadow: 0 0 0 2px var(--accent-soft); }
.ct { flex: 1; min-width: 0; }
.card-body h3 { font-size: 1.06rem; font-weight: 700; letter-spacing: -.01em; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0 0; color: var(--muted); font-size: .84rem; }
.meta .i { width: 1em; height: 1em; }
.fav-ico { width: 16px; height: 16px; border-radius: 4px; }
.pend { color: var(--amber); }
.ex { margin: 6px 0 0; color: var(--muted); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ex mark { background: var(--mark-y); color: inherit; border-radius: 3px; }
.thumb { flex: none; width: 92px; height: 92px; border-radius: 6px; overflow: hidden; background: var(--surface-2); align-self: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--out); }
.card-body:hover .thumb img { transform: scale(1.06); }
.pbar { position: absolute; z-index: 2; left: 16px; right: 16px; bottom: 6px; height: 3px; border-radius: 3px; background: var(--surface-2); overflow: hidden; pointer-events: none; }
.pbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 3px; }
.more { position: absolute; z-index: 2; top: 6px; right: 2px; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); border-radius: 50%; cursor: pointer; }
.star-badge { position: absolute; z-index: 2; right: 12px; bottom: 14px; color: var(--amber); pointer-events: none; }
.star-badge .i { fill: currentColor; width: 1em; height: 1em; }
.swipe-bg { position: absolute; inset: 0; border-radius: 6px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; font-weight: 700; color: #fff; overflow: hidden; }
.swipe-bg span { display: flex; align-items: center; gap: 8px; opacity: 0; transform: scale(.8); transition: opacity .2s, transform .3s var(--spring); }
.card-item.sw-l .swipe-bg { background: var(--amber); }
.card-item.sw-r .swipe-bg { background: var(--accent); }
.card-item.sw-l .sb-l, .card-item.sw-r .sb-r { opacity: .7; }
.card-item.sw-go .sb-l, .card-item.sw-go .sb-r { opacity: 1; transform: scale(1.12); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); display: grid; justify-items: center; gap: 14px; }
.empty p { white-space: pre-line; max-width: 34ch; margin: 0; }
.empty-art { width: 110px; height: 110px; border-radius: 6px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--amber) 20%, var(--surface))); color: var(--accent); animation: bob 4s ease-in-out infinite; }
.empty-art .i { width: 50px; height: 50px; }
.skel { display: grid; gap: 12px; padding: 8px 0; }
.skel i { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 300% 100%; animation: shimmer 1.4s infinite; }
.skel i:nth-child(3n) { width: 70%; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* ---------- долна навигация и бутонът „+“ ---------- */
.bnav {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom)); width: min(520px, calc(100% - 20px));
  display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px; border-radius: 6px; background: var(--glass);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px); box-shadow: var(--shadow); border: 1px solid var(--line);
}
.bnav a { position: relative; display: grid; justify-items: center; gap: 2px; padding: 7px 2px 6px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 600; transition: color .2s; }
.bnav a .i { width: 23px; height: 23px; transition: transform .35s var(--spring); }
.bnav a.on { color: var(--accent); background: var(--accent-soft); }
.bnav a.on .i { transform: translateY(-1px) scale(1.1); }
.bnav a span { white-space: nowrap; overflow: hidden; max-width: 100%; }
.fab {
  position: fixed; z-index: 31; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 6px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .18); display: grid; place-items: center;
  animation: popin .5s .2s var(--spring) both; transition: transform .3s var(--spring), border-radius .3s;
}
.fab .i { width: 28px; height: 28px; stroke-width: 1.5; transition: transform .4s var(--spring); }
.fab:active { transform: scale(.9); border-radius: 6px; }
.fab:hover .i { transform: rotate(90deg); }

/* ---------- долни прозорци (sheet) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(5, 15, 13, 0); transition: background .28s; display: flex; align-items: flex-end; justify-content: center; }
.sheet-wrap.on { background: rgba(5, 15, 13, .45); }
.sheet {
  width: min(560px, 100%); max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border-radius: 6px 6px 0 0;
  padding: 6px 18px calc(22px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .38s var(--spring); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
}
.sheet-wrap.on .sheet { transform: none; }
.sheet h2 { font-size: 1.2rem; margin: 6px 0 14px; }
.grab { width: 100%; height: 26px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.grab::before { content: ""; width: 44px; height: 5px; border-radius: 3px; background: var(--line); }
.menu { display: grid; gap: 2px; margin-top: 10px; }
.menu button, .menu a { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 8px 10px; border: 0; background: none; border-radius: 6px; text-align: left; color: var(--text); text-decoration: none; font-size: 1rem; cursor: pointer; }
.menu button:active, .menu a:active { background: var(--surface-2); }
.menu .i { color: var(--accent); width: 22px; height: 22px; }
.menu .danger, .menu .danger .i { color: var(--danger); }
.tagbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 50px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); }
.tagbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tchips { display: contents; }
.tin { flex: 1; min-width: 120px; border: 0; background: none; outline: none; min-height: 34px; font-size: 16px; }
.tsug { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 0 0 14px; }
.seg button { min-height: 50px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: .85rem; transition: transform .2s var(--spring), border-color .2s; display: grid; place-items: center; line-height: 1.2; padding: 4px; }
.seg button.on { border-color: var(--accent); transform: translateY(-2px); }
.seg small { display: block; font-weight: 400; font-size: .7rem; color: var(--muted); }
.seg .th-light { background: #fff; color: #13221f; } .seg .th-dark { background: #151f1d; color: #e6efec; } .seg .th-sepia { background: #f4ecd8; color: #3b2f1e; }
.seg .th-auto { background: linear-gradient(135deg, #fff 50%, #151f1d 50%); color: #13221f; }
.seg .th-auto span { background: rgba(255, 255, 255, .9); color: #13221f; border-radius: 4px; padding: 2px 6px; }
.seg .f-serif { font-family: "Literata", serif; font-size: 1.1rem; } .seg .f-pt { font-family: "PT Serif", serif; font-size: 1.1rem; } .seg .f-mono { font-family: ui-monospace, monospace; }
.rng { display: grid; gap: 4px; margin-bottom: 12px; font-size: .9rem; color: var(--muted); font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--accent); min-height: 32px; }
.colors button { min-height: 44px; }
.colors .c-y { background: var(--mark-y); } .colors .c-g { background: var(--mark-g); } .colors .c-b { background: var(--mark-b); } .colors .c-o { background: var(--mark-o); }

/* ---------- съобщения ---------- */
.toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px) scale(.95); opacity: 0;
  width: max-content; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; border-radius: 6px;
  background: #13221f; color: #fff; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); transition: transform .35s var(--spring), opacity .25s; white-space: pre-line; font-size: .95rem;
}
.toast.on { transform: translate(-50%, 0) scale(1); opacity: 1; }
.toast.err { background: #8f2424; }
.toast.ok { background: #0b5d52; }
.toast button { border: 0; background: rgba(255, 255, 255, .16); color: #fff; border-radius: 6px; padding: 8px 12px; font-weight: 700; cursor: pointer; min-height: 38px; }

/* ---------- четецът ---------- */
.rbar {
  position: fixed; z-index: 40; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: calc(4px + env(safe-area-inset-top)) 6px 4px;
  background: var(--glass); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); transition: transform .35s var(--out);
}
.rbar.hide { transform: translateY(-100%); }
.rbar.hide .rprog { transform: translateY(calc(100% + 0px)); }
.rtools { display: flex; }
.rprog { position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; transition: transform .35s var(--out); }
.rprog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--amber)); border-radius: 0 3px 3px 0; }
.reader { max-width: var(--r-width); margin: 0 auto; padding: calc(70px + env(safe-area-inset-top)) 20px 140px; font-family: var(--r-font); font-size: var(--r-size); line-height: var(--r-lh); }
.rhead { font-family: var(--ui); margin-bottom: 26px; }
.rsite { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; text-decoration: none; }
.rsite .i { width: 1em; height: 1em; }
.rhead h1 { font-family: var(--r-font); font-size: calc(var(--r-size) * 1.55); line-height: 1.2; margin: 10px 0 10px; letter-spacing: -.015em; }
.rmeta { color: var(--muted); font-size: .9rem; margin: 0; }
.chip.add { color: var(--accent); }
.rbody { overflow-wrap: break-word; }
.rbody > *:first-child { margin-top: 0; }
.rbody p, .rbody ul, .rbody ol, .rbody blockquote, .rbody figure, .rbody pre, .rbody table { margin: 0 0 1.1em; }
.rbody h2, .rbody h3, .rbody h4 { font-family: var(--r-font); margin: 1.6em 0 .6em; line-height: 1.3; }
.rbody h2 { font-size: 1.32em; } .rbody h3 { font-size: 1.15em; }
.rbody img { display: block; height: auto; margin: 1.2em auto; border-radius: 6px; max-height: 80vh; object-fit: contain; }
.rbody figure img { margin-bottom: .4em; }
.rbody figcaption { font-family: var(--ui); font-size: .8rem; color: var(--muted); text-align: center; }
.rbody blockquote { border-left: 2px solid var(--accent); padding: .2em 0 .2em 1em; margin-left: 0; font-style: italic; color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
.rbody pre { overflow-x: auto; background: var(--surface-2); padding: 12px; border-radius: 6px; font-size: .8em; }
.rbody code { font-size: .88em; background: var(--surface-2); border-radius: 4px; padding: 0 4px; }
.rbody pre code { background: none; padding: 0; }
.rbody table { display: block; overflow-x: auto; border-collapse: collapse; font-size: .85em; font-family: var(--ui); }
.rbody td, .rbody th { border: 1px solid var(--line); padding: 6px 8px; }
.rbody a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.rbody ul, .rbody ol { padding-left: 1.3em; }
.rbody li { margin-bottom: .35em; }
mark.hl { color: inherit; border-radius: 3px; padding: .05em 0; cursor: pointer; transition: filter .2s; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
mark.hl.c-y { background: var(--mark-y); } mark.hl.c-g { background: var(--mark-g); } mark.hl.c-b { background: var(--mark-b); } mark.hl.c-o { background: var(--mark-o); }
mark.hl { animation: hlin .5s var(--out); }
@keyframes hlin { from { background-size: 0 100%; filter: brightness(1.2); } }
.speaking { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 12%, transparent); transition: background .3s; }
.aibox { margin-top: 18px; }
.ai-btn { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), color-mix(in srgb, var(--amber) 14%, var(--surface))); border-color: transparent; }
.ai-btn .i { color: var(--amber); }
.ai-card { position: relative; padding: 16px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .95rem; overflow: hidden; }
.ai-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--accent), var(--amber), var(--accent)); background-size: 200% 100%; animation: flow 3s linear infinite; }
@keyframes flow { to { background-position: -200% 0; } }
.ai-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ai-h .i { color: var(--amber); }
.ai-h b { flex: 1; }
.ai-card p { margin: 0 0 8px; }
.ai-card ul { margin: 0; padding-left: 1.2em; }
.ai-card.loading .i { animation: spin 2s linear infinite; }
.rfoot { margin-top: 40px; font-family: var(--ui); font-size: 1rem; }
.done-card { text-align: center; padding: 22px 16px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); }
.done-card .row { justify-content: center; }
.selbar, .ttsbar {
  position: fixed; z-index: 45; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 4px;
  padding: 6px; border-radius: 6px; background: #13221f; color: #fff; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); animation: rise .25s var(--out);
}
.selbar button { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px; border: 0; background: none; color: #fff; border-radius: 6px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.selbar button:active { background: rgba(255, 255, 255, .14); }
.selbar .i { color: var(--mark-y); }
.ttsbar .icon-btn { color: #fff; }
.ttsbar .icon-btn.big { background: var(--accent-2); color: #06201b; }
.ttsbar .chip { background: rgba(255, 255, 255, .12); color: #fff; border: 0; min-width: 48px; justify-content: center; min-height: 38px; }
body.tts-on .reader { padding-bottom: 200px; }

/* ---------- подчертавания и етикети ---------- */
.hl-group { margin-bottom: 18px; animation: rise .5s calc(var(--i) * 50ms) var(--out) both; }
.hl-title { display: grid; gap: 2px; text-decoration: none; color: var(--text); padding: 4px 4px 8px; }
.q { margin: 0 0 8px; padding: 14px 16px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); border-left: 2px solid var(--mark-y); font-family: var(--r-font); font-size: 1.02rem; line-height: 1.55; }
.q.c-g { border-left-color: var(--mark-g); } .q.c-b { border-left-color: var(--mark-b); } .q.c-o { border-left-color: var(--mark-o); }
.q .note { font-family: var(--ui); font-size: .9rem; margin: 8px 0 4px; color: var(--muted); display: flex; gap: 6px; }
.q .muted { display: block; font-family: var(--ui); margin-top: 6px; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px; }
.tc { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); text-decoration: none;
  color: var(--text); font-weight: 600; font-size: calc(1rem * var(--w)); box-shadow: var(--shadow); animation: popin .5s calc(var(--i) * 30ms) var(--spring) both; }
.tc b { font-size: .75rem; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 8px; }

/* ---------- профил ---------- */
.me { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.me > div:last-child { min-width: 0; display: grid; }
.avatar { flex: none; width: 54px; height: 54px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 1.4rem; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--amber)); }
.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.statgrid div { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px 8px; text-align: center; }
.statgrid b { display: block; font-size: 1.5rem; color: var(--accent); }
.statgrid span { font-size: .8rem; color: var(--muted); }
details.grp { margin-bottom: 12px; padding: 0; }
details.grp summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; cursor: pointer; min-height: 56px; }
details.grp summary::-webkit-details-marker { display: none; }
details.grp summary h2 { font-size: 1.05rem; }
details.grp summary .i { transition: transform .3s var(--spring); color: var(--muted); }
details.grp[open] summary .i { transform: rotate(180deg); }
.grp-b { padding: 0 18px 18px; animation: rise .35s var(--out); }
.grp-b p { white-space: pre-line; margin: 0 0 12px; }
.grp-b .btn { margin: 0 0 8px; }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.save-card { gap: 14px; }
.save-anim { min-height: 92px; display: grid; place-items: center; }
.save-card .row { justify-content: center; }

/* ---------- изгледи между страниците ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }

@media (min-width: 700px) {
  .main { padding-left: 20px; padding-right: 20px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .thumb { width: 104px; height: 104px; }
  .fab { right: max(24px, calc(50% - 400px)); }
  .reader { padding-left: 32px; padding-right: 32px; }
}
@media (min-width: 1100px) { .cards { grid-template-columns: 1fr 1fr 1fr; } .main { max-width: 1180px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media print { .rbar, .selbar, .ttsbar, .aibox, .rfoot, .bnav, .fab { display: none !important; } .reader { padding-top: 0; } }

/* тънки линии (по молба на Боби): разделители и рамки по 1px, почти прави ъгли */
.card-body, .card, .feat, .statgrid div, .q, .tc, .done-card, .ai-card { box-shadow: none; }
.top .inst { min-height: 34px; padding: 3px 10px; margin-right: 2px; }


/* ---------- компактен изглед (18.10.2026, по молба на Боби): повече място за съдържанието, малки спокойни бутони, без застъпване ---------- */
:root { --accent-2: var(--accent); }
body { font-size: 15px; }
.btn { min-height: 38px; padding: 6px 14px; font-weight: 500; gap: 6px; font-size: .92rem; }
.btn.big { min-height: 44px; font-size: .98rem; }
.btn.primary { background: var(--accent); }
.btn .i { width: 1.1em; height: 1.1em; }
.icon-btn { width: 38px; height: 38px; }
.top { padding: calc(4px + env(safe-area-inset-top)) 4px 4px 12px; gap: 4px; }
.brand { font-size: 1.05rem; gap: 8px; min-width: 0; }
.brand img { width: 26px; height: 26px; }
.top-tools { flex: none; }
.top .inst { height: 26px; padding: 0 8px; margin-right: 4px; border: 1px solid var(--accent); border-radius: 4px; color: var(--accent); background: transparent; font-size: .72rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.main { padding: 4px 8px calc(84px + env(safe-area-inset-bottom)); }
.list-head { padding: 10px 4px 8px; align-items: center; }
.list-head h1 { font-size: 1.25rem; letter-spacing: -.01em; }
.list-head p { font-size: .8rem; }
.sortsel { padding: 0 4px 0 8px; font-size: .82rem; }
.sortsel select { min-height: 30px; }
.cards { gap: 6px; }
.card-body { padding: 10px 40px 12px 12px; gap: 10px; }
.card-body h3 { font-size: .98rem; font-weight: 600; }
.meta { margin-top: 3px; font-size: .78rem; }
.ex { font-size: .85rem; margin-top: 3px; }
.thumb { width: 72px; height: 72px; }
.chips { gap: 4px; margin-top: 6px; }
.chip { min-height: 24px; padding: 1px 8px; font-size: .78rem; }
.more { top: 4px; width: 36px; height: 36px; }
.empty { padding: 28px 12px; gap: 10px; font-size: .92rem; }
.empty-art { width: 56px; height: 56px; background: none; border: 1px solid var(--line); animation: none; }
.empty-art .i { width: 28px; height: 28px; }
/* долната лента: цяла ширина, ниска, тънка линия отгоре, надписите не се режат */
.bnav { left: 0; right: 0; bottom: 0; width: auto; transform: none; padding: 2px 2px calc(2px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line);
  border-radius: 0; box-shadow: none; }
.bnav a { padding: 5px 0 4px; font-size: .64rem; font-weight: 500; letter-spacing: -.01em; border-radius: 4px; }
.bnav a .i { width: 21px; height: 21px; }
.bnav a span { overflow: visible; white-space: nowrap; }
.bnav a.on { background: none; }
.bnav a.on::before { content: ""; position: absolute; top: -2px; left: 25%; right: 25%; height: 2px; background: var(--accent); }
.fab { width: 48px; height: 48px; right: 12px; bottom: calc(68px + env(safe-area-inset-bottom)); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); background: var(--accent); }
.fab .i { width: 22px; height: 22px; }
.toast { bottom: calc(72px + env(safe-area-inset-bottom)); font-size: .88rem; padding: 9px 10px 9px 14px; }
/* профил и настройки */
.me { padding: 12px; gap: 10px; }
.avatar { width: 40px; height: 40px; font-size: 1.1rem; }
.statgrid { gap: 6px; }
.statgrid div { padding: 8px 4px; }
.statgrid b { font-size: 1.15rem; }
details.grp summary { padding: 11px 12px; min-height: 44px; }
details.grp summary h2 { font-size: .95rem; font-weight: 600; }
.grp-b { padding: 0 12px 12px; font-size: .92rem; }
.card { padding: 12px; }
.fld input, .fld textarea { min-height: 42px; padding: 8px 12px; }
.seg button { min-height: 40px; font-size: .8rem; font-weight: 500; }
.menu button, .menu a { min-height: 44px; font-size: .95rem; gap: 12px; }
.sheet { padding: 2px 14px calc(16px + env(safe-area-inset-bottom)); }
.sheet h2 { font-size: 1.05rem; margin: 2px 0 10px; }
/* вход */
.auth { gap: 14px; padding-top: max(18px, env(safe-area-inset-top)); }
.logo-big { width: 72px; height: 72px; animation: none; }
.logo-big img { width: 56px; height: 56px; }
.auth-hero h1 { font-size: 1.7rem; margin-top: 6px; }
.auth-card h2 { font-size: 1.15rem; margin-bottom: 12px; }
.feat { padding: 8px 10px; gap: 10px; }
.feat .i { width: 24px; height: 24px; padding: 2px; }
.feat span { font-size: .82rem; }
/* четецът */
.rbar { padding: calc(2px + env(safe-area-inset-top)) 2px 2px; }
.reader { padding: calc(52px + env(safe-area-inset-top)) 16px 110px; }
.rhead { margin-bottom: 18px; }
.ai-btn { min-height: 34px; }
.selbar, .ttsbar { padding: 4px; bottom: calc(10px + env(safe-area-inset-bottom)); }
.selbar button { min-height: 38px; padding: 4px 10px; font-weight: 500; }
.nw { white-space: nowrap; }
.pubbrand { font-size: 1rem; padding-left: 6px; }
.pubsave { margin-top: 12px; }
/* помощ: видеата и обратна връзка */
.vids { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.vid { position: relative; display: block; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 9 / 12; background: var(--surface-2); }
.vid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid span { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px; padding: 8px; font-size: .8rem; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); }
.howto { margin: 0 0 4px; padding-left: 1.1em; font-size: .9rem; }
.howto li { margin-bottom: 6px; }
.shots { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.shot { position: relative; width: 72px; height: 96px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot button { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.secline { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: .82rem; margin: 14px 0 0; }
.secline .i { color: var(--accent); }

/* превключватели в „Профил“ и в Aa */
.tgl { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer; border-top: 1px solid var(--line); }
.tgl:first-child { border-top: 0; }
.tgl input { appearance: none; -webkit-appearance: none; flex: none; width: 34px; height: 20px; margin: 1px 0 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); position: relative; cursor: pointer; transition: background .2s; }
.tgl input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .25s var(--spring), background .2s; }
.tgl input:checked { background: var(--accent); border-color: var(--accent); }
.tgl input:checked::after { transform: translateX(14px); background: #fff; }
.tgl span { display: grid; gap: 2px; font-size: .9rem; }
.tgl small { color: var(--muted); font-size: .78rem; white-space: pre-line; }
.addr { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 4px; padding: 2px 2px 2px 10px; margin-bottom: 8px; background: var(--surface-2); }
.addr code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .85rem; }
/* режим по страници */
body.paged { overflow: hidden; }
body.paged .reader { position: fixed; top: calc(46px + env(safe-area-inset-top)); bottom: calc(26px + env(safe-area-inset-bottom)); left: 0; right: 0; margin: 0 auto;
  width: min(100vw, calc(var(--r-width) + 32px)); max-width: none; padding: 0; overflow: hidden; column-gap: 0; column-fill: auto; }
body.paged .reader > * { padding-left: 16px; padding-right: 16px; }
body.paged .rbody img { max-height: calc(100dvh - 140px); }
body.paged .rbar.hide { transform: none; }
.pgno { position: fixed; left: 0; right: 0; bottom: calc(4px + env(safe-area-inset-bottom)); text-align: center; font-size: .72rem; color: var(--muted); pointer-events: none; }

/* току-що запазената статия светва в списъка */
.card-item.flash .card-body { animation: flash 2.2s var(--out); }
@keyframes flash { 0%, 35% { box-shadow: 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); } 100% { box-shadow: none; } }
/* миниатюрата е второстепенна: малка и горе, текстът взима мястото (18.10.2026) */
.thumb { width: 48px; height: 48px; border-radius: 4px; align-self: flex-start; margin-top: 2px; }
.card-body { padding-right: 38px; }
@media (min-width: 700px) { .thumb { width: 64px; height: 64px; } }
/* миниатюрата е вдясно в текста: заглавието и описанието продължават и под нея */
.card-body { display: block; }
.card-body .thumb { float: right; margin: 2px 0 6px 10px; }
.card-body .ct::after { content: ""; display: block; clear: both; }
.ex { -webkit-line-clamp: 3; }
/* (18.10.2026) текстът ползва цялата ширина: малко място горе вдясно за „⋯“, под него картинката, описанието 2 реда и обтича картинката */
.card-body { padding: 10px 12px 12px; }
.card-body .ct::before { content: ""; float: right; width: 26px; height: 26px; }
.card-body .thumb { clear: right; float: right; margin: 0 0 4px 10px; }
.card-body .ex { display: block; -webkit-line-clamp: unset; overflow: hidden; line-height: 1.4; max-height: 2.8em; }
.more { top: 2px; right: 0; width: 34px; height: 34px; }
/* полето за линк: бутоните „Постави“ и „Запази“ са вътре в него */
.urlbox { position: relative; display: block; }
.urlbox input { padding-right: 88px; }
.urlbox .ib { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; border-radius: 4px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.urlbox #paste { right: 44px; }
.urlbox .go { right: 3px; background: var(--accent); color: var(--accent-ink); }
.urlbox .go.busy .i { display: none; }
.urlbox .go.busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.urlbox input.filled { box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.vids { max-width: 420px; }
/* търсенето се побира в горната лента (18.10.2026): същата височина, без второто „×“ на браузъра */
.top { min-height: calc(48px + env(safe-area-inset-top)); }
.searchbar { top: calc(4px + env(safe-area-inset-top)); bottom: 4px; left: 8px; right: 4px; inset: calc(4px + env(safe-area-inset-top)) 4px 4px 8px; align-items: center; }
.searchbar input { min-height: 0; height: 38px; padding: 6px 12px; border-radius: 4px; box-shadow: none; }
.searchbar input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
