:root {
  --bg: #0f0f0f;
  --surface: #212121;
  --surface-2: #272727;
  --text: #f1f1f1;
  --muted: #aaa;
  --line: #303030;
  --brand: #ff0033;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.4 Roboto, Arial, "Microsoft YaHei", sans-serif; }
a { color: inherit; text-decoration: none; }
button { color: inherit; background: none; border: 0; cursor: pointer; font: inherit; }
input { font: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center;
  gap: 16px; padding: 0 16px; background: var(--bg);
}
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }
.logo { display: flex; align-items: center; }
.logo img { height: 32px; width: auto; display: block; }
.logo-mark { display: none; }
.logo sup { display: none; }
.search { flex: 1; max-width: 640px; display: flex; height: 40px; }
.search input {
  flex: 1; min-width: 0; padding: 0 16px; color: var(--text); background: #121212;
  border: 1px solid var(--line); border-right: 0; border-radius: 40px 0 0 40px; outline: none;
}
.search input:focus { border-color: #3ea6ff; }
.search button { width: 64px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 0 40px 40px 0; display: grid; place-items: center; }
.search button svg { width: 22px; height: 22px; fill: currentColor; }
.mic { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.mic svg { width: 20px; height: 20px; fill: currentColor; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #3f51b5; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }

.layout { display: flex; }
.sidebar { width: 240px; flex: none; padding: 12px; position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; }
.side a { display: flex; align-items: center; gap: 24px; height: 40px; padding: 0 12px; border-radius: 10px; margin-bottom: 2px; }
.side a:hover { background: var(--surface-2); }
.side a.on { background: var(--surface-2); font-weight: 500; }
.side svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.side .head { font-size: 16px; font-weight: 500; padding: 6px 12px; }

main { flex: 1; min-width: 0; padding: 18px 24px 40px; }
.chips { display: flex; gap: 12px; overflow-x: auto; margin-bottom: 20px; padding-bottom: 4px; }
.chip { white-space: nowrap; padding: 8px 12px; background: var(--surface-2); border-radius: 8px; font-weight: 500; }
.chip.on { background: var(--text); color: var(--bg); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 40px 16px; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.8); padding: 2px 4px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.card-info { display: flex; gap: 12px; margin-top: 12px; }
.card-info .avatar { width: 36px; height: 36px; }
.card-title { font-size: 16px; font-weight: 500; line-height: 1.35; max-height: 2.7em; overflow: hidden; }
.card-meta { color: var(--muted); font-size: 14px; margin-top: 4px; }

.watch { display: flex; gap: 24px; max-width: 1700px; }
.watch-main { flex: 1; min-width: 0; }
.player { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player video { width: 100%; height: 100%; display: block; }
.watch h1 { font-size: 20px; font-weight: 700; margin: 12px 0; }
.channel-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.channel-row .avatar { width: 40px; height: 40px; }
.channel-name { font-weight: 600; }
.channel-sub { color: var(--muted); font-size: 12px; }
.subscribe { margin-left: auto; background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 20px; font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.pill { display: flex; align-items: center; gap: 6px; background: var(--surface-2); padding: 9px 14px; border-radius: 20px; }
.pill svg { width: 18px; height: 18px; fill: currentColor; }
.desc { margin-top: 16px; background: var(--surface-2); border-radius: var(--radius); padding: 12px; font-size: 14px; line-height: 1.5; }
.desc b { display: block; }

.recs { width: 400px; flex: none; }
.rec { display: flex; gap: 8px; margin-bottom: 8px; }
.rec .thumb { width: 168px; flex: none; border-radius: 8px; }
.rec .t { font-size: 14px; font-weight: 500; line-height: 1.3; max-height: 2.6em; overflow: hidden; }
.rec .m { color: var(--muted); font-size: 12px; margin-top: 4px; }

@media (max-width: 1100px) {
  .sidebar { display: none; }
  .recs { width: 320px; }
}
@media (max-width: 800px) {
  .watch { flex-direction: column; }
  .recs { width: 100%; }
  .search input { display: none; }
  .search button { display: none; }
}

body.embed { background: #000; overflow: hidden; }
body.embed video { width: 100vw; height: 100vh; display: block; object-fit: contain; }
