:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --ink: #171716;
  --muted: #6e6960;
  --line: #d8cfc0;
  --panel: #fffaf2;
  --panel-2: #ece5d8;
  --accent: #b93426;
  --accent-2: #0f6b62;
  --accent-3: #c99b28;
  --shadow: 0 18px 50px rgba(41, 32, 22, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(185, 52, 38, 0.08), transparent 35%),
    linear-gradient(280deg, rgba(15, 107, 98, 0.12), transparent 45%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

body:has(.app.locked) {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.download-link {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.download-link:hover {
  transform: translateY(-1px);
}

.text-button {
  background: transparent;
  color: var(--ink);
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.login {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 250, 242, 0.46), transparent 34%),
    linear-gradient(135deg, rgba(23, 23, 22, 0.4), rgba(23, 23, 22, 0.16));
  backdrop-filter: blur(18px) saturate(120%);
}

.login-panel {
  width: min(100%, 520px);
  padding: 42px;
  background: rgba(255, 250, 242, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(23, 23, 22, 0.24);
  backdrop-filter: blur(22px);
}

.login h1,
.topbar h1,
.hero h2 {
  margin: 0;
  letter-spacing: 0;
}

.login h1 {
  font-size: clamp(34px, 7vw, 64px);
  line-height: 0.95;
}

.login-copy {
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

.form-note,
.muted {
  color: var(--muted);
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 112px;
}

.app {
  transition: filter 220ms ease, opacity 220ms ease, transform 220ms ease;
}

.app.locked {
  filter: blur(8px) saturate(70%);
  opacity: 0.66;
  transform: scale(0.985);
  pointer-events: none;
  user-select: none;
}

.topbar,
.controls,
.section-heading,
.player-row,
.modal-head,
.top-actions,
.detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar h1 {
  font-size: clamp(30px, 5vw, 52px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero {
  min-height: 250px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 26px;
  align-items: end;
  margin: 26px 0;
  padding: 32px;
  background: #151412;
  color: #fff7eb;
  border-radius: 8px;
  overflow: hidden;
}

.hero h2 {
  max-width: 780px;
  font-size: clamp(38px, 7vw, 90px);
  line-height: 0.92;
}

.hero p:last-child {
  max-width: 640px;
  color: #d8cfc0;
  line-height: 1.6;
}

.hero-art,
.cover {
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: linear-gradient(135deg, #b93426, #0f6b62 52%, #c99b28);
  box-shadow: inset 0 0 0 14px rgba(255, 255, 255, 0.08);
}

.controls {
  align-items: stretch;
  margin-bottom: 18px;
}

.search-wrap {
  flex: 1;
}

.segments {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segment {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.segment.active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: 230px minmax(360px, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.sidebar,
.library,
.detail {
  background: rgba(255, 250, 242, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
}

.gap {
  margin-top: 28px;
}

.list-nav {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.nav-item {
  min-height: 38px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  justify-content: flex-start;
}

.nav-item.active {
  background: var(--ink);
  color: #fff;
}

.track-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.track-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.78);
  cursor: pointer;
}

.track-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.row-play {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.track-row.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(185, 52, 38, 0.14);
}

.thumb {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  background: var(--cover);
  border: 1px solid rgba(23, 23, 22, 0.1);
}

.track-row h3,
.detail h2,
.detail h3 {
  margin: 0;
}

.track-row h3 {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.track-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.pill,
.badges span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink);
  font-size: 12px;
}

.detail {
  position: sticky;
  top: 16px;
}

.cover {
  width: 100%;
  margin-bottom: 16px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}

.meta-grid div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.detail h3 {
  margin-top: 18px;
  font-size: 15px;
}

.detail p {
  line-height: 1.65;
}

.lyrics {
  white-space: pre-line;
}

.player {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 5;
  width: min(880px, calc(100vw - 32px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 14px;
  background: rgba(23, 23, 22, 0.88);
  color: #fffaf2;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(23, 23, 22, 0.26);
  backdrop-filter: blur(18px) saturate(130%);
}

.player button {
  border-color: rgba(255, 255, 255, 0.16);
  background: transparent;
  color: #fffaf2;
}

.player .icon-button {
  width: 38px;
  height: 38px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-nav {
  display: none;
}

.play-button {
  min-width: 72px;
  background: #fffaf2 !important;
  color: var(--ink) !important;
  border-color: #fffaf2 !important;
  font-weight: 800;
}

.player-main {
  min-width: 0;
}

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

.player-row span {
  color: rgba(255, 250, 242, 0.72);
  font-size: 13px;
}

.mini-button {
  min-height: 38px;
  padding: 0 12px;
  color: rgba(255, 250, 242, 0.78);
  font-size: 13px;
}

.mini-button.active {
  background: var(--accent-3);
  border-color: var(--accent-3);
  color: var(--ink);
}

#seekBar {
  padding: 0;
  min-height: 22px;
  accent-color: var(--accent-3);
}

.upload-dialog,
.admin-dialog {
  width: min(760px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.admin-dialog {
  width: min(880px, calc(100vw - 28px));
}

.upload-dialog::backdrop,
.admin-dialog::backdrop {
  background: rgba(12, 11, 10, 0.42);
}

.upload-form,
.admin-form {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.upload-form label,
.admin-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-form section {
  display: grid;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.admin-form h3 {
  margin: 0;
  font-size: 16px;
}

.hero-preview {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(13, 13, 12, 0.78), rgba(13, 13, 12, 0.34)),
    #151412;
  background-size: cover;
  background-position: center;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.check-row {
  align-content: center;
  grid-template-columns: auto 1fr;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 0;
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .detail {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 86px;
  }

  .shell {
    width: min(100vw - 20px, 720px);
    padding-top: 12px;
    padding-bottom: 188px;
  }

  .password-row,
  .hero,
  .workspace,
  .form-grid,
  .player {
    grid-template-columns: 1fr;
  }

  .login-panel,
  .hero,
  .sidebar,
  .library,
  .detail {
    padding: 18px;
  }

  .login {
    padding: 18px;
  }

  button,
  .download-link,
  input,
  select {
    min-height: 46px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 30px;
  }

  .top-actions .text-button {
    display: none;
  }

  .hero {
    min-height: 190px;
    margin: 14px 0;
    gap: 16px;
  }

  .hero h2 {
    font-size: clamp(34px, 13vw, 56px);
  }

  .hero p:last-child {
    margin-bottom: 0;
  }

  .hero-art {
    width: min(48vw, 170px);
  }

  .controls {
    display: grid;
    position: sticky;
    top: 0;
    z-index: 4;
    padding: 10px 0;
    background: linear-gradient(to bottom, var(--bg) 85%, rgba(246, 242, 234, 0));
  }

  .segments {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .segments::-webkit-scrollbar {
    display: none;
  }

  .segment {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .workspace {
    gap: 14px;
  }

  .library {
    order: 1;
  }

  .sidebar {
    order: 2;
  }

  .detail {
    order: 3;
  }

  .list-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .track-row {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    padding: 10px;
    min-height: 78px;
  }

  .track-actions {
    align-self: stretch;
    align-content: center;
  }

  .track-actions .pill {
    display: none;
  }

  .row-play {
    min-width: 56px;
    min-height: 44px;
    padding: 0 10px;
  }

  .detail-actions {
    position: sticky;
    bottom: 142px;
    z-index: 3;
    padding: 10px 0;
    background: linear-gradient(to top, var(--panel) 80%, rgba(255, 250, 242, 0));
  }

  .upload-dialog,
  .admin-dialog {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .upload-form,
  .admin-form {
    min-height: 100%;
    padding: 16px;
    overflow-y: auto;
  }

  .upload-form menu,
  .admin-form menu {
    position: sticky;
    bottom: 0;
    padding: 12px 0 0;
    background: var(--panel);
  }

  .upload-form menu button,
  .admin-form menu button {
    flex: 1;
  }

  .player {
    bottom: 70px;
    width: calc(100vw - 20px);
    grid-template-columns: 1fr;
    padding: 10px;
    gap: 8px;
  }

  .player-main {
    grid-column: auto;
    grid-row: auto;
  }

  .player-controls {
    display: grid;
    grid-template-columns: 1fr 46px minmax(78px, 1fr) 46px;
    gap: 8px;
  }

  .player-row {
    align-items: flex-start;
  }

  #playerTitle {
    max-width: 62vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #playerTime {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--muted);
  }

  .play-button {
    min-width: 0;
  }

  .mobile-nav {
    position: fixed;
    left: 50%;
    bottom: 10px;
    z-index: 6;
    width: calc(100vw - 20px);
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px;
    background: rgba(23, 23, 22, 0.92);
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
  }

  .mobile-nav button {
    min-height: 44px;
    padding: 0 6px;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #fffaf2;
    font-size: 13px;
  }
}
