/* =========================================================
   WAVE FM — 24H 在線音樂電台
   現代化介面樣式（深色 / 淺色雙主題、玻璃擬態、漸層光效）
   ========================================================= */

:root {
  --bg: #05060a;
  --bg-soft: #0b0e17;
  --text: #f5f6f8;
  --text-sub: #aab2c0;
  --text-muted: #667085;
  --border: rgba(255, 255, 255, 0.09);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --accent: #7c3aed;
  --accent-2: #22d3ee;
  --danger: #fb7185;
  --grad: linear-gradient(135deg, #7c3aed 0%, #22d3ee 100%);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.5);
  --radius: 20px;
  --mood-color: transparent; /* 每日心情選色：由 JS 寫入 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
          "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}

body.light-mode {
  --bg: #eef1f8;
  --bg-soft: #ffffff;
  --text: #10131a;
  --text-sub: #4b5565;
  --text-muted: #8a94a6;
  --border: rgba(16, 19, 26, 0.1);
  --glass: rgba(255, 255, 255, 0.7);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --shadow-lg: 0 24px 70px rgba(23, 37, 84, 0.14);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  letter-spacing: 0.01em;
  transition: background 0.4s ease, color 0.4s ease;
  /* 預留底部空間，避免內容被固定播放器遮住 */
  padding-bottom: 140px;
}

::selection { background: rgba(124, 58, 237, 0.45); color: #fff; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 6px; }

/* ---------- 背景場景：隨機星雲圖片 + 漸層光暈 ---------- */
/* 隨機背景圖片（每次進入/刷新隨機一張，由 JS 指定） */
.bg-image {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.32;
  filter: saturate(0.85);
  transition: opacity 1.2s ease;
}
body.light-mode .bg-image { opacity: 0.45; }

.bg-scene {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}
.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}
.blob-a { width: 520px; height: 520px; left: -140px; top: -120px; background: #7c3aed; animation: drift 26s ease-in-out infinite alternate; }
.blob-b { width: 420px; height: 420px; right: -90px; top: 28%; background: #0ea5e9; animation: drift 30s ease-in-out infinite alternate-reverse; }
.blob-c { width: 460px; height: 460px; left: 32%; bottom: -190px; background: #db2777; opacity: 0.32; animation: drift 34s ease-in-out infinite alternate; }

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, -40px) scale(1.12); }
}

/* ---------- 頂部導覽 ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 6vw, 64px);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(to bottom, rgba(5, 6, 10, 0.78), transparent);
}
body.light-mode .nav { background: linear-gradient(to bottom, rgba(238, 241, 248, 0.85), transparent); }

.brand {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}
.brand span {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-right { display: flex; align-items: center; gap: 14px; }
.clock {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--text-sub);
  letter-spacing: 0.1em;
}

.theme-switch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.25s;
}
.theme-switch:hover { background: var(--glass-strong); transform: rotate(15deg); }
.theme-switch svg {
  width: 18px;
  height: 18px;
  stroke: var(--text);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic-moon { display: none; }
body.light-mode .ic-sun { display: none; }
body.light-mode .ic-moon { display: block; }

/* 右上角：七彩虹圈按鈕（隨時更換今日心情） */
.mood-switch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.35s;
}
.mood-switch:hover { background: var(--glass-strong); transform: rotate(120deg); }

.rainbow-ring {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: conic-gradient(#f59e0b, #10b981, #3b82f6, #ec4899, #ef4444, #8b5cf6, #000000, #f59e0b);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
}

/* ---------- 主內容 ---------- */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 118px clamp(20px, 6vw, 64px) 60px;
}

/* ---------- Hero ---------- */
.hero { padding: 46px 0 60px; max-width: 840px; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text-sub);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(251, 113, 133, 0.5); }
  50%      { opacity: 0.55; box-shadow: 0 0 0 7px rgba(251, 113, 133, 0); }
}

.hero-title {
  font-size: clamp(2.7rem, 7vw, 5rem);
  font-weight: 800;
  line-height: 1.07;
  letter-spacing: -0.02em;
  margin: 26px 0 20px;
}
.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  max-width: 660px;
  color: var(--text-sub);
  font-size: 1.08rem;
}

.hero-actions { display: flex; gap: 14px; margin-top: 36px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.97rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; fill: currentColor; }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 10px 30px rgba(124, 58, 237, 0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 42px rgba(124, 58, 237, 0.45);
}
.btn-ghost { background: var(--glass); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--glass-strong); }

/* ---------- 現在播出卡片 ---------- */
.now-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 26px 30px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.now-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
    color-mix(in srgb, var(--accent) 20%, transparent), transparent 55%);
  opacity: 0.7;
  pointer-events: none;
}

.now-left { display: flex; align-items: center; gap: 20px; position: relative; }
.now-meta .now-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.73rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  font-weight: 700;
}
.now-meta .now-label .live-dot { width: 7px; height: 7px; }
.now-name { font-size: 1.6rem; font-weight: 800; margin-top: 5px; }
.now-en { color: var(--text-sub); font-size: 0.92rem; margin-top: 2px; }

.now-right { text-align: right; color: var(--text-sub); font-size: 0.9rem; line-height: 1.9; position: relative; }
.now-right b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
  font-weight: 800;
}
.now-next span { color: var(--text); font-weight: 600; }

/* ---------- 段落與節目表 ---------- */
.section { margin-top: 80px; }
.section-title { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; letter-spacing: -0.01em; }
.section-sub { color: var(--text-muted); margin-top: 8px; font-size: 0.95rem; }

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 28px;
}
.slot {
  position: relative;
  padding: 18px 20px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
  overflow: hidden;
}
.slot:hover { transform: translateY(-3px); }
.slot.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent),
              0 14px 40px color-mix(in srgb, var(--accent) 28%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, var(--glass));
}
.slot-time {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.slot-name { display: block; font-size: 1.12rem; font-weight: 800; margin-top: 8px; }
.slot-desc { display: block; font-size: 0.82rem; color: var(--text-sub); margin-top: 6px; }
.slot-now {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fff;
  background: var(--accent);
  padding: 3px 9px;
  border-radius: 999px;
}

/* ---------- 特色卡片 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 28px;
}
.card {
  padding: 28px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.2s, border-color 0.2s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.card h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 10px; }
.card p { color: var(--text-sub); font-size: 0.93rem; }

/* ---------- 頁尾 ---------- */
.footer {
  margin-top: 92px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.88rem;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-note { opacity: 0.85; }

/* ---------- 全域播放器 ---------- */
.player-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  width: min(980px, calc(100% - 32px));
  z-index: 60;
  border-radius: 20px;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.player-progress { height: 3px; background: var(--border); }
.player-progress-fill {
  height: 100%;
  width: 0;
  background: var(--grad);
  transition: width 0.3s linear;
}

.player-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 20px;
}

.player-info { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.player-meta { min-width: 0; }
.player-track {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-center { display: flex; align-items: center; gap: 14px; flex: none; }

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 14px;   /* 現代圓角方形：手機上不會被擠壓變形 */
  flex: none;
  border: none;
  cursor: pointer;
  background: var(--grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.35);
  transition: transform 0.18s, box-shadow 0.18s;
}
.icon-btn:hover { transform: scale(1.06); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; }



/* 自訂 range 滑桿 */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text);
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text);
  border: none;
}

.player-right { display: flex; align-items: center; gap: 16px; }
.vol-wrap { display: flex; align-items: center; gap: 8px; width: 110px; }
.vol-wrap svg { width: 16px; height: 16px; fill: var(--text-sub); flex: none; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  padding: 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.live-badge .live-dot { width: 7px; height: 7px; }

/* 直播模式：頂部細線改由 updateNow 顯示「本時段播放進度」 */

/* ---------- 等化器動畫 ---------- */
.eq { display: flex; align-items: flex-end; gap: 3px; height: 30px; flex: none; }
.eq i {
  width: 4px;
  border-radius: 2px;
  background: var(--grad);
  height: 22%;
  animation-play-state: paused;
}
body.playing .eq i { animation: eq-bounce 1s ease-in-out infinite; animation-play-state: running; }
.eq i:nth-child(1) { animation-delay: 0s; }
.eq i:nth-child(2) { animation-delay: 0.18s; }
.eq i:nth-child(3) { animation-delay: 0.36s; }
.eq i:nth-child(4) { animation-delay: 0.09s; }
.eq i:nth-child(5) { animation-delay: 0.27s; }

.eq-mini { height: 22px; }
.eq-mini i { width: 3px; }

@keyframes eq-bounce {
  0%, 100% { height: 22%; }
  50%      { height: 96%; }
}

/* ---------- 每日心情選色：全頁色罩（50% 不透明） ---------- */
.mood-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;              /* 在背景之上、內容之下 */
  pointer-events: none;
  background: var(--mood-color);
  opacity: 0.5;
  transition: background 0.8s ease;
}

/* ---------- 每日心情選色：彈窗 ---------- */
.mood-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.mood-modal.show { opacity: 1; pointer-events: auto; }

.mood-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.mood-card {
  position: relative;
  max-width: 600px;
  width: 100%;
  padding: 34px 30px 24px;
  border-radius: 24px;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  text-align: center;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.35s ease;
}
.mood-modal.show .mood-card { transform: translateY(0) scale(1); }

.mood-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.mood-sub { color: var(--text-sub); font-size: 0.92rem; margin: 8px 0 24px; }

.mood-options {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}
.mood-swatch {
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  border-radius: 14px;
  transition: transform 0.18s ease, background 0.18s ease;
}
.mood-swatch:hover { transform: translateY(-4px); background: var(--glass); }
.mood-swatch:active { transform: scale(0.95); }

.mood-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--sw);
  border: 1px solid var(--border);   /* 讓黑色色點在深色背景下仍清晰可見 */
  box-shadow: 0 6px 18px color-mix(in srgb, var(--sw) 45%, transparent);
  transition: transform 0.18s ease;
}
.mood-swatch:hover .mood-dot { transform: scale(1.12); }
.mood-name { font-size: 0.78rem; color: var(--text-sub); font-weight: 600; }

/* 目前選中的心情（重新開啟選單時標示） */
.mood-swatch.selected { background: var(--glass-strong); }
.mood-swatch.selected .mood-dot {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

.mood-skip {
  margin-top: 22px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.mood-skip:hover { color: var(--text-sub); }

/* 語言選擇（彈窗下方） */
.mood-langs {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.mood-langs-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 10px;
}
.mood-lang-btns {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.lang-btn {
  min-width: 46px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text-sub);
  font-size: 1.05rem;      /* 國旗與簡/繁字顯示 */
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}
.lang-btn:hover { background: var(--glass-strong); color: var(--text); transform: translateY(-2px); }
.lang-btn.active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.35);
}

/* ---------- 響應式 ---------- */
@media (max-width: 720px) {
  .player-inner { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .player-info { flex: 1 1 100%; }
  .player-center { order: 3; width: 100%; justify-content: center; gap: 12px; }
  .icon-btn { width: 54px; height: 48px; border-radius: 14px; }
  .vol-wrap { display: none; }
  .now-right { text-align: left; }
  .footer { flex-direction: column; }
  main { padding-top: 100px; }
  .mood-options { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .mood-dot { width: 38px; height: 38px; }
}

/* ---------- 動效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  .bg-blob, .live-dot, .eq i { animation: none !important; }
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
