:root {
  color-scheme: dark;
  --bg: #06070c;
  --bg-elevated: #12141d;
  --bg-elevated-2: #191c28;
  --border: #262b3c;
  --text: #f3f4f8;
  --text-muted: #9297ab;
  --accent-a: #ff4d8d;
  --accent-b: #7c5cff;
  --accent-c: #22d3ee;
  --gradient-brand: linear-gradient(135deg, var(--accent-a), var(--accent-b) 55%, var(--accent-c));
  --accent: #8b7bff;
  --ad-bg: #12141d;
  --gold: linear-gradient(135deg, #ffe08a, #ffb347);
  --silver: linear-gradient(135deg, #eef1f6, #b7bfcf);
  --bronze: linear-gradient(135deg, #e7ab6b, #b8703a);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Noto Sans JP", "Hiragino Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-columns: 1fr minmax(auto, 760px) 280px 1fr;
  grid-template-areas:
    "header header header header"
    "topad topad topad topad"
    ". main sidebar ."
    "footer footer footer footer";
  gap: 20px;
  position: relative;
}

h1, h2, h3 { font-family: "Space Grotesk", "Noto Sans JP", sans-serif; letter-spacing: -0.01em; }

a { color: inherit; }

/* 背景の淡いグラデーショングロー */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 8% -5%, rgba(255, 77, 141, 0.16), transparent 60%),
    radial-gradient(700px 500px at 100% 0%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(600px 400px at 50% 110%, rgba(34, 211, 238, 0.10), transparent 60%);
}

/* ===== ヘッダー ===== */
.site-header {
  grid-area: header;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(6, 7, 12, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  flex-wrap: wrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  text-decoration: none;
  white-space: nowrap;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--gradient-brand);
  color: #fff;
  font-size: 0.7rem;
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.45);
}

.nav-groups { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }

.tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}
.tabs::-webkit-scrollbar { display: none; }

.tabs-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-right: 4px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tabs a {
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.tabs a:hover { color: var(--text); background: var(--bg-elevated-2); transform: translateY(-1px); }
.tabs a.active {
  color: #fff;
  background: var(--gradient-brand);
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.35);
}

/* ===== 広告枠 ===== */
.ad-slot {
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.ad-slot-top { grid-area: topad; margin: 0 24px; }
.site-main { grid-area: main; padding: 8px 8px 32px; min-width: 0; }
.site-sidebar { grid-area: sidebar; padding: 8px 8px 32px; display: flex; flex-direction: column; gap: 16px; }

.side-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.side-card-title { font-family: "Space Grotesk", sans-serif; font-weight: 700; margin: 0 0 6px; }
.side-card-text { color: var(--text-muted); font-size: 0.88rem; margin: 0 0 12px; line-height: 1.6; }
.side-card-link { color: var(--accent-c); text-decoration: none; font-size: 0.88rem; font-weight: 600; }
.side-card-link:hover { text-decoration: underline; }

.site-footer {
  grid-area: footer;
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.site-footer nav a { color: var(--text-muted); margin-right: 14px; text-decoration: none; }
.site-footer nav a:hover { color: var(--text); }

/* ===== 見出し ===== */
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 1.6rem; margin: 0 0 10px; }
.title-accent {
  width: 56px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--gradient-brand);
  margin-bottom: 10px;
}
.updated-at { color: var(--text-muted); font-size: 0.82rem; margin: 0; }

/* ===== ランキングリスト ===== */
.ranking-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.ranking-item {
  display: grid;
  grid-template-columns: 44px 168px 1fr;
  gap: 14px;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.ranking-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(124, 92, 255, 0.4);
}

.rank-badge {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  text-align: center;
  color: var(--text-muted);
}
.ranking-item.tier-1 .rank-badge,
.ranking-item.tier-2 .rank-badge,
.ranking-item.tier-3 .rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #1a1408;
  font-size: 1rem;
}
.ranking-item.tier-1 .rank-badge { background: var(--gold); box-shadow: 0 0 16px rgba(255, 179, 71, 0.5); }
.ranking-item.tier-2 .rank-badge { background: var(--silver); box-shadow: 0 0 12px rgba(183, 191, 207, 0.4); }
.ranking-item.tier-3 .rank-badge { background: var(--bronze); box-shadow: 0 0 12px rgba(184, 112, 58, 0.4); color: #2a1707; }
.ranking-item.tier-1 { border-color: rgba(255, 179, 71, 0.35); }

.thumb-link {
  position: relative;
  display: block;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #000;
}
.thumb-link img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s ease; }
.ranking-item:hover .thumb-link img { transform: scale(1.06); }

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  background: rgba(6, 7, 12, 0.35);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.ranking-item:hover .play-overlay { opacity: 1; }

.live-pill {
  position: absolute;
  top: 6px;
  left: 6px;
  background: #ff2d55;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
}
.live-pill-embed { top: -10px; left: 50%; transform: translateX(-50%); z-index: 2; }

.video-title {
  display: block;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.4;
  margin-bottom: 4px;
}
.video-title:hover { color: var(--accent-c); }
.channel-title { color: var(--text-muted); margin: 0 0 8px; font-size: 0.88rem; }

.meta-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.stat-pill, .genre-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}
.genre-pill { color: var(--accent-c); border-color: rgba(34, 211, 238, 0.25); }

.ad-slot-infeed { padding: 22px; }

/* ===== 動画詳細ページ ===== */
.video-embed { position: relative; padding-top: 56.25%; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); }
.video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

.channel-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.channel-link { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.channel-link:hover { color: var(--accent-c); }
.channel-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.stat-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.stat-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  min-width: 110px;
}
.stat-chip .stat-value { display: block; font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.15rem; }
.stat-chip .stat-label { display: block; color: var(--text-muted); font-size: 0.76rem; margin-top: 2px; }

.regions-line { color: var(--text-muted); font-size: 0.85rem; }

.share-row { display: flex; align-items: center; gap: 8px; margin: 16px 0; }
.share-label { color: var(--text-muted); font-size: 0.8rem; margin-right: 4px; }
.share-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.share-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.share-x { background: #000; }
.share-line { background: #06c755; }
.share-hatena { background: #00a4de; }

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

.affiliate-slot {
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
}
.affiliate-label { font-size: 0.72rem; color: var(--text-muted); border: 1px solid var(--border); padding: 2px 8px; border-radius: var(--radius-sm); }

.back-links { font-size: 0.9rem; }
.back-links a { color: var(--accent-c); text-decoration: none; }
.back-links a:hover { text-decoration: underline; }
.back-links .sep { color: var(--text-muted); margin: 0 6px; }

/* ===== レスポンシブ ===== */
@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "topad"
      "main"
      "sidebar"
      "footer";
    gap: 14px;
  }
  .ranking-item { grid-template-columns: 34px 120px 1fr; padding: 8px; }
  .header-inner { padding: 12px 16px; gap: 14px; }
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #fafafc;
    --bg-elevated: #ffffff;
    --bg-elevated-2: #f1f2f7;
    --border: #e6e8f0;
    --text: #14161f;
    --text-muted: #5c6070;
    --ad-bg: #f1f2f7;
    --shadow-md: 0 10px 30px rgba(20, 22, 31, 0.12);
  }
  .site-header { background: rgba(250, 250, 252, 0.8); }
  .live-pill-embed { box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
}
