:root {
  color-scheme: light;
  --bg: #f2f0ea;
  --ink: #17191d;
  --ink-soft: #4e5661;
  --muted: #7a828c;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: #ffffff;
  --line: rgba(29, 34, 39, 0.1);
  --line-strong: rgba(29, 34, 39, 0.16);
  --accent: #155f87;
  --accent-soft: #e7f3f6;
  --gold: #9f7333;
  --danger: #b3261e;
  --shadow: 0 18px 60px rgba(25, 28, 34, 0.12);
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(242, 240, 234, 0.96) 38%, #ede9df 100%),
    var(--bg);
  color: var(--ink);
}

body.is-scroll-locked {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(145deg, rgba(15, 18, 22, 0.72), rgba(15, 18, 22, 0.28)),
    url("./assets/cover.jpg") center / cover;
  transition: opacity 360ms ease, transform 360ms ease, visibility 360ms ease;
}

body[data-auth-state="unlocking"] .lock-screen {
  opacity: 0;
  transform: translateY(-10px) scale(0.985);
  pointer-events: none;
}

body[data-auth-state="unlocked"] .lock-screen {
  opacity: 0;
  transform: translateY(-10px) scale(0.985);
  pointer-events: none;
  visibility: hidden;
}

.lock-panel {
  width: min(100%, 390px);
  max-height: calc(100vh - 40px);
  display: grid;
  gap: 22px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(251, 250, 246, 0.88);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(24px);
  overflow: auto;
}

.lock-art {
  aspect-ratio: 1 / 0.72;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.lock-cover,
.hero-cover,
.mini-cover {
  display: block;
  object-fit: cover;
}

.lock-cover {
  width: 100%;
  height: 100%;
}

.lock-copy {
  display: grid;
  gap: 8px;
}

.overline {
  margin: 0;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.lock-copy h1,
.hero-copy h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
}

.lock-subtitle,
.hero-copy p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.45;
}

.password-form {
  display: grid;
  gap: 10px;
}

.field-label {
  color: var(--muted);
  font-size: 13px;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 10px;
}

.password-input,
.search-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 15px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.password-input:focus,
.search-input:focus {
  border-color: rgba(21, 95, 135, 0.72);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(21, 95, 135, 0.12);
}

.primary-button,
.ghost-button,
.transport-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 15px;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.primary-button {
  background: #15191f;
  color: #fff;
  font-weight: 750;
}

.primary-button:hover {
  transform: translateY(-1px);
}

.ghost-button,
.transport-button {
  background: rgba(255, 255, 255, 0.74);
  border-color: var(--line);
  color: var(--ink);
}

.transport-button:disabled {
  color: #a2a8b0;
  background: rgba(245, 245, 242, 0.66);
}

.auth-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.app-screen {
  min-height: 100vh;
  padding-bottom: 180px;
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 320ms ease, transform 320ms ease;
}

body[data-auth-state="unlocked"] .app-shell,
body[data-auth-state="unlocking"] .app-shell {
  opacity: 1;
  transform: translateY(0);
}

.library-hero {
  display: grid;
  gap: 18px;
  padding: max(18px, env(safe-area-inset-top)) 18px 16px;
}

.hero-topline,
.hero-main,
.hero-stats {
  display: flex;
  align-items: center;
}

.hero-topline,
.hero-stats {
  justify-content: space-between;
  gap: 14px;
}

.hero-main {
  gap: 14px;
}

.hero-cover {
  width: 82px;
  height: 82px;
  flex: 0 0 82px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 32px rgba(32, 35, 40, 0.18);
}

.hero-copy {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.hero-copy h1 {
  font-size: 31px;
}

.hero-copy p,
.track-copy strong,
.track-copy span,
.song-title,
.song-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-stats {
  min-height: 38px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 13px;
}

.hero-stats span:first-child {
  color: var(--ink);
  font-weight: 800;
}

.control-surface {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  gap: 12px;
  padding: 12px 18px 14px;
  background: rgba(242, 240, 234, 0.88);
  border-top: 1px solid rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.search-input {
  min-height: 50px;
  padding-left: 16px;
}

.category-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.category-list::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  max-width: 226px;
  min-height: 36px;
  border: 1px solid rgba(29, 34, 39, 0.11);
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip[aria-pressed="true"] {
  border-color: rgba(21, 95, 135, 0.18);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.songs-section {
  padding: 14px 18px 24px;
}

.song-list {
  display: grid;
  gap: 7px;
}

.song-row {
  width: 100%;
  min-height: 62px;
  display: grid;
  gap: 6px;
  text-align: left;
  border: 1px solid rgba(29, 34, 39, 0.08);
  border-radius: 8px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.62) inset;
}

.song-row:hover {
  background: rgba(255, 255, 255, 0.92);
}

.song-row.is-current {
  border-color: rgba(21, 95, 135, 0.3);
  background: #edf6f8;
}

.song-title,
.track-copy strong {
  display: block;
  font-size: 15px;
  line-height: 1.25;
}

.song-meta,
.track-copy span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  margin: 34px 0;
  text-align: center;
  color: var(--muted);
}

.player-bar {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  z-index: 10;
  width: min(100%, 760px);
  transform: translateX(-50%);
  display: grid;
  gap: 10px;
  padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  background: rgba(251, 250, 246, 0.94);
  border-top: 1px solid rgba(29, 34, 39, 0.11);
  box-shadow: 0 -18px 50px rgba(29, 34, 39, 0.14);
  backdrop-filter: blur(22px);
}

.now-playing {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.mini-cover {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.transport-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

audio {
  width: 100%;
  height: 40px;
}

@media (min-width: 760px) {
  body {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(242, 240, 234, 0.94) 38%, #ede9df 100%),
      var(--bg);
  }

  .app-shell {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

@media (max-width: 380px) {
  .lock-panel {
    gap: 16px;
    padding: 18px;
  }

  .password-row {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
  }

  .hero-copy h1 {
    font-size: 27px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
