/* KADR — раскладка как у YouTube, но строго без скруглений. Движение — минимальное. */

:root {
  --bg: #0f0f0f;
  --raised: #272727;
  --hover: #3f3f3f;
  --hover-soft: rgba(255, 255, 255, .1);
  --line: #303030;
  --text: #f1f1f1;
  --muted: #aaaaaa;
  --accent: #e02424;
  --accent-text: #fff;
  --invert-bg: #f1f1f1;
  --invert-text: #0f0f0f;
  --input: #121212;
  --input-line: #303030;
  --menu: #282828;
  --scrim: rgba(0, 0, 0, .6);
  --ok: #2ba640;
  --warn: #e0a93b;
  --bad: #ff4e45;
  --top-h: 56px;
  --guide-w: 240px;
  --mini-w: 72px;
  --ease: cubic-bezier(.2, 0, 0, 1);
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --raised: #f2f2f2;
  --hover: #e5e5e5;
  --hover-soft: rgba(0, 0, 0, .05);
  --line: #e5e5e5;
  --text: #0f0f0f;
  --muted: #606060;
  --invert-bg: #0f0f0f;
  --invert-text: #ffffff;
  --input: #ffffff;
  --input-line: #c6c6c6;
  --menu: #ffffff;
  --scrim: rgba(0, 0, 0, .3);
  --bad: #cc0000;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ffffff;
    --raised: #f2f2f2;
    --hover: #e5e5e5;
    --hover-soft: rgba(0, 0, 0, .05);
    --line: #e5e5e5;
    --text: #0f0f0f;
    --muted: #606060;
    --invert-bg: #0f0f0f;
    --invert-text: #ffffff;
    --input: #ffffff;
    --input-line: #c6c6c6;
    --menu: #ffffff;
    --scrim: rgba(0, 0, 0, .3);
    --bad: #cc0000;
    color-scheme: light;
  }
}

/* Никаких скруглений нигде, включая браузерные поля */
*, *::before, *::after { box-sizing: border-box; border-radius: 0 !important; }
input, textarea, select, button { -webkit-appearance: none; appearance: none; }
input[type="checkbox"], input[type="radio"] { -webkit-appearance: auto; appearance: auto; }

html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; font-size: 14px; line-height: 1.43; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
img, video { display: block; }
[hidden] { display: none !important; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: square; stroke-linejoin: miter; flex: none; }
.ln { text-decoration: underline; }

/* ── полоска загрузки вверху, как у YouTube ── */
.loadbar {
  position: fixed; left: 0; top: 0; z-index: 100; height: 2px; width: 0;
  background: var(--accent); opacity: 0; pointer-events: none;
}
.loadbar.run { opacity: 1; width: 70%; transition: width 2.5s var(--ease); }
.loadbar.end { opacity: 0; width: 100%; transition: width .15s, opacity .25s .15s; }

/* ── шапка ── */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 40; height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 16px; background: var(--bg);
}
.top-start { display: flex; align-items: center; gap: 4px; flex: none; }
.top-end { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; flex: none;
  background: none; border: 0; cursor: pointer; transition: background .1s;
}
.icon-btn:hover { background: var(--hover-soft); }
.icon-btn:active { background: var(--hover); }
.logo { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px 0 10px; }
.logo img { width: 28px; height: 28px; }
.logo span { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }

.search { flex: 0 1 640px; min-width: 0; display: flex; align-items: center; }
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 16px;
  background: var(--input); border: 1px solid var(--input-line); border-right: 0; outline: none; font-size: 16px;
}
.search input:focus { border-color: #1c62b9; }
.search input::-webkit-search-cancel-button { display: none; }
.search-btn {
  width: 64px; height: 40px; display: grid; place-items: center; flex: none;
  background: var(--raised); border: 1px solid var(--input-line); cursor: pointer; transition: background .1s;
}
.search-btn:hover { background: var(--hover); }
.search-btn svg { width: 22px; height: 22px; }
.search-back, .search-open { display: none; }

.create-btn {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px 0 10px;
  background: var(--raised); font-weight: 500; transition: background .1s;
}
.create-btn:hover { background: var(--hover); }
.me-btn {
  width: 32px; height: 32px; margin: 0 8px; padding: 0; border: 0; cursor: pointer; flex: none;
  color: #fff; font-weight: 500; font-size: 15px; background: var(--accent);
}
.me-btn.guest {
  width: auto; height: 36px; margin: 0; padding: 0 14px; display: flex; align-items: center; gap: 6px;
  background: none; color: #3ea6ff; box-shadow: inset 0 0 0 1px var(--line); font-size: 14px;
}
.me-btn.guest:hover { background: rgba(62, 166, 255, .12); }
:root[data-theme="light"] .me-btn.guest { color: #065fd4; }

.menu {
  position: absolute; right: 16px; top: 52px; z-index: 50; width: 300px; max-height: calc(100vh - 70px); overflow: auto;
  background: var(--menu); padding: 8px 0; box-shadow: 0 4px 32px rgba(0, 0, 0, .35), 0 0 0 1px var(--line);
  animation: rise .12s var(--ease);
}
.menu .who { display: flex; gap: 14px; padding: 8px 16px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.menu .who .ava { width: 40px; height: 40px; }
.menu .who b { display: block; font-size: 16px; font-weight: 500; }
.menu .who span { color: var(--muted); }
.menu a, .menu button {
  display: flex; align-items: center; gap: 16px; width: 100%; height: 40px; padding: 0 16px;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--hover-soft); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }

/* ── левая навигация ── */
.guide, .mini-guide {
  position: fixed; left: 0; top: var(--top-h); bottom: 0; z-index: 30; background: var(--bg);
  overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: transparent transparent;
}
.guide:hover, .mini-guide:hover { scrollbar-color: var(--hover) transparent; }
.guide { width: var(--guide-w); padding: 12px 12px 24px; display: none; }
.mini-guide { width: var(--mini-w); padding: 4px; display: none; }
.g-item {
  display: flex; align-items: center; gap: 24px; height: 40px; padding: 0 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .1s;
}
.g-item:hover { background: var(--hover-soft); }
.g-item.on { background: var(--hover-soft); font-weight: 500; }
.g-item .ava { width: 24px; height: 24px; font-size: 12px; }
.g-item span { overflow: hidden; text-overflow: ellipsis; }
.g-sep { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.g-head { padding: 6px 12px 4px; font-size: 16px; font-weight: 500; }
.g-foot { padding: 16px 12px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.m-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 0 14px; font-size: 10px; transition: background .1s; }
.m-item:hover { background: var(--hover-soft); }
.m-item.on { font-weight: 500; }

body.g-full .guide { display: block; }
body.g-full main { margin-left: var(--guide-w); }
body.g-mini .mini-guide { display: block; }
body.g-mini main { margin-left: var(--mini-w); }
body.drawer .guide {
  display: block; top: 0; z-index: 60; padding-top: 0;
  box-shadow: 0 0 40px rgba(0, 0, 0, .4); animation: slide .16s var(--ease);
}
body.drawer .guide::before {
  content: ""; display: block; height: var(--top-h);
}
.drawer-head { display: none; }
body.drawer .drawer-head {
  display: flex; align-items: center; gap: 4px; position: absolute; top: 0; left: 4px; height: var(--top-h);
}
.scrim { position: fixed; inset: 0; z-index: 55; background: var(--scrim); animation: fade .16s; }

/* ── основная часть ── */
main { padding: var(--top-h) 0 40px; min-height: 100vh; }
.view { animation: rise .18s var(--ease); }
.pad { padding: 0 24px; }

@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide { from { transform: translateX(-12px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ── категории-чипы ── */
.chips {
  position: sticky; top: var(--top-h); z-index: 20; background: var(--bg);
  display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding: 12px 24px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 32px; padding: 0 12px; display: flex; align-items: center;
  background: var(--raised); font-weight: 500; white-space: nowrap; transition: background .1s;
}
.chip:hover { background: var(--hover); }
.chip.on { background: var(--invert-bg); color: var(--invert-text); }

/* ── сетка видео ── */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 40px 16px; padding: 12px 24px 0;
}
.grid.compact { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 32px 8px; padding: 0; }
.card { display: block; min-width: 0; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--raised); overflow: hidden; }
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb video { opacity: 0; transition: opacity .2s; background: #000; object-fit: contain; }
.thumb video.on { opacity: 1; }
.thumb .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.thumb .noimg svg { width: 40px; height: 40px; }
.dur {
  position: absolute; right: 8px; bottom: 8px; padding: 1px 4px;
  background: rgba(0, 0, 0, .8); color: #fff; font-size: 12px; font-weight: 500; line-height: 18px;
}
.badge {
  position: absolute; left: 8px; top: 8px; padding: 1px 6px;
  font-size: 12px; font-weight: 500; line-height: 18px; color: #000;
}
.badge.warn { background: var(--warn); }
.badge.bad { background: var(--bad); color: #fff; }
.card .info { display: flex; gap: 12px; padding-top: 12px; }
.card .info .ava { width: 36px; height: 36px; font-size: 15px; }
.card .txt { min-width: 0; }
.ctitle {
  font-size: 16px; font-weight: 500; line-height: 22px; margin: 0 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}
.cmeta { color: var(--muted); font-size: 14px; line-height: 20px; }
.cmeta a:hover { color: var(--text); }
.reason { color: var(--bad); font-size: 13px; margin-top: 4px; }

/* аватарка канала — квадрат с буквой */
.ava {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 500; font-size: 17px; background: #5f6368; user-select: none;
}

/* ── список (поиск, история) ── */
.list { display: flex; flex-direction: column; gap: 16px; padding: 16px 24px 0; max-width: 1280px; }
.row-card { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 16px; }
.row-card .ctitle { font-size: 18px; line-height: 26px; font-weight: 400; }
.row-card .chan-line { display: flex; align-items: center; gap: 8px; margin: 12px 0; color: var(--muted); }
.row-card .chan-line .ava { width: 24px; height: 24px; font-size: 11px; }
.row-card .snip { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 24px 4px; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 700; }

/* ── кнопки ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  height: 36px; padding: 0 16px; border: 0; background: var(--raised); cursor: pointer;
  font-weight: 500; font-size: 14px; white-space: nowrap; transition: background .1s;
}
.btn:hover { background: var(--hover); }
.btn svg { width: 22px; height: 22px; }
.btn.primary, .btn.sub { background: var(--invert-bg); color: var(--invert-text); }
.btn.primary:hover, .btn.sub:hover { opacity: .88; background: var(--invert-bg); }
.btn.blue { background: #3ea6ff; color: #0f0f0f; }
.btn.blue:hover { background: #65b8ff; }
.btn.ghost { background: none; }
.btn.ghost:hover { background: var(--hover-soft); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.warn { background: var(--warn); color: #000; }
.btn.red { background: var(--accent); color: #fff; }
.btn.bad { background: none; color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.btn.bad:hover { background: rgba(255, 78, 69, .1); }
.btn.on { background: var(--raised); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-group { display: inline-flex; }
.btn-group .btn + .btn { box-shadow: inset 1px 0 0 var(--line); }
.liked svg { fill: currentColor; }

/* ── поля ── */
.field { display: block; margin-bottom: 20px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input.in, textarea.in, select.in {
  width: 100%; padding: 10px 12px; background: var(--input); border: 1px solid var(--input-line); outline: none; font-size: 15px;
}
input.in:focus, textarea.in:focus, select.in:focus { border-color: #3ea6ff; }
select.in {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 16px center, right 11px center; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px;
}
textarea.in { resize: vertical; min-height: 96px; }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); margin: 6px 0 14px; }
.check input { margin-top: 2px; accent-color: #3ea6ff; width: 16px; height: 16px; flex: none; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 20px; }
.panel { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); padding: 24px; }

/* ── пусто / ошибка ── */
.empty { text-align: center; padding: 96px 24px; color: var(--muted); }
.empty svg { width: 96px; height: 96px; stroke-width: 1; margin-bottom: 16px; }
.empty h2 { color: var(--text); margin: 0 0 8px; font-size: 22px; font-weight: 400; }
.empty p { margin: 0 auto; max-width: 460px; }
.empty .btn { margin-top: 20px; }

/* ── просмотр ── */
.watch {
  display: grid; grid-template-columns: minmax(0, 1fr) 402px; gap: 24px;
  max-width: 1754px; margin: 0 auto; padding: 24px 24px 0;
}
.player { position: relative; background: #000; aspect-ratio: 16 / 9; max-height: calc(100vh - 169px); width: 100%; display: grid; place-items: center; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player .perr { padding: 30px; text-align: center; color: #aaa; }
.status-bar { padding: 12px 16px; margin-bottom: 12px; background: var(--raised); box-shadow: inset 3px 0 0 var(--warn); }
.status-bar.bad { box-shadow: inset 3px 0 0 var(--bad); }
.vtitle { font-size: 20px; font-weight: 700; line-height: 28px; margin: 12px 0 0; word-break: break-word; }
.vrow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 12px; }
.chan { display: flex; gap: 12px; align-items: center; min-width: 0; }
.chan b { display: block; font-size: 16px; font-weight: 500; line-height: 22px; }
.chan .muted { font-size: 12px; }
.chan-box { display: flex; align-items: center; gap: 24px; min-width: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.desc { margin-top: 12px; padding: 12px; background: var(--raised); word-break: break-word; cursor: pointer; transition: background .1s; }
.desc:hover { background: var(--hover); }
.desc.open { cursor: default; }
.desc.open:hover { background: var(--raised); }
.desc .dmeta { font-weight: 500; margin-bottom: 4px; }
.desc .dtext { white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.desc.open .dtext { display: block; }
.desc .more { font-weight: 500; margin-top: 4px; }
.modbox { margin-top: 12px; padding: 12px 16px; background: var(--raised); box-shadow: inset 3px 0 0 var(--warn); }
.modbox h3 { margin: 0 0 8px; font-size: 14px; font-weight: 500; color: var(--warn); }
.flags { margin: 6px 0 10px; padding-left: 18px; color: var(--warn); }

.comments { margin-top: 24px; }
.comments h3 { font-size: 20px; font-weight: 700; margin: 0 0 24px; }
.cform { display: flex; gap: 16px; margin-bottom: 32px; }
.cform .ava { width: 40px; height: 40px; }
.cform .body { flex: 1; min-width: 0; }
.cform textarea {
  width: 100%; min-height: 26px; height: 26px; padding: 2px 0; resize: none; overflow: hidden;
  background: none; border: 0; border-bottom: 1px solid var(--line); outline: none; font-size: 14px;
}
.cform textarea:focus { border-bottom: 2px solid var(--text); }
.cform .row { display: none; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 8px; }
.cform.active .row { display: flex; }
.cform .row .err { flex: 1; }
.cm { display: flex; gap: 16px; margin-bottom: 20px; }
.cm .ava { width: 40px; height: 40px; }
.cm .body { flex: 1; min-width: 0; }
.cm .head { font-size: 12px; color: var(--muted); }
.cm .head b { color: var(--text); margin-right: 4px; font-weight: 500; font-size: 13px; }
.cm .text { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.cm .del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 500; padding: 6px 0 0; }
.cm .del:hover { color: var(--bad); }

.side h3 { margin: 0 0 12px; font-size: 16px; font-weight: 500; }
.mini { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 8px; margin-bottom: 8px; }
.mini .thumb .dur { right: 4px; bottom: 4px; }
.mini .ctitle { font-size: 14px; line-height: 20px; margin-bottom: 4px; }
.mini .cmeta { font-size: 12px; line-height: 18px; }

/* ── канал ── */
.channel { max-width: 1284px; margin: 0 auto; padding: 0 24px; }
.banner { height: clamp(100px, 16vw, 200px); margin-top: 16px; }
.ch-head { display: flex; gap: 24px; align-items: center; padding: 24px 0 8px; }
.ch-head .ava { width: 160px; height: 160px; font-size: 72px; }
.ch-head h1 { margin: 0 0 8px; font-size: 36px; font-weight: 700; line-height: 1.1; word-break: break-word; }
.ch-head .meta { color: var(--muted); margin-bottom: 8px; }
.ch-head .about { color: var(--muted); max-width: 640px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 12px; }
.ch-head .actions { margin-top: 4px; }
.tag { display: inline-block; padding: 1px 6px; font-size: 12px; font-weight: 500; vertical-align: 2px; }
.tag.admin { background: var(--invert-bg); color: var(--invert-text); }
.tag.mod { background: var(--raised); }
.tag.ban { background: var(--bad); color: #fff; }
.tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; height: 48px; display: flex; align-items: center; padding: 0 12px; color: var(--muted); font-size: 16px; font-weight: 500; box-shadow: inset 0 -2px 0 transparent; transition: color .1s, box-shadow .1s; }
.tabs a:hover { color: var(--text); box-shadow: inset 0 -2px 0 var(--muted); }
.tabs a.on { color: var(--text); box-shadow: inset 0 -2px 0 var(--text); }
.about-page { max-width: 760px; white-space: pre-wrap; word-break: break-word; }
.about-page dl { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; margin: 24px 0 0; white-space: normal; }
.about-page dt { color: var(--muted); }
.about-page dd { margin: 0; }

/* ── загрузка, вход, правила ── */
.narrow { max-width: 760px; margin: 0 auto; padding: 24px 24px 0; }
.narrow h1 { font-size: 24px; font-weight: 700; margin: 0 0 20px; }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px;
  min-height: 260px; padding: 24px; background: var(--raised); cursor: pointer; margin-bottom: 20px;
  box-shadow: inset 0 0 0 1px var(--line); transition: background .1s, box-shadow .1s;
}
.drop:hover { background: var(--hover); }
.drop.over { box-shadow: inset 0 0 0 2px #3ea6ff; }
.drop .circle { width: 112px; height: 112px; display: grid; place-items: center; background: var(--bg); margin-bottom: 12px; }
.drop .circle svg { width: 52px; height: 52px; color: var(--muted); stroke-width: 1.4; }
.drop b { font-size: 15px; font-weight: 400; }
.picked { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: center; margin-bottom: 20px; }
.picked img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.progress { height: 4px; background: var(--raised); margin: 12px 0 6px; }
.progress div { height: 100%; width: 0; background: #3ea6ff; transition: width .2s; }
.steps { list-style: none; padding: 0; margin: 20px 0; }
.steps li { padding: 10px 0 10px 30px; position: relative; box-shadow: inset 2px 0 0 var(--line); margin-left: 5px; }
.steps li::before { content: ""; position: absolute; left: -5px; top: 15px; width: 12px; height: 12px; background: var(--line); }
.steps li.done::before { background: var(--ok); }
.steps li.now::before { background: var(--warn); }
.auth { max-width: 450px; margin: 48px auto 0; padding: 0 16px; }
.auth .panel { padding: 40px 36px 32px; }
.auth .panel > img { width: 40px; height: 40px; margin: 0 0 16px; }
.auth h1 { font-size: 24px; font-weight: 400; margin: 0 0 6px; }
.auth .sub { color: var(--muted); margin: 0 0 28px; }
.rules h2 { font-size: 16px; font-weight: 500; margin: 26px 0 8px; }
.rules li { margin-bottom: 6px; }

/* ── модерация ── */
.studio { max-width: 1400px; margin: 0 auto; padding: 24px 24px 0; }
.studio h1 { margin: 0 0 20px; font-size: 24px; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--line); box-shadow: 0 0 0 1px var(--line); margin-bottom: 24px; }
.stat { background: var(--bg); padding: 14px 16px; }
.stat b { display: block; font-size: 28px; font-weight: 500; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12px; }
.qitem { display: grid; grid-template-columns: minmax(280px, 480px) 1fr; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.qitem video { width: 100%; aspect-ratio: 16 / 9; background: #000; }
.qitem h3 { margin: 4px 0; font-size: 18px; font-weight: 500; word-break: break-word; }
.qitem .qdesc { white-space: pre-wrap; word-break: break-word; max-height: 140px; overflow: auto; margin: 8px 0; padding: 8px 10px; background: var(--raised); }
.qitem .reports { margin: 8px 0; padding-left: 18px; }
.qitem .qact { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.table-wrap { overflow-x: auto; box-shadow: inset 0 0 0 1px var(--line); }
table.users { width: 100%; border-collapse: collapse; min-width: 680px; }
table.users th, table.users td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.users th { color: var(--muted); font-weight: 500; font-size: 12px; }
table.users tr:hover td { background: var(--hover-soft); }
table.users td .btn { height: 30px; padding: 0 10px; font-size: 13px; }

/* ── окно и уведомление ── */
.modal { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 70; padding: 20px; animation: fade .12s; }
.modal .box {
  width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; background: var(--menu); padding: 24px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, .4); animation: rise .16s var(--ease);
}
.modal h2 { margin: 0 0 16px; font-size: 20px; font-weight: 400; }
.modal .opts label { display: flex; gap: 14px; padding: 8px 0; cursor: pointer; }
.modal .opts input { accent-color: #3ea6ff; }
.modal .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast {
  position: fixed; left: 24px; bottom: 24px; z-index: 80; max-width: min(520px, calc(100vw - 48px));
  background: #f1f1f1; color: #0f0f0f; padding: 14px 20px; box-shadow: 0 4px 16px rgba(0, 0, 0, .3); animation: rise .16s var(--ease);
}
.toast.bad { background: #b3261e; color: #fff; }

.offline { max-width: 560px; margin: 0 auto; padding: 120px 24px 0; text-align: center; }
.offline svg { width: 88px; height: 88px; stroke-width: 1.2; color: var(--muted); margin-bottom: 20px; }
.offline h1 { font-size: 24px; font-weight: 400; margin: 0 0 10px; }
.offline p { color: var(--muted); margin: 0 0 6px; }
.offline .btn { margin-top: 20px; }

.bottom-nav { display: none; }

/* ── планшет ── */
@media (max-width: 1100px) {
  .watch { grid-template-columns: minmax(0, 1fr); }
  .qitem { grid-template-columns: minmax(0, 1fr); }
}

/* ── телефон ── */
@media (max-width: 791px) {
  :root { --top-h: 48px; }
  body { padding-bottom: 48px; }
  .top { padding: 0 4px 0 0; gap: 4px; }
  #guideBtn { display: none; }
  .logo { padding-left: 12px; }
  .search { display: none; }
  .search-open { display: grid; }
  .create-btn { width: 40px; padding: 0; justify-content: center; background: none; }
  .create-btn span { display: none; }
  .me-btn { margin: 0 8px 0 4px; width: 28px; height: 28px; font-size: 13px; }
  .me-btn.guest { margin: 0 8px 0 0; height: 32px; padding: 0 10px; font-size: 13px; }
  .me-btn.guest svg { display: none; }
  body.searching .top-start, body.searching .top-end { display: none; }
  body.searching .search { display: flex; flex: 1; gap: 4px; padding-left: 4px; }
  body.searching .search-back { display: grid; }
  body.searching .search input { border-right: 1px solid var(--input-line); height: 36px; }
  body.searching .search-btn { display: none; }
  .menu { left: 8px; right: 8px; width: auto; top: 46px; }

  .chips { padding: 8px 12px; gap: 8px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 4px 0 0; }
  .grid .card .info { padding: 12px 12px 0; }
  .grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 8px; }
  .grid.compact .card .info { padding: 8px 0 0; }
  .grid.compact .info .ava { display: none; }
  .grid.compact .ctitle { font-size: 14px; line-height: 20px; }
  .grid.compact .cmeta { font-size: 12px; line-height: 16px; }
  .pad, .page-head { padding-left: 12px; padding-right: 12px; }
  .page-head h1 { font-size: 22px; }
  .list { padding: 8px 12px 0; }
  .row-card { grid-template-columns: 160px minmax(0, 1fr); gap: 10px; }
  .row-card .ctitle { font-size: 14px; line-height: 20px; }
  .row-card .chan-line { margin: 4px 0; font-size: 12px; }
  .row-card .chan-line .ava, .row-card .snip { display: none; }

  .watch { padding: 0; gap: 16px; }
  .watch > div:first-child > :not(.player):not(.status-bar) { margin-left: 12px; margin-right: 12px; }
  .status-bar { margin: 0; }
  .player { max-height: 62vh; }
  .vtitle { font-size: 18px; line-height: 26px; }
  .vrow { flex-direction: column; align-items: stretch; }
  .chan-box { justify-content: space-between; }
  .actions { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .actions::-webkit-scrollbar { display: none; }
  .side { padding: 0 12px; }
  .mini { grid-template-columns: 150px minmax(0, 1fr); }

  .channel { padding: 0 12px; }
  .banner { margin-top: 8px; }
  .ch-head { gap: 16px; align-items: flex-start; padding-top: 16px; }
  .ch-head .ava { width: 72px; height: 72px; font-size: 32px; }
  .ch-head h1 { font-size: 24px; }
  .about-page dl { grid-template-columns: 1fr; gap: 2px; }
  .about-page dd { margin-bottom: 10px; }

  .narrow, .studio { padding: 16px 12px 0; }
  .narrow h1, .studio h1 { font-size: 20px; }
  .panel { padding: 16px; }
  .auth { margin-top: 16px; padding: 0 12px; }
  .auth .panel { padding: 24px 20px; }
  .picked { grid-template-columns: 1fr; }
  .drop { min-height: 200px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat b { font-size: 22px; }
  .btn { height: 36px; }
  .modal { padding: 0; align-items: end; }
  .modal .box { max-width: none; max-height: 85vh; }
  .toast { left: 12px; right: 12px; bottom: 60px; max-width: none; }

  .bottom-nav {
    display: flex; position: fixed; inset: auto 0 0 0; z-index: 35; height: 48px;
    background: var(--bg); box-shadow: 0 -1px 0 var(--line);
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.on svg { stroke-width: 2.4; }
  .bottom-nav a.plus svg { width: 36px; height: 36px; stroke-width: 1.2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
