:root {
  --bg: #0f1115;
  --bg-elev: #181b22;
  --bg-elev-2: #22262f;
  --text: #e6e8eb;
  --text-dim: #9aa0aa;
  --accent: #ff6b35;
  --accent-2: #ffb800;
  --border: #2d313b;
  --shadow: 0 4px 12px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
body { line-height: 1.6; }

header {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 16px 24px;
  display: flex; align-items: center; gap: 24px;
  flex-wrap: wrap;
}
#brand {
  font-size: 20px; font-weight: 600; margin: 0;
  color: var(--text);
  cursor: pointer;
}
.header-controls {
  margin-left: auto;
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.back-btn {
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font-size: 14px;
}
.back-btn:hover { background: var(--border); }
.toggle-group { display: flex; align-items: center; gap: 8px; }
.toggle-label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.seg {
  display: inline-flex; background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
}
.seg button {
  background: transparent; color: var(--text-dim); border: 0;
  padding: 6px 12px; cursor: pointer; font-size: 14px;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.seg button:hover { background: var(--border); color: var(--text); }
.seg button.active { background: var(--accent); color: #fff; font-weight: 600; }

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
footer {
  text-align: center; padding: 32px 24px;
  color: var(--text-dim); font-size: 12px;
  border-top: 1px solid var(--border);
}

/* Channel grid */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.channel-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.channel-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(255,107,53,0.15);
}
.channel-card .thumb {
  width: 100%; height: 160px;
  background: linear-gradient(135deg, #2d313b, #1a1d23);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
}
.channel-card .thumb img { width: 80px; height: 80px; border-radius: 50%; border: 3px solid var(--bg-elev); box-shadow: var(--shadow); }
.channel-card .info { padding: 16px; }
.channel-card .title { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.channel-card .stats { color: var(--text-dim); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }
.channel-card .stats span::before { content: "· "; margin-right: 4px; }
.channel-card .stats span:first-child::before { content: ""; margin-right: 0; }

/* Video list */
.video-list {
  display: grid; gap: 12px;
  grid-template-columns: 1fr;
}
.video-row {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 50px 140px 1fr auto;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.video-row:hover { border-color: var(--accent); background: var(--bg-elev-2); }
.video-row .rank {
  font-size: 22px; font-weight: 700; color: var(--accent); text-align: center;
}
.video-row .row-thumb {
  width: 140px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden;
  background: var(--bg-elev-2);
}
.video-row .row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-row .row-meta .meta-title { font-size: 15px; font-weight: 500; margin: 0 0 4px; }
.video-row .row-meta .meta-sub { color: var(--text-dim); font-size: 13px; }
.video-row .views { color: var(--accent-2); font-weight: 600; font-size: 14px; }

.channel-header {
  display: flex; gap: 20px; align-items: center;
  margin-bottom: 32px;
  padding: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.channel-header img { width: 100px; height: 100px; border-radius: 50%; }
.channel-header h2 { margin: 0 0 6px; font-size: 24px; }
.channel-header p { color: var(--text-dim); margin: 4px 0; font-size: 13px; }

/* Video detail */
.video-detail {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
}
.video-detail .video-thumb {
  display: block; max-width: 480px; margin: 0 auto 20px; border-radius: 10px;
  overflow: hidden; box-shadow: var(--shadow);
  text-decoration: none; line-height: 0;
}
.video-detail .video-thumb img { width: 100%; height: auto; display: block; }
.video-detail h2 { margin-top: 0; font-size: 22px; line-height: 1.4; }
.video-detail .meta { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; display: flex; gap: 16px; flex-wrap: wrap; }
.video-detail .meta a { color: var(--accent); text-decoration: none; }
.video-detail .meta a:hover { text-decoration: underline; }
.summary-content {
  background: var(--bg);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  min-height: 200px;
  font-size: 15px;
}
.summary-content h1, .summary-content h2, .summary-content h3 { color: var(--accent-2); }
.summary-content ul { padding-left: 24px; }
.summary-content li { margin-bottom: 8px; }
.summary-content code { background: var(--bg-elev-2); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

.transcript {
  max-height: 60vh; overflow-y: auto;
  white-space: pre-wrap;
  font-size: 13px; line-height: 1.7;
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, "Menlo", monospace;
}

.muted { color: var(--text-dim); font-style: italic; }

.search-bar {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 24px;
}
.search-bar:focus { outline: none; border-color: var(--accent); }

@media (max-width: 720px) {
  .video-row { grid-template-columns: 40px 100px 1fr; }
  .video-row .views { grid-column: 1 / 4; text-align: right; padding-top: 4px; }
  .video-row .row-thumb { width: 100px; }
  .channel-header { flex-direction: column; text-align: center; }
  .video-detail { padding: 20px; }
}
