:root {
  --ink: #0a0c24;
  --panel: rgba(18, 20, 54, 0.66);
  --panel-solid: #14163a;
  --line: rgba(176, 166, 255, 0.22);
  --text: #ecebff;
  --muted: #a6a4cf;
  --accent: #b3a6ff;
  --accent-2: #f1d4ff;
  --danger: #ff8aa8;
  --side-w: 252px;
  --dim: 0.45;
  font-family: Pretendard, 'Noto Sans KR', 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--ink); color: var(--text); }
body { font-size: 15px; line-height: 1.6; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* 배경 */
#bg {
  position: fixed; inset: 0; z-index: -2;
  background: radial-gradient(120% 90% at 70% 0%, #2b2766 0%, #0f1132 55%, #070818 100%) center / cover no-repeat;
}
#bgdim { position: fixed; inset: 0; z-index: -1; background: rgba(6, 7, 24, var(--dim)); }

/* 레이아웃 */
.app { display: flex; min-height: 100vh; }
aside {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 20;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(20, 20, 62, 0.82), rgba(14, 14, 44, 0.9));
  backdrop-filter: blur(14px); border-right: 1px solid var(--line);
  transition: transform 0.25s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 18px 18px; border-bottom: 1px solid var(--line); }
.logo {
  width: 44px; height: 44px; flex: none; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--accent); background: #232260;
  display: grid; place-items: center; font-weight: 700; overflow: hidden;
}
.brand b { display: block; font-size: 16px; line-height: 1.2; }
.brand small { display: block; font-size: 10.5px; letter-spacing: 0.08em; color: var(--muted); margin-top: 3px; }
.sec { padding: 14px 18px 6px; font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }
nav { padding: 6px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; }
nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
  border: 1px solid transparent; color: #d9d6ff;
}
nav a i { font-style: normal; width: 18px; text-align: center; color: var(--accent); }
nav a:hover { background: rgba(179, 166, 255, 0.1); }
nav a.on { background: rgba(179, 166, 255, 0.18); border-color: var(--line); color: #fff; }
.side-foot { padding: 14px; border-top: 1px solid var(--line); }
.side-foot a {
  display: block; text-align: center; padding: 10px; border-radius: 10px; font-size: 13px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); color: var(--muted);
}
.side-foot a:hover { color: #fff; }

main { flex: 1; margin-left: var(--side-w); min-width: 0; transition: margin 0.25s ease; }
body.fold aside { transform: translateX(-100%); }
body.fold main { margin-left: 0; }
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 14px 22px; background: linear-gradient(180deg, rgba(8, 9, 30, 0.7), rgba(8, 9, 30, 0));
}
.btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 14px;
  backdrop-filter: blur(8px);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #17123f; border-color: var(--accent); font-weight: 700; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: default; }
.crumb { color: var(--muted); font-size: 13px; }
#view { padding: 14px clamp(18px, 4vw, 56px) 80px; max-width: 1100px; }

/* 페이지 본문 */
.pg-title { font-size: clamp(28px, 4.4vw, 46px); font-weight: 800; letter-spacing: -0.02em; margin: 18px 0 26px; }
.blk { margin: 0 0 20px; }
.blk h2 { font-size: 22px; margin: 28px 0 8px; }
.blk p { white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; max-width: 72ch; margin: 0; }
.blk figure { margin: 0; }
.blk img { max-width: 100%; border-radius: 14px; border: 1px solid var(--line); display: block; }
.blk figcaption { color: var(--muted); font-size: 13px; margin-top: 6px; }
.empty { color: var(--muted); padding: 40px 0; }

/* Home */
.home-title { font-size: clamp(32px, 6vw, 64px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin: 22px 0 10px; text-shadow: 0 2px 24px rgba(120, 100, 255, 0.5); }
.home-text { color: #d8d5ff; white-space: pre-wrap; max-width: 60ch; margin: 0 0 28px; }
.player {
  display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: clamp(20px, 4vw, 48px); align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: clamp(18px, 3vw, 34px);
  backdrop-filter: blur(12px);
}
.disc-wrap { display: grid; place-items: center; }
.cd {
  position: relative; width: min(100%, 320px); aspect-ratio: 1; border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 17%, rgba(255, 255, 255, 0.0) 17% 100%),
    conic-gradient(from 20deg, #cfd6ff, #f7d8ff, #b7f0ff, #d9c9ff, #ffe6f6, #bfd0ff, #cfd6ff);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18), 0 20px 60px rgba(100, 80, 255, 0.45), inset 0 0 40px rgba(255, 255, 255, 0.35);
  animation: spin 7s linear infinite; animation-play-state: paused;
}
.cd.playing { animation-play-state: running; }
.cd::before { /* 라벨 영역 */
  content: ''; position: absolute; inset: 24%; border-radius: 50%;
  background: var(--label, radial-gradient(circle, #3a2f8f, #17123f)) center / cover no-repeat;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.55), inset 0 0 18px rgba(0, 0, 0, 0.4);
}
.cd::after { /* 가운데 구멍 */
  content: ''; position: absolute; inset: 45%; border-radius: 50%;
  background: #0b0c26; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.7);
}
@keyframes spin { to { transform: rotate(360deg); } }
.now { font-size: clamp(20px, 2.6vw, 28px); font-weight: 800; margin: 0 0 4px; word-break: keep-all; overflow-wrap: anywhere; }
.now-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.ctl { display: flex; align-items: center; gap: 10px; margin: 6px 0 16px; flex-wrap: wrap; }
.ctl button {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07); font-size: 16px; display: grid; place-items: center;
}
.ctl button:hover { border-color: var(--accent); }
.ctl button.big { width: 54px; height: 54px; background: var(--accent); color: #17123f; border-color: var(--accent); font-size: 20px; }
.ctl button.on { border-color: var(--accent-2); color: var(--accent-2); }
.row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.row input[type='range'] { flex: 1; }
input[type='range'] { accent-color: var(--accent); height: 20px; }
.vol { max-width: 180px; }
.tracks { list-style: none; padding: 0; margin: 14px 0 0; max-height: 230px; overflow-y: auto; border-top: 1px solid var(--line); }
.tracks li button {
  width: 100%; text-align: left; background: none; border: 0; padding: 9px 6px; color: #d9d6ff;
  border-bottom: 1px solid rgba(176, 166, 255, 0.1); display: flex; gap: 10px;
}
.tracks li button:hover { background: rgba(179, 166, 255, 0.08); }
.tracks li.on button { color: #fff; font-weight: 700; }
.tracks li.on button::before { content: '♪'; color: var(--accent-2); }

/* 관리자 */
.login { max-width: 360px; margin: 18vh auto 0; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(12px); }
.login h1 { font-size: 22px; margin: 0 0 16px; }
.in, textarea.in, select.in {
  width: 100%; background: rgba(8, 9, 30, 0.6); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea.in { min-height: 110px; resize: vertical; }
.in:focus { border-color: var(--accent); outline: none; }
.err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 8px; }
.adm { display: flex; min-height: 100vh; }
.adm aside { width: 220px; }
.adm main { margin-left: 220px; padding: 26px clamp(16px, 3vw, 40px) 80px; }
.adm h1 { margin: 0 0 20px; font-size: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 16px; backdrop-filter: blur(10px); }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.preview { max-width: 180px; max-height: 120px; border-radius: 10px; border: 1px solid var(--line); display: block; margin-bottom: 8px; }
.preview.round { border-radius: 50%; width: 72px; height: 72px; object-fit: cover; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bar { position: sticky; bottom: 0; display: flex; gap: 12px; align-items: center; padding: 12px 0; background: linear-gradient(0deg, rgba(8, 9, 30, 0.9), rgba(8, 9, 30, 0)); }
.status { font-size: 13px; color: var(--muted); }
.blkedit { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.blkedit .tag { font-size: 11px; color: var(--accent); margin-bottom: 4px; }
.mini { display: flex; flex-direction: column; gap: 4px; }
.mini button { width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); }
.track-edit { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-bottom: 10px; }

@media (max-width: 800px) {
  aside { transform: translateX(-100%); box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5); }
  body.open aside { transform: none; }
  main, .adm main { margin-left: 0; }
  body.fold aside { transform: translateX(-100%); }
  .player { grid-template-columns: 1fr; }
  .adm aside { width: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  .cd { animation-duration: 20s; }
  aside, main { transition: none; }
}
