/* ============ Токены ============ */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --bg: #15130f; --bg-2: #1c1915; --surface: #221e19; --surface-2: #2b261f; --line: rgba(255, 255, 255, .09);
  --text: #f3ede3; --muted: #a89f92; --dim: #736a5f;
  --accent: #e3a857; --accent-2: #f0c98a; --accent-ink: #1d1508;
  --ok: #7fc98a; --warn: #e6b45c; --bad: #e4756a; --info: #86b9e0;
  --radius: 12px; --shadow: 0 12px 34px rgba(0, 0, 0, .45);
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --topbar-h: 104px;
}
[data-theme="light"] {
  --bg: #f4efe6; --bg-2: #ebe5d9; --surface: #fffdf8; --surface-2: #f0e9dc; --line: rgba(45, 32, 12, .11);
  --text: #221c15; --muted: #665d51; --dim: #95897a;
  --accent: #b9782f; --accent-2: #9a5f22; --accent-ink: #fffaf0;
  --ok: #2f8d4a; --warn: #a8701c; --bad: #b6443a; --info: #2f6ea8;
  --shadow: 0 12px 34px rgba(60, 40, 10, .16);
}
html { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 15px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-wrap: break-word;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-ink); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
svg { flex: none; }

/* ============ Кнопки, чипы ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .2s, border-color .2s, transform .1s;
}
.btn:hover { border-color: var(--muted); filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn--accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--accent:hover { background: var(--accent-2); border-color: var(--accent-2); filter: none; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { color: var(--text); background: var(--surface-2); border-color: transparent; filter: none; }
.btn--danger { color: var(--bad); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.iconbtn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); transition: color .2s, background .2s, border-color .2s;
}
.iconbtn:hover { color: var(--text); background: var(--surface-2); }
.iconbtn.is-active { color: var(--accent); border-color: var(--accent); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500;
  white-space: nowrap; transition: all .2s;
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip small { opacity: .7; font-weight: 500; }
.pill {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; line-height: 1;
}
.pill:empty { display: none; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 13px;
  background: var(--surface-2); color: var(--text); font-size: 12.5px; border: 1px solid transparent; white-space: nowrap;
}
button.tag:hover { border-color: var(--accent); color: var(--accent); }
.tag--warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.tag--dim { color: var(--muted); }
.tag--ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.spin { animation: spin 1s linear infinite; display: inline-grid; place-items: center; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============ Шапка ============ */
.topbar {
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25);
}
.topbar__row {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 16px;
  padding: 10px clamp(12px, 3vw, 28px); max-width: 1900px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-serif); font-size: 19px; white-space: nowrap; }
.brand__mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(145deg, var(--accent-2), var(--accent) 60%, #b97a2c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 18px color-mix(in srgb, var(--accent) 28%, transparent);
  position: relative; overflow: hidden;
}
.brand__mark::after {
  content: ""; position: absolute; left: 7px; right: 7px; bottom: 7px; height: 12px; border-radius: 2px;
  background: var(--accent-ink); clip-path: polygon(0 100%, 35% 30%, 55% 60%, 75% 20%, 100% 100%);
}
.views { display: flex; gap: 4px; padding: 4px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); }
.views__btn {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 9px;
  color: var(--muted); font-weight: 600; font-size: 14px; transition: background .2s, color .2s;
}
.views__btn:hover { color: var(--text); }
.views__btn.is-active { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.views__btn.is-active svg { color: var(--accent); }
.tools { display: flex; align-items: center; gap: 8px; justify-self: end; min-width: 0; }
.search {
  display: flex; align-items: center; gap: 8px; flex: 1; max-width: 480px; min-width: 120px; height: 40px; padding: 0 12px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); transition: border-color .2s;
}
.search:focus-within { border-color: var(--accent); color: var(--text); }
.search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; color: var(--text); }
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { filter: invert(.6); }
.statline {
  display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; padding: 2px clamp(12px, 3vw, 28px) 8px;
  max-width: 1900px; margin: 0 auto; font-size: 13px; color: var(--muted);
}
.statline b { color: var(--text); font-weight: 600; }
.statline .sep::before { content: "·"; color: var(--dim); margin-right: 16px; }
.progress { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); }
.progress__bar { width: 90px; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.progress__bar i { display: block; height: 100%; background: var(--accent); transition: width .5s; }
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px clamp(12px, 3vw, 28px) 12px;
  border-top: 1px solid var(--line); max-width: 1900px; margin: 0 auto; animation: rise .2s;
}
.filters[hidden] { display: none; }
.filters__sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.filters__label { font-size: 11.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; margin-right: -2px; }

/* ============ Основная область ============ */
.main { max-width: 1900px; margin: 0 auto; padding: 14px clamp(10px, 2vw, 24px) 40px; min-height: 70vh; }
.masonry { position: relative; }
.m-item { position: absolute; top: 0; left: 0; will-change: transform; animation: fadein .3s both; }
.card {
  display: block; width: 100%; text-align: left; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .25s cubic-bezier(.2, .7, .2, 1), box-shadow .25s, border-color .25s;
}
.card:hover, .card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--muted); }
.card__media { position: relative; aspect-ratio: var(--ar); background: #0b0a09; overflow: hidden; }
.card__media > img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.card:hover .card__media > img { transform: scale(1.04); }
.card__back { position: absolute; inset: 0; opacity: 0; transition: opacity .35s; }
.card__back img { width: 100%; height: 100%; object-fit: cover; }
.card:hover .card__back { opacity: 1; }
.card__badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; pointer-events: none; }
.badge {
  display: inline-grid; place-items: center; height: 24px; min-width: 24px; padding: 0 7px; border-radius: 12px;
  background: rgba(12, 10, 8, .64); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #f6f1e8; font-size: 12px; font-weight: 700; line-height: 1;
}
.badge--warn { color: #ffd27a; } .badge--fav { color: #ffb86b; } .badge--ok { color: #9fe0a8; }
.card__meta { height: 52px; padding: 8px 11px 0; display: grid; gap: 2px; align-content: start; }
.card__date { font-family: var(--font-serif); font-size: 15px; line-height: 1.2; color: var(--accent-2); }
.card__date--dim { color: var(--muted); font-style: italic; }
.card__caption { font-size: 13px; line-height: 1.3; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skeleton {
  position: absolute; top: 0; left: 0; border-radius: var(--radius);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
.more { display: flex; justify-content: center; padding: 28px 0 10px; }
.more[hidden] { display: none; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty[hidden] { display: none; }
.empty h3 { font-family: var(--font-serif); font-weight: 500; font-size: 24px; color: var(--text); }
.section-title { font-family: var(--font-serif); font-weight: 500; font-size: 20px; color: var(--accent-2); margin: 18px 4px 10px; }

/* ============ Лента ============ */
.feed { display: grid; gap: 12px; }
.feed__head {
  position: sticky; top: var(--topbar-h); z-index: 5; display: flex; align-items: baseline; gap: 12px; padding: 12px 6px 6px;
  background: linear-gradient(var(--bg) 72%, transparent); margin-top: 8px;
}
.feed__head h2 { font-family: var(--font-serif); font-weight: 500; font-size: 26px; line-height: 1.1; color: var(--accent-2); }
.feed__head span { color: var(--muted); font-size: 13px; }
.feed__item {
  display: grid; grid-template-columns: minmax(260px, 440px) minmax(0, 1fr); gap: 22px; padding: 14px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--line); transition: border-color .2s;
  animation: rise .25s both;
}
.feed__item:hover { border-color: var(--muted); }
.feed__pic { position: relative; border-radius: 10px; overflow: hidden; background: #0b0a09; cursor: zoom-in; align-self: start; }
.feed__pic img { width: 100%; height: auto; max-height: 540px; object-fit: cover; transition: transform .5s; }
.feed__item:hover .feed__pic img { transform: scale(1.025); }
.feed__pic .badge { position: absolute; bottom: 8px; left: 8px; }
.feed__backbtn {
  position: absolute; top: 10px; right: 10px; width: 68px; height: 68px; padding: 0; border-radius: 10px; overflow: hidden;
  border: 2px solid rgba(255, 250, 240, .88); box-shadow: 0 6px 18px rgba(0, 0, 0, .45); opacity: .92; transition: transform .2s, opacity .2s;
}
.feed__backbtn:hover { transform: scale(1.06); opacity: 1; }
.feed__backbtn img { width: 100%; height: 100%; object-fit: cover; }
.feed__body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.feed__date { font-family: var(--font-serif); font-size: 28px; line-height: 1.1; color: var(--accent-2); }
.feed__date small { font-size: 14px; color: var(--muted); font-family: var(--font-ui); margin-left: 8px; }
.feed__title { font-family: var(--font-serif); font-size: 21px; font-weight: 500; line-height: 1.3; }
.feed__quote {
  font-family: var(--font-serif); font-style: italic; font-size: 17px; line-height: 1.5; white-space: pre-line;
  border-left: 2px solid var(--accent); padding-left: 12px;
}
.feed__quote small { display: block; font-family: var(--font-ui); font-style: normal; font-size: 12px; color: var(--dim); margin-bottom: 2px; }
.feed__text { color: var(--muted); font-size: 14.5px; }
.feed__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.feed__side { display: flex; gap: 10px; align-items: center; }
.feed__side button { width: 76px; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); flex: none; }
.feed__side img { width: 100%; height: 100%; object-fit: cover; }
.freegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.freegrid .picker__item { cursor: pointer; }

/* ============ Просмотр ============ */
.viewer {
  position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--bg); color: var(--text); overflow: hidden;
}
.viewer::backdrop { background: rgba(0, 0, 0, .6); }
.viewer[open] { animation: rise .25s; }
.viewer__shell { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: 100%; width: 100%; }
.viewer__bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg-2); min-width: 0; }
.viewer__counter { flex: 1 1 0; min-width: 0; contain: inline-size; text-align: center; font-family: var(--font-serif); font-size: 17px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer__counter b { color: var(--text); font-weight: 500; }
.viewer__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 430px); min-height: 0; min-width: 0; }
.stage { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: radial-gradient(ellipse at center, var(--bg-2), var(--bg) 78%); }
.stage__canvas { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; touch-action: none; cursor: grab; }
.stage__canvas.is-dragging { cursor: grabbing; }
.stage__frame { position: relative; transform-origin: 0 0; will-change: transform; }
.flip { position: relative; width: 100%; height: 100%; perspective: 1600px; }
.flip__inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.2, .75, .25, 1); }
.is-back .flip__inner { transform: rotateY(180deg); }
.flip__face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 5px; overflow: hidden;
  background: #0b0a09; box-shadow: 0 14px 44px rgba(0, 0, 0, .5);
}
.flip__face--back { transform: rotateY(180deg); }
.flip__face img { width: 100%; height: 100%; object-fit: contain; }
.stage--split .flip__inner { transform: none !important; display: flex; gap: 8px; perspective: none; }
.stage--split .flip__face, .stage--split .flip__face--back { position: static; transform: none; backface-visibility: visible; -webkit-backface-visibility: visible; flex: 1; cursor: zoom-in; box-shadow: 0 8px 26px rgba(0, 0, 0, .4); }
.stage__label {
  position: absolute; top: 12px; left: 12px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 13px; background: rgba(12, 10, 8, .64); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #f6f1e8; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; pointer-events: none;
}
.zoomctl { position: absolute; right: 12px; bottom: 12px; z-index: 3; display: flex; gap: 6px; }
.zoom {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #f6f1e8;
  background: rgba(12, 10, 8, .64); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background .2s;
}
.zoom:hover { background: rgba(12, 10, 8, .9); }
.stage__tools { display: flex; gap: 8px; align-items: center; padding: 10px 12px; overflow-x: auto; scrollbar-width: thin; border-top: 1px solid var(--line); }
.stage__tools > * { flex: none; }
.seg { display: flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.seg__btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 9px; color: var(--muted);
  font-weight: 600; font-size: 13px; white-space: nowrap; transition: background .2s, color .2s;
}
.seg__btn:hover { color: var(--text); }
.seg__btn.is-active { background: var(--accent); color: var(--accent-ink); }
.seg__btn small { font-weight: 600; opacity: .7; }
.seg__btn .x { opacity: .6; } .seg__btn:hover .x { opacity: 1; }
.cmp { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.cmp__top { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--x, 50%)) 0 0); }
.cmp__top img { width: 100%; height: 100%; object-fit: contain; }
.cmp__handle { position: absolute; top: 0; bottom: 0; left: var(--x, 50%); width: 2px; margin-left: -1px; background: var(--accent); pointer-events: auto; cursor: ew-resize; }
.cmp__knob {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.filmstrip { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; border-top: 1px solid var(--line); scrollbar-width: thin; scroll-snap-type: x proximity; }
.filmstrip button { flex: 0 0 auto; width: 58px; height: 58px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; opacity: .55; transition: opacity .2s, border-color .2s; scroll-snap-align: center; }
.filmstrip button img { width: 100%; height: 100%; object-fit: cover; background: #0b0a09; }
.filmstrip button.is-cur { border-color: var(--accent); opacity: 1; }
.filmstrip button:hover { opacity: 1; }
.info { overflow-y: auto; min-width: 0; padding: 16px 20px 40px; border-left: 1px solid var(--line); background: var(--bg); }
.block { padding: 14px 0; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: 0; }
.block__label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.block__label .btn--sm { margin-left: auto; text-transform: none; letter-spacing: 0; }
.date-big { font-family: var(--font-serif); font-size: 32px; line-height: 1.1; color: var(--accent-2); }
.date-big--dim { color: var(--muted); font-style: italic; font-size: 26px; }
.title { font-family: var(--font-serif); font-size: 22px; font-weight: 500; line-height: 1.3; margin: 4px 0 8px; }
.quote { font-family: var(--font-serif); font-style: italic; font-size: 17.5px; line-height: 1.55; white-space: pre-line; border-left: 2px solid var(--accent); padding-left: 12px; }
.norm { color: var(--muted); font-size: 14px; margin-top: 6px; white-space: pre-line; }
.muted { color: var(--muted); } .dim { color: var(--dim); font-size: 12.5px; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.conf { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.conf__bar { width: 80px; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.conf__bar i { display: block; height: 100%; background: var(--accent); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: grid; gap: 10px; }
.pair { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.pair img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: #0b0a09; cursor: zoom-in; flex: none; }
.pair--warn { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.pair__text { flex: 1; min-width: 0; font-size: 13.5px; color: var(--muted); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.4; }
.alert--warn { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.alert--bad { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.alert--ok { background: color-mix(in srgb, var(--ok) 14%, transparent); }
.alert svg { margin-top: 2px; }
.form { display: grid; gap: 10px; }
.field { display: grid; gap: 4px; }
.field > label { font-size: 12px; color: var(--dim); }
.input, .textarea { width: 100%; padding: 9px 11px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); outline: 0; }
.input:focus, .textarea:focus { border-color: var(--accent); }
.textarea { min-height: 84px; resize: vertical; font-family: var(--font-serif); font-size: 15.5px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch { position: relative; width: 40px; height: 22px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch.is-on { background: var(--accent); } .switch.is-on::after { transform: translateX(18px); background: var(--accent-ink); }
.switch__label { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
details.sub { font-size: 13.5px; } details.sub summary { cursor: pointer; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
details.sub summary::-webkit-details-marker { display: none; }
details.sub summary::before { content: "▸"; transition: transform .2s; } details.sub[open] summary::before { transform: rotate(90deg); }
details.sub > div { margin-top: 6px; padding-left: 14px; color: var(--muted); }
.picker { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0, 0, 0, .62); padding: 16px; animation: rise .2s; }
.picker__box { width: min(900px, 100%); max-height: 86vh; display: flex; flex-direction: column; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: var(--shadow); }
.picker__head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.picker__head .iconbtn { margin-left: auto; }
.picker__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; padding: 14px; overflow: auto; }
.picker__item { display: grid; gap: 6px; padding: 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); text-align: left; transition: border-color .2s; }
.picker__item:hover { border-color: var(--accent); }
.picker__item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: #0b0a09; }
.picker__item div { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker__item b { font-weight: 600; color: var(--text); }
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 90; width: min(92vw, 440px); pointer-events: none; }
.toast { padding: 11px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 14px; animation: rise .25s; pointer-events: auto; }
.toast--ok { border-color: var(--ok); } .toast--bad { border-color: var(--bad); }

/* ============ Вход по паролю ============ */
.login {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(ellipse at 50% 30%, var(--bg-2), var(--bg) 75%);
}
.login__form {
  width: min(380px, 100%); display: grid; gap: 14px; justify-items: center; padding: 32px 28px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); animation: rise .3s;
}
.login__form .brand__mark { width: 54px; height: 54px; border-radius: 16px; }
.login__form .brand__mark::after { left: 11px; right: 11px; bottom: 11px; height: 18px; }
.login__title { font-family: var(--font-serif); font-weight: 500; font-size: 25px; text-align: center; }
.login__hint { color: var(--muted); font-size: 14px; text-align: center; margin-top: -8px; }
.login__form .input { height: 46px; text-align: center; font-size: 17px; letter-spacing: .08em; }
.login__form .btn { width: 100%; height: 46px; }
.login__error { color: var(--bad); font-size: 13.5px; }
.shake { animation: shake .35s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }

/* ============ Адаптив ============ */
@media (max-width: 1180px) {
  .viewer__body { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
}
@media (max-width: 960px) {
  :root { --topbar-h: 100px; }
  .viewer__body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 54vh) minmax(0, 1fr); }
  .info { border-left: 0; border-top: 1px solid var(--line); }
  .feed__item { grid-template-columns: 1fr; gap: 14px; }
  .feed__pic img { max-height: 62vh; object-fit: contain; }
  .date-big { font-size: 27px; }
}
@media (max-width: 720px) {
  :root { --topbar-h: 98px; }
  /* размытие шапки сделало бы её контейнером для fixed-навигации — на мобильных шапка плотная */
  .topbar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar__row { grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 8px 12px; }
  .brand__name { display: none; }
  .views {
    position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
    justify-content: space-around; padding: 6px; border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25); box-shadow: var(--shadow);
  }
  .views__btn { flex: 1; flex-direction: column; gap: 3px; height: 54px; padding: 0 6px; font-size: 12px; border-radius: 13px; }
  .main { padding-bottom: 100px; }
  .statline { font-size: 12px; gap: 2px 12px; padding-bottom: 8px; }
  .statline .opt { display: none; }
  .viewer__body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 50vh) minmax(0, 1fr); }
  .viewer__counter { font-size: 15px; }
  .filmstrip { padding: 8px 10px; }
  .stage__tools { padding: 8px 10px; }
  .date-big { font-size: 24px; }
  .title { font-size: 20px; }
  .info { padding: 12px 14px 90px; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .form__row { grid-template-columns: 1fr; }
}
