:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-strong: rgba(118, 118, 128, 0.2);
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --sep: rgba(60, 60, 67, 0.29);
  --accent: #ff2d55;
  --accent-soft: rgba(255, 45, 85, 0.12);
  --blue: #007aff;
  --red: #ff3b30;
  --green: #34c759;
  --bar: rgba(249, 249, 249, 0.82);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.36);
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.6);
    --label-3: rgba(235, 235, 245, 0.3);
    --sep: rgba(84, 84, 88, 0.6);
    --accent: #ff375f;
    --accent-soft: rgba(255, 55, 95, 0.18);
    --blue: #0a84ff;
    --red: #ff453a;
    --green: #30d158;
    --bar: rgba(22, 22, 23, 0.8);
    --shadow: none;
  }
}

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

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px calc(96px + env(safe-area-inset-bottom));
}

.view { display: none; animation: fade 0.25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.hidden { display: none !important; }

/* 큰 제목 */
.large-title { padding: 28px 4px 14px; }
.large-title h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: 0.01em; line-height: 1.15; }
.eyebrow { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: 0.02em; min-height: 17px; }
.subtitle { margin: 4px 0 0; color: var(--label-2); font-size: 15px; }

/* 카드(inset grouped) */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 20px; }
.group-header { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 16px 7px; font-size: 13px; color: var(--label-2); text-transform: uppercase; }
.group-footer { margin: 7px 16px 24px; font-size: 13px; color: var(--label-2); }
.text-btn { color: var(--blue); font-size: 15px; text-transform: none; padding: 0; }

/* 장르 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 34px; padding: 0 14px; border-radius: 17px;
  background: var(--fill); font-size: 15px; font-weight: 500;
  transition: background 0.18s, color 0.18s, transform 0.12s;
}
.chip:active { transform: scale(0.95); }
.chip svg { width: 15px; height: 15px; stroke-width: 3; display: none; }
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; }
.chip[aria-pressed="true"] svg { display: inline; }
.chip .count { font-size: 12px; opacity: 0.6; font-weight: 400; }

/* 플레이어 */
.video { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video iframe, .video > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.meta { display: flex; align-items: center; gap: 12px; padding: 14px 16px 4px; }
.meta-text { flex: 1; min-width: 0; }
.meta-text h2 { margin: 0; font-size: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-text p { margin: 2px 0 0; color: var(--label-2); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { flex: none; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 4px 9px; border-radius: 10px; font-variant-numeric: tabular-nums; }

.actions { display: flex; justify-content: space-around; padding: 16px 12px 6px; }
.round { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--label-2); }
.round svg { width: 60px; height: 60px; padding: 17px; border-radius: 50%; background: var(--fill); stroke-width: 1.9; transition: transform 0.12s, background 0.18s; }
.round:active svg { transform: scale(0.9); }
.round.skip svg { width: 48px; height: 48px; padding: 14px; margin: 6px 0; }
.round.like svg { background: var(--accent); color: #fff; }
.round.dislike svg { color: var(--label); }
.remaining { text-align: center; font-size: 12px; color: var(--label-3); margin: 6px 0 14px; }

/* 빈 상태 */
.empty { padding: 40px 24px; text-align: center; }
.empty.plain { padding: 32px 24px 8px; }
.empty-icon svg { width: 52px; height: 52px; color: var(--label-3); stroke-width: 1.5; }
.empty-title { margin: 10px 0 4px; font-size: 20px; font-weight: 600; }
.empty-sub { margin: 0; color: var(--label-2); font-size: 15px; }
.empty .pill { margin-top: 16px; }

/* 알약 버튼 */
.pl-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 46px; padding: 0 18px; border-radius: 12px; font-weight: 600; font-size: 17px; transition: opacity 0.15s; }
.pill:active { opacity: 0.6; }
.pill svg { width: 18px; height: 18px; }
.pill.primary { background: var(--fill); color: var(--accent); }
.pill.primary svg { fill: currentColor; stroke: none; }
.pill.secondary { background: var(--fill); color: var(--accent); }
.pill:disabled { opacity: 0.35; }

/* 미니 플레이어 */
.mini { margin-bottom: 20px; }
.mini-bar { display: flex; align-items: center; gap: 4px; padding: 12px 8px 12px 16px; }
.mini-bar h2 { font-size: 17px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--label); }
.icon-btn svg { fill: currentColor; }
.icon-btn:active { background: var(--fill); }

/* 리스트 */
.list .row {
  position: relative; display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 44px; padding: 8px 16px; text-align: left;
}
.list .row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: 0.5px solid var(--sep); }
.list .row.song + .row.song::before { left: 92px; }
.row.song.playing .row-title { color: var(--accent); }
.thumb { flex: none; width: 64px; height: 48px; border-radius: 6px; background: var(--fill) center / cover no-repeat; }
.row-text { flex: 1; min-width: 0; }
.row-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .del { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: var(--label-3); }
.row .del svg { width: 18px; height: 18px; }
.row .del:active { color: var(--red); background: var(--fill); }
.row.link { justify-content: space-between; color: var(--blue); }
.row.link.danger { color: var(--red); }
.chev { color: var(--label-3); font-size: 22px; line-height: 1; }
.settings { margin-top: 24px; }

/* 탭바 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 56px;
  padding: 7px 0 calc(6px + env(safe-area-inset-bottom));
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 72px; font-size: 10px; font-weight: 500; color: var(--label-3); }
.tab svg { width: 26px; height: 26px; stroke-width: 1.8; }
.tab.active { color: var(--accent); }
.tab-badge { position: absolute; top: -3px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-style: normal; font-weight: 600; line-height: 18px; text-align: center; }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 22px; white-space: nowrap;
  background: var(--bar); color: var(--label); font-size: 15px; font-weight: 500;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .large-title h1 { font-size: 40px; }
}
