/* ---------- Theme tokens ---------- */
:root {
  --bg: #f3f3f5;
  --bg-blob-1: rgba(255, 255, 255, 0.9);
  --bg-blob-2: rgba(200, 200, 210, 0.45);
  --text: #111113;
  --text-2: #55555c;
  --text-3: #8a8a92;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-edge: rgba(0, 0, 0, 0.06);
  --shadow: 0 10px 40px rgba(20, 20, 30, 0.10), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  --hover: rgba(0, 0, 0, 0.05);
  --accent: #111113;
  --accent-text: #ffffff;
  --veil: linear-gradient(180deg, rgba(243, 243, 245, 0.15) 0%, rgba(243, 243, 245, 0.35) 55%, var(--bg) 100%);
  --today: #111113;

  --c-release: #e0457b;
  --c-media: #4a7bd8;
  --c-live: #e5484d;
  --c-event: #2f9e6e;
  --c-show: #8b5cf6;
  --c-birthday: #f59e0b;
  --c-scheduled: #0ea5b7;
  --c-other: #8a8a92;

  --radius: 22px;
  --blur: saturate(160%) blur(22px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1b1e;
    --bg-blob-1: rgba(90, 90, 100, 0.35);
    --bg-blob-2: rgba(60, 60, 70, 0.4);
    --text: #f2f2f4;
    --text-2: #b4b4bc;
    --text-3: #7c7c85;
    --glass: rgba(44, 44, 49, 0.5);
    --glass-strong: rgba(44, 44, 49, 0.72);
    --glass-border: rgba(255, 255, 255, 0.09);
    --glass-edge: rgba(255, 255, 255, 0.04);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
    --hover: rgba(255, 255, 255, 0.06);
    --accent: #f2f2f4;
    --accent-text: #111113;
    --veil: linear-gradient(180deg, rgba(27, 27, 30, 0.25) 0%, rgba(27, 27, 30, 0.5) 55%, var(--bg) 100%);
    --today: #f2f2f4;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1b1b1e;
  --bg-blob-1: rgba(90, 90, 100, 0.35);
  --bg-blob-2: rgba(60, 60, 70, 0.4);
  --text: #f2f2f4;
  --text-2: #b4b4bc;
  --text-3: #7c7c85;
  --glass: rgba(44, 44, 49, 0.5);
  --glass-strong: rgba(44, 44, 49, 0.72);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-edge: rgba(255, 255, 255, 0.04);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  --hover: rgba(255, 255, 255, 0.06);
  --accent: #f2f2f4;
  --accent-text: #111113;
  --veil: linear-gradient(180deg, rgba(27, 27, 30, 0.25) 0%, rgba(27, 27, 30, 0.5) 55%, var(--bg) 100%);
  --today: #f2f2f4;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(60vw 60vw at 85% -10%, var(--bg-blob-1), transparent 60%),
    radial-gradient(50vw 50vw at -10% 40%, var(--bg-blob-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, "Noto Sans KR", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--text-3); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 50;
  display: flex; align-items: center; gap: 8px;
  width: min(1180px, 100% - 32px);
  padding: 8px 8px 8px 20px;
  border-radius: 999px;
}
.brand {
  font-weight: 800; letter-spacing: -0.02em; text-decoration: none; font-size: 18px;
  margin-right: auto;
}
.brand span { font-weight: 500; color: var(--text-3); }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  text-decoration: none; font-size: 14px; font-weight: 600; color: var(--text-2);
  padding: 8px 14px; border-radius: 999px; transition: background .2s, color .2s;
}
.nav-links a:hover { background: var(--hover); color: var(--text); }
.nav-links a.active { background: var(--accent); color: var(--accent-text); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 999px;
  border: 0; background: transparent; cursor: pointer; font-size: 20px; line-height: 1;
  transition: background .2s;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:focus-visible, .pill:focus-visible, .nav-links a:focus-visible, .link-btn:focus-visible {
  outline: 2px solid var(--text); outline-offset: 2px;
}
#theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] #theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] #theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-toggle .i-sun { display: none; }
  :root:not([data-theme="light"]) #theme-toggle .i-moon { display: block; }
}

/* ---------- Hero ---------- */
#view-home { position: relative; }
.hero-bg {
  position: absolute; inset: 0 0 auto 0; height: 100vh; height: 100svh;
  overflow: hidden; z-index: 0; background: #000;
}
.hero-bg #bg-player, .hero-bg iframe {
  position: absolute; top: 50%; left: 50%;
  width: max(100vw, 177.78vh); height: max(56.25vw, 100vh);
  transform: translate(-50%, -50%) scale(1.15);
  border: 0; pointer-events: none;
}
.hero-poster {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  transition: opacity 1.2s ease;
}
.hero-poster.fade { opacity: 0; }
.hero-veil { position: absolute; inset: 0; background: var(--veil); }

.hero {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100svh;
  display: grid; place-items: end center;
  padding: 100px 16px 64px;
}
.hero-card {
  width: min(640px, 100%);
  padding: 32px 32px 28px;
  border-radius: 28px;
  text-align: center;
  background: var(--glass-strong);
}
.eyebrow {
  margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .22em; color: var(--text-2);
}
.eyebrow .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-live); margin-right: 8px; vertical-align: 1px;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity: .35; } }
.album-title {
  margin: 0; font-size: clamp(40px, 8vw, 72px); font-weight: 800; letter-spacing: -0.04em; line-height: 1;
}
.album-meta { margin: 12px 0 0; color: var(--text-2); font-size: 15px; }
.album-meta b { color: var(--text); font-weight: 700; }

.countdown {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 26px 0 0;
}
.cd-cell {
  padding: 14px 4px 10px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--glass-border);
}
.cd-cell span {
  display: block; font-size: clamp(28px, 6vw, 44px); font-weight: 800;
  font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1.05;
}
.cd-cell small { font-size: 10px; letter-spacing: .18em; color: var(--text-3); font-weight: 700; }
.release-date { margin: 16px 0 0; font-size: 13px; color: var(--text-3); }

.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.link-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; text-decoration: none;
  font-size: 14px; font-weight: 600;
  background: var(--glass); border: 1px solid var(--glass-border);
  transition: transform .15s, background .2s;
}
.link-btn:hover { transform: translateY(-1px); background: var(--hover); }
.link-btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.link-btn svg { width: 16px; height: 16px; flex: none; }

.sound-btn { position: absolute; right: 24px; bottom: 24px; }

/* ---------- Sections ---------- */
.upcoming { position: relative; z-index: 1; padding: 8px 0 64px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.more { font-size: 14px; color: var(--text-2); text-decoration: none; }
.more:hover { color: var(--text); }

.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.upcoming .event-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.event {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px; border-radius: 18px;
}
.event-date {
  flex: none; width: 52px; text-align: center; padding: 6px 0; border-radius: 12px;
  background: var(--hover);
}
.event-date b { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; }
.event-date small { font-size: 11px; color: var(--text-3); font-weight: 600; }
.event-body { min-width: 0; flex: 1; }
.event-title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
.event-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--text-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.event-sub a { color: var(--text-2); }
.tag {
  display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text-2);
}
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cat, var(--c-other)); }

.event-list.compact { gap: 8px; }
.event-list.compact .event { padding: 12px 14px; background: var(--glass); border: 1px solid var(--glass-border); }

/* ---------- Calendar ---------- */
#view-calendar { padding: 96px 0 48px; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cal-panel, .day-panel { border-radius: var(--radius); padding: 18px; }
.day-panel { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow: auto; }
.day-panel h3 { margin: 4px 4px 14px; font-size: 18px; letter-spacing: -0.02em; }

.cal-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.cal-toolbar h2 { margin: 0 6px; font-size: 22px; letter-spacing: -0.02em; min-width: 140px; text-align: center; }
.pill {
  margin-left: auto; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--glass-border); background: var(--glass); font-size: 13px; font-weight: 600;
}
.pill:hover { background: var(--hover); }

.cal-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--glass-border); background: var(--glass); color: var(--text-2);
  transition: opacity .2s;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cat); }
.chip[aria-pressed="false"] { opacity: .4; }

.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-weekdays span { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-3); padding-bottom: 6px; }
.cal-weekdays span:first-child { color: var(--c-live); }
.cal-day {
  min-height: 96px; padding: 6px; border-radius: 14px; text-align: left; cursor: pointer;
  border: 1px solid transparent; background: var(--glass-edge);
  display: flex; flex-direction: column; gap: 3px; overflow: hidden;
  transition: background .15s, border-color .15s;
}
.cal-day:hover { background: var(--hover); }
.cal-day.out { opacity: .35; }
.cal-day.selected { border-color: var(--text); }
.cal-day .num { font-size: 13px; font-weight: 700; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .num { background: var(--today); color: var(--bg); }
.cal-day.sun .num { color: var(--c-live); }
.cal-day.today.sun .num { color: var(--bg); }
.cal-ev {
  font-size: 11px; line-height: 1.3; padding: 2px 6px; border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--cat) 16%, transparent);
  border-left: 2px solid var(--cat);
}
.cal-more { font-size: 11px; color: var(--text-3); padding-left: 4px; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--cat); }

.source { margin: 16px 4px 0; font-size: 12px; color: var(--text-3); }

/* ---------- Footer ---------- */
.footer { position: relative; z-index: 1; text-align: center; padding: 24px 16px 40px; font-size: 12px; color: var(--text-3); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .cal-layout { grid-template-columns: 1fr; }
  .day-panel { position: static; max-height: none; }
}
@media (max-width: 600px) {
  .nav { padding-left: 14px; }
  .brand span { display: none; }
  .nav-links a { padding: 8px 10px; }
  .hero-card { padding: 24px 18px 20px; border-radius: 24px; }
  .countdown { gap: 6px; }
  .cal-panel { padding: 12px; }
  .cal-toolbar h2 { font-size: 18px; min-width: 0; }
  .cal-weekdays, .cal-grid { gap: 3px; }
  .cal-day { min-height: 54px; padding: 4px; border-radius: 10px; align-items: center; }
  .cal-ev, .cal-more { display: none; }
  .cal-dots { display: flex; justify-content: center; }
  .sound-btn { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Music ---------- */
#view-music { padding: 96px 0 48px; }
.music-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title { margin: 0; font-size: clamp(30px, 5vw, 44px); font-weight: 800; letter-spacing: -0.04em; }
.page-sub { margin: 6px 0 0; color: var(--text-3); font-size: 14px; }

.segmented { display: inline-flex; gap: 2px; padding: 4px; border-radius: 999px; }
.segmented button {
  border: 0; background: transparent; cursor: pointer; padding: 8px 14px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; transition: background .2s, color .2s;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); }
.segmented button:focus-visible, .album-card:focus-visible, .mini-link:focus-visible, .chip:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.chip.plain::before { display: none; }

.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.album-card {
  display: flex; flex-direction: column; gap: 10px; padding: 10px 10px 14px; border-radius: 20px;
  text-align: left; cursor: pointer; transition: transform .2s, box-shadow .2s;
}
.album-card:hover { transform: translateY(-3px); }
.album-cover { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; display: block; background: var(--hover); }
.album-info { display: flex; flex-direction: column; gap: 3px; padding: 0 4px; min-width: 0; }
.album-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; line-height: 1.3; overflow-wrap: anywhere; }
.album-sub { font-size: 12.5px; color: var(--text-3); }

.member-chip {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--hover); color: var(--text-2); margin-right: 4px;
}
.title-badge {
  display: inline-block; margin-left: 8px; padding: 1px 6px; border-radius: 6px; vertical-align: 2px;
  font-size: 9.5px; font-weight: 800; letter-spacing: .08em; background: var(--accent); color: var(--accent-text);
}

.track-links { display: inline-flex; gap: 4px; flex: none; }
.mini-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 34px; height: 34px; padding: 0 9px; border-radius: 999px; text-decoration: none;
  color: var(--text-2); background: var(--hover); transition: color .2s, background .2s;
}
.mini-link svg { width: 16px; height: 16px; }
.mini-link b { font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.mini-link.yt:hover { color: #ff0033; }
.mini-link.sp:hover { color: #1db954; }

/* Album dialog */
.album-dialog {
  width: min(720px, 100% - 32px); max-height: min(86vh, 900px); padding: 0; border-radius: 26px;
  color: var(--text); background: var(--glass-strong); overflow: auto;
}
.album-dialog::backdrop { background: rgba(10, 10, 14, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dlg-inner { position: relative; padding: 24px; }
.dlg-close { position: absolute; top: 14px; right: 14px; }
.dlg-head { display: flex; gap: 20px; align-items: flex-end; margin-bottom: 18px; }
.dlg-cover { width: 160px; height: 160px; border-radius: 16px; object-fit: cover; flex: none; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.dlg-meta { min-width: 0; }
.dlg-meta h2 { margin: 0; font-size: clamp(24px, 4vw, 32px); letter-spacing: -0.03em; line-height: 1.1; padding-right: 32px; }
.dlg-meta .eyebrow { margin-bottom: 6px; }
.dlg-links { justify-content: flex-start; margin-top: 14px; }

.track-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--glass-border); }
.track {
  display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--glass-edge);
}
.track-n { width: 22px; text-align: right; color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.track-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.track-name { font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.track-sub { font-size: 12.5px; color: var(--text-3); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.track-dur { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }

/* Member songs */
.member-filters { margin-bottom: 14px; }
.song-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.song { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 12px; border-radius: 18px; }
.song-cover { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: none; }
.song-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.song-note { margin-left: 2px; }

@media (max-width: 600px) {
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding: 8px 6px; font-size: 12.5px; }
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .song-list { grid-template-columns: 1fr; }
  .dlg-inner { padding: 18px 14px; }
  .dlg-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .dlg-cover { width: 120px; height: 120px; }
  .track { gap: 8px; padding: 10px 2px; }
  .track-dur { display: none; }
}
