:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --bg2: #16161a;
  --line: #232329;
  --text: #ededf0;
  --text2: #b4b4bd;
  --acc: #8b8cff;
  --acc-ink: #0d0d26;
  --f: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fl: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fm: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --nav-full: 248px;
  --nav-mini: 80px;
  --nav: var(--nav-full);
  --pad: 32px;
  --top: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 16px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.55 var(--f); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 600; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
::selection { background: var(--acc); color: var(--acc-ink); }

/* Шапка */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top);
  display: flex; align-items: center; gap: 24px; padding: 0 24px 0 16px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.burger, .help { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--text2); flex-shrink: 0; }
.burger:hover, .help:hover { color: var(--text); background: var(--bg2); }
.burger:hover { background: none; }
/* Левый блок шапки ровно до левого края сетки роликов — поиск начинается на одной линии с видео. */
.brand { display: flex; align-items: center; gap: 16px; flex-shrink: 0; width: calc(var(--nav-full) + var(--pad) - 16px - 24px); }
.logo { display: flex; align-items: center; gap: 10px; font: 700 22px/1 var(--fl); letter-spacing: -0.045em; white-space: nowrap; }
.ufo { flex-shrink: 0; overflow: visible; }
.ufo .disc { fill: var(--acc); }
.ufo .dome { fill: #c4c5ff; }
.ufo .lamp { fill: var(--bg); }
.ufo .beam { fill: var(--acc); opacity: 0; transition: opacity .2s, filter .2s; }
.ufo .cargo { fill: var(--acc); transition: fill .2s; }
.ufo .ring { display: none; }
/* Наведение: «плей» стоит на месте, просто включается подсветка луча-магнита. */
.logo:hover .ufo .beam, .logo:focus-visible .ufo .beam { opacity: .45; filter: drop-shadow(0 0 3px var(--acc)); }
.logo:hover .ufo .cargo, .logo:focus-visible .ufo .cargo { fill: #c4c5ff; }
.search { position: relative; flex: 1; min-width: 0; max-width: 640px; display: flex; align-items: center; gap: 12px; height: 40px; }
.search::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--line); }
/* Луч: при фокусе линия загорается от тарелки вправо и гаснет. */
.search::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, var(--acc), rgba(139, 140, 255, .35) 60%, transparent);
  transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.search:focus-within::after, .search.has::after { transform: scaleX(1); }
.sufo { flex-shrink: 0; margin-left: -1px; overflow: visible; color: var(--text2); transition: color .2s, transform .3s cubic-bezier(.2, .8, .2, 1); }
.sufo .sdisc { fill: currentColor; }
.sufo .sdome { fill: currentColor; opacity: .6; }
.sufo .slamp { fill: var(--bg); }
.sufo .sbeam { fill: var(--acc); opacity: 0; transition: opacity .25s; }
.search:focus-within .sufo, .search.has .sufo { color: var(--acc); transform: translateY(-3px); }
.search:focus-within .sufo .sdome { fill: #c4c5ff; opacity: 1; }
.search:focus-within .sufo .sbeam { opacity: .3; }
.search:focus-within .slamp { animation: lamp 1.2s steps(1) infinite; }
.search:focus-within .slamp:nth-of-type(2) { animation-delay: .4s; }
.search:focus-within .slamp:nth-of-type(3) { animation-delay: .8s; }
@keyframes lamp { 0% { fill: #f0ebee; } 33% { fill: var(--bg); } }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: 400 17px var(--f); padding: 8px 0; caret-color: var(--acc); }
.search input::placeholder { color: var(--text2); transition: color .2s; }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(.6); }
/* Блик под буквой, которую сейчас «сканирует» тарелка. */
.glint {
  position: absolute; left: 0; bottom: -1px; width: 96px; height: 3px; margin-left: -48px; pointer-events: none;
  background: radial-gradient(closest-side, #e6e6ff, var(--acc) 40%, transparent);
  filter: drop-shadow(0 0 6px var(--acc)); opacity: 0;
  transform: translateX(var(--cx, 0px)); transition: transform .18s cubic-bezier(.2, .8, .2, 1), opacity .2s;
}
.glint::before { content: ""; position: absolute; left: 24px; right: 24px; bottom: 3px; height: 22px; background: linear-gradient(to top, rgba(139, 140, 255, .16), transparent); }
.search.typing .glint { opacity: 1; }
/* Ищем по смыслу — блик ходит по линии туда-сюда. */
.search.scan .glint { opacity: 1; animation: scan 1s ease-in-out infinite alternate; }
@keyframes scan { from { transform: translateX(0); } to { transform: translateX(var(--w, 400px)); } }
/* Ничего не нашлось — тарелка растерянно качается. */
.search.miss .sufo { animation: miss .5s ease; }
@keyframes miss { 25% { transform: translateY(-3px) rotate(-12deg); } 75% { transform: translateY(-3px) rotate(10deg); } }
/* Пасхалка: спросили про НЛО — тарелка улетает по лучу и возвращается. */
.search.ufo-fly .sufo { animation: fly 1.1s cubic-bezier(.5, 0, .3, 1); }
@keyframes fly {
  40% { transform: translate(var(--w, 400px), -6px) rotate(8deg); opacity: 0; }
  41% { transform: translate(-40px, -6px); opacity: 0; }
  100% { transform: translateY(-3px); opacity: 1; }
}
.help { margin-left: auto; }

/* Меню слева */
.nav { position: fixed; top: var(--top); left: 0; bottom: 0; width: var(--nav); padding: 16px 0 24px; overflow-x: hidden; overflow-y: auto; background: var(--bg); z-index: 15; }
.nav a { position: relative; display: flex; align-items: center; gap: 16px; padding: 8px 24px; color: var(--text2); font-size: 16px; white-space: nowrap; }
.nav .s { display: none; }
.nav a.out i { font-style: normal; color: var(--text2); margin-left: 4px; }
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--text); font-weight: 500; }
.nav a.on::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--acc); }
.nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; flex-shrink: 0; }
.nav a.on svg { color: var(--acc); }
.nav hr { border: 0; border-top: 1px solid var(--line); margin: 16px 24px; }
.nav-foot { margin: 16px 24px 0; font-size: 14px; color: var(--text2); line-height: 1.5; }
.nav-foot b { color: var(--text); font-weight: 500; }
.scrim { display: none; }

/* Основная область */
main { margin-left: var(--nav); padding: 24px var(--pad) 80px; min-height: calc(100vh - var(--top)); outline: 0; }
.ph { font: 700 32px/1.2 var(--fl); letter-spacing: -0.035em; margin: 8px 0; }
.pd { color: var(--text2); margin: 0 0 32px; max-width: 60ch; }
.hello { color: var(--text2); margin: 0 0 16px; max-width: 60ch; }
.hello b { color: var(--text); font-weight: 500; }

/* Сетка роликов */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 40px 24px; }
.v { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.th { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--bg2); }
.th img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
/* Нажатие: карточка чуть «проседает» — видно, что клик пойман. */
.v .th, .row .th { transition: transform .12s ease; }
.v:active .th, .row:active .th { transform: scale(.98); }
.act, .fbtn, .nav a, .burger, .help { transition: color .15s, transform .12s ease; }
.act:active, .fbtn:active, .burger:active, .help:active { transform: scale(.92); }
.act.pop svg { animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 40% { transform: scale(1.3) rotate(-8deg); } }
.v:hover .th img, .row:hover .th img { transform: scale(1.04); }
.th::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 45%; background: linear-gradient(transparent, rgba(10, 8, 12, .85)); pointer-events: none; }
.dur { position: absolute; right: 8px; bottom: 8px; z-index: 1; font: 500 14px/1 var(--fm); color: var(--text); text-shadow: 0 1px 3px #000; font-variant-numeric: tabular-nums; }
.seen { position: absolute; left: 0; bottom: 0; z-index: 1; height: 3px; background: var(--acc); }
.vt { margin-top: 8px; font-weight: 600; letter-spacing: -0.01em; font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.v:hover .vt { text-decoration: underline; text-decoration-color: var(--text2); text-underline-offset: 3px; }
.vc, .vm { font-size: 14px; color: var(--text2); }
.vr { font-size: 14px; color: var(--text2); margin-top: 4px; }
.vr b { color: var(--acc); font-weight: 500; }
.more { height: 1px; }
.empty { color: var(--text2); max-width: 60ch; padding: 32px 0; }
.empty a, .pd a, .prose a, .lnk { color: var(--text); text-decoration: underline; text-decoration-color: var(--acc); text-underline-offset: 4px; }

/* Фильтры */
.fbar { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin: 0 0 32px; }
.fbtn { display: inline-flex; align-items: center; gap: 8px; color: var(--text2); font-weight: 500; }
.fbtn:hover, .fbtn[aria-expanded="true"] { color: var(--text); }
.fbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.factive { color: var(--text2); font-size: 14px; }
.factive b { color: var(--text); font-weight: 500; }
.fpanel { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 32px; padding: 0 0 32px; margin: -8px 0 32px; border-bottom: 1px solid var(--line); }
.fpanel[hidden] { display: none; }
.fcol h3 { font: 500 14px/1 var(--fm); color: var(--text2); text-transform: lowercase; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.fcol a { display: block; padding: 4px 0; color: var(--text2); }
.fcol a:hover { color: var(--text); }
.fcol a.on { color: var(--acc); font-weight: 500; }

/* Страница ролика */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 376px; gap: 40px; max-width: 1480px; }
.player { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #000; }
.player iframe, .player .ytbox { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.poster { position: absolute; inset: 0; width: 100%; height: 100%; }
.poster img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.72); transition: filter .2s; }
.poster:hover img { filter: brightness(.85); }
.pbtn { position: absolute; left: 50%; top: 50%; width: 80px; height: 80px; margin: -40px 0 0 -40px; border-radius: 50%; background: var(--acc); color: var(--acc-ink); display: grid; place-items: center; transition: transform .2s; }
.poster:hover .pbtn { transform: scale(1.06); }
.noembed { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 24px; color: var(--text); background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.sb { margin-top: 8px; font-size: 14px; color: var(--text2); min-height: 21px; }
.sb b { color: var(--acc); font-weight: 500; }
.sb button { text-decoration: underline; text-underline-offset: 3px; color: var(--text2); }
.wt { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; margin: 16px 0 8px; overflow-wrap: anywhere; }
.wch { font-weight: 500; }
.wrec { font-size: 14px; color: var(--text2); }
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin: 16px 0 24px; }
.act { display: inline-flex; align-items: center; gap: 8px; color: var(--text2); font-weight: 500; padding: 4px 0; }
.act:hover { color: var(--text); }
.act:hover span { text-decoration: underline; text-underline-offset: 4px; }
.act.on { color: var(--acc); }
.act svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.act.on svg { fill: currentColor; fill-opacity: .18; }
.about { padding: 24px 0; border-top: 1px solid var(--line); }
.wmeta { font-size: 14px; color: var(--text2); margin-bottom: 8px; }
.wmeta b { color: var(--acc); font-weight: 500; }
.wsum { margin: 0 0 16px; max-width: 60ch; font-size: 18px; line-height: 1.55; }
.wwhy { margin: 0 0 16px; max-width: 60ch; color: var(--text2); }
.wwhy::before { content: "Почему советуют: "; color: var(--text); font-weight: 500; }
.wtags { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; }
.wtags a { color: var(--text2); }
.wtags a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.wtags a.tp { color: var(--text); }
.h2 { font: 600 20px/1.3 var(--f); margin: 32px 0 8px; }
.h2 span { color: var(--text2); font-weight: 400; }

/* Комментарии */
.cms { list-style: none; padding: 0; margin: 0; }
.cm { padding: 24px 0; border-top: 1px solid var(--line); }
.cmh { font-size: 14px; color: var(--text2); }
.cmh .who { color: var(--text); font-weight: 500; }
.cmh a:hover { text-decoration: underline; text-underline-offset: 3px; }
.cmt { margin: 8px 0; max-width: 64ch; overflow-wrap: anywhere; }
.cmt p { margin: 0 0 8px; }
.cmt a { color: var(--acc); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cmt blockquote { margin: 0 0 8px; padding: 0 0 0 16px; border-left: 2px solid var(--line); color: var(--text2); }
.cmt img { max-width: min(100%, 480px); max-height: 360px; width: auto; height: auto; border-radius: 6px; margin: 8px 0; }
.cmt code, .cmt pre { font: 14px/1.5 ui-monospace, "SF Mono", Menlo, monospace; }
.cmt pre { white-space: pre-wrap; margin: 0 0 8px; color: var(--text2); }
.cmf { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--text2); }
.cmf a { text-decoration: underline; text-underline-offset: 3px; }
.cmf a:hover { color: var(--text); }
.st-strong, .st-rec { color: var(--acc); }
.cmore { margin-top: 16px; color: var(--text2); text-decoration: underline; text-underline-offset: 4px; }

/* Колонка справа */
.side h2 { font: 600 16px/1.3 var(--f); margin: 0 0 16px; }
.side h2 + .rows { margin-bottom: 32px; }
.rows { display: flex; flex-direction: column; gap: 16px; }
.row { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 16px; align-items: start; }
.row > span { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row .vt { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; }
.row .vc, .row .vm { font-size: 14px; }

/* Темы */
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 40px 32px; }
.topic .tn { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; font-size: 20px; font-weight: 600; padding-bottom: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.topic .tn span { font-size: 14px; color: var(--text2); font-weight: 400; }
.topic .tn:hover { color: var(--acc); }
.tstrip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tstrip .th { border-radius: 6px; }
.tstrip .th::after { display: none; }

/* О проекте */
.prose { max-width: 60ch; }
.prose p, .prose li { color: var(--text2); }
.prose p b, .prose li b { color: var(--text); font-weight: 500; }
.prose h2 { font-size: 20px; margin: 40px 0 8px; }
.prose ul { padding-left: 20px; }
.nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 24px; margin: 32px 0; max-width: 720px; }
.nums b { display: block; font: 500 32px/1.1 var(--fm); color: var(--acc); letter-spacing: -0.03em; }
.nums span { font-size: 14px; color: var(--text2); }

/* Переход «превью → плеер»: страница меняется сразу, раскрывается только превью, по которому кликнули. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-group(hero) { animation-duration: .3s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(hero), ::view-transition-new(hero) { height: 100%; object-fit: cover; }

/* Всплывашки */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 50; background: #1d1d24; color: var(--text); padding: 8px 16px; border-radius: 4px; font-size: 15px; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.keys { position: fixed; inset: 0; z-index: 60; background: rgba(8, 6, 10, .7); display: grid; place-items: center; padding: 16px; }
.keys[hidden] { display: none; }
.keys-in { background: var(--bg); padding: 32px 40px; border-radius: 8px; min-width: 280px; }
.keys h2 { font-size: 20px; margin-bottom: 16px; }
.keys dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 24px; margin: 0; }
.keys dt { font: 500 15px var(--fm); color: var(--acc); }
.keys dd { margin: 0; color: var(--text2); }

.skeleton { color: var(--text2); padding: 32px 0; }

/* Свёрнутое меню: иконки с короткой подписью под ними. */
@media (min-width: 1024px) {
  html.mini { --nav: var(--nav-mini); }
  html.mini .nav { padding-top: 8px; }
  html.mini .nav a { flex-direction: column; gap: 4px; padding: 12px 0; font-size: 12px; line-height: 1.2; text-align: center; }
  html.mini .nav a .l, html.mini .nav hr, html.mini .nav-foot { display: none; }
  html.mini .nav a .s { display: block; }
  html.mini .nav a.on::before { top: 12px; bottom: 12px; }
}

@media (max-width: 1180px) {
  .watch { grid-template-columns: minmax(0, 1fr); }
  .side { max-width: 760px; }
}
@media (max-width: 1023px) {
  :root { --nav: 0px; }
  .brand { width: auto; }
  .nav { width: 272px; transform: translateX(-100%); transition: transform .25s ease; z-index: 40; }
  body.nav-open .nav { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(8, 6, 10, .6); }
  main { padding: 24px 24px 80px; }
}
@media (max-width: 640px) {
  .top { gap: 16px; padding: 0 8px 0 8px; }
  .brand { gap: 8px; }
  .logo { font-size: 19px; }
  .ufo { width: 26px; height: 23px; }
  .help { display: none; }
  .search input { font-size: 16px; }
  main { padding: 16px 16px 64px; }
  .ph { font-size: 24px; }
  .grid { gap: 32px; }
  .wt { font-size: 20px; }
  .wsum { font-size: 16px; }
  .row { grid-template-columns: 136px minmax(0, 1fr); gap: 8px 16px; }
  .topics { grid-template-columns: minmax(0, 1fr); }
  .pbtn { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
