:root {
  --bg: #0b0b0d;
  --surface: #16161a;
  --surface-hi: #212127;
  --line: #26262d;
  --text: #f4f4f6;
  --muted: #85858f;
  --accent: #ffb23e;
  --accent-ink: #1a1206;
  --radius: 14px;
  --bar-h: 76px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Pretendard", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  /* 모바일 전용: 중앙 정렬된 좁은 컬럼 */
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 16px calc(var(--bar-h) + env(safe-area-inset-bottom) + 24px);
}

/* ── 상단 ─────────────────────────────── */
.topbar {
  padding: calc(env(safe-area-inset-top) + 22px) 4px 18px;
}
.topbar h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.22em;
}
.topbar .sub {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ── 채널 리스트 ──────────────────────── */
.loading { padding: 40px 4px; color: var(--muted); font-size: 14px; }

.group { margin-bottom: 22px; }
.group-title {
  margin: 0 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.chan {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 16px 14px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  line-height: 1.25;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s;
}
.chan:active { transform: scale(.97); background: var(--surface-hi); }

/* 현재 재생 중인 채널 */
.chan.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
/* 로딩 중인 채널 */
.chan.loading-state { border-color: var(--accent); }

/* ── 하단 재생 바 ─────────────────────── */
.player {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 20;
  max-width: 480px;
  margin: 0 auto;
  height: calc(var(--bar-h) + env(safe-area-inset-bottom));
  padding: 0 16px env(safe-area-inset-bottom);
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(18,18,22,.86);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--line);
}

.np { flex: 1; min-width: 0; }
.np-name {
  display: block;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-status {
  display: inline-block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.np-status.err { color: #ff6b6b; }
.np-status.buffering { color: var(--muted); }

/* 재생/일시정지 버튼 */
.toggle {
  flex: none;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.toggle:active { transform: scale(.94); }
.toggle svg { width: 26px; height: 26px; fill: currentColor; }
.toggle .ic-pause { display: none; }
.player.playing .toggle .ic-play { display: none; }
.player.playing .toggle .ic-pause { display: block; }

/* 이퀄라이저 (재생 중일 때만 애니메이션) */
.eq {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  width: 22px;
}
.eq i {
  flex: 1;
  background: var(--accent);
  height: 30%;
  border-radius: 2px;
}
.player.playing .eq i { animation: bounce .9s ease-in-out infinite; }
.player.playing .eq i:nth-child(2) { animation-delay: .15s; }
.player.playing .eq i:nth-child(3) { animation-delay: .3s; }
.player.playing .eq i:nth-child(4) { animation-delay: .45s; }
@keyframes bounce {
  0%, 100% { height: 25%; }
  50% { height: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .player.playing .eq i { animation: none; height: 60%; }
}
