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

:root {
  --bg: #fffbf7;
  --card-bg: #ffffff;
  --accent: #e07320;
  --accent2: #e8526d;
  --gold: #c8920a;
  --text: #1a1619;
  --text-muted: #80706a;
  --border: rgba(0,0,0,0.08);
  --shadow: 0 8px 32px rgba(0,0,0,0.08);
  --music-tint: rgba(224,115,32,0.06);
  --music-border: rgba(224,115,32,0.18);
  --art-tint: rgba(200,146,10,0.06);
  --art-border: rgba(200,146,10,0.2);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  min-height: 100vh;
}

/* ── Hero Banner ── */
.hero-banner {
  background: url('images/2400x1350sr.webp') center / cover no-repeat;
  height: 260px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 32px 24px;
}

.hero-logo {
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 2px 20px rgba(0,0,0,0.45));
}

/* ── Header (sticky controls bar) ── */
header {
  background: rgba(255,251,247,0.97);
  border-bottom: 1px solid rgba(224,115,32,0.12);
  padding: 12px 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 16px rgba(224,115,32,0.08);
}

.episode-count {
  font-size: 0.8rem;
  color: var(--accent);
  background: rgba(224,115,32,0.1);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
  margin-left: auto;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 8px;
}

.filter-btn {
  background: rgba(0,0,0,0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 18px;
  border-radius: 24px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: rgba(224,115,32,0.1);
  color: var(--accent);
  border-color: rgba(224,115,32,0.3);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.search-box {
  background: rgba(0,0,0,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 16px;
  border-radius: 24px;
  font-size: 0.85rem;
  outline: none;
  width: 200px;
  transition: all 0.2s;
}

.search-box::placeholder { color: var(--text-muted); }

.search-box:focus {
  border-color: var(--accent);
  background: rgba(224,115,32,0.05);
}

/* ── Grid ── */
main {
  padding: 28px 32px;
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

/* ── Card ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(224,115,32,0.15);
  border-color: rgba(224,115,32,0.3);
}

.card-artwork {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: contain;
  display: block;
  background: #f5f0e8;
  padding: 8px;
}

.card-artwork-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5ede2, #f0e8d8);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
}

.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.card-body {
  padding: 12px 14px 14px;
}

.card-ep {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.card-title-cn {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 2px;
}

.card-title-en {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card-music, .card-art {
  font-size: 0.71rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-music::before {
  content: '♪ ';
  color: var(--accent);
}

.card-art::before {
  content: '🖼 ';
}

/* ── Empty state ── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--card-bg);
  border: 1px solid rgba(224,115,32,0.15);
  border-radius: 20px;
  width: 100%;
  max-width: 920px;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.15);
}

.modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-track { background: transparent; }
.modal::-webkit-scrollbar-thumb { background: rgba(224,115,32,0.2); border-radius: 3px; }

.modal-close {
  position: sticky;
  top: 16px;
  float: right;
  margin: 16px 16px 0 0;
  background: rgba(0,0,0,0.07);
  border: none;
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
  z-index: 10;
}

.modal-close:hover {
  background: rgba(232,82,109,0.15);
  color: var(--accent2);
}

.modal-content {
  padding: 0 0 28px;
}

/* Modal header */
.modal-header {
  padding: 20px 28px 16px;
}

.modal-season-ep {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.modal-title-cn {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 4px;
  line-height: 1.2;
}

.modal-title-en {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Modal hero image */
.modal-hero-wrap {
  width: 100%;
  height: 240px;
  overflow: hidden;
  background: #f0ebe3;
  margin-bottom: 24px;
}

.modal-hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Modal sections grid */
.modal-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 0 28px;
  margin-bottom: 20px;
}

@media (max-width: 660px) {
  .modal-sections { grid-template-columns: 1fr; }
}

/* Info section card */
.info-section {
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-section.music-section {
  background: var(--music-tint);
  border: 1px solid var(--music-border);
}

.info-section.art-section {
  background: var(--art-tint);
  border: 1px solid var(--art-border);
}

.section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}

.music-section .section-label { color: var(--accent); }
.art-section .section-label { color: var(--gold); }

.section-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 3px;
}

.section-en {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.section-bg {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 2px;
}

/* Bio card inside section */
.bio-card {
  background: rgba(255,255,255,0.7);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 14px;
  border: 1px solid rgba(0,0,0,0.06);
}

.bio-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.bio-meta {
  font-size: 0.71rem;
  font-weight: 600;
  margin-bottom: 7px;
}

.music-section .bio-meta { color: var(--accent); }
.art-section .bio-meta { color: var(--gold); }

.bio-text {
  font-size: 0.79rem;
  color: var(--text-muted);
  line-height: 1.68;
}

/* ── Players ── */
.players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 660px) {
  .players { grid-template-columns: 1fr; }
}

.player-block label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.player-block label span { color: var(--accent); }

.youtube-wrap {
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
}

.youtube-thumb-link {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  text-decoration: none;
}

.youtube-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.youtube-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.18);
  transition: background 0.2s;
}

.youtube-thumb-link:hover .youtube-play-overlay {
  background: rgba(0,0,0,0.4);
}

.youtube-play-btn {
  width: 58px;
  height: 58px;
  background: rgba(220,0,0,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  padding-left: 4px;
  transition: transform 0.2s;
}

.youtube-thumb-link:hover .youtube-play-btn {
  transform: scale(1.1);
}

.drive-wrap {
  border-radius: 10px;
  overflow: hidden;
  background: #faf5ee;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(224,115,32,0.2);
}

.drive-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.drive-placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
}

.drive-placeholder .icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.drive-placeholder p {
  font-size: 0.8rem;
  line-height: 1.6;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(224,115,32,0.2); border-radius: 4px; }

/* ── Modal body ── */
.modal-body {
  padding: 0 28px;
}

/* 全寬集數影片（僅有 Drive ID 時出現） */
.modal-drive {
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  background: #111;
}

.drive-thumb-link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  text-decoration: none;
}

.drive-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.55);
}

.drive-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #fff;
  background: rgba(0,0,0,0.30);
  transition: background 0.2s;
}

.drive-thumb-link:hover .drive-play-overlay {
  background: rgba(0,0,0,0.50);
}

.drive-play-btn {
  width: 72px;
  height: 72px;
  background: rgba(255,255,255,0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e07320;
  font-size: 28px;
  padding-left: 4px;
  transition: transform 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.drive-thumb-link:hover .drive-play-btn {
  transform: scale(1.08);
}

.drive-play-label {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drive-play-label span {
  font-size: 0.78rem;
  font-weight: 400;
  opacity: 0.9;
}

/* 左右兩欄 */
.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.grid-empty {
  /* placeholder to keep grid alignment when one side is absent */
}

@media (max-width: 640px) {
  .modal-grid { grid-template-columns: 1fr; }
  .grid-empty { display: none; }
  .youtube-wrap { order: 1; }
  .info-block:not(.composer-block) { order: 2; }
  .info-block.composer-block { order: 3; }
  .modal-artwork-wrap { order: 4; }
  .artwork-label:not(.artist-block) { order: 5; }
  .artwork-label.artist-block { order: 6; }
}

.modal-artwork-wrap {
  background: #f5f0e8;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4/3;
}

.modal-artwork {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 8px;
}

.artwork-label {
  padding: 10px 14px;
  background: rgba(200,146,10,0.05);
  border: 1px solid rgba(200,146,10,0.18);
  border-radius: 10px;
}

.artwork-label label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gold);
  margin-bottom: 8px;
}

.artwork-label p {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.4;
}

.artwork-artist {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
  margin-bottom: 2px;
}

.person-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  float: right;
  margin: 0 0 8px 12px;
  border: 2px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.artist-block {
  background: rgba(200,146,10,0.04);
  border-color: rgba(200,146,10,0.22);
}

.artist-block label {
  color: var(--gold) !important;
}

.artist-meta {
  font-size: 0.73rem;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 0;
}

.artwork-label p.en {
  font-size: 0.73rem;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
  margin-bottom: 0;
  margin-top: 3px;
}


/* ── Info blocks ── */
.info-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.info-block label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin-bottom: 8px;
}

.info-block p {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 2px;
}

.info-block p.en {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
  margin-bottom: 0;
}

.info-block .piece-bg {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.85;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 10px;
}

.composer-block {
  background: rgba(224,115,32,0.03);
  border-color: rgba(224,115,32,0.2);
}

.composer-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.composer-meta {
  font-size: 0.73rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0;
}

.info-block .composer-bio {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.85;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 10px;
}
