:root {
  --bg: #1e1f22;
  --bg-2: #2b2d31;
  --bg-3: #313338;
  --line: #3f4147;
  --text: #f2f3f5;
  --muted: #b5bac1;
  --dim: #80848e;
  --accent: #5865f2;
  --accent-2: #4752c4;
  --bar-h: 92px;
}

* {
  box-sizing: border-box;
}

/* .boot / #app 의 display 선언이 기본 [hidden] 규칙을 이겨버리므로 못박아 둔다 */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 'gg sans', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── 부팅 화면 ───────────────────────────────────────────── */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── 레이아웃 ────────────────────────────────────────────── */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.top {
  flex: 0 0 auto;
  padding: 12px 14px 0;
  background: var(--bg);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border-radius: 8px;
  padding: 0 10px;
}
.search .icon {
  width: 18px;
  height: 18px;
  fill: var(--dim);
  flex: 0 0 auto;
}
.search input {
  flex: 1;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 15px;
  padding: 10px 0;
}
.search input::placeholder {
  color: var(--dim);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  border-bottom: 1px solid var(--line);
}
.tab {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover {
  color: var(--text);
}
.tab.is-active {
  color: #fff;
  border-bottom-color: var(--accent);
}

.refresh {
  margin-left: auto;
  margin-bottom: 2px;
  background: none;
  border: 0;
  color: var(--dim);
  font-size: 17px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  align-self: center;
}
.refresh:hover {
  color: var(--text);
  background: var(--bg-3);
}
.refresh.is-busy {
  animation: spin 1s linear infinite;
  color: var(--accent);
}

.crumb {
  padding: 10px 16px 0;
  color: var(--muted);
  font-size: 13px;
}
.crumb button {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

.list {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 8px calc(var(--bar-h) + 12px);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.list::-webkit-scrollbar {
  width: 8px;
}
.list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

/* ── 행 ──────────────────────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}
.row:hover {
  background: var(--bg-3);
}
.row.is-current {
  background: rgba(88, 101, 242, 0.16);
}
.row .cover {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-2);
  flex: 0 0 auto;
}
.row .folder-icon {
  display: grid;
  place-items: center;
  font-size: 20px;
}

.row .meta {
  min-width: 0;
  flex: 1;
}
.row .title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.row.is-current .title {
  color: #a8b1ff;
}
.row .sub {
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .dur {
  color: var(--dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.row .more {
  background: none;
  border: 0;
  color: var(--dim);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
}
.row:hover .more {
  opacity: 1;
}
.row .more:hover {
  color: var(--text);
  background: var(--bg-2);
}

.empty {
  text-align: center;
  color: var(--dim);
  padding: 48px 16px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 6px;
  color: var(--dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.section-head button {
  background: var(--bg-2);
  border: 0;
  color: var(--muted);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
}
.section-head button:hover {
  background: var(--bg-3);
  color: var(--text);
}

/* ── 하단 바 ─────────────────────────────────────────────── */
.bar {
  flex: 0 0 auto;
  height: var(--bar-h);
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 14px;
  padding: 8px 14px;
}
.np {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  grid-row: 1 / span 2;
}
.np .cover {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-3);
}
.np-text {
  min-width: 0;
}
.np-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-sub {
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.controls {
  display: flex;
  align-items: center;
  gap: 6px;
  grid-column: 2;
}
.ctl {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.ctl:hover {
  color: #fff;
  background: var(--bg-3);
}
.ctl.is-on {
  color: #a8b1ff;
}
.ctl-main {
  background: var(--accent);
  color: #fff;
  width: 38px;
  height: 38px;
  font-size: 16px;
}
.ctl-main:hover {
  background: var(--accent-2);
  color: #fff;
}

.seek {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(460px, 44vw);
}
.time {
  color: var(--dim);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  width: 38px;
  text-align: center;
}

.vol {
  grid-column: 3;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.vol .icon-vol {
  font-size: 13px;
}
.vol .range {
  max-width: 110px;
}

.range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  outline: none;
  cursor: pointer;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

/* ── 토스트 ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar-h) + 16px);
  transform: translateX(-50%);
  background: #111214;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  z-index: 50;
  max-width: 80vw;
  text-align: center;
}

/* ── 좁은 화면 (모바일 Activity) ─────────────────────────── */
@media (max-width: 640px) {
  :root {
    --bar-h: 128px;
  }
  .bar {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 6px;
  }
  .np {
    grid-row: 1;
  }
  .controls {
    grid-column: 1;
    grid-row: 2;
    justify-content: center;
  }
  .seek {
    grid-column: 1;
    grid-row: 3;
    width: 100%;
  }
  .vol {
    display: none;
  }
}
