:root {
  color-scheme: light dark;
  --bg: #f4f1e9;
  --panel: #fffaf0;
  --panel-strong: #ebe4d8;
  --text: #191c1b;
  --muted: #6d746f;
  --line: rgba(25, 28, 27, 0.12);
  --accent: #167454;
  --accent-strong: #0f5d43;
  --warm: #9b682e;
  --steel: #58615e;
  --danger: #ff716b;
  --glass: rgba(255, 250, 240, 0.72);
  --glass-soft: rgba(255, 255, 255, 0.48);
  --control-surface: rgba(244, 241, 233, 0.76);
  --shadow: 0 26px 80px rgba(58, 45, 26, 0.16);
  font-family:
    "Avenir Next", "SF Pro Display", "Segoe UI", "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f10;
    --panel: #151a1b;
    --panel-strong: #202728;
    --text: #f7f3e8;
    --muted: #9ea8a4;
    --line: rgba(255, 255, 255, 0.11);
    --accent: #7be0b2;
    --accent-strong: #4ccf97;
    --warm: #e9b96d;
    --steel: #aeb8c4;
    --glass: rgba(20, 26, 27, 0.72);
    --glass-soft: rgba(34, 41, 48, 0.46);
    --control-surface: rgba(31, 38, 39, 0.5);
    --shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--accent) 13%, transparent), transparent 34%),
    linear-gradient(245deg, color-mix(in srgb, var(--warm) 14%, transparent), transparent 38%),
    repeating-linear-gradient(
      90deg,
      color-mix(in srgb, var(--text) 4%, transparent) 0 1px,
      transparent 1px 42px
    ),
    linear-gradient(145deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 82%, var(--panel)) 48%, var(--bg) 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(color-mix(in srgb, var(--text) 4%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) 3%, transparent) 1px, transparent 1px);
  background-size: 120px 120px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 1180px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: grid;
  gap: 18px;
  align-content: center;
}

.now-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, color-mix(in srgb, white 14%, transparent), transparent 28%),
    var(--glass);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(26px) saturate(1.18);
  -webkit-backdrop-filter: blur(26px) saturate(1.18);
}

.now-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(123, 224, 178, 0.08), transparent),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.025) 0 1px,
      transparent 1px 16px
    );
  opacity: 0.55;
}

.brand-row,
.settings-row,
.time-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-row {
  justify-content: flex-end;
  min-height: 18px;
  margin-bottom: 6px;
}

.eyebrow,
.label {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 8vw, 3.1rem);
  font-weight: 700;
  line-height: 1;
}

h2 {
  font-size: clamp(1.35rem, 6vw, 2.45rem);
  font-weight: 800;
  line-height: 1.06;
  overflow-wrap: anywhere;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 6px rgba(174, 183, 189, 0.08);
  flex: 0 0 auto;
}

.status-dot.playing {
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(103, 214, 163, 0.16);
}

.track-area {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 24px;
  align-items: center;
  margin: 14px 0 34px;
}

.turntable {
  position: relative;
  width: 148px;
  aspect-ratio: 1;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 28% 24%, color-mix(in srgb, white 20%, transparent), transparent 28%),
    linear-gradient(145deg, color-mix(in srgb, var(--panel) 74%, transparent), color-mix(in srgb, var(--bg) 52%, transparent));
  border: 1px solid var(--line);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, white 12%, transparent),
    0 20px 52px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.turntable::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.13), transparent 22%),
    color-mix(in srgb, var(--bg) 72%, transparent);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent),
    inset 0 0 32px rgba(0, 0, 0, 0.14);
}

.disc {
  position: relative;
  width: 116px;
  aspect-ratio: 1;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 17%, rgba(255, 255, 255, 0.04) 17.4% 18%, transparent 18.4%),
    repeating-radial-gradient(
      circle,
      color-mix(in srgb, white 6%, transparent) 0 1px,
      transparent 1px 5px
    ),
    repeating-conic-gradient(
      from 0deg,
      rgba(255, 255, 255, 0.026) 0deg 1deg,
      transparent 1deg 8deg
    ),
    radial-gradient(circle at 42% 32%, #2b3031 0%, #111516 50%, #050606 100%);
  display: grid;
  place-items: center;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 0 0 9px rgba(0, 0, 0, 0.18),
    0 18px 44px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.disc::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: inherit;
  background:
    linear-gradient(128deg, rgba(255, 255, 255, 0.16), transparent 25%),
    linear-gradient(310deg, transparent 60%, color-mix(in srgb, var(--accent) 10%, transparent));
  mix-blend-mode: screen;
  pointer-events: none;
}

.disc::after {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.disc.playing {
  animation: spin 8.5s linear infinite;
}

.disc-label {
  position: absolute;
  width: 42px;
  aspect-ratio: 1;
  border-radius: 999px;
  background:
    radial-gradient(circle, color-mix(in srgb, var(--bg) 58%, white 10%) 0 13%, transparent 14%),
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.42), transparent 28%),
    conic-gradient(from 42deg, color-mix(in srgb, var(--accent) 86%, white 8%), var(--warm), #8da4ff, var(--accent));
  box-shadow:
    inset 0 0 0 7px rgba(255, 255, 255, 0.13),
    0 0 20px color-mix(in srgb, var(--accent) 18%, transparent);
}

.disc-core {
  position: relative;
  z-index: 1;
  width: 14px;
  aspect-ratio: 1;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 58%, #000 42%);
  border: 2px solid rgba(255, 255, 255, 0.26);
}

.track-meta {
  min-width: 0;
}

.track-meta p:last-child {
  color: var(--muted);
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.progress-wrap {
  position: relative;
  z-index: 1;
  margin: 0 0 24px;
}

.time-row {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.controls,
.action-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.action-row {
  margin-top: 14px;
}

.icon-button,
.text-button,
.scene {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.icon-button:hover,
.text-button:hover,
.scene:hover {
  transform: translateY(-1px);
}

.icon-button,
.text-button {
  background: linear-gradient(135deg, rgba(103, 214, 163, 0.96), rgba(89, 198, 149, 0.84));
  color: #0b1611;
  font-weight: 800;
}

.icon-button {
  display: grid;
  place-items: center;
}

.player-glyph {
  position: relative;
  display: block;
  width: 26px;
  height: 26px;
}

.player-glyph::before {
  content: "";
  position: absolute;
  inset: 3px 2px 3px 7px;
  border-left: 17px solid #0b1611;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
}

.icon-button.playing .player-glyph::before,
.icon-button.playing .player-glyph::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 7px;
  height: 20px;
  border: 0;
  border-radius: 2px;
  background: #0b1611;
}

.icon-button.playing .player-glyph::before {
  left: 5px;
}

.icon-button.playing .player-glyph::after {
  right: 5px;
}

.text-button {
  background: var(--control-surface);
  color: var(--text);
  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
}

.text-button.secondary {
  min-height: 44px;
  color: var(--muted);
}

.settings-row {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  flex-wrap: wrap;
}

.switch,
.volume {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.volume {
  flex: 1 1 180px;
}

.message {
  position: relative;
  z-index: 1;
  min-height: 20px;
  margin-top: 14px;
  color: var(--warm);
  font-size: 0.9rem;
}

.message.error {
  color: var(--danger);
}

.insight-strip {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.insight-strip div,
.stats-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-soft);
  padding: 10px 12px;
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
}

.insight-strip span,
.stats-grid span {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
}

.insight-strip small,
.stats-grid small {
  color: var(--muted);
}

.drawer {
  position: relative;
  z-index: 1;
  margin-top: 10px;
}

.drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  list-style: none;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: var(--glass-soft);
  padding: 10px 12px;
  transition:
    border-color 160ms ease,
    background 160ms ease;
  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
}

.drawer summary::-webkit-details-marker {
  display: none;
}

.drawer summary:hover {
  border-color: rgba(103, 214, 163, 0.35);
  background: rgba(34, 41, 48, 0.58);
}

.summary-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.summary-main > span {
  min-width: 0;
}

.drawer summary small {
  color: var(--muted);
  font-weight: 600;
}

.drawer-chevron {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.06);
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.drawer-chevron::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-1px, -1px);
}

.drawer[open] .drawer-chevron {
  transform: rotate(180deg);
  background: rgba(103, 214, 163, 0.12);
}

.drawer-body {
  padding-top: 12px;
}

.drawer-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.drawer-actions button,
.mini-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-surface);
  color: var(--muted);
  min-height: 34px;
  padding: 0 10px;
  backdrop-filter: blur(10px) saturate(1.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
}

.drawer-actions button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.favorites-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.empty-state {
  color: var(--muted);
  font-size: 0.9rem;
}

.favorite-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.favorite-main {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-soft);
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  backdrop-filter: blur(10px) saturate(1.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
}

.favorite-main span,
.favorite-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-main span {
  font-weight: 800;
}

.favorite-main small {
  color: var(--muted);
  margin-top: 2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.stats-list {
  display: grid;
  gap: 8px;
}

.stat-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-soft);
  padding: 8px 10px;
  backdrop-filter: blur(10px) saturate(1.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
}

.stat-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-row span,
.stat-row small {
  color: var(--muted);
}

.scene-section {
  align-self: stretch;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  background:
    linear-gradient(145deg, color-mix(in srgb, white 12%, transparent), transparent 36%),
    var(--glass);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  backdrop-filter: blur(24px) saturate(1.16);
  -webkit-backdrop-filter: blur(24px) saturate(1.16);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.library-header {
  padding: 4px 2px 8px;
}

.library-header h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.4rem, 4vw, 2rem);
}

.library-block {
  display: grid;
  gap: 10px;
}

.library-block-title {
  display: block;
}

.library-block-title h3 {
  margin: 0;
  font-size: 1rem;
}

.featured-libraries {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.scene {
  position: relative;
  min-height: 76px;
  background:
    linear-gradient(135deg, color-mix(in srgb, white 9%, transparent), transparent 42%),
    var(--control-surface);
  padding: 13px 14px;
  text-align: left;
  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
}

.scene::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 10px;
  height: 2px;
  background: linear-gradient(90deg, rgba(123, 224, 178, 0.56), transparent);
  opacity: 0;
  transition: opacity 160ms ease;
}

.scene span,
.scene small {
  display: block;
}

.scene span {
  color: var(--text);
  font-weight: 800;
  margin-bottom: 4px;
}

.scene small {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.scene.active {
  border-color: color-mix(in srgb, var(--accent) 68%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent 58%),
    color-mix(in srgb, var(--control-surface) 74%, var(--accent) 8%);
}

.scene.active::after {
  opacity: 1;
}

.all-libraries {
  display: grid;
  gap: 7px;
  max-height: 310px;
  overflow: auto;
  padding-right: 2px;
}

.library-row {
  min-height: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  color: var(--text);
  padding: 9px 11px;
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.library-row:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
}

.library-row span {
  min-width: 0;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-row small {
  color: var(--accent);
  font-weight: 800;
  font-size: 0.78rem;
}

.library-row.active {
  border-color: color-mix(in srgb, var(--accent) 68%, transparent);
  background: color-mix(in srgb, var(--control-surface) 74%, var(--accent) 8%);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 760px) {
  .app-shell {
    grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.92fr);
    align-items: start;
    padding-inline: 28px;
  }

  .scene-section {
    max-height: calc(100svh - 56px);
    overflow: auto;
  }
}

@media (max-width: 420px) {
  .app-shell {
    align-content: start;
  }

  .now-panel {
    padding: 16px;
  }

  .track-area {
    grid-template-columns: 96px 1fr;
    gap: 14px;
    margin-top: 10px;
  }

  .turntable {
    width: 96px;
  }

  .disc {
    width: 76px;
  }

  .disc-label {
    width: 30px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .action-row,
  .favorite-item,
  .insight-strip,
  .stats-grid,
  .stat-row,
  .featured-libraries,
  .library-row {
    grid-template-columns: 1fr;
  }

  .scene {
    min-height: 96px;
  }
}
