:root {
  color-scheme: dark;
  --night: #0b1220;
  --night-soft: #121d31;
  --card: rgba(23, 35, 57, 0.86);
  --card-strong: #1a2944;
  --line: rgba(194, 211, 239, 0.14);
  --text: #f3f6ff;
  --muted: #aab8d0;
  --soft: #dce6f8;
  --accent: #9cc9ff;
  --accent-strong: #75b0ff;
  --water: #82d3e6;
  --fire: #ffb07a;
  --electric: #f3dd7a;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.28);
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(73, 119, 190, 0.2), transparent 33rem),
    radial-gradient(circle at 90% 24%, rgba(115, 93, 175, 0.16), transparent 28rem),
    var(--night);
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.page-shell { min-height: 100vh; overflow: hidden; }

.hero {
  position: relative;
  min-height: 390px;
  display: grid;
  place-items: center;
  padding: 68px 20px 74px;
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(7, 13, 25, 0.14), var(--night)),
    radial-gradient(ellipse at 52% -20%, rgba(137, 179, 239, 0.23), transparent 55%);
}

.hero::after {
  content: "";
  position: absolute;
  width: 480px;
  height: 480px;
  right: -210px;
  top: -230px;
  border-radius: 50%;
  border: 1px solid rgba(164, 202, 255, 0.16);
  box-shadow: 0 0 0 34px rgba(164, 202, 255, 0.04), 0 0 0 70px rgba(164, 202, 255, 0.025);
  z-index: -1;
}

.hero-content { width: min(760px, 100%); text-align: center; }
.eyebrow, .section-kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1, h2, p { margin-top: 0; }
h1 {
  max-width: 720px;
  margin: 0 auto 20px;
  font-size: clamp(2.15rem, 8vw, 4.75rem);
  line-height: 1.08;
  letter-spacing: -0.06em;
}

.hero-copy {
  max-width: 600px;
  margin: 0 auto 24px;
  color: var(--soft);
  font-size: clamp(0.98rem, 2.7vw, 1.18rem);
  line-height: 1.9;
}

.hero-note {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(9, 17, 31, 0.42);
  font-size: 0.86rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94dfbd;
  box-shadow: 0 0 0 5px rgba(148, 223, 189, 0.12);
}

.hero-orbit { position: absolute; border-radius: 50%; pointer-events: none; z-index: -1; }
.hero-orbit-one { width: 8px; height: 8px; left: 16%; top: 30%; background: var(--water); box-shadow: 0 0 24px 7px rgba(130, 211, 230, 0.3); }
.hero-orbit-two { width: 5px; height: 5px; left: 79%; top: 47%; background: #d0b9ff; box-shadow: 0 0 18px 5px rgba(208, 185, 255, 0.27); }

main { width: min(1080px, calc(100% - 32px)); margin: -24px auto 0; }

.player-card, .episode-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(32, 48, 77, 0.93), rgba(18, 29, 49, 0.93));
  box-shadow: var(--shadow);
}

.player-card { position: relative; padding: clamp(22px, 4vw, 42px); border-radius: 28px; }
.player-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(156, 201, 255, 0.1), transparent 35%);
}

.player-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.player-heading h2 { margin-bottom: 8px; font-size: clamp(1.45rem, 4vw, 2.2rem); letter-spacing: -0.04em; }
.now-description { max-width: 640px; margin-bottom: 0; color: var(--muted); line-height: 1.7; }
.pill { display: inline-flex; flex: 0 0 auto; align-items: center; padding: 7px 11px; border-radius: 999px; font-size: 0.77rem; font-weight: 700; }
.pill-muted { color: var(--muted); background: rgba(205, 220, 247, 0.09); }
.pill-ready { color: #b9f0d2; background: rgba(111, 203, 157, 0.13); }
.pill-preview { color: #cde2ff; background: rgba(117, 176, 255, 0.14); }

.playlist-panel, .playback-mode, .sleep-timer {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(9, 17, 31, 0.2);
}

.playlist-panel { margin-top: 26px; padding: 18px; }
.subsection-header, .sleep-timer-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.subsection-header h3, .sleep-timer-header h3 { margin: 0; font-size: 1.08rem; letter-spacing: -0.02em; }
.subsection-header .section-kicker, .sleep-timer-header .section-kicker { margin-bottom: 7px; }
.playlist-heading-actions { display: flex; align-items: center; gap: 12px; }
.text-button { border: 0; padding: 5px 0; color: var(--accent); background: transparent; font-size: 0.8rem; font-weight: 700; }
.text-button:hover { color: var(--text); }
.text-button:disabled { cursor: default; color: #687993; }
.playlist-list { display: grid; gap: 8px; margin: 15px 0 0; padding: 0; list-style: none; }
.playlist-empty { padding: 13px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 0.82rem; line-height: 1.6; text-align: center; }
.playlist-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; }
.playlist-play { display: flex; align-items: center; gap: 10px; min-width: 0; border: 1px solid transparent; border-radius: 12px; padding: 9px 11px; color: var(--soft); background: rgba(205, 220, 247, 0.06); text-align: left; }
.playlist-play:hover, .playlist-item.is-current .playlist-play { border-color: rgba(156, 201, 255, 0.32); background: rgba(156, 201, 255, 0.12); }
.playlist-order { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 auto; border-radius: 7px; color: var(--muted); background: rgba(205, 220, 247, 0.1); font-size: 0.72rem; }
.playlist-item-icon { flex: 0 0 auto; font-size: 1rem; }
.playlist-item-copy { display: grid; min-width: 0; gap: 2px; }
.playlist-item-copy strong, .playlist-item-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist-item-copy strong { font-size: 0.88rem; }
.playlist-item-copy small { color: var(--muted); font-size: 0.72rem; }
.playlist-remove { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; font-size: 1.2rem; line-height: 1; }
.playlist-remove:hover { color: var(--text); border-color: rgba(255, 176, 122, 0.5); background: rgba(255, 176, 122, 0.1); }

.playback-mode { min-width: 0; margin: 16px 0 0; padding: 16px 18px 14px; }
.playback-mode legend { padding: 0 8px; color: var(--soft); font-size: 0.9rem; font-weight: 700; }
.playback-mode-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mode-option { position: relative; min-width: 0; cursor: pointer; }
.mode-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mode-option span { display: grid; gap: 4px; height: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: rgba(205, 220, 247, 0.04); }
.mode-option span:hover { border-color: rgba(156, 201, 255, 0.35); }
.mode-option input:checked + span { border-color: rgba(156, 201, 255, 0.55); background: rgba(156, 201, 255, 0.13); }
.mode-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.mode-option strong { color: var(--soft); font-size: 0.84rem; }
.mode-option small { color: var(--muted); font-size: 0.7rem; line-height: 1.4; }
.control-help { margin: 10px 0 0; color: var(--muted); font-size: 0.76rem; line-height: 1.5; }

.player-controls { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 30px 0 22px; }
.icon-button, .play-button { border: 0; color: var(--text); background: transparent; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 1.2rem; }
.icon-button:hover { color: var(--text); border-color: rgba(156, 201, 255, 0.42); }
.play-button { width: 70px; height: 70px; border-radius: 50%; color: #0d1b30; background: linear-gradient(145deg, #b9dcff, #76b6ff); box-shadow: 0 10px 32px rgba(117, 176, 255, 0.3); font-size: 1.35rem; padding-left: 4px; }
.play-button.is-playing { padding-left: 0; }
.play-button:hover { transform: translateY(-2px); }

.progress-area { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; color: var(--muted); font-size: 0.78rem; }
input[type="range"] { width: 100%; accent-color: var(--accent-strong); }
.segment-label { margin: 8px 0 24px; text-align: center; color: var(--muted); font-size: 0.8rem; }

.sound-controls { display: flex; flex-wrap: wrap; gap: 18px 30px; justify-content: space-between; align-items: center; padding-top: 18px; border-top: 1px solid var(--line); }
.sound-toggle, .volume-control { display: inline-flex; align-items: center; gap: 10px; color: var(--soft); font-size: 0.9rem; }
.sound-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { display: inline-flex; align-items: center; width: 39px; height: 23px; padding: 3px; border-radius: 999px; background: rgba(169, 187, 215, 0.28); transition: 0.2s; }
.toggle-thumb { width: 17px; height: 17px; border-radius: 50%; background: #e9f1ff; transition: 0.2s; }
.sound-toggle input:checked + .toggle-track { justify-content: flex-end; background: #70b8c9; }
.volume-control { flex: 1 1 250px; justify-content: flex-end; color: var(--muted); }
.volume-control input { max-width: 180px; }
.sleep-timer { margin-top: 18px; padding: 18px; }
.timer-display { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; color: var(--muted); background: rgba(205, 220, 247, 0.08); font-size: 0.78rem; font-weight: 700; }
.timer-display.is-active { color: #cde2ff; background: rgba(117, 176, 255, 0.14); }
.timer-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 15px; }
.timer-preset, .timer-set-button { border: 1px solid rgba(156, 201, 255, 0.25); border-radius: 10px; padding: 9px 8px; color: var(--soft); background: rgba(156, 201, 255, 0.07); font-size: 0.78rem; font-weight: 700; }
.timer-preset:hover, .timer-preset.is-selected, .timer-set-button:hover { border-color: rgba(156, 201, 255, 0.55); background: rgba(156, 201, 255, 0.15); }
.custom-timer-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 0.8rem; }
.custom-timer-form input { width: 95px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 9px; color: var(--text); background: rgba(205, 220, 247, 0.06); }
.timer-set-button { padding-inline: 11px; }
.custom-timer-form .text-button { margin-left: auto; }
.player-status { margin: 18px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.6; }

.episodes-section { padding: 76px 0 40px; }
.section-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-header h2 { margin-bottom: 0; font-size: clamp(1.65rem, 4vw, 2.4rem); letter-spacing: -0.04em; }
.episode-count { color: var(--muted); font-size: 0.85rem; }
.episode-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.episode-card { display: flex; flex-direction: column; min-width: 0; padding: 22px; border-radius: 22px; box-shadow: none; transition: transform 0.2s, border-color 0.2s, background 0.2s; }
.episode-card:hover, .episode-card.is-active { transform: translateY(-3px); border-color: rgba(156, 201, 255, 0.5); background: linear-gradient(145deg, rgba(37, 58, 91, 0.97), rgba(19, 33, 56, 0.97)); }
.episode-card.is-active { box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2); }
.episode-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.episode-number { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.08em; }
.pokemon-art { position: relative; display: grid; place-items: center; width: 86px; height: 86px; flex: 0 0 auto; border-radius: 24px; background: rgba(255, 255, 255, 0.08); overflow: visible; }
.pokemon-art img { position: absolute; z-index: 1; width: 112px; height: 112px; object-fit: contain; top: -17px; left: -13px; filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.3)); }
.pokemon-symbol { position: absolute; z-index: 2; right: -5px; bottom: -5px; display: grid; place-items: center; width: 31px; height: 31px; border: 3px solid var(--card-strong); border-radius: 11px; font-size: 0.92rem; background: rgba(255, 255, 255, 0.12); }
.episode-card[data-type="水"] .pokemon-symbol { background: rgba(130, 211, 230, 0.13); }
.episode-card[data-type="火"] .pokemon-symbol { background: rgba(255, 176, 122, 0.13); }
.episode-card[data-type="電"] .pokemon-symbol { background: rgba(243, 221, 122, 0.13); }
.episode-card h3 { margin: 0 0 5px; font-size: 1.45rem; }
.episode-bopomofo { margin: 0 0 5px; color: var(--accent); font-size: 0.95rem; letter-spacing: 0.05em; }
.episode-english { margin-bottom: 15px; color: var(--muted); font-size: 0.78rem; }
.episode-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.meta-chip { padding: 5px 8px; border-radius: 7px; color: var(--soft); background: rgba(205, 220, 247, 0.08); font-size: 0.73rem; }
.episode-summary { min-height: 68px; margin-bottom: 20px; color: var(--muted); line-height: 1.7; font-size: 0.9rem; }
.episode-summary-ruby { min-height: 84px; line-height: 1.9; }
.annotated-char { display: inline-flex; align-items: baseline; gap: 0.18em; margin-inline-end: 0.36em; white-space: nowrap; vertical-align: baseline; }
.annotated-char-text { color: var(--muted); }
.annotated-char-bopomofo { color: var(--accent); font-size: 0.62em; font-weight: 700; letter-spacing: 0; white-space: nowrap; }
.summary-punctuation { display: inline-block; margin-inline-end: 0.08em; }
.episode-action { width: 100%; border: 1px solid rgba(156, 201, 255, 0.25); border-radius: 12px; padding: 11px 12px; color: var(--soft); background: rgba(156, 201, 255, 0.08); font-weight: 700; }
.episode-action:hover { background: rgba(156, 201, 255, 0.16); }
.episode-action:disabled { cursor: default; color: #8090a9; border-color: var(--line); background: rgba(205, 220, 247, 0.04); }
.episode-actions { display: grid; gap: 8px; margin-top: auto; }
.episode-cry { width: 100%; border: 1px solid rgba(243, 221, 122, 0.28); border-radius: 12px; padding: 9px 12px; color: #f3dd9a; background: rgba(243, 221, 122, 0.07); font-size: 0.8rem; font-weight: 700; }
.episode-cry:hover { border-color: rgba(243, 221, 122, 0.55); background: rgba(243, 221, 122, 0.14); }
.episode-cry:disabled { cursor: default; color: #8090a9; border-color: var(--line); background: rgba(205, 220, 247, 0.04); }
.episode-add { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; color: var(--muted); background: transparent; font-size: 0.8rem; font-weight: 700; }
.episode-add:hover { color: var(--soft); border-color: rgba(156, 201, 255, 0.4); background: rgba(156, 201, 255, 0.08); }
.episode-add.is-added { color: #b9f0d2; border-color: rgba(111, 203, 157, 0.3); background: rgba(111, 203, 157, 0.08); }
.episode-add:disabled { cursor: default; color: #687993; border-color: var(--line); background: rgba(205, 220, 247, 0.025); }

.footer { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 30px 0 50px; color: #8190a8; font-size: 0.77rem; line-height: 1.8; }
.footer p { margin-bottom: 4px; }

@media (max-width: 800px) {
  .episode-list { grid-template-columns: 1fr; }
  .episode-summary, .episode-summary-ruby { min-height: 0; }
  .hero { min-height: 350px; padding-top: 52px; }
}

@media (min-width: 600px) and (max-width: 820px) {
  main, .footer { width: min(100% - 36px, 1080px); }
  .hero { min-height: 350px; padding: 52px 24px 66px; }
  .player-card { padding: 28px; }
  .episode-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .episode-card { padding: 18px; border-radius: 20px; }
  .episode-topline { margin-bottom: 16px; }
  .pokemon-art { width: 72px; height: 72px; border-radius: 20px; }
  .pokemon-art img { width: 96px; height: 96px; top: -13px; left: -12px; }
  .episode-card h3 { font-size: 1.3rem; }
  .episode-summary { font-size: 0.84rem; }
  .episode-summary-ruby { min-height: 112px; line-height: 1.85; }
  .annotated-char { gap: 0.14em; margin-inline-end: 0.26em; }
}

@media (max-width: 560px) {
  main { width: min(100% - 20px, 1080px); }
  .hero { padding-right: 16px; padding-left: 16px; }
  .player-card { border-radius: 22px; padding: 20px 17px; }
  .player-heading { display: block; }
  .player-heading .pill { margin-top: 15px; }
  .sound-controls { align-items: flex-start; }
  .volume-control { width: 100%; justify-content: space-between; }
  .volume-control input { max-width: none; }
  .playlist-panel, .playback-mode, .sleep-timer { padding: 15px; }
  .playback-mode-options { grid-template-columns: 1fr; }
  .timer-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .custom-timer-form .text-button { margin-left: 0; }
}
