/* ===== CSS変数 ===== */
:root {
  --bp: #1a2235;
  --bs: #1e2a40;
  --bt: #131c2e;
  --tp: #e8edf8;
  --ts: #8899b8;
  --tm: #4a5a78;
  --br: #243050;
  --ac: #f97316;
  --al: #2a1800;
  --am: #fb923c;
  --hbg: #0d1525;
  --hbg2: #111e33;
}

[data-theme="light"] {
  --bp: #ffffff;
  --bs: #f4f6fb;
  --bt: #eaecf4;
  --tp: #0f1623;
  --ts: #4a5878;
  --tm: #9aa8c8;
  --br: #dde3f0;
  --ac: #f97316;
  --al: #fff4ed;
  --am: #c2530a;
  --hbg: #0d1525;
  --hbg2: #111e33;
}

/* ===== リセット ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  background: var(--bt);
  color: var(--tp);
  font-size: 14px;
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

/* ===== ヘッダー ===== */
.header {
  background: var(--hbg);
  height: 50px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.5px solid rgba(255,255,255,0.07);
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo {
  font-size: 20px;
  font-weight: 500;
  color: #e8edf8;
  letter-spacing: -0.5px;
}
.logo em { color: var(--ac); font-style: normal; }

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-link {
  font-size: 12px;
  color: #6e85a8;
  transition: color 0.15s;
}
.nav-link:hover, .nav-link.on { color: #e8edf8; }

.toggle {
  background: rgba(255,255,255,0.07);
  border: 0.5px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  color: #6e85a8;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s;
}
.toggle:hover { background: rgba(255,255,255,0.14); }

/* ===== APIバー ===== */
.api-bar {
  background: var(--hbg2);
  border-bottom: 0.5px solid rgba(255,255,255,0.05);
  padding: 5px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #4a5a78;
}
.api-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ac);
  flex-shrink: 0;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===== レイアウト ===== */
.main-content { padding: 10px 20px 0; }

.layout {
  display: grid;
  grid-template-columns: 1fr 265px;
  gap: 10px;
  max-width: 1000px;
  margin: 0 auto;
}
.main-col   { display: flex; flex-direction: column; gap: 10px; }
.sidebar-col { display: flex; flex-direction: column; gap: 10px; }

/* ===== カード ===== */
.card {
  background: var(--bp);
  border: 0.5px solid var(--br);
  border-radius: 10px;
  overflow: hidden;
  transition: background 0.2s, border 0.2s;
}
.card-head {
  padding: 9px 14px;
  border-bottom: 0.5px solid var(--br);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--tp);
  display: flex;
  align-items: center;
  gap: 6px;
}
.more-link { font-size: 11px; color: var(--ac); }
.more-link:hover { opacity: 0.8; }

.loading-box {
  padding: 24px;
  text-align: center;
  color: var(--tm);
  font-size: 12px;
}

/* ===== バッジ・タグ ===== */
.badge {
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 500;
}
.badge-orange { background: var(--al); color: var(--am); }
.badge-amber  { background: #2a1e00; color: #fcd34d; }
[data-theme="light"] .badge-amber { background: #fef3c7; color: #92400e; }

.api-tag {
  background: var(--al);
  color: var(--am);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  border: 0.5px solid var(--ac);
  font-weight: 400;
}

/* ===== ヒーローグリッド ===== */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--br);
}
.hero-main {
  background: var(--bp);
  padding: 12px;
  cursor: pointer;
}
.hero-thumb {
  border-radius: 6px;
  overflow: hidden;
  height: 130px;
  background: var(--bs);
  margin-bottom: 8px;
}
.hero-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-rank {
  display: inline-block;
  background: var(--ac);
  color: #fff;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 5px;
}
.hero-title { font-size: 14px; font-weight: 500; color: var(--tp); line-height: 1.4; margin-bottom: 3px; }
.hero-score { font-size: 11px; color: var(--ac); }
.hero-genre { font-size: 11px; color: var(--ts); margin-top: 2px; }

.hero-subs { background: var(--bp); display: flex; flex-direction: column; }
.hero-sub {
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  border-bottom: 0.5px solid var(--br);
}
.hero-sub:last-child { border-bottom: none; }
.sub-thumb {
  width: 52px;
  height: 38px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bs);
}
.sub-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sub-rank  { font-size: 9px; color: var(--ac); font-weight: 500; margin-bottom: 2px; }
.sub-title { font-size: 11px; font-weight: 500; color: var(--tp); line-height: 1.3; margin-bottom: 1px; }
.sub-info  { font-size: 10px; color: var(--ts); }

/* ===== 今季グリッド ===== */
.season-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}
.season-card {
  border: 0.5px solid var(--br);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bs);
  transition: border-color 0.15s;
}
.season-card:hover { border-color: var(--ac); }
.season-thumb {
  height: 80px;
  overflow: hidden;
  background: var(--bs);
  display: flex;
  align-items: center;
  justify-content: center;
}
.season-thumb img { width: 100%; height: 100%; object-fit: cover; }
.season-body { padding: 6px 8px; }
.season-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--tp);
  margin-bottom: 2px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.season-score { font-size: 10px; color: var(--ac); }
.season-genre { font-size: 9px; color: var(--tm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== ジャンル ===== */
.genre-wrap { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px; }
.g-chip {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  border: 0.5px solid var(--br);
  color: var(--ts);
  background: var(--bs);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.g-chip.on, .g-chip:hover {
  background: var(--al);
  border-color: var(--ac);
  color: var(--am);
}

/* ===== ランキング ===== */
.rank-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 0.5px solid var(--br);
  cursor: pointer;
}
.rank-item:last-child { border-bottom: none; }
.rank-num { font-size: 15px; font-weight: 500; min-width: 20px; text-align: center; }
.rank-num.gold   { color: #d97706; }
.rank-num.silver { color: #64748b; }
.rank-num.bronze { color: #b45309; }
.rank-thumb {
  width: 30px;
  height: 42px;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bs);
}
.rank-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rank-info { flex: 1; min-width: 0; }
.rank-title { font-size: 11px; font-weight: 500; color: var(--tp); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-genre { font-size: 10px; color: var(--tm); }
.rank-score { font-size: 12px; font-weight: 500; color: var(--ac); text-align: right; }
.rank-diff  { font-size: 9px; color: var(--ac); text-align: right; }
.rank-diff.down { color: #ef4444; }
.rank-diff.flat { color: var(--tm); }

/* ===== 人気ジャンル ===== */
.tag-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 0.5px solid var(--br);
}
.tag-item:last-child { border-bottom: none; }
.tag-num  { font-size: 12px; font-weight: 500; color: var(--tm); min-width: 18px; }
.tag-name { font-size: 12px; color: var(--tp); flex: 1; }
.tag-bar  { height: 3px; border-radius: 2px; background: var(--ac); opacity: 0.6; margin-top: 3px; }
.tag-count { font-size: 10px; color: var(--tm); }

/* ===== VODバナー ===== */
.vod-box {
  background: var(--hbg);
  border-radius: 10px;
  padding: 14px;
  border: 0.5px solid rgba(249,115,22,0.2);
}
.vod-accent { width: 28px; height: 3px; background: var(--ac); border-radius: 2px; margin-bottom: 8px; }
.vod-title  { color: #e8edf8; font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.vod-sub    { color: #4a5a78; font-size: 11px; margin-bottom: 10px; line-height: 1.5; }
.vod-btn {
  display: block;
  background: var(--ac);
  color: #fff;
  text-align: center;
  padding: 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
  transition: opacity 0.15s;
}
.vod-btn:hover  { opacity: 0.85; }
.vod-btn2 {
  display: block;
  border: 0.5px solid var(--br);
  color: #6e85a8;
  text-align: center;
  padding: 8px;
  border-radius: 6px;
  font-size: 12px;
  transition: border-color 0.15s;
}
.vod-btn2:hover { border-color: var(--ac); }

/* ===== フッター ===== */
.footer {
  background: var(--hbg);
  padding: 16px 24px;
  margin-top: 12px;
  border-top: 0.5px solid rgba(255,255,255,0.05);
}
.footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.footer-logo { font-size: 15px; font-weight: 500; color: #e8edf8; margin-bottom: 3px; }
.footer-logo em { color: var(--ac); font-style: normal; }
.footer-corp { font-size: 11px; color: #2e3d52; margin-bottom: 3px; }
.footer-copy { font-size: 10px; color: #1e2d42; }
.footer-links { display: flex; gap: 14px; font-size: 11px; color: #2e3d52; margin-top: 6px; }
.footer-links a:hover { color: var(--ac); }

/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .hero-grid { grid-template-columns: 1fr; }
  .season-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar-col { order: -1; }
  .nav-link { display: none; }
}
