/* ===== Форум Гимназии №31 — стили (mobile-first) ===== */

:root,
[data-theme="dark"] {
  --bg: #0e1113;
  --surface: #16191c;
  --surface-2: #1e2327;
  --hover: #262c31;
  --border: #2a3237;
  --text: #e6e9ec;
  --text-2: #b8c2c9;
  --muted: #84919a;
  --accent: #ff4500;
  --accent-hover: #ff6a33;
  --accent-soft: rgba(255, 69, 0, .14);
  --up: #ff4500;
  --down: #7193ff;
  --link: #6ea8ff;
  --quote: #8fbf3a;
  --danger: #ff5a5f;
  --ok: #33c27f;
  --pin: #3ccf8e;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  --line: #343d43;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #eef1f3;
  --surface: #ffffff;
  --surface-2: #f2f4f5;
  --hover: #e8ecee;
  --border: #dde2e5;
  --text: #1a1c1e;
  --text-2: #3a4247;
  --muted: #5f6e76;
  --accent: #e03d00;
  --accent-hover: #ff4500;
  --accent-soft: rgba(255, 69, 0, .1);
  --up: #e03d00;
  --down: #4b6fe8;
  --link: #0a64d8;
  --quote: #5b8a12;
  --danger: #d93a3f;
  --ok: #1a9e5f;
  --pin: #12a36a;
  --shadow: 0 8px 30px rgba(15, 25, 35, .14);
  --line: #d3d9dd;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
  transition: background-color .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; flex: none; }
img, video { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
[hidden] { display: none !important; }
.sprite { display: none; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; opacity: 0; }
.only-desktop { display: none !important; }
.inline-form { display: inline; }
.linklike { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 650; background: var(--surface-2); color: var(--text);
  transition: background .15s, transform .1s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; }
@media (hover: hover) { .btn-primary:hover:not(:disabled) { background: var(--accent-hover); } }
.btn-ghost { background: transparent; border-color: var(--border); }
@media (hover: hover) { .btn-ghost:hover { background: var(--hover); } }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
@media (hover: hover) { .btn-danger:hover { background: var(--danger); color: #fff; } }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: transparent; border: 0; color: var(--text); position: relative;
  transition: background .15s, transform .15s;
}
@media (hover: hover) { .icon-btn:hover { background: var(--hover); } }
.icon-btn:active { transform: scale(.9); }
.dot-badge {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

/* ---------- Шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 8px; padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.logo-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ff8a3d); color: #fff;
  font-weight: 800; font-size: 15px; letter-spacing: -.5px; flex: none;
  box-shadow: 0 2px 10px var(--accent-soft);
}
.logo-mark.big { width: 52px; height: 52px; font-size: 22px; }
.logo-text { font-size: 1.05rem; white-space: nowrap; }
.logo-text b { font-weight: 800; }
.top-search { display: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }

.theme-toggle .when-light { display: none; }
[data-theme="light"] .theme-toggle .when-light { display: block; }
[data-theme="light"] .theme-toggle .when-dark { display: none; }
.theme-toggle svg { transition: transform .45s cubic-bezier(.5, 1.6, .4, 1); }
.theme-toggle.spin svg { transform: rotate(180deg); }

/* ---------- Каркас ---------- */
.layout { display: block; max-width: 1180px; margin: 0 auto; }
.content { min-width: 0; padding: 8px 0 24px; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(84vw, 300px);
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 8px 8px calc(16px + env(safe-area-inset-bottom));
  padding-top: calc(8px + env(safe-area-inset-top));
  overflow-y: auto; transform: translateX(-102%);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.sidebar.open { transform: none; box-shadow: var(--shadow); }
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .5);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 8px; font-weight: 700; }
.side-title { padding: 14px 12px 6px; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-2); transition: background .15s;
}
@media (hover: hover) { .side-nav a:hover { background: var(--hover); } }
.side-nav a.active { background: var(--surface-2); color: var(--text); font-weight: 650; }
.board-ico { width: 20px; height: 20px; color: var(--muted); transition: color .15s; }
.side-nav a.active .board-ico { color: var(--accent); }
.board-slug { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
.side-foot { padding: 18px 12px; font-size: .82rem; color: var(--muted); border-top: 1px solid var(--border); margin-top: 14px; }

/* ---------- Нижняя навигация (телефон) ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
}
.bottom-nav a, .bottom-nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: 100%; background: none; border: 0; color: var(--muted); font-size: 10.5px;
  transition: color .15s, transform .1s;
}
.bottom-nav a:active, .bottom-nav button:active { transform: scale(.9); }
.bottom-nav .active { color: var(--text); }
.bottom-nav svg { width: 24px; height: 24px; }
.bn-plus {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 16px;
  background: var(--accent); color: #fff; box-shadow: 0 4px 14px var(--accent-soft);
}
.bn-plus svg { width: 26px; height: 26px; }

/* ---------- Карточки ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 0;
  border-left: 0; border-right: 0; padding: 12px 14px; margin-bottom: 8px;
}
.page-card { padding: 20px 16px; }
.page-head { padding: 8px 14px 12px; }

.board-head { display: flex; align-items: center; gap: 12px; }
.board-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); flex: none; }
.board-icon svg { width: 28px; height: 28px; }
.board-info { flex: 1; min-width: 0; }
.board-info .muted { font-size: .85rem; }

/* ---------- Вкладки ---------- */
.tabs-row { padding: 2px 10px 8px; display: flex; flex-direction: column; gap: 6px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 7px 14px; border-radius: 999px; font-weight: 650; font-size: .9rem; color: var(--muted);
  white-space: nowrap; transition: background .15s, color .15s;
}
@media (hover: hover) { .tab:hover { background: var(--hover); } }
.tab.active { background: var(--surface-2); color: var(--text); }
.tabs-sub .tab, .tabs-sm .tab { padding: 5px 11px; font-size: .82rem; }

/* ---------- Пост ---------- */
.post-card { cursor: pointer; animation: rise .35s ease both; transition: background .15s; }
@media (hover: hover) { .post-card:hover { background: color-mix(in srgb, var(--surface) 94%, var(--text)); } }
.post-card.is-pinned { border-left: 3px solid var(--pin); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: .8rem; color: var(--muted); }
.post-meta .sep { opacity: .6; }
.board-chip { font-weight: 700; color: var(--text-2); }
@media (hover: hover) { .board-chip:hover { text-decoration: underline; } }
.anon { color: hsl(var(--h, 20) 70% 62%); font-weight: 650; }
[data-theme="light"] .anon { color: hsl(var(--h, 20) 60% 38%); }
.tag {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 6px;
  font-size: .72rem; font-weight: 700; background: var(--surface-2); color: var(--muted);
}
.tag svg { width: 12px; height: 12px; }
.tag-op { background: var(--accent-soft); color: var(--accent); }
.tag-admin { background: var(--ok); color: #fff; letter-spacing: .02em; }
.tag-pin { background: color-mix(in srgb, var(--pin) 16%, transparent); color: var(--pin); }
.tag-lock { color: #e8b500; }
.tag-report { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

.post-title { font-size: 1.08rem; font-weight: 700; margin: 6px 0 8px; overflow-wrap: anywhere; }
.post-full .post-title { font-size: 1.3rem; }
.post-snippet { color: var(--text-2); font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 8px; overflow-wrap: anywhere; }
.post-body { margin: 10px 0; overflow-wrap: anywhere; font-size: .98rem; }
.post-body a, .post-snippet a, .c-body a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
/* Цитата как в Telegram: полоска слева, кавычки справа */
.quote {
  position: relative; display: block; margin: 6px 0; padding: 6px 30px 6px 11px;
  border-left: 3px solid var(--link); border-radius: 4px 10px 10px 4px;
  background: color-mix(in srgb, var(--link) 11%, transparent); color: var(--text-2);
  font-size: .95em; overflow-wrap: anywhere;
}
.quote::after {
  content: ""; position: absolute; top: 7px; right: 8px; width: 14px; height: 14px; background: var(--link); opacity: .75;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 11.5C4 7.4 6.6 4.6 10 4v2.6c-1.8.6-2.9 2-3 3.9H10V20H4zm10 0c0-4.1 2.6-6.9 6-7.5v2.6c-1.8.6-2.9 2-3 3.9h3V20h-6z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 11.5C4 7.4 6.6 4.6 10 4v2.6c-1.8.6-2.9 2-3 3.9H10V20H4zm10 0c0-4.1 2.6-6.9 6-7.5v2.6c-1.8.6-2.9 2-3 3.9h3V20h-6z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.post-snippet .quote { display: block; }

/* Редактор с живыми цитатами (вместо textarea) */
.rich-editor {
  width: 100%; min-height: 44px; max-height: 50vh; overflow-y: auto; border: 1px solid var(--border);
  background: var(--surface-2); border-radius: 12px; padding: 10px 12px; outline: none; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; font-size: 16px; position: relative;
  transition: border-color .15s, min-height .2s;
}
.rich-editor:focus { border-color: var(--accent); min-height: 90px; }
.rich-editor.is-empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; position: absolute; }
.rich-editor .quote { margin: 4px 0; font-size: 1em; color: var(--text); }
.rich-editor-lg { min-height: 140px; }
.rich-editor-lg:focus { min-height: 160px; }

/* ---------- Медиа (как на reddit — под заголовком) ---------- */
.media {
  position: relative; overflow: hidden; border-radius: 14px; margin: 4px -4px 10px;
  background: #000; border: 1px solid var(--border); display: flex; justify-content: center;
}
.media-image { cursor: zoom-in; max-height: 540px; }
.media-blur {
  position: absolute; inset: -20px; background-size: cover; background-position: center;
  filter: blur(24px) brightness(.55); transform: scale(1.1);
}
.media-image img { position: relative; display: block; max-height: 540px; width: auto; height: auto; object-fit: contain; }
.post-full .media-image, .post-full .media-image img { max-height: 75vh; }

/* ---------- Видеоплеер ---------- */
.player { position: relative; width: 100%; background: #000; line-height: 0; user-select: none; -webkit-user-select: none; }
.player video { display: block; width: 100%; max-height: 70vh; background: #000; }
.pl-center {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  display: grid; place-items: center; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(6px);
  transition: opacity .2s, transform .2s;
}
.pl-center svg { width: 30px; height: 30px; margin-left: 3px; }
.player.playing .pl-center { opacity: 0; transform: scale(.7); pointer-events: none; }
.pl-spinner {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.player.waiting .pl-spinner { opacity: 1; }
.pl-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px;
  padding: 26px 8px 6px; line-height: 1.2; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75));
  transition: opacity .25s;
}
.player.playing.idle .pl-bar { opacity: 0; pointer-events: none; }
.player.playing.idle { cursor: none; }
.pl-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; background: none; color: #fff; border-radius: 50%; flex: none; }
.pl-btn:active { background: rgba(255, 255, 255, .15); }
.pl-btn svg { width: 22px; height: 22px; }
.pl-i-pause, .player.playing .pl-i-play { display: none; }
.player.playing .pl-i-pause { display: block; }
.pl-i-mute, .player.muted .pl-i-vol { display: none; }
.player.muted .pl-i-mute { display: block; }
.pl-time { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 34px; text-align: center; flex: none; }
.pl-seek { position: relative; flex: 1; height: 32px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.pl-track { position: relative; width: 100%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25); overflow: hidden; transition: height .15s; }
.pl-seek.dragging .pl-track { height: 6px; }
@media (hover: hover) { .pl-seek:hover .pl-track { height: 6px; } }
.pl-buffer { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255, 255, 255, .35); }
.pl-progress { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); }
.pl-thumb {
  position: absolute; left: 0; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 3px rgba(255, 69, 0, .35); transform: scale(0); transition: transform .15s;
}
.pl-seek.dragging .pl-thumb, .player:not(.playing) .pl-thumb { transform: scale(1); }
@media (hover: hover) { .pl-seek:hover .pl-thumb { transform: scale(1); } }
.pl-volume { display: flex; align-items: center; }
.pl-vol { width: 0; opacity: 0; transition: width .2s, opacity .2s; accent-color: var(--accent); height: 4px; }
.pl-volume.open .pl-vol { width: 70px; opacity: 1; margin-right: 4px; }
@media (hover: hover) { .pl-volume:hover .pl-vol { width: 70px; opacity: 1; margin-right: 4px; } }
.player:fullscreen video, .player:-webkit-full-screen video { max-height: 100vh; height: 100%; }
.player:fullscreen { display: flex; align-items: center; }

/* ---------- Действия: голоса и пилюли ---------- */
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vote {
  display: inline-flex; align-items: center; border-radius: 999px; background: var(--surface-2);
  transition: background .2s;
}
.vote-btn {
  display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); transition: color .15s, background .15s;
}
.vote-btn svg { width: 18px; height: 18px; fill-opacity: 0; transition: fill-opacity .15s, transform .25s cubic-bezier(.4, 1.8, .5, 1); }
.vote-btn svg path { fill-opacity: 0; transition: fill-opacity .15s; }
@media (hover: hover) { .vote-btn:hover { background: var(--hover); } }
@media (hover: hover) { .vote-btn.up:hover { color: var(--up); } }
@media (hover: hover) { .vote-btn.down:hover { color: var(--down); } }
.vote-score { min-width: 22px; text-align: center; font-weight: 750; font-size: .85rem; font-variant-numeric: tabular-nums; display: inline-block; }
.vote.is-up { background: var(--up); }
.vote.is-down { background: var(--down); }
.vote.is-up .vote-btn, .vote.is-down .vote-btn, .vote.is-up .vote-score, .vote.is-down .vote-score { color: #fff; }
.vote.is-up .up svg path, .vote.is-down .down svg path { fill-opacity: 1; }
@media (hover: hover) { .vote.is-up .vote-btn:hover, .vote.is-down .vote-btn:hover { background: rgba(255, 255, 255, .15); } }
.vote .pop svg { animation: pop .4s cubic-bezier(.3, 1.8, .5, 1); }
.vote .pop.down svg { animation-name: popdown; }
.vote-score.tick-up { animation: tickup .3s ease; }
.vote-score.tick-down { animation: tickdown .3s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.45) translateY(-3px); } 100% { transform: scale(1); } }
@keyframes popdown { 0% { transform: scale(1); } 40% { transform: scale(1.45) translateY(3px); } 100% { transform: scale(1); } }
@keyframes tickup { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tickdown { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.vote-sm { background: transparent; }
.vote-sm .vote-btn { width: 30px; height: 30px; }
.vote-sm.is-up, .vote-sm.is-down { background: transparent; }
.vote-sm.is-up .vote-btn.up, .vote-sm.is-up .vote-score { color: var(--up); }
.vote-sm.is-down .vote-btn.down, .vote-sm.is-down .vote-score { color: var(--down); }
.vote-sm.is-up .vote-btn.down, .vote-sm.is-down .vote-btn.up { color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  background: var(--surface-2); border: 0; font-weight: 650; font-size: .85rem; color: var(--text-2);
  transition: background .15s, transform .1s;
}
@media (hover: hover) { .pill:hover { background: var(--hover); } }
.pill:active { transform: scale(.94); }
.pill svg { width: 18px; height: 18px; }
.pill-icon { padding: 0 9px; margin-left: auto; }
.actions .pill span { white-space: nowrap; }

/* ---------- Страница поста ---------- */
.back-row { display: flex; align-items: center; gap: 4px; padding: 0 6px 6px; }
.back-row .board-chip { font-size: .9rem; }
.post-full .post-meta { font-size: .85rem; }
.avatar {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: hsl(var(--h, 20) 55% 45%); color: #fff; font-size: 11px; font-weight: 800;
}
.avatar-deleted { background: var(--surface-2); color: var(--muted); }
.mod-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--border); color: var(--ok);
}
.mod-btn { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 5px 10px; font-size: .8rem; font-weight: 650; }
@media (hover: hover) { .mod-btn:hover { background: var(--hover); } }
.mod-btn.danger { color: var(--danger); }
.locked-note { display: flex; align-items: center; gap: 8px; color: var(--muted); }

.composer { display: flex; flex-direction: column; gap: 8px; transition: box-shadow .2s; }
.composer:focus-within { box-shadow: inset 0 0 0 1px var(--accent); }
.composer-who { font-size: .82rem; color: var(--muted); }
.composer textarea, .c-reply-slot textarea {
  width: 100%; min-height: 44px; max-height: 50vh; resize: none; border: 1px solid var(--border);
  background: var(--surface-2); border-radius: 12px; padding: 10px 12px; outline: none; line-height: 1.45;
  transition: border-color .15s, min-height .2s;
}
.composer textarea:focus, .c-reply-slot textarea:focus { border-color: var(--accent); min-height: 90px; }
.composer-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.composer-actions .muted { margin-right: auto; }
.comments-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; gap: 8px; }
.no-comments { text-align: center; padding: 30px 16px; }

/* ---------- Комментарии (как на reddit) ---------- */
.comment-tree { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px 6px 10px 2px; }
.comment { position: relative; display: flex; padding-top: 8px; }
.comment.is-new { animation: newc .9s ease; }
@keyframes newc { 0% { opacity: 0; transform: translateY(-6px); } 30% { opacity: 1; transform: none; } 100% { background: transparent; } }
.comment.flash-target > .c-main { animation: hl 2.2s ease; border-radius: 10px; }
@keyframes hl { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
.c-line {
  position: absolute; left: 13px; top: 38px; bottom: 0; width: 16px; margin-left: -8px;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.c-line::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; border-radius: 1px; background: var(--line); transition: background .15s; }
@media (hover: hover) { .c-line:hover::before { background: var(--accent); } }
.c-main { flex: 1; min-width: 0; }
.c-head { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); padding-left: 2px; min-height: 26px; }
.c-head .anon { font-size: .82rem; }
.c-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--muted); padding: 2px 6px; border-radius: 6px; font-size: .78rem; }
.c-toggle svg { width: 16px; height: 16px; }
.c-content { padding-left: 30px; }
.c-body { overflow-wrap: anywhere; font-size: .93rem; margin: 2px 0 2px; }
.c-actions { display: flex; align-items: center; gap: 2px; margin-left: -6px; color: var(--muted); }
.c-act {
  display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--muted);
  height: 30px; padding: 0 8px; border-radius: 999px; font-size: .8rem; font-weight: 650;
}
@media (hover: hover) { .c-act:hover { background: var(--hover); color: var(--text); } }
.c-act svg { width: 16px; height: 16px; }
.c-children { margin-left: -8px; }
.comment.is-pinned > .c-main > .c-head .anon::after { content: ""; }
.comment.is-pinned > .c-main { background: color-mix(in srgb, var(--pin) 6%, transparent); border-radius: 10px; }
.comment.is-deleted > .c-main > .c-content > .c-body { font-style: italic; }

/* свёрнутая ветка */
.comment.collapsed > .c-line { display: none; }
.comment.collapsed > .c-main > .c-content { display: none; }
.comment.collapsed > .c-main > .c-head { opacity: .75; cursor: pointer; }
.comment.collapsed .c-minus { display: none; }
.c-count:empty { display: none; }
.comment:not(.collapsed) .c-count { display: none; }
.c-count { background: var(--surface-2); border-radius: 999px; padding: 0 8px; font-weight: 700; }

.c-reply-slot form { margin: 6px 0 8px; display: flex; flex-direction: column; gap: 6px; animation: rise .2s ease; }
.c-reply-slot .composer-actions .btn { min-height: 34px; padding: 0 14px; }

/* ---------- Формы ---------- */
.submit-form, .login-card, .search-card { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; font-weight: 600; position: relative; }
.field small { font-weight: 400; }
.field input, .field select, .field textarea, .search-filters select {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px;
  padding: 11px 12px; outline: none; font-weight: 400; font-size: 16px; /* 16px — iOS не зумит */
  transition: border-color .15s;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.counter { position: absolute; right: 10px; top: 0; color: var(--muted); }
.form-error { color: var(--danger); margin: 0; font-size: .88rem; font-weight: 600; animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.submit-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }

.dropzone {
  position: relative; border: 2px dashed var(--border); border-radius: 14px; min-height: 120px;
  display: grid; place-items: center; text-align: center; overflow: hidden; transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; }
.dz-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; }
.dz-empty svg { width: 34px; height: 34px; color: var(--muted); }
.dz-preview { width: 100%; background: #000; line-height: 0; }
.dz-preview img, .dz-preview video { display: block; width: 100%; max-height: 360px; object-fit: contain; }
.dz-preview .dz-info { line-height: 1.4; padding: 6px 10px; background: var(--surface-2); color: var(--muted); font-size: .8rem; text-align: left; }
.dropzone.has-file { border-style: solid; }
.dropzone.has-file input[type=file] { display: none; }
.dz-remove { position: absolute; top: 8px; right: 8px; z-index: 2; background: rgba(0, 0, 0, .6); color: #fff; }

.progress { position: relative; height: 26px; border-radius: 13px; background: var(--surface-2); overflow: hidden; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); transition: width .2s; }
.progress span { position: relative; display: block; text-align: center; font-size: .8rem; font-weight: 700; line-height: 26px; }

.search-field { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 14px; }
.search-field:focus-within { border-color: var(--accent); }
.search-field input { flex: 1; border: 0; background: none; outline: none; padding: 11px 0; font-size: 16px; min-width: 0; }
.search-field svg { color: var(--muted); }
.search-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.search-filters select { flex: 1; min-width: 130px; width: auto; padding: 9px 10px; }
.results-count { padding: 0 14px; }

/* чекбокс */
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-weight: 600; user-select: none; }
.check input { position: absolute; opacity: 0; }
.check-box {
  flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--muted); margin-top: 1px;
  display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.check-box::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0); margin-top: -2px; transition: transform .2s cubic-bezier(.4, 1.8, .5, 1); }
.check input:checked + .check-box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check-box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .check-box { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Модалка правил ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .65); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center; animation: fadein .25s ease;
}
.modal {
  width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--surface);
  border-radius: 22px 22px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; animation: slideup .35s cubic-bezier(.2, .8, .2, 1);
}
.modal-backdrop.closing { animation: fadeout .25s ease forwards; }
.modal-backdrop.closing .modal { animation: slidedown .25s ease forwards; }
.rules-head { display: flex; align-items: center; gap: 12px; }
.rules-head p { margin: 2px 0 0; }
.rules-text {
  min-height: 140px; max-height: 40vh; overflow-y: auto; background: var(--surface-2); border-radius: 14px;
  padding: 14px; border: 1px solid var(--border);
}
.rules-placeholder { color: var(--muted); text-align: center; margin: 40px 0; }
@keyframes fadein { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes slideup { from { transform: translateY(100%); } }
@keyframes slidedown { to { transform: translateY(100%); } }

/* ---------- Нижняя шторка ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .5); animation: fadein .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 91; max-width: 520px; margin: 0 auto;
  background: var(--surface); border-radius: 20px 20px 0 0; padding: 6px 8px calc(12px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow); animation: slideup .28s cubic-bezier(.2, .8, .2, 1); max-height: 85vh; overflow-y: auto;
}
.sheet.closing { animation: slidedown .2s ease forwards; }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 4px auto 8px; }
.sheet-title { padding: 6px 12px 10px; font-weight: 750; }
.sheet-item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 12px; border: 0; background: none;
  border-radius: 12px; text-align: left; font-weight: 600;
}
.sheet-item:active { background: var(--hover); }
@media (hover: hover) { .sheet-item:hover { background: var(--hover); } }
.sheet-item.danger { color: var(--danger); }
.sheet-item.mod { color: var(--ok); }
.sheet-item svg { width: 22px; height: 22px; }
.sheet-sep { height: 1px; background: var(--border); margin: 6px 12px; }
.sheet-form { display: flex; flex-direction: column; gap: 10px; padding: 0 6px 6px; }
.radio-list { display: flex; flex-direction: column; gap: 4px; }
.radio-item { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 12px; cursor: pointer; font-weight: 550; }
@media (hover: hover) { .radio-item:hover { background: var(--hover); } }
.radio-item input { accent-color: var(--accent); width: 18px; height: 18px; }
.sheet-form textarea, .sheet-form input[type=text] {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px;
  padding: 10px 12px; font-size: 16px; resize: none; outline: none;
}

/* ---------- Лайтбокс ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, .92); display: grid; place-items: center;
  animation: fadein .2s; touch-action: pinch-zoom;
}
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; animation: zoomin .25s ease; }
.lightbox-close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; color: #fff; background: rgba(255, 255, 255, .12); z-index: 1; }
@keyframes zoomin { from { transform: scale(.92); opacity: 0; } }

/* ---------- Тосты ---------- */
.toasts {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 130; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 650; font-size: .9rem;
  box-shadow: var(--shadow); animation: toastin .3s cubic-bezier(.2, 1.4, .4, 1);
}
.toast.error { background: var(--danger); color: #fff; }
.toast.out { animation: toastout .25s ease forwards; }
@keyframes toastin { from { transform: translateY(20px) scale(.9); opacity: 0; } }
@keyframes toastout { to { transform: translateY(10px); opacity: 0; } }

.flash-list { padding: 0 8px; }
.flash { padding: 10px 14px; border-radius: 12px; margin-bottom: 8px; background: var(--surface-2); font-weight: 600; font-size: .9rem; }
.flash-success { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); }
.flash-warning, .flash-error { background: color-mix(in srgb, var(--danger) 18%, var(--surface)); }

/* ---------- Пустые состояния / загрузка ---------- */
.empty { text-align: center; padding: 40px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-ico { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); margin-bottom: 4px; }
.empty-ico svg { width: 34px; height: 34px; }
.title-ico { display: flex; align-items: center; gap: 8px; }
.title-ico svg { width: 26px; height: 26px; color: var(--accent); }
.tab { display: inline-flex; align-items: center; gap: 6px; }
.tab svg { width: 17px; height: 17px; }
.empty p { margin: 0 0 6px; color: var(--muted); }
.feed-more { display: grid; place-items: center; padding: 20px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.captcha-host { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 140; }

/* ---------- Установка приложения (PWA) ---------- */
.install-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 0;
  background: none; color: var(--accent); font-weight: 650; text-align: left; width: 100%;
}
@media (hover: hover) { .install-link:hover { background: var(--hover); } }
.install-banner { display: flex; align-items: center; gap: 12px; animation: rise .35s ease both; }
.install-banner .ib-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.ib-close { width: 34px; height: 34px; margin-right: -6px; color: var(--muted); }
.ib-close svg { width: 18px; height: 18px; }
.ios-steps { margin: 0; padding: 0 12px 6px 34px; display: flex; flex-direction: column; gap: 10px; }
.ios-steps svg { width: 18px; height: 18px; vertical-align: -3px; color: var(--link); }
.offline-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; }

/* ---------- 404 ---------- */
.not-found { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.nf-code {
  font-size: 84px; font-weight: 900; line-height: 1; letter-spacing: -3px;
  background: linear-gradient(135deg, var(--accent), #ff8a3d); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: rise .5s ease both;
}
.not-found p { margin: 0 0 10px; max-width: 340px; }
.nf-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------- Админ-панель ---------- */
.panel { display: flex; flex-direction: column; gap: 4px; }
.panel h2 { margin-bottom: 10px; }
.panel-tabs { padding: 0 10px 8px; }
.count-badge { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .75rem; margin-left: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 0 8px 8px; }
.stat-grid .card { margin: 0; border: 1px solid var(--border); border-radius: 14px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stat-sub { font-size: .75rem; color: var(--muted); }
@media (hover: hover) { a.stat:hover { background: var(--hover); } }
.stat-alert { border-color: var(--danger) !important; }
.stat-alert b { color: var(--danger); }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.legend { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-posts, .bar-posts { background: var(--accent); }
.lg-comments, .bar-comments { background: var(--down); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 170px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.bar-stack { flex: 1; width: 100%; display: flex; flex-direction: column-reverse; justify-content: flex-start; border-radius: 6px 6px 2px 2px; overflow: hidden; background: var(--surface-2); }
.bar { width: 100%; transform-origin: bottom; animation: grow .7s cubic-bezier(.2, .8, .2, 1) both; min-height: 0; }
@keyframes grow { from { transform: scaleY(0); } }
.bar-label { font-size: .7rem; color: var(--muted); }
.panel-cols { display: grid; gap: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: .78rem; }
@media (hover: hover) { .table a:hover, .top-list a:hover { text-decoration: underline; } }
.top-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: .9rem; }
.report-row { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.report-row:last-child { border-bottom: 0; }
.report-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.report-details { margin: 0; color: var(--text-2); font-style: italic; }
.report-target { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border-left: 3px solid var(--border); overflow-wrap: anywhere; }
@media (hover: hover) { .report-target:hover { border-left-color: var(--accent); } }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ban-form { display: flex; gap: 6px; }
.ban-form select { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 0 8px; }
.login-card { max-width: 420px; margin: 30px auto; }

/* ================= Планшеты и компьютеры ================= */
@media (min-width: 640px) {
  .card { border-radius: 16px; border: 1px solid var(--border); margin: 0 8px 10px; }
  .content { padding: 14px 8px 30px; }
  .comment-tree { border-radius: 16px; border: 1px solid var(--border); margin: 0 8px; }
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 22px; padding: 26px; animation-name: zoomin; }
  .modal-backdrop.closing .modal { animation: fadeout .2s forwards; }
  .media { margin: 4px 0 10px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .panel-cols { grid-template-columns: 1fr 1fr; }
  .only-desktop { display: inline-flex !important; }
  .only-desktop.btn { display: inline-flex !important; }
  .flash-list { padding: 0 8px; }
  .c-content { padding-left: 32px; }
}

@media (min-width: 960px) {
  body { padding-bottom: 0; }
  .bottom-nav, .only-mobile { display: none !important; }
  .topbar { padding: 0 20px; gap: 16px; }
  .top-search {
    display: flex; align-items: center; gap: 8px; flex: 1; max-width: 520px; margin: 0 auto;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 14px; height: 40px;
  }
  .top-search:focus-within { border-color: var(--accent); background: var(--surface); }
  .top-search svg { color: var(--muted); }
  .top-search input { flex: 1; border: 0; background: none; outline: none; min-width: 0; }
  .top-actions { margin-left: 0; gap: 6px; }
  .layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 12px; padding: 0 16px; }
  .sidebar {
    position: sticky; top: 57px; height: calc(100vh - 57px); transform: none; width: auto; z-index: 1;
    background: transparent; border-right: 1px solid var(--border); border-radius: 0; padding: 14px 10px;
  }
  .drawer-backdrop { display: none; }
  .content { max-width: 760px; width: 100%; }
  .toasts { bottom: 24px; }
  .captcha-host { bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
