* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  min-height: 100vh;
}

/* ── Navbar ── */
.navbar {
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ff4444;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  text-decoration: none;
  color: #aaa;
  font-size: 0.95rem;
  padding: 6px 14px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: #fff;
  background: #2a2a2a;
}

.nav-link.active {
  color: #ff4444;
  background: #2a1515;
}

/* ── Layout ── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 36px 20px 60px;
}

h1 {
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 24px;
}

/* ── Search ── */
.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.search-box input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #1e1e1e;
  color: #e0e0e0;
  font-size: 1rem;
  outline: none;
}

.search-box input:focus {
  border-color: #ff4444;
}

.search-box button {
  padding: 12px 24px;
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
}

.search-box button:hover { background: #cc0000; }
.search-box button:disabled { background: #555; cursor: not-allowed; }

/* ── Error ── */
.error {
  background: #3a1a1a;
  color: #ff6b6b;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid #ff4444;
}

.hidden { display: none !important; }

/* ── Section ── */
.section {
  background: #1e1e1e;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.section h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ff4444;
  margin-bottom: 14px;
}

/* ── Video page ── */
.video-wrap {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  background: #1e1e1e;
  border-radius: 12px;
  padding: 20px;
}

#thumbnail {
  width: 260px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: cover;
}

.video-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.video-info h2 {
  font-size: 1.15rem;
  line-height: 1.5;
  color: #ffffff;
  margin-bottom: 4px;
}

.meta-row {
  display: flex;
  gap: 10px;
  font-size: 0.88rem;
  color: #bbb;
  align-items: baseline;
}

.label {
  color: #666;
  flex-shrink: 0;
  width: 60px;
}

.stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.stat-item {
  background: #2a2a2a;
  border-radius: 10px;
  padding: 10px 16px;
  text-align: center;
  min-width: 80px;
}

.stat-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.stat-label {
  font-size: 0.75rem;
  color: #888;
  margin-top: 2px;
}

#description {
  font-family: inherit;
  font-size: 0.88rem;
  color: #ccc;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  line-height: 1.7;
}

/* ── Tags ── */
#tags, #chKeywords, #chTopics, #chRelated {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: #2a2a2a;
  color: #bbb;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.83rem;
  border: 1px solid #333;
  cursor: default;
}

.tag:hover { border-color: #ff4444; color: #fff; }

.tag-link {
  text-decoration: none;
  cursor: pointer;
}

/* ── Channel page ── */
.channel-header {
  background: #1e1e1e;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.ch-banner {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  display: block;
}

.ch-profile-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
}

.ch-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 3px solid #333;
  object-fit: cover;
}

.ch-basic {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ch-basic h2 {
  font-size: 1.3rem;
  color: #fff;
}

.ch-custom-url {
  font-size: 0.9rem;
  color: #888;
}

.ch-meta {
  font-size: 0.85rem;
  color: #666;
}

/* Stats grid */
.stats-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 120px;
  background: #2a2a2a;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.stat-card-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
}

.stat-card-label {
  font-size: 0.78rem;
  color: #888;
  margin-top: 4px;
}

/* Info table */
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.info-table tr {
  border-bottom: 1px solid #2a2a2a;
}

.info-table tr:last-child {
  border-bottom: none;
}

.info-table td {
  padding: 10px 4px;
  vertical-align: top;
  word-break: break-all;
}

.info-key {
  color: #888;
  width: 120px;
  flex-shrink: 0;
}

#chDescription {
  font-family: inherit;
  font-size: 0.88rem;
  color: #ccc;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  line-height: 1.7;
}

/* ── Landing page ── */
.landing-hero {
  text-align: center;
  padding: 80px 20px 48px;
  background: linear-gradient(180deg, #1a0a0a 0%, #0f0f0f 100%);
}

.landing-eyebrow {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #ff4444;
  margin-bottom: 16px;
}

.landing-title {
  font-size: 2.6rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 16px;
}

.landing-sub {
  font-size: 1.05rem;
  color: #888;
}

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 8px;
}

.feature-card {
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s;
}

.feature-card:hover {
  border-color: #ff4444;
}

.feature-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.feature-title {
  font-size: 1.25rem;
  color: #fff;
  font-weight: 700;
}

.feature-desc {
  font-size: 0.9rem;
  color: #aaa;
  line-height: 1.8;
  flex: 1;
}

.feature-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 11px 22px;
  background: #ff4444;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  transition: background 0.2s;
}

.feature-btn:hover {
  background: #cc0000;
}

.landing-footer {
  text-align: center;
  padding: 40px 20px;
  font-size: 0.8rem;
  color: #444;
}

/* ── Navbar logo as link ── */
.nav-logo {
  text-decoration: none;
  color: #ff4444;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ── Badges ── */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-red    { background: #3a1010; color: #ff6b6b; border: 1px solid #ff4444; }
.badge-green  { background: #0e2a1a; color: #4caf82; border: 1px solid #2e7d52; }
.badge-blue   { background: #0e1e3a; color: #64b3f4; border: 1px solid #2a5fa8; }
.badge-orange { background: #2e1e00; color: #f0a040; border: 1px solid #a06010; }
.badge-gray   { background: #2a2a2a; color: #888; border: 1px solid #444; }

/* ── Stats bar (video page) ── */
.stats-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.stats-bar .stat-item {
  flex: 1;
  min-width: 100px;
  background: #1e1e1e;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

/* ── Region restriction ── */
.region-summary {
  font-size: 0.88rem;
  color: #f0a040;
  margin-bottom: 10px;
}

/* ── Thumbnail gallery ── */
.thumb-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.thumb-card {
  background: #2a2a2a;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #333;
}

.thumb-card img {
  width: 100%;
  display: block;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.thumb-card-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  font-size: 0.78rem;
  color: #888;
}

.thumb-link {
  color: #ff4444;
  text-decoration: none;
  font-weight: 600;
}

.thumb-link:hover { text-decoration: underline; }

/* ── Tag analysis ── */
.tag-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 14px;
  align-items: center;
}

.tag-stat-item {
  font-size: 0.88rem;
  color: #888;
}

.tag-stat-item strong {
  color: #fff;
  margin-left: 4px;
}

.tag-overlap-hint {
  font-size: 0.78rem;
  color: #666;
  width: 100%;
  margin-top: -8px;
}

.tag-overlap {
  border-color: #a06010 !important;
  color: #f0a040 !important;
}

/* ── Recent uploads ── */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-item {
  display: flex;
  gap: 14px;
  text-decoration: none;
  background: #2a2a2a;
  border-radius: 8px;
  padding: 10px;
  border: 1px solid #333;
  transition: border-color 0.2s;
}

.recent-item:hover { border-color: #ff4444; }

.recent-thumb {
  width: 120px;
  flex-shrink: 0;
  border-radius: 6px;
  object-fit: cover;
  aspect-ratio: 16/9;
}

.recent-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.recent-title {
  font-size: 0.9rem;
  color: #e0e0e0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-meta {
  font-size: 0.78rem;
  color: #888;
}

/* ── Site footer ── */
.site-footer {
  margin-top: 80px;
  border-top: 1px solid #2a2a2a;
  background: #1a1a1a;
}

.footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  text-decoration: none;
  color: #888;
  font-size: 0.85rem;
  transition: color 0.2s;
}

.footer-links a:hover { color: #fff; }

.footer-copy {
  font-size: 0.78rem;
  color: #444;
  text-align: center;
}

/* ── About page ── */
.about-wrap {
  padding-bottom: 40px;
}

.about-hero {
  padding: 40px 0 32px;
  border-bottom: 1px solid #2a2a2a;
  margin-bottom: 36px;
}

.about-hero h1 {
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 8px;
}

.about-hero p {
  color: #888;
  font-size: 0.95rem;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 40px;
}

.about-card {
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.about-card-icon {
  font-size: 1.6rem;
}

.about-card h3 {
  font-size: 1rem;
  color: #fff;
}

.about-card p {
  font-size: 0.88rem;
  color: #aaa;
  line-height: 1.7;
}

.about-section {
  margin-bottom: 36px;
}

.about-section h2 {
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #2a2a2a;
}

.about-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.about-list li {
  font-size: 0.9rem;
  color: #bbb;
  padding-left: 16px;
  position: relative;
  line-height: 1.6;
}

.about-list li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: #ff4444;
}

/* ── Privacy page ── */
.privacy-wrap {
  max-width: 720px;
  padding-bottom: 40px;
}

.privacy-wrap h1 {
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 8px;
}

.privacy-updated {
  font-size: 0.82rem;
  color: #666;
  margin-bottom: 36px;
}

.privacy-wrap .section p {
  font-size: 0.9rem;
  color: #bbb;
  line-height: 1.8;
  margin-bottom: 12px;
}

/* ── Navbar wider ── */
.nav-inner {
  max-width: 1100px;
}

.container {
  max-width: 1000px;
}

.nav-link {
  font-size: 0.88rem;
  padding: 6px 10px;
}

/* ── Controls (trending/keyword) ── */
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.ctrl-select {
  padding: 9px 12px;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
}

.ctrl-select:focus { border-color: #ff4444; }

.rank-status {
  font-size: 0.85rem;
  color: #888;
  flex: 1;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 0.9rem;
}

.page-sub {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 24px;
  margin-top: -16px;
}

/* ── Ranking list ── */
.rank-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  margin-bottom: 8px;
  text-decoration: none;
  transition: border-color 0.2s;
}

.rank-item:hover { border-color: #ff4444; }

.rank-num {
  width: 28px;
  text-align: center;
  font-size: 0.9rem;
  color: #666;
  flex-shrink: 0;
}

.rank-medal {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.rank-medal.gold   { background: #3d2e00; color: #f0c040; border: 1px solid #a07c00; }
.rank-medal.silver { background: #1e2030; color: #a0b0d0; border: 1px solid #607090; }
.rank-medal.bronze { background: #2a1800; color: #d09060; border: 1px solid #804020; }

.rank-thumb {
  width: 120px;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-title {
  font-size: 0.9rem;
  color: #e0e0e0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 5px;
}

.rank-meta {
  font-size: 0.78rem;
  color: #888;
}

.rank-stats {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.rank-stat {
  text-align: center;
  min-width: 56px;
}

.rank-stat-val {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
}

.rank-stat-lbl {
  display: block;
  font-size: 0.7rem;
  color: #666;
  margin-top: 2px;
}

/* ── Channel recent rank number ── */
.recent-rank {
  width: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: #666;
  flex-shrink: 0;
}

/* ── Feature grid 4-col ── */
.feature-grid {
  grid-template-columns: 1fr 1fr;
}

/* ── Guide page ── */
.guide-hero {
  padding: 40px 0 32px;
  border-bottom: 1px solid #2a2a2a;
  margin-bottom: 36px;
}

.guide-hero h1 {
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 8px;
}

.guide-hero p {
  color: #888;
  font-size: 0.95rem;
  line-height: 1.6;
}

.guide-toc {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.toc-title {
  font-size: 0.78rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 4px;
}

.toc-item {
  text-decoration: none;
  color: #aaa;
  font-size: 0.88rem;
  padding: 5px 14px;
  border: 1px solid #2a2a2a;
  border-radius: 20px;
  transition: border-color 0.2s, color 0.2s;
}

.toc-item:hover {
  border-color: #ff4444;
  color: #fff;
}

.guide-section {
  margin-bottom: 64px;
  scroll-margin-top: 72px;
}

.guide-section-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
}

.guide-num {
  font-size: 2.4rem;
  font-weight: 800;
  color: #2a2a2a;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 4px;
}

.guide-section-title {
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 6px;
}

.guide-section-sub {
  font-size: 0.9rem;
  color: #888;
}

.guide-block {
  background: #1e1e1e;
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 16px;
}

.guide-block h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #ff4444;
  margin-bottom: 18px;
}

.guide-block p {
  font-size: 0.92rem;
  color: #bbb;
  line-height: 1.85;
  margin-bottom: 14px;
}

.guide-block p:last-child {
  margin-bottom: 0;
}

.guide-list {
  list-style: none;
  margin: 10px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-list li {
  font-size: 0.88rem;
  color: #bbb;
  padding-left: 16px;
  position: relative;
}

.guide-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: #555;
}

.guide-list code {
  font-family: 'Courier New', monospace;
  font-size: 0.83rem;
  background: #2a2a2a;
  color: #e0b97a;
  padding: 2px 7px;
  border-radius: 4px;
}

.guide-field {
  border-bottom: 1px solid #2a2a2a;
  padding: 16px 0;
}

.guide-field:first-of-type {
  border-top: 1px solid #2a2a2a;
}

.guide-field-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.guide-field-desc {
  font-size: 0.88rem;
  color: #aaa;
  line-height: 1.8;
}

.guide-cta {
  margin-top: 20px;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .guide-num {
    display: none;
  }
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .landing-title {
    font-size: 1.8rem;
  }
  .video-wrap {
    flex-direction: column;
  }
  #thumbnail {
    width: 100%;
  }
  .ch-avatar {
    width: 60px;
    height: 60px;
  }
  .stats-grid {
    gap: 8px;
  }
}
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .landing-title {
    font-size: 1.8rem;
  }
  .video-wrap {
    flex-direction: column;
  }
  #thumbnail {
    width: 100%;
  }
  .ch-avatar {
    width: 60px;
    height: 60px;
  }
  .stats-grid {
    gap: 8px;
  }
}
