@font-face {
  font-family: "Playfair Display";
  src: url("/static/fonts/PlayfairDisplay.ttf") format("truetype");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("/static/fonts/PlayfairDisplay-Italic.ttf") format("truetype");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("/static/fonts/Outfit.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #eef6fb;
  --bg-soft: #e3f1f9;
  --surface: #ffffff;
  --surface-2: #f3f9fd;
  --line: rgba(90, 140, 180, 0.16);
  --line-strong: rgba(70, 120, 165, 0.28);
  --text: #1a2c3c;
  --text-dim: #4a6578;
  --text-faint: #6e8798;
  --accent: #3f8fbc;
  --accent-soft: rgba(80, 165, 210, 0.2);
  --accent-hot: #2f7aa8;
  --accent-fill: #9ed0ea;
  --accent-fill-hot: #7ebfe0;
  --on-accent: #123044;
  --gold: var(--accent);
  --gold-soft: var(--accent-soft);
  --gold-hot: var(--accent-hot);
  --danger: #c24b4b;
  --on-danger: #ffffff;
  --hover: rgba(50, 110, 155, 0.08);
  --overlay: rgba(22, 42, 62, 0.36);
  --seek-track: rgba(80, 130, 170, 0.2);
  --seek-buffer: rgba(90, 160, 205, 0.32);
  --shadow: 0 18px 44px rgba(80, 130, 170, 0.16);
  --player-h: 92px;
  --topbar-h: 72px;
  --radius: 14px;
  --sans: "Outfit", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --serif: "Playfair Display", "Songti SC", "Noto Serif SC", "STSong", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scrollbar-color: var(--accent) var(--bg-soft);
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(140, 200, 230, 0.45), transparent 55%),
    radial-gradient(900px 500px at -10% 110%, rgba(170, 215, 235, 0.4), transparent 50%);
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

img {
  display: block;
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.view[hidden],
[hidden] {
  display: none !important;
}

.wordmark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin: 0;
}

/* ---------- Login ---------- */
.login-view {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px 56px;
}

.login-panel {
  width: min(400px, 100%);
  text-align: center;
}

.login-panel .wordmark {
  font-size: clamp(2.2rem, 5vw, 3rem);
  color: var(--text);
}

.login-lede {
  margin: 10px 0 36px;
  color: var(--text-dim);
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.login-lede::before,
.login-lede::after {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  margin: 0 10px;
  background: var(--gold);
  vertical-align: middle;
  opacity: 0.6;
}

.field {
  display: block;
  text-align: left;
  margin-bottom: 18px;
}

.field-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 10px 0 12px;
  outline: none;
  transition: border-color 0.2s ease;
}

.field input:focus {
  border-bottom-color: var(--gold);
}

.btn-primary {
  width: 100%;
  margin-top: 10px;
  padding: 12px 18px;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-weight: 560;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.78rem;
  border-radius: 999px;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-fill-hot);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.form-error {
  margin: 16px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
}

/* ---------- App chrome ---------- */
.app-view {
  min-height: 100dvh;
  padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom, 0px));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr minmax(200px, 420px) auto;
  gap: 20px;
  align-items: center;
  min-height: var(--topbar-h);
  padding: 12px 28px 8px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-width: 0;
}

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

.topbar .wordmark {
  font-size: 1.45rem;
  white-space: nowrap;
}

.library-meta {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.8rem;
  white-space: nowrap;
}

.search-wrap input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.search-wrap input:focus {
  border-color: color-mix(in srgb, var(--gold) 55%, var(--line));
  background: var(--surface-2);
}

.search-wrap input::placeholder {
  color: var(--text-faint);
}

.btn-ghost {
  padding: 8px 14px;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--line);
}

.btn-primary.btn-compact {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  letter-spacing: 0.08em;
  text-transform: none;
  font-size: 0.86rem;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--on-danger);
  background: var(--danger);
  font-weight: 560;
  font-size: 0.86rem;
}

.btn-danger:hover {
  filter: brightness(1.08);
}

.inline-link {
  display: inline;
  padding: 0;
  color: var(--gold);
  font-size: inherit;
}

.inline-link:hover,
.inline-link:focus-visible {
  color: var(--gold-hot);
  text-decoration: underline;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 14px 28px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.tab {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 0.86rem;
  border: 1px solid transparent;
  white-space: nowrap;
  flex: none;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--gold-hot);
  background: var(--gold-soft);
  border-color: color-mix(in srgb, var(--gold) 28%, transparent);
}

.library {
  padding: 8px 20px 28px;
  outline: none;
}

/* ---------- Track list ---------- */
.track-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.group + .group {
  margin-top: 28px;
}

.group-title {
  margin: 0 8px 10px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
}

.group-title .count {
  margin-left: 8px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-faint);
}

.track-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 4px;
  align-items: center;
  width: 100%;
  padding: 2px 4px 2px 2px;
  border-radius: 12px;
}

.track-row:hover,
.track-row:focus-within {
  background: var(--hover);
}

.track-row.is-current {
  background: var(--gold-soft);
}

.track-row.is-current .track-title {
  color: var(--gold-hot);
}

.track-play {
  display: grid;
  grid-template-columns: 52px minmax(0, 1.4fr) minmax(0, 1fr) 64px;
  gap: 14px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 12px;
  color: inherit;
  min-width: 0;
}

.track-play:focus-visible {
  outline: none;
  background: var(--hover);
}

.cover {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.track-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.track-title,
.player-title,
.sheet-title {
  font-weight: 520;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-sub,
.album-cell,
.player-artist,
.sheet-sub {
  color: var(--text-dim);
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-cell {
  display: none;
}

@media (min-width: 840px) {
  .album-cell {
    display: block;
  }
}

.track-duration {
  text-align: right;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  font-size: 0.84rem;
}

.track-more {
  width: 36px;
  height: 36px;
  color: var(--text-faint);
}

.track-more:hover,
.track-more:focus-visible {
  color: var(--text);
}

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

/* ---------- Album grid ---------- */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 22px 16px;
  padding: 12px 8px 8px;
}

.album-card {
  text-align: left;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.album-card .cover {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 10px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.album-card:hover .cover,
.album-card:focus-visible .cover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.4);
}

.album-card .name {
  font-weight: 520;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-card .meta {
  color: var(--text-dim);
  font-size: 0.84rem;
}

.album-header {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 22px;
  align-items: end;
  padding: 8px 8px 22px;
}

.album-header .cover {
  width: 160px;
  height: 160px;
  border-radius: 12px;
}

.album-header h2 {
  margin: 8px 0 4px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-style: italic;
}

.album-header p {
  margin: 0;
  color: var(--text-dim);
}

.back-link {
  color: var(--gold);
  font-size: 0.86rem;
  margin-bottom: 8px;
}

.back-link:hover {
  color: var(--gold-hot);
}

/* ---------- Playlists ---------- */
.playlist-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 4px 8px 12px;
}

.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px 14px;
  padding: 4px 8px 8px;
}

.playlist-card {
  text-align: left;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px;
  border-radius: 12px;
}

.playlist-card:hover,
.playlist-card:focus-visible {
  outline: none;
}

.playlist-card .cover,
.playlist-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  object-fit: cover;
  background:
    radial-gradient(circle at 30% 30%, rgba(130, 190, 225, 0.4), transparent 55%),
    var(--surface-2);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  display: grid;
  place-items: center;
  color: var(--gold);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.6rem;
}

.playlist-card:hover .cover,
.playlist-card:hover .playlist-cover,
.playlist-card:focus-visible .cover,
.playlist-card:focus-visible .playlist-cover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.playlist-card .name {
  font-weight: 520;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-card .meta {
  color: var(--text-dim);
  font-size: 0.84rem;
}

.playlist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.playlist-header .cover {
  display: grid;
  place-items: center;
  color: var(--gold);
  font-family: var(--serif);
  font-style: italic;
  font-size: 2.2rem;
  background:
    radial-gradient(circle at 30% 30%, rgba(130, 190, 225, 0.4), transparent 55%),
    var(--surface-2);
}

/* ---------- Player ---------- */
.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 1.6fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: var(--player-h);
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 86%, var(--bg-soft));
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.now-hit {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-align: left;
  color: inherit;
}

.player-cover {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
  flex: none;
}

.player-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.player-title {
  font-size: 0.95rem;
}

.player-artist {
  font-size: 0.8rem;
}

.player-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.transport {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-dim);
}

.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--text);
  background: var(--hover);
  outline: none;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.play-btn {
  width: 44px;
  height: 44px;
  color: var(--on-accent);
  background: var(--accent-fill);
}

.play-btn:hover,
.play-btn:focus-visible {
  background: var(--accent-fill-hot);
  color: var(--on-accent);
}

.play-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: none;
}

.play-btn .icon-pause,
.play-btn.is-playing .icon-play,
.icon-btn .icon-muted,
.icon-btn.is-muted .icon-vol,
.btn-repeat[data-mode="all"] .repeat-one,
.btn-repeat[data-mode="off"] .repeat-one {
  display: none;
}

.play-btn.is-playing .icon-pause,
.icon-btn.is-muted .icon-muted {
  display: block;
}

.btn-shuffle[aria-pressed="true"],
.btn-repeat[aria-pressed="true"] {
  color: var(--gold-hot);
}

.btn-repeat[data-mode="one"] .repeat-one {
  display: block;
  fill: none;
  stroke: currentColor;
}

.seek-row {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.time {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.seek {
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.seek-track {
  position: relative;
  width: 100%;
  height: 3px;
  border-radius: 99px;
  background: var(--seek-track);
  overflow: hidden;
}

.seek-buffer,
.seek-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  border-radius: inherit;
}

.seek-buffer {
  background: var(--seek-buffer);
}

.seek-fill {
  background: var(--gold);
  z-index: 1;
}

.seek:hover .seek-track,
.seek:focus-visible .seek-track {
  height: 5px;
  outline: none;
}

.player-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.text-link {
  color: var(--text-dim);
  font-size: 0.78rem;
  white-space: nowrap;
  padding: 6px 0;
}

.text-link:hover,
.text-link:focus-visible {
  color: var(--gold-hot);
}

.volume {
  display: flex;
  align-items: center;
  gap: 4px;
  width: min(150px, 100%);
}

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

/* ---------- Expanded now-playing sheet ---------- */
.sheet[hidden] {
  display: none !important;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.sheet-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 22px 28px;
  box-shadow: var(--shadow);
}

.sheet-close {
  color: var(--text-dim);
  font-size: 0.84rem;
  float: right;
}

.sheet-close:hover {
  color: var(--text);
}

.sheet-cover {
  width: min(280px, 70%);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  margin: 12px auto 20px;
  box-shadow: var(--shadow);
}

.sheet-title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.5rem;
  text-align: center;
  white-space: normal;
}

.sheet-sub,
.sheet-genre {
  text-align: center;
  margin: 0;
}

.sheet-genre {
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 0.82rem;
}

.sheet-seek-row {
  margin-top: 22px;
}

.sheet-transport {
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.sheet-transport .play-btn {
  width: 56px;
  height: 56px;
}

.sheet-transport .icon-btn {
  width: 44px;
  height: 44px;
}

.sheet-extras {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-top: 18px;
}

.sheet-extras .volume {
  width: min(180px, 100%);
  flex: 1 1 140px;
}

.speed {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  flex: none;
}

.speed-btn {
  min-width: 44px;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.speed-btn:hover,
.speed-btn:focus-visible {
  color: var(--text);
  outline: none;
}

.speed-btn.is-active {
  color: var(--on-accent);
  background: var(--accent-fill);
  font-weight: 560;
}

.sheet-license {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.65;
}

.sheet-license a {
  color: var(--gold);
  text-decoration: none;
}

.sheet-license a:hover {
  text-decoration: underline;
}

.sheet-license .attr {
  margin: 10px 0 0;
  color: var(--text-faint);
}

/* ---------- Modal, popover, toast ---------- */
.modal[hidden],
.popover[hidden],
.toast[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(400px, calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 22px 20px;
  box-shadow: var(--shadow);
}

.modal-title {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.35rem;
}

.modal.is-wide .modal-panel {
  width: min(520px, calc(100% - 32px));
}

.upload-hint {
  margin: 0 0 16px;
  color: var(--text-faint);
  font-size: 0.8rem;
  line-height: 1.6;
}

.upload-files {
  display: grid;
  gap: 14px;
  margin-bottom: 8px;
}

.file-field {
  display: grid;
  gap: 8px;
}

.file-field input[type="file"] {
  width: 100%;
  color: var(--text-dim);
  font-size: 0.86rem;
}

.file-field input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.cover-preview-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cover-preview {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
  flex: none;
}

.file-meta {
  color: var(--text-dim);
  font-size: 0.82rem;
}

.upload-progress {
  display: none;
  margin-top: 14px;
}

.upload-progress.is-active {
  display: block;
}

.upload-progress-track {
  height: 4px;
  border-radius: 99px;
  background: var(--seek-track);
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  border-radius: inherit;
  transition: width 0.15s ease;
}

.upload-progress-label {
  margin: 6px 0 0;
  color: var(--text-faint);
  font-size: 0.78rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.modal .field input,
.modal .field textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 10px 0 12px;
  outline: none;
}

.modal .field input:focus,
.modal .field textarea:focus {
  border-bottom-color: var(--gold);
}

.modal .field textarea {
  resize: vertical;
  min-height: 64px;
}

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 40dvh;
  overflow: auto;
}

.picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border-radius: 10px;
  color: inherit;
}

.picker-item:hover,
.picker-item:focus-visible {
  background: var(--hover);
  outline: none;
}

.picker-item .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-item .meta {
  color: var(--text-faint);
  font-size: 0.8rem;
  flex: none;
}

.picker-create {
  margin-top: 12px;
  width: 100%;
  border: 1px dashed var(--line-strong);
}

.popover {
  position: fixed;
  z-index: 60;
  min-width: 168px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.popover button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
}

.popover button:hover,
.popover button:focus-visible {
  background: var(--hover);
  outline: none;
}

.popover button.is-danger {
  color: var(--danger);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-h) + 16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 70;
  max-width: min(360px, calc(100% - 32px));
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.86rem;
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .player {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "now transport"
      "seek seek";
    gap: 4px 8px;
    --player-h: 118px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .now-hit {
    grid-area: now;
  }

  .player-center {
    display: contents;
  }

  .player-center .transport {
    display: flex;
    grid-area: transport;
    justify-self: end;
  }

  .player-center .seek-row {
    grid-area: seek;
  }

  .player-right,
  .player .desktop-only {
    display: none;
  }

  .player-cover {
    width: 48px;
    height: 48px;
  }

  .sheet-panel {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    transform: none;
    width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  }

  .sheet-cover {
    width: min(260px, 58vw);
  }
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 10px 16px 8px;
    gap: 10px;
  }

  .search-wrap {
    grid-column: 1 / -1;
    order: 3;
  }

  .library-meta {
    display: none;
  }

  .tabs {
    padding: 8px 16px 4px;
  }

  .library {
    padding: 4px 10px 20px;
  }

  .track-play {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    gap: 10px;
    padding: 8px 6px;
  }

  .album-header,
  .playlist-header {
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 14px;
  }

  .album-header .cover,
  .playlist-header .cover {
    width: 108px;
    height: 108px;
  }

  .album-grid,
  .playlist-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 16px 12px;
  }
}

@media (max-width: 420px) {
  .player {
    padding-left: 10px;
    padding-right: 10px;
  }

  .player-center .transport .icon-btn {
    width: 36px;
    height: 36px;
  }

  .player-center .transport .play-btn {
    width: 42px;
    height: 42px;
  }

  .seek-row {
    grid-template-columns: 36px 1fr 36px;
    gap: 4px;
  }

  .sheet-extras {
    flex-direction: column;
    align-items: stretch;
  }

  .sheet-extras .volume {
    width: 100%;
  }

  .speed {
    justify-content: space-between;
  }
}

.icp-footer {
  margin: 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-faint);
}

.icp-footer a {
  color: inherit;
  text-decoration: none;
}

.icp-footer a:hover,
.icp-footer a:focus-visible {
  text-decoration: underline;
}

.login-view .icp-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

.app-view > .icp-footer {
  padding: 8px 20px 16px;
}
