:root {
  --bg: #0a0809;
  --surface: #161213;
  --surface-2: #211b1c;
  --hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f5f1f0;
  --muted: #a59c9a;
  --accent: #ff7a1a;
  --accent-2: #ff9a3c;
  --red: 255, 46, 46;
  --top-h: 60px;
  --side-w: 232px;
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 12px); }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.glow {
  position: fixed;
  inset: 0 0 auto 0;
  height: 520px;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(40% 55% at 50% 0%, rgba(var(--red), 0.16), transparent 70%),
    radial-gradient(25% 40% at 20% 0%, rgba(255, 110, 40, 0.07), transparent 70%);
}

/* ---------- top bar ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: rgba(10, 8, 9, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  cursor: pointer;
  flex: 0 0 auto;
}
.icon-btn:hover { background: var(--hover); }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 750;
  font-size: 19px;
  letter-spacing: -0.01em;
  flex: 0 0 auto;
}
.brand img { border-radius: 8px; }
.search {
  flex: 1 1 auto;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  min-width: 0;
}
.search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: 20px 0 0 20px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  outline: none;
}
.search input:focus { border-color: rgba(255, 154, 60, 0.7); }
.search input::-webkit-search-cancel-button { filter: invert(1); }
.search button {
  width: 60px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 0 20px 20px 0;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.search button:hover { background: #2b2324; }
.top-app {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 19px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #1a0d05;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
  box-shadow: 0 6px 22px rgba(255, 122, 26, 0.3);
}
.top-app svg { width: 18px; height: 18px; }
.top-app-soft {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.top-app-soft:hover { background: var(--hover); }

/* release-driven visibility (bot sets aria-disabled on .btn-dl when no APK) */
.btn-dl[aria-disabled="true"] { display: none !important; }
body:has(.btn-dl[aria-disabled="true"]) .when-live { display: none !important; }
body:not(:has(.btn-dl[aria-disabled="true"])) .when-soon { display: none !important; }

/* ---------- layout ---------- */
.layout { position: relative; z-index: 1; display: flex; }
main { flex: 1 1 auto; min-width: 0; padding: 0 24px 40px; }

.side {
  position: sticky;
  top: var(--top-h);
  align-self: flex-start;
  width: var(--side-w);
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  padding: 12px;
  flex: 0 0 auto;
}
.side a {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 12px;
  height: 42px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 14.5px;
}
.side a:hover { background: var(--hover); }
.side a.active { background: rgba(255, 122, 26, 0.13); color: var(--accent-2); font-weight: 650; }
.side hr { border: 0; border-top: 1px solid var(--border); margin: 12px 4px; }
.side-note { color: var(--muted); font-size: 12px; padding: 12px; line-height: 1.45; }
body.side-collapsed .side { display: none; }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.55); }

@media (max-width: 1099px) {
  .side {
    position: fixed;
    z-index: 50;
    top: 0;
    left: 0;
    height: 100vh;
    background: #120e0f;
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    padding-top: 16px;
  }
  body.menu-open .side { transform: none; }
}

/* ---------- home: chips + grid ---------- */
.chips {
  position: sticky;
  top: var(--top-h);
  z-index: 5;
  display: flex;
  gap: 10px;
  padding: 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
  background: linear-gradient(var(--bg) 75%, transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
  font-weight: 550;
  font-size: 14px;
}
.chip:hover { background: rgba(255, 255, 255, 0.14); }
.chip.active { background: var(--text); color: #0a0809; }
.results-title { font-size: 18px; margin: 4px 0 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 28px 16px;
  padding-top: 8px;
}
.vcard { text-decoration: none; display: block; }
.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.vcard:hover .thumb img { transform: scale(1.03); }
.dur {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.8);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.vmeta { display: flex; gap: 12px; padding-top: 12px; }
.vmeta h3, .nitem h3 {
  font-size: 15.5px;
  line-height: 1.35;
  font-weight: 650;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.vmeta p, .nitem p { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.ava {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  flex: 0 0 auto;
}
.ava-blender { background: linear-gradient(135deg, #ff9a3c, #e2562a); color: #1a0d05; }
.ava-nasa { background: linear-gradient(135deg, #3d6fd8, #1b3a8a); color: #fff; }
.empty { color: var(--muted); text-align: center; padding: 60px 16px; }

/* ---------- watch ---------- */
.watch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 24px;
  padding-top: 20px;
  max-width: 1720px;
}
.player {
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(var(--red), 0.14);
}
.player video { width: 100%; height: 100%; display: block; background: #000; }
.w-title { font-size: 20px; line-height: 1.35; margin: 14px 0 10px; font-weight: 700; }
.w-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.w-channel { display: flex; align-items: center; gap: 12px; }
.w-channel div b { display: block; font-size: 15.5px; }
.w-channel div span { display: block; color: var(--muted); font-size: 12.5px; }
.w-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
.pill:hover { background: rgba(255, 255, 255, 0.15); }
.pill svg { width: 18px; height: 18px; }
.pill-accent { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #1a0d05; }
.pill-accent:hover { background: linear-gradient(180deg, #ffab5a, var(--accent-2)); }
.w-desc {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 14.5px;
}
.w-desc p + p { margin-top: 6px; }
.w-info { font-weight: 650; }
.w-desc .src { color: var(--muted); font-size: 13.5px; }
.w-desc .src a { color: var(--accent-2); }
.next h2 { font-size: 16px; margin-bottom: 12px; }
.nitem { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 10px; text-decoration: none; margin-bottom: 10px; }
.nitem .thumb { border-radius: 9px; }
.nitem h3 { font-size: 14px; }
.nitem p { font-size: 12.5px; }

@media (max-width: 1099px) {
  .watch { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  main { padding: 0 12px 32px; }
  .top { gap: 6px; padding: 0 8px 0 4px; }
  .brand span { display: none; }
  .search button { width: 46px; }
  .top-app { width: 38px; padding: 0; justify-content: center; }
  .top-app span { display: none; }
  .grid { grid-template-columns: 1fr; gap: 22px; }
  .watch { padding-top: 0; margin: 0 -12px; }
  .player { border-radius: 0; }
  .primary > :not(.player) { margin-left: 12px; margin-right: 12px; }
  .next { padding: 0 12px; }
  .w-title { font-size: 17px; }
  .nitem { grid-template-columns: 150px minmax(0, 1fr); }
}

/* ---------- app landing (/?page=app) ---------- */
.hero { max-width: 680px; margin: 0 auto; padding: 56px 0 64px; text-align: center; }
.hero-icon {
  display: inline-block;
  margin-bottom: 26px;
  border-radius: 24px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 12px 60px rgba(var(--red), 0.45);
}
.hero-icon img { border-radius: 22px; }
.hero h1 { font-size: clamp(32px, 7vw, 54px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 800; }
.lead { margin: 18px auto 0; max-width: 520px; color: var(--muted); font-size: clamp(16px, 2.2vw, 18px); }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 26px;
  border-radius: 12px;
  font-weight: 650;
  font-size: 16px;
  text-decoration: none;
}
.btn-primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #1a0d05; box-shadow: 0 8px 28px rgba(255, 122, 26, 0.35); }
.btn-secondary { background: rgba(255, 255, 255, 0.06); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--hover); }
.actions:has(.btn-dl[aria-disabled="true"]) + .meta { display: none; }
.actions:has(.btn-dl[aria-disabled="true"]) .btn-secondary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #1a0d05;
  border-color: transparent;
  box-shadow: 0 8px 28px rgba(255, 122, 26, 0.35);
}
.meta { margin-top: 14px; color: var(--muted); font-size: 14px; }
.meta b { color: var(--text); font-weight: 600; }
.features { max-width: 1080px; margin: 0 auto; padding: 8px 0 56px; }
.features h2 { font-size: clamp(24px, 4vw, 32px); text-align: center; margin-bottom: 24px; }
.cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); border-radius: 16px; padding: 22px; }
.card-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: rgba(255, 122, 26, 0.12); margin-bottom: 14px; color: var(--accent-2); }
.card-icon svg .fill { fill: currentColor; stroke: none; }
.card h3 { font-size: 18px; margin-bottom: 6px; }
.card p { color: var(--muted); font-size: 15px; }
.shots { max-width: 1080px; margin: 0 auto; padding: 0 0 56px; }
.shots::before { content: "Скриншоты"; display: block; text-align: center; font-size: clamp(24px, 4vw, 32px); font-weight: 700; margin-bottom: 24px; }
.shots-track { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.shots-track img { flex: 0 0 auto; width: 220px; height: auto; border-radius: 18px; border: 1px solid var(--border); scroll-snap-align: start; }

.footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  padding: 22px 16px 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
