:root {
  color-scheme: dark;
  --bg: #111111;
  --panel: #191919;
  --panel-2: #222222;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f7f2ec;
  --muted: #aaa29a;
  --accent: #8b5cf6;
  --accent-2: #d8b4fe;
  --green: #72d6c9;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(139, 92, 246, 0.22), transparent 28%),
    radial-gradient(circle at 88% 10%, rgba(114, 214, 201, 0.12), transparent 30%),
    linear-gradient(135deg, #101010 0%, #171226 44%, #0f1218 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(340px, 1fr) minmax(300px, 380px);
  gap: 18px;
  width: min(1480px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  min-height: 0;
  margin: 16px auto;
}

.app-shell.lyrics-off {
  grid-template-columns: minmax(260px, 330px) minmax(340px, 1fr);
}

.library-panel,
.player-stage,
.lyrics-panel {
  min-height: 0;
  border: 1px solid var(--line);
  background: rgba(25, 25, 25, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.library-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  border-radius: 8px;
  overflow: hidden;
}

.brand-row,
.stage-topbar,
.lyrics-title,
.playlist-header,
.track-row,
.maker-head,
.maker-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.copyright-note {
  display: grid;
  gap: 1px;
  margin: -8px 0 -4px;
  color: rgba(247, 242, 236, 0.42);
  font-size: 0.68rem;
  line-height: 1.25;
}

.copyright-note strong {
  color: var(--accent-2);
  font-weight: 900;
}

.eyebrow,
.lyrics-title p {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2vw, 2.1rem);
  line-height: 1.08;
}

.icon-button,
.play-button,
.ghost-button,
.tab-button,
.primary-action {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  font-size: 1.5rem;
}

.icon-button:hover,
.ghost-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.filter-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 8px;
}

.tab-button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
}

.tab-button.active {
  border-color: rgba(139, 92, 246, 0.68);
  background: rgba(139, 92, 246, 0.22);
  color: var(--text);
}

.playlist-header {
  color: var(--muted);
  font-size: 0.85rem;
}

.playlist {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.track-row {
  width: 100%;
  min-height: 68px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
}

.track-row.active {
  border-color: rgba(139, 92, 246, 0.62);
  background: rgba(139, 92, 246, 0.16);
}

.track-row strong {
  display: block;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-row span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-row > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.track-index {
  flex: 0 0 28px;
  color: var(--accent-2);
  font-weight: 800;
  text-align: right;
}

.player-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 24px clamp(18px, 4vw, 54px);
  border-radius: 8px;
  overflow: hidden;
}

.stage-topbar {
  width: 100%;
  margin-bottom: 18px;
}

.player-brand {
  position: relative;
  width: 100%;
  margin-bottom: 10px;
  text-align: center;
}

.player-brand .eyebrow {
  margin-bottom: 3px;
  font-size: 0.68rem;
}

.player-brand p:last-child {
  margin: 0;
  color: var(--text);
  font-size: clamp(0.98rem, 1.45vw, 1.25rem);
  font-weight: 900;
  line-height: 1.12;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
}

.ghost-button[aria-pressed="true"] {
  color: var(--text);
  border-color: rgba(216, 180, 254, 0.62);
}

.admin-only {
  display: none;
}

body.admin-mode .admin-only {
  display: inline-flex;
}

.now-tag {
  color: var(--muted);
  font-size: 0.86rem;
}

.turntable-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: min(42vh, 460px, 78vw);
  aspect-ratio: 1;
  margin: auto 0 16px;
}

.record {
  position: relative;
  display: grid;
  place-items: center;
  width: 82%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, #181818 0 9%, #0d0d0d 10% 13%, transparent 14%),
    repeating-radial-gradient(circle, #090909 0 8px, #171717 9px 10px, #050505 11px 18px);
  box-shadow:
    inset 0 0 34px rgba(255, 255, 255, 0.06),
    0 30px 80px rgba(0, 0, 0, 0.52);
}

.record::before {
  position: absolute;
  inset: -7%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: inherit;
  content: "";
}

.record.playing {
  animation: spin 6s linear infinite;
}

.record-ring {
  position: absolute;
  width: 60%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: inherit;
}

.record-label {
  display: grid;
  place-items: center;
  width: 34%;
  aspect-ratio: 1;
  border: 10px solid #111;
  border-radius: 50%;
  background:
    linear-gradient(145deg, rgba(216, 180, 254, 0.96), rgba(139, 92, 246, 0.9)),
    #8b5cf6;
  color: #fff8ef;
  font-size: clamp(2.2rem, 7vw, 4.8rem);
  font-weight: 900;
}

.tonearm {
  position: absolute;
  top: 3%;
  right: 10%;
  z-index: 3;
  width: 36%;
  height: 36%;
  transform: rotate(-20deg);
  transform-origin: 88% 18%;
  transition: transform 260ms ease;
}

.tonearm.playing {
  transform: rotate(2deg);
}

.tonearm-base {
  position: absolute;
  top: 2%;
  right: 2%;
  width: 28%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(135deg, #d8d2c8, #5f5b56);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.35);
}

.tonearm-stick {
  position: absolute;
  top: 22%;
  right: 21%;
  width: 72%;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dcd6cd, #8e8980);
  transform: rotate(39deg);
  transform-origin: right center;
}

.tonearm-head {
  position: absolute;
  top: 67%;
  left: 4%;
  width: 24%;
  height: 18%;
  border-radius: 5px;
  background: #8b5cf6;
  transform: rotate(38deg);
}

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

.track-meta {
  width: min(560px, 100%);
  flex: 0 0 auto;
  text-align: center;
}

.track-meta p {
  margin-bottom: 6px;
  color: var(--muted);
}

.track-meta h2 {
  max-width: 100%;
  margin-bottom: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  font-size: clamp(1.55rem, 3.25vw, 2.7rem);
  line-height: 1.12;
  scrollbar-width: thin;
  white-space: nowrap;
}

.track-meta h2::-webkit-scrollbar {
  height: 4px;
}

.track-meta h2::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(216, 180, 254, 0.42);
}

.progress-area {
  display: grid;
  grid-template-columns: 44px minmax(120px, 1fr) 44px;
  align-items: center;
  gap: 12px;
  width: min(620px, 100%);
  color: var(--muted);
  font-size: 0.86rem;
}

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

.controls {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 16px;
  margin-top: 18px;
}

.volume-control {
  position: absolute;
  right: 8px;
  bottom: 14px;
  z-index: 4;
  display: grid;
  place-items: end right;
  width: 42px;
  height: 42px;
  pointer-events: none;
}

.queue-button {
  position: absolute;
  left: 8px;
  bottom: 14px;
  z-index: 4;
  width: 36px;
  height: 36px;
  border-color: transparent;
  background: rgba(25, 25, 25, 0.42);
  color: var(--muted);
  font-size: 1.2rem;
  backdrop-filter: blur(12px);
}

.volume-button {
  width: 36px;
  height: 36px;
  border-color: transparent;
  background: rgba(25, 25, 25, 0.42);
  color: var(--muted);
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

.volume-icon {
  width: 19px;
  height: 19px;
}

.speaker-shape {
  fill: currentColor;
}

.sound-wave,
.muted-cross {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.muted-cross {
  display: none;
}

.volume-button.is-muted .sound-wave {
  display: none;
}

.volume-button.is-muted .muted-cross {
  display: block;
}

.volume-button.is-low .wave-two {
  display: none;
}

.volume-popover {
  position: absolute;
  right: 0;
  bottom: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 38px;
  min-width: 38px;
  height: 142px;
  padding: 10px 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 0;
  border-radius: 999px 999px 8px 8px;
  background: rgba(25, 25, 25, 0.42);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  color: var(--muted);
  font-size: 0.78rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  backdrop-filter: blur(12px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.volume-control:hover .volume-popover,
.volume-button:hover + .volume-popover,
.volume-popover:hover,
.volume-control:focus-within .volume-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.volume-popover input[type="range"] {
  width: 18px;
  height: 92px;
  margin: 0;
  border-radius: 999px;
  accent-color: var(--accent-2);
  writing-mode: vertical-rl;
  direction: rtl;
}

.play-button {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-color: rgba(139, 92, 246, 0.76);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.55rem;
  box-shadow: 0 14px 34px rgba(139, 92, 246, 0.36);
}

.primary-action {
  min-height: 40px;
  padding: 0 16px;
  border-color: rgba(139, 92, 246, 0.74);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.maker-overlay {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 7, 7, 0.66);
  backdrop-filter: blur(16px);
}

.maker-overlay.hidden {
  display: none;
}

.queue-overlay {
  position: fixed;
  inset: 0;
  z-index: 11;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: rgba(7, 7, 7, 0.5);
  backdrop-filter: blur(10px);
}

.queue-overlay.hidden {
  display: none;
}

.queue-panel {
  width: min(560px, 100%);
  max-height: min(540px, 76vh);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 25, 25, 0.97);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.queue-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.queue-playlist {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.maker-panel {
  display: flex;
  flex-direction: column;
  width: min(1040px, 100%);
  max-height: min(860px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 25, 25, 0.96);
  box-shadow: var(--shadow);
}

.maker-head {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.maker-head h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
}

.maker-grid {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(260px, 0.92fr) minmax(300px, 1.08fr);
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.maker-editor,
.maker-timing,
.maker-output-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.maker-editor label,
.maker-output-wrap label {
  color: var(--muted);
  font-size: 0.85rem;
}

textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  line-height: 1.65;
  padding: 14px;
}

textarea:focus {
  border-color: rgba(216, 180, 254, 0.55);
}

.maker-clock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  color: var(--muted);
}

.maker-clock span:first-child {
  color: var(--accent-2);
  font-size: clamp(1.7rem, 3.6vw, 2.55rem);
  font-weight: 900;
}

.maker-current-line {
  display: flex;
  align-items: center;
  min-height: 76px;
  padding: 14px;
  border: 1px solid rgba(216, 180, 254, 0.24);
  border-radius: 8px;
  background: rgba(216, 180, 254, 0.09);
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  line-height: 1.45;
}

.maker-seek {
  display: grid;
  grid-template-columns: 48px minmax(140px, 1fr) 48px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.maker-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.maker-output-wrap textarea {
  min-height: 190px;
}

.lyrics-panel {
  display: flex;
  flex-direction: column;
  padding: 24px 16px 24px 24px;
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}

.lyrics-panel.hidden {
  display: none;
}

.lyrics-title {
  align-items: flex-end;
  margin-right: 8px;
  margin-bottom: 18px;
}

.lyrics-title h2 {
  margin: 0;
  overflow: hidden;
  font-size: 1.1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lyrics-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding-right: 8px;
}

.lyric-line {
  margin: 0 0 16px;
  color: rgba(247, 242, 236, 0.45);
  font-size: clamp(1rem, 1.45vw, 1.28rem);
  line-height: 1.6;
  transition:
    color 180ms ease,
    transform 180ms ease;
}

.lyric-line.active {
  color: var(--text);
  transform: translateX(6px);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 25, 25, 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: minmax(260px, 340px) minmax(360px, 1fr);
    height: auto;
    min-height: calc(100vh - 32px);
  }

  .app-shell.lyrics-off {
    grid-template-columns: minmax(260px, 340px) minmax(360px, 1fr);
  }

  .lyrics-panel {
    grid-column: 1 / -1;
    max-height: min(430px, 46vh);
    min-height: min(340px, 46vh);
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(100vw - 20px, 560px);
    margin: 10px auto;
  }

  .player-stage {
    order: 1;
    min-height: calc(100vh - 20px);
    justify-content: flex-start;
  }

  .player-brand {
    margin-top: -12px;
    margin-bottom: 4px;
  }

  .player-brand .eyebrow {
    font-size: 0.62rem;
  }

  .player-brand p:last-child {
    font-size: clamp(0.88rem, 4.4vw, 1.12rem);
  }

  .lyrics-panel {
    order: 2;
    grid-column: auto;
    max-height: 62vh;
  }

  .library-panel {
    order: 3;
    max-height: 70vh;
  }

  .library-panel,
  .player-stage,
  .lyrics-panel,
  .maker-panel {
    padding: 18px;
  }

  .player-stage {
    padding-top: 24px;
  }

  .maker-panel {
    padding: 0;
  }

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

  textarea {
    min-height: 160px;
  }

  .maker-output-wrap textarea {
    min-height: 150px;
  }

  .turntable-wrap {
    width: min(43vh, 86vw, 420px);
    margin: 2px 0 10px;
  }

  .stage-topbar {
    margin-bottom: 6px;
  }

  .track-meta p {
    margin-bottom: 3px;
  }

  .track-meta h2 {
    margin-bottom: 3px;
    font-size: clamp(1.35rem, 7vw, 2.1rem);
  }

  .controls {
    margin-top: 12px;
  }

  .volume-control {
    right: 8px;
    bottom: 12px;
  }

  .queue-button {
    left: 8px;
    bottom: 12px;
  }

  .filter-tabs {
    grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  }
}
