:root {
  --bg: #0f0f0f;
  --surface: #1f1f1f;
  --surface-2: #272727;
  --hover: #3a3a3a;
  --line: #303030;
  --text: #f1f1f1;
  --muted: #aaaaaa;
  --accent: #3ea6ff;
  --brand: #3ea6ff;
  --warn: #f2b33d;
  --ok: #3ccf7a;
  --top-h: 64px;
  --side-w: 248px;
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
}

button { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top bar ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--top-h);
  padding: 0 16px;
  background: var(--bg);
}
.top__left, .top__right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.top__right { margin-left: auto; gap: 12px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 0;
  background: none;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
}
.brand__mark svg { width: 18px; height: 18px; stroke: #0f0f0f; stroke-width: 2.6; }

.search {
  display: flex;
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
}
.search input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 24px 0 0 24px;
  background: #121212;
  color: var(--text);
  font-size: 17px;
}
.search input:focus { outline: none; border-color: var(--accent); }
.search__btn {
  width: 72px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 0 24px 24px 0;
  background: var(--surface-2);
  cursor: pointer;
}

.status {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 15px;
  white-space: nowrap;
  border: 1px solid var(--line);
}
.status--parked { color: var(--ok); border-color: var(--ok); }
.status--moving { color: var(--warn); border-color: var(--warn); }
.status--unknown { color: var(--muted); }

.account { position: relative; }
.signin-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: none;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
}
.avatar-btn { padding: 0; width: 44px; height: 44px; border: 0; border-radius: 50%; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.account-menu {
  position: absolute;
  right: 0;
  top: 52px;
  min-width: 220px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
}
.account-menu p { margin: 0 0 10px; font-weight: 500; }
.account-menu button { width: 100%; }

/* ---------- layout ---------- */
.shell { display: flex; }
.sidebar {
  position: sticky;
  top: var(--top-h);
  flex: 0 0 var(--side-w);
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  padding: 8px 12px 96px;
}
body.nav-collapsed .sidebar { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.is-active { background: var(--surface-2); font-weight: 500; }
.nav-heading {
  margin: 16px 0 4px;
  padding: 12px 14px 0;
  border-top: 1px solid var(--line);
  font-size: 16px;
}

.main { flex: 1; min-width: 0; padding: 8px 24px 120px; }

@media (max-width: 1000px) {
  .sidebar { position: fixed; left: 0; z-index: 40; background: var(--bg); box-shadow: 4px 0 16px rgb(0 0 0 / 0.5); }
  body:not(.nav-open) .sidebar { display: none; }
  .status { display: none; }
}

/* ---------- browse ---------- */
.browse__title { margin: 8px 0 20px; font-size: 24px; }
.browse__msg { margin-bottom: 20px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 32px 18px;
}
.card, .card__main {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
div.card { cursor: default; }

.channel-link {
  display: block;
  padding: 4px 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.channel-link:hover { color: var(--text); }
.watch__channel-name.channel-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 24px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
}
.watch__channel-name.channel-link:hover { background: var(--hover); }

.channel-head {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 8px 0 32px;
}
.channel-head__avatar {
  flex: 0 0 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--surface-2) center / cover no-repeat;
}
.channel-head__name { margin: 0 0 6px; font-size: 32px; }
.channel-head__stats { margin: 0; color: var(--muted); }
.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__main:hover .thumb img, button.card:hover .thumb img { filter: brightness(1.1); }
.badge {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 40%;
  background: rgb(0 0 0 / 0.72);
  font-size: 15px;
  font-weight: 500;
}
.card__title {
  margin: 12px 0 4px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__sub { margin: 0; color: var(--muted); font-size: 15px; }

.duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgb(0 0 0 / 0.8);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.duration--live { background: #cc0000; }

.section + .section { margin-top: 40px; }
.section__title { margin: 0 0 16px; font-size: 20px; }

.hero {
  max-width: 560px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.hero h2 { margin: 0 0 8px; font-size: 22px; }
.hero p { margin: 0 0 20px; color: var(--muted); }
.hero code { color: var(--text); }

/* ---------- watch ---------- */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; }
@media (max-width: 1200px) { .watch { grid-template-columns: 1fr; } }

.player-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.player-wrap video, .yt-host, .yt-host iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.watch__title { margin: 14px 0 4px; font-size: 22px; }
.watch__channel { margin: 4px 0 0; color: var(--muted); }

.drive-cover {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: #000;
  text-align: center;
}
.drive-cover__label { margin: 0; color: var(--warn); font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; }
.drive-cover__title { margin: 0; font-size: 24px; max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-cover__speed { margin: 0; color: var(--muted); font-size: 15px; }

.transport { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.transport--big { justify-content: center; }
.transport--big .btn { min-width: 110px; min-height: 90px; font-size: 36px; border-radius: 45px; }

.btn {
  min-width: 72px;
  min-height: 56px;
  padding: 0 20px;
  border: 0;
  border-radius: 28px;
  background: var(--surface-2);
  font-size: 20px;
  cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--text); color: #0f0f0f; }
.btn--primary:hover { background: #d9d9d9; }

.up-next__title { margin: 0 0 12px; font-size: 18px; }
.up-next__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.up-item {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 6px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.up-item:hover { background: var(--surface-2); }
.up-item.is-current { background: var(--surface-2); outline: 1px solid var(--accent); }
.up-item .thumb { flex: 0 0 168px; border-radius: 8px; }
.up-item__text { min-width: 0; }
.up-item__title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.up-item__sub { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- update banner ---------- */
.update {
  position: fixed;
  top: calc(var(--top-h) + 8px);
  left: 50%;
  z-index: 70;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 10px 10px 20px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
}
.update__text { margin: 0; white-space: nowrap; }

/* ---------- mini player bar ---------- */
.mini {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 80px;
  padding: 0 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.mini__thumb { flex: 0 0 96px; aspect-ratio: 16 / 9; border-radius: 6px; background: var(--surface-2) center / cover no-repeat; }
.mini__title { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
