:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: #121212;
  --panel2: #1c1c1c;
  --text: #f5f5f5;
  --muted: #a1a1aa;
  --line: #27272a;
  --accent: #e8ad65;
  --ink: #171717;
  --green: #9fbc8d;
  --danger: #f29a83;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
html {
  min-height: 100%;
  background: var(--bg);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  outline-offset: 4px;
}
button {
  cursor: pointer;
  border: 0;
  color: inherit;
  background: transparent;
  transition:
    background 0.18s,
    transform 0.18s;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:hover:not(:disabled) {
  filter: brightness(1.12);
}
a {
  color: inherit;
  text-decoration: none;
}
input,
select {
  width: 100%;
  padding: 11px 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
input[type="range"] {
  accent-color: var(--accent);
  padding: 0;
  height: 4px;
  border: 0;
  cursor: pointer;
}
input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}
label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 15px 0;
}
label input,
label select {
  margin-top: 7px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 30px;
  line-height: 1.3;
  letter-spacing: -1px;
  margin-bottom: 0;
}
h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.4px;
}
h3 {
  font-size: 15px;
}
small {
  font-size: 11px;
}
.muted,
.fine {
  color: var(--muted);
}
.fine {
  font-size: 11px;
  line-height: 1.9;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2.4px;
  color: var(--muted);
  font-weight: 600;
}
.wordmark {
  font-size: 35px;
  font-weight: 800;
  letter-spacing: -2px;
  display: block;
  line-height: 1.2;
}
.wordmark span {
  font-size: 13px;
  vertical-align: top;
  margin-left: 3px;
  letter-spacing: 0;
}
.primary,
.secondary,
.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  padding: 10px 17px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.primary {
  background: var(--accent);
  color: var(--ink);
}
.secondary {
  background: var(--panel2);
  border: 1px solid var(--line);
}
.danger {
  background: #452c27;
  color: var(--danger);
}
.text-button {
  color: var(--accent);
  font-size: 12px;
  padding: 15px 0;
}
.icon-button {
  font-size: 22px;
  line-height: 1;
  padding: 5px 8px;
}
.error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 12px;
}
.pill {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
}
.dot {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background: var(--accent);
}
.green {
  background: var(--green);
}
[hidden] {
  display: none !important;
}
.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
}
.auth-art {
  position: relative;
  padding: 45px 7vw;
  background: #c7c8ac;
  color: #23291e;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: end;
  min-height: 800px;
}
.auth-art .wordmark {
  position: absolute;
  top: 40px;
  left: 7vw;
}
.auth-art h1 {
  font-size: clamp(35px, 4vw, 59px);
  margin: 15px 0 25px;
  position: relative;
}
.auth-art p {
  position: relative;
}
.auth-art .eyebrow {
  color: #414b36;
}
.auth-art .disc {
  width: 380px;
  height: 380px;
  position: absolute;
  top: 100px;
  right: -30px;
  transform: rotate(-25deg);
}
.auth-form {
  width: 360px;
  max-width: 85%;
  margin: auto;
  padding: 60px 0;
}
.auth-form h2 {
  font-size: 32px;
  margin: 15px 0 10px;
}
.auth-form form {
  margin-top: 35px;
}
.auth-form .primary {
  width: 100%;
  padding: 14px;
  margin-top: 12px;
}
nav {
  display: grid;
  gap: 5px;
}
.section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  letter-spacing: 1.8px;
  color: var(--muted);
  margin: 33px 12px 15px;
}
.deck-link {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 9px 12px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 7px;
}
.deck-link.selected {
  color: var(--accent);
  background: #e8ad650b;
}
.deck-icon {
  width: 23px;
  height: 23px;
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: 10px;
}
.avatar {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #b7b99e;
  color: #293020;
  font-size: 12px;
  font-weight: 700;
}
main {
  padding: 34px 42px 150px;
  max-width: 1800px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 35px;
}
.topbar h1 {
  margin-top: 8px;
}
.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--muted);
}
.connection .pill {
  margin-left: 14px;
}
#notice {
  padding: 12px 16px;
  background: #e8ad6512;
  border: 1px solid #e8ad6540;
  border-radius: 8px;
  color: var(--accent);
  margin-bottom: 20px;
  font-size: 12px;
  white-space: pre-wrap;
}
.hero {
  background: #c7c8ac;
  min-height: 295px;
  border-radius: 13px;
  color: #252b20;
  padding: 35px 38px;
  display: flex;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}
.hero .eyebrow {
  color: #525c46;
}
.hero h2 {
  font-size: 37px;
  margin: 15px 0 10px;
  letter-spacing: -1.4px;
  max-width: 480px;
  line-height: 1.3;
}
.hero p {
  font-size: 12px;
  color: #4e5744;
}
.hero .primary {
  background: #18181b;
  color: #ffffff;
}
.hero .secondary {
  background: transparent;
  border-color: #939a7f;
  color: #303928;
}
.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 65%;
  display: flex;
  flex-direction: column;
  align-items: start;
}
.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 15px;
}
.disc {
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle,
    #222823 0,
    #222823 2px,
    #313831 3px,
    #222823 4px
  );
  border: 7px solid #30352d;
  box-shadow: 0 10px 25px #26302033;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
}
.hero .disc {
  width: 240px;
  height: 240px;
  flex-shrink: 0;
  align-self: center;
  margin-right: -15px;
  transform: rotate(-18deg);
}
.disc-label {
  border: 24px solid #dea46c;
  width: 48%;
  height: 48%;
  border-radius: 50%;
  background: #e9bd8a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #2c3125;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.8px;
  position: relative;
}
.disc-label:after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #30372c;
  position: absolute;
}
.disc-label small {
  font-size: 6px;
  letter-spacing: 1px;
  margin-top: 14px;
}
.spinning {
  animation: spin 12s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(342deg);
  }
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 22px 0 30px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 23px;
}
.stat {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}
.stat:first-child {
  padding-left: 0;
  border: 0;
}
.stat span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
}
.stat strong {
  font-size: 23px;
  font-weight: 500;
  display: inline-block;
  margin-right: 6px;
}
.stat small {
  color: var(--muted);
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 25px 0 16px;
}
.section-heading h2 {
  margin: 0;
}
.section-heading .muted {
  font-size: 11px;
}
.tracks {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.tracks th {
  font-size: 9px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 1.3px;
  border-bottom: 1px solid var(--line);
  padding: 10px;
}
.tracks td {
  border-bottom: 1px solid #7c8c7015;
  padding: 13px 10px;
  font-size: 12px;
}
.tracks tr:hover td {
  background: #899a7c07;
}
.tracks .num {
  color: var(--muted);
  width: 35px;
}
.track-info {
  display: flex;
  gap: 12px;
  align-items: center;
}
.cover {
  width: 36px;
  height: 36px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #747f5f, #b8ba95);
  color: #182216;
  font-size: 17px;
  flex-shrink: 0;
}
.track-info strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}
.track-info small {
  color: var(--muted);
  display: block;
  font-size: 10px;
}
.track-actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}
.track-actions button {
  font-size: 10px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  white-space: nowrap;
}
.cached {
  color: var(--green);
}
.empty {
  padding: 44px 25px;
  text-align: center;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
}
.empty strong {
  display: block;
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--text);
}
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 25px 0;
}
.toolbar input {
  flex: 1;
  min-width: 140px;
}
.toolbar select {
  width: auto;
  max-width: 250px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
}
.panel p {
  font-size: 12px;
  color: var(--muted);
}
.panel h3 {
  margin-bottom: 8px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.settings-grid .panel {
  margin: 0;
}
.source-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.source-card strong {
  font-size: 13px;
}
.source-card small {
  display: block;
  color: var(--muted);
  word-break: break-all;
}
.job {
  padding: 10px 0;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}
.status-tag {
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--green);
}
.conflict {
  border: 1px solid #e8ad6580;
  background: #e8ad6510;
  padding: 16px;
  border-radius: 8px;
  margin: 15px 0;
  font-size: 12px;
}
.conflict button {
  margin-top: 8px;
}
.player {
  position: fixed;
  inset: auto 0 0;
  height: 100px;
  background: #1b1e1b;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  align-items: center;
  padding: 0 28px;
  gap: 20px;
  z-index: 10;
}
.playing-track {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}
.mini-cover {
  width: 48px;
  height: 48px;
  background: linear-gradient(145deg, #b0b69a, #666f55);
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #263020;
  font-size: 23px;
  flex-shrink: 0;
}
.playing-track strong,
.playing-track small {
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 240px;
}
.playing-track strong {
  font-size: 12px;
  font-weight: 500;
}
.playing-track small {
  font-size: 10px;
  color: var(--muted);
}
.transport {
  max-width: 480px;
  width: 100%;
  margin: auto;
}
.transport-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-bottom: 11px;
}
.transport-buttons button {
  font-size: 15px;
  color: var(--muted);
  padding: 0;
}
.transport-buttons .play-main {
  border-radius: 50%;
  width: 32px;
  height: 32px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
}
.seek-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.seek-row time {
  font-size: 9px;
  color: var(--muted);
  min-width: 25px;
}
.player-options {
  display: flex;
  align-items: center;
  gap: 15px;
  justify-content: end;
}
.player-options input {
  width: 80px;
}
.player-options span {
  font-size: 10px;
}
dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 460px;
  max-width: 92vw;
  padding: 25px;
}
dialog::backdrop {
  background: #080b08b0;
  backdrop-filter: blur(5px);
}
dialog .section-heading {
  margin-top: 0;
}
dialog form > .primary {
  margin-top: 12px;
}
#debug {
  margin-top: 30px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  font-size: 11px;
}
#debug h2 {
  font-size: 16px;
}
.debug-controls {
  display: flex;
  gap: 20px;
}
.debug-controls label {
  font-size: 11px;
}
#debug-cache-events {
  max-height: 200px;
  overflow: auto;
  font-family: monospace;
  font-size: 10px;
  color: var(--muted);
}
.member {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.license {
  font-size: 10px;
  color: var(--muted);
}
.backup-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.backup-line code {
  color: var(--accent);
}
.light {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #fafafa;
  --panel2: #f3f3f3;
  --text: #18181b;
  --muted: #71717a;
  --line: #e4e4e7;
  --accent: #b87534;
  --ink: #ffffff;
  --green: #527841;
  --danger: #ad4632;
}
.light .player {
  background: #ffffff;
}
.light .danger {
  background: #f4ded3;
}
.light .hero .primary {
  background: #18181b;
  color: #ffffff;
}
@media (min-width: 1500px) {
  main {
    padding-left: 60px;
    padding-right: 60px;
  }
  .hero {
    padding: 45px 55px;
    min-height: 340px;
  }
  .hero .disc {
    width: 275px;
    height: 275px;
    margin-right: 40px;
  }
  .hero h2 {
    font-size: 46px;
  }
}
@media (max-width: 1050px) {
  main {
    padding: 28px 25px 140px;
  }
  .hero {
    padding: 25px;
    min-height: 270px;
  }
  .hero h2 {
    font-size: 30px;
  }
  .hero .disc {
    width: 190px;
    height: 190px;
    margin-right: -55px;
  }
  .hero-copy {
    max-width: 75%;
  }
  .player-options .muted {
    display: none;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .tracks .album-col {
    display: none;
  }
}
@media (max-width: 720px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }
  .auth-art {
    display: none;
  }
  .auth-form {
    padding: 70px 0;
  }
  main {
    margin-left: 0;
    padding: 23px 18px 155px;
  }
  .topbar {
    margin-bottom: 25px;
  }
  .topbar h1 {
    font-size: 25px;
  }
  .connection .pill {
    display: none;
  }
  .hero {
    min-height: 245px;
    padding: 24px;
  }
  .hero h2 {
    font-size: 28px;
  }
  .hero .disc {
    width: 170px;
    height: 170px;
    margin-right: -100px;
    opacity: 0.8;
  }
  .hero-copy {
    max-width: 85%;
  }
  .hero p {
    font-size: 11px;
  }
  .hero-actions button {
    font-size: 10px;
    padding: 9px 11px;
  }
  .stats {
    margin-top: 20px;
  }
  .stat {
    padding-left: 15px;
  }
  .stat strong {
    font-size: 20px;
  }
  .stat span {
    font-size: 9px;
  }
  .tracks td {
    padding: 11px 5px;
  }
  .tracks th {
    padding: 9px 5px;
  }
  .tracks .num,
  .tracks .size-col {
    display: none;
  }
  .track-actions {
    gap: 3px;
    flex-wrap: wrap;
  }
  .track-actions button {
    padding: 5px;
    font-size: 9px;
  }
  .cover {
    width: 30px;
    height: 30px;
  }
  .track-info {
    gap: 8px;
  }
  .track-info strong {
    font-size: 11px;
  }
  .track-info small {
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .player {
    height: 124px;
    grid-template-columns: 1fr 1fr;
    padding: 12px 18px;
    gap: 5px 12px;
  }
  .playing-track {
    grid-column: 1;
  }
  .playing-track strong,
  .playing-track small {
    max-width: 155px;
  }
  .mini-cover {
    width: 34px;
    height: 34px;
  }
  .transport {
    display: contents;
  }
  .transport-buttons {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    gap: 18px;
    justify-content: end;
  }
  .seek-row {
    grid-column: 1/3;
    grid-row: 2;
  }
  .player-options {
    display: none;
  }
  .panel {
    padding: 18px;
  }
  .section-heading h2 {
    font-size: 17px;
  }
  .toolbar select {
    max-width: 100%;
  }
  dialog {
    padding: 20px;
  }
  #debug .section-heading {
    flex-wrap: wrap;
  }
  .connection {
    font-size: 9px;
  }
  .section-heading .secondary {
    font-size: 10px;
  }
  .disc-label {
    border-width: 16px;
  }
  .auth-art .disc-label {
    border-width: 24px;
  }
}

.together-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 12px;
}
.together-panel .section-heading {
  margin: 0;
  gap: 10px;
}
.together-panel h3 {
  margin: 0;
  font-size: 12px;
  white-space: nowrap;
}
.together-panel p {
  flex: 1;
  min-width: 180px;
  font-size: 10px;
  line-height: 1.7;
  margin: 0;
}
.together-panel .secondary {
  font-size: 10px;
  padding: 8px 12px;
}
.transport-buttons svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}
@media (max-width: 720px) {
  .together-panel p {
    order: 5;
    flex-basis: 100%;
  }
  .together-panel {
    gap: 8px;
    padding: 12px;
  }
}

.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 0 10px;
}
.library-header h2 {
  font-size: 32px;
  margin: 8px 0;
}
.library-header p {
  font-size: 12px;
  margin: 0;
}
.library-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.library-stats {
  display: flex;
  gap: 24px;
  margin: 15px 0;
  padding: 12px 0;
  font-size: 11px;
  color: var(--muted);
}
.library-stats strong {
  font-size: 12px;
  color: var(--text);
  margin-left: 8px;
}
.download-target {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.download-target select {
  margin: 0;
}
@media (max-width: 720px) {
  .library-header {
    align-items: start;
    flex-direction: column;
    padding-top: 0;
  }
  .library-header h2 {
    font-size: 26px;
  }
  .section-heading {
    flex-wrap: wrap;
  }
  .library-actions .secondary {
    font-size: 10px;
    padding: 8px 10px;
  }
}

/* Two primary tabs, a secondary settings menu, and an independent debug launcher. */
.primary-tabs {
  display: flex;
  gap: 30px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.primary-tabs button {
  position: relative;
  padding: 12px 2px 16px;
  font-size: 16px;
  color: var(--muted);
  font-weight: 600;
}
.primary-tabs button.active {
  color: var(--text);
}
.primary-tabs button.active:after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 3px;
}
.topbar {
  justify-content: flex-end;
  margin-bottom: 14px;
}
.topbar > div:first-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.settings-control {
  position: relative;
  margin-bottom: 15px;
}
.settings-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  color: var(--muted);
  border-radius: 8px;
  text-align: left;
}
.settings-toggle:hover {
  background: var(--panel2);
  color: var(--text);
}
.settings-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 190px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 40px #0005;
  z-index: 40;
}
.settings-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border-radius: 6px;
  font-size: 13px;
}
.settings-menu button:hover,
.settings-menu button:focus-visible {
  background: var(--panel2);
}
.settings-menu #logout {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  color: var(--danger);
}
#settings-panel {
  width: 900px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 60px);
  padding: 0;
}
.settings-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  background: var(--panel);
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.settings-panel-header h2 {
  margin: 0;
  font-size: 20px;
}
#settings-content {
  padding: 24px;
}
#settings-panel .settings-grid {
  grid-template-columns: 1fr;
}
#settings-panel section {
  scroll-margin-top: 85px;
}
.debug-fab {
  position: fixed;
  right: 24px;
  bottom: 124px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--accent);
  font-size: 24px;
  box-shadow: 0 6px 24px #0005;
  z-index: 31;
}
.debug-fab[aria-expanded="true"] {
  background: var(--accent);
  color: var(--ink);
}
#debug.debug-drawer {
  position: fixed;
  right: 24px;
  bottom: 184px;
  width: 440px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 215px);
  overflow: auto;
  margin: 0;
  box-shadow: 0 12px 48px #0007;
  z-index: 30;
}
#debug .section-heading {
  margin: 0 0 12px;
  flex-wrap: wrap;
}
#debug-close {
  margin-left: auto;
}

@media (max-width: 720px) {
  .settings-control {
    margin: 0;
  }
  .settings-toggle {
    width: auto;
    padding: 8px;
  }
  .settings-toggle span {
    display: none;
  }
  .settings-menu {
    top: calc(100% + 6px);
    bottom: auto;
    left: auto;
    right: 0;
  }
  .primary-tabs {
    margin-bottom: 14px;
    gap: 28px;
  }
  .primary-tabs button {
    font-size: 16px;
    padding-top: 0;
  }
  .debug-fab {
    right: 16px;
    bottom: 148px;
  }
  #debug.debug-drawer {
    right: 16px;
    bottom: 208px;
    max-height: calc(100dvh - 230px);
  }
  #settings-panel {
    max-height: calc(100dvh - 24px);
  }
  .settings-panel-header {
    padding: 16px;
  }
  #settings-content {
    padding: 16px;
  }
}

#settings-notice {
  margin: 16px 24px 0;
  padding: 10px 14px;
  border-radius: 7px;
  background: var(--panel2);
  color: var(--accent);
  font-size: 12px;
}

.account-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 16px 4px 0;
  border-top: 1px solid var(--line);
  text-align: left;
}
.account-label {
  flex: 1;
  min-width: 0;
}
.account-label strong,
.account-label small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-label strong {
  font-size: 12px;
}
.account-label small {
  font-size: 10px;
  color: var(--muted);
}
#account-panel {
  width: 480px;
  padding: 0;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 40px);
}
.account-panel-body {
  padding: 22px;
}
.account-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.account-profile small {
  color: var(--muted);
}
.account-panel-body .section-label {
  margin: 22px 0 12px;
}
.account-panel-body #deck-list {
  max-height: 220px;
  overflow: auto;
}
.library-member-tools {
  display: flex;
  gap: 8px;
  margin: 15px 0 24px;
}
#library-redeem-form {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
#library-redeem-form p {
  font-size: 11px;
}
@media (max-width: 720px) {
  .account-switch {
    width: auto;
    border: 0;
    padding: 0;
    gap: 7px;
  }
  .account-label {
    max-width: 95px;
  }
  .account-switch .avatar {
    width: 28px;
    height: 28px;
  }
  .account-label strong {
    font-size: 11px;
  }
  .account-label small {
    font-size: 9px;
  }
  #account-panel {
    max-height: calc(100dvh - 24px);
  }
  .account-panel-body {
    padding: 16px;
  }
}
.settings-toggle {
  width: auto;
}
.settings-menu {
  top: calc(100% + 8px);
  bottom: auto;
  left: auto;
  right: 0;
}
.account-switch {
  width: auto;
  max-width: 250px;
  border: 0;
  padding: 0;
}
.account-label {
  max-width: 160px;
}
main {
  margin: 0 auto;
  padding: 28px 36px 150px;
  max-width: 1500px;
}
@media (max-width: 720px) {
  .account-label {
    max-width: 90px;
  }
  .account-switch {
    gap: 7px;
  }
  main {
    padding: 20px 18px 155px;
  }
}

/* One real app header, with no sidebar element or reserved sidebar column. */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  flex-wrap: nowrap;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 28px;
  width: 100%;
  height: 64px;
  padding: 0 30px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.app-header .wordmark {
  font-size: 28px;
  padding: 0;
  flex-shrink: 0;
}
.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}
.header-controls .settings-control {
  order: 2;
  margin: 0;
}
.header-controls .connection {
  order: 0;
}
.account-switch {
  order: 1;
}
.account-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.account-label strong,
.account-label small {
  white-space: nowrap;
}
.account-label small:before {
  content: "· ";
}
.primary-tabs {
  height: 64px;
  align-items: center;
  gap: 24px;
  margin: 0;
  border: 0;
  flex-shrink: 0;
}
.primary-tabs button {
  height: 64px;
  padding: 0 2px;
  font-size: 14px;
}
.primary-tabs button.active:after {
  bottom: 0;
}
.settings-toggle {
  padding: 8px;
}
.settings-menu {
  top: calc(100% + 10px);
  bottom: auto;
  left: auto;
  right: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
main {
  margin: 0 auto;
  padding: 24px 30px 150px;
  max-width: 1500px;
}
@media (max-width: 720px) {
  .app-header {
    height: 60px;
    padding: 0 12px;
    gap: 16px;
  }
  .app-header .wordmark {
    font-size: 24px;
  }
  .primary-tabs {
    height: 60px;
    gap: 14px;
  }
  .primary-tabs button {
    font-size: 14px;
    height: 60px;
  }
  .header-controls {
    gap: 4px;
  }
  .header-controls .connection,
  .account-label,
  .account-switch > span:last-child {
    display: none;
  }
  .account-switch {
    width: 30px;
    max-width: 30px;
    gap: 0;
  }
  .account-switch .avatar {
    width: 28px;
    height: 28px;
  }
  .settings-toggle {
    padding: 6px;
  }
  .settings-toggle span {
    display: none;
  }
  main {
    padding: 18px 16px 155px;
  }
}

/* Functional controls share compact rows; no branding or decorative cards. */
#app {
  padding-top: 52px;
}
.auth-layout {
  display: flex;
  min-height: 100dvh;
}
.auth-form {
  padding: 32px 0;
}
.app-header {
  height: 52px;
  padding: 0 24px;
  gap: 16px;
}
.primary-tabs,
.primary-tabs button {
  height: 52px;
}
main {
  padding: 12px 24px 150px;
}
.library-header {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 0 12px;
}
.library-stats {
  display: inline;
  margin: 0;
  padding: 0;
  font-size: 12px;
}
.library-actions {
  margin-left: auto;
  gap: 6px;
}
.library-actions button {
  padding: 8px 12px;
  font-size: 12px;
}
.toolbar {
  margin: 0 0 10px;
}
.track-info {
  gap: 0;
}
.tracks td {
  padding-top: 10px;
  padding-bottom: 10px;
}
.empty {
  padding: 32px 12px;
}
.debug-fab {
  font-size: 12px;
}
@media (max-width: 720px) {
  #app {
    padding-top: 48px;
  }
  .app-header {
    height: 48px;
    padding: 0 12px;
  }
  .primary-tabs,
  .primary-tabs button {
    height: 48px;
  }
  main {
    padding: 12px 12px 155px;
  }
  .library-header {
    flex-direction: row;
    gap: 8px;
  }
  .library-actions {
    width: 100%;
    margin: 0;
  }
  .library-actions button {
    padding: 7px 9px;
    font-size: 12px;
  }
}

#notice {
  position: fixed;
  top: auto;
  bottom: var(--floating-bottom);
  left: 24px;
  right: auto;
  z-index: 35;
  width: fit-content;
  max-width: min(480px, calc(100vw - 208px));
  margin: 0;
  padding: 10px 14px;
  box-shadow: 0 4px 20px #0003;
  pointer-events: auto;
}

#notice,
#settings-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.notice-message {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.notice-close {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 2px 6px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

/* Settings is a self-contained modal with category navigation and subpages. */
#settings-panel {
  width: 1000px;
  height: min(720px, calc(100dvh - 64px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}
#settings-panel > .settings-panel-header {
  padding: 14px 20px;
  height: 60px;
  box-sizing: border-box;
}
.settings-layout {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  height: calc(100% - 60px);
  min-height: 0;
}
#settings-navigation {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 10px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
#settings-navigation button {
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
#settings-navigation button:hover,
#settings-navigation button.active {
  background: var(--line);
  color: var(--text);
}
#settings-navigation #logout {
  margin-top: auto;
  color: var(--danger);
}
.settings-workspace {
  min-width: 0;
  overflow-y: auto;
  padding: 20px 24px;
}
.settings-page-header {
  margin-bottom: 20px;
}
.settings-page-header h3 {
  margin: 8px 0 0;
  font-size: 17px;
}
#settings-content {
  padding: 0;
}
#settings-content .panel {
  padding: 0;
  border: 0;
  background: transparent;
}
#settings-content .settings-grid > section > h2 {
  display: none;
}
#settings-library h4 {
  margin: 0 0 16px;
}
#settings-library .library-member-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
#settings-library form {
  max-width: 440px;
}
#settings-content #share-form {
  max-width: 440px;
}
@media (max-width: 720px) {
  #settings-panel {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    height: calc(100dvh - 24px);
    max-height: calc(100dvh - 24px);
  }
  .settings-layout {
    grid-template-columns: 106px minmax(0, 1fr);
  }
  #settings-navigation {
    padding: 12px 5px;
  }
  #settings-navigation button {
    padding: 10px 7px;
    font-size: 12px;
  }
  .settings-workspace {
    padding: 12px;
  }
  #settings-content .library-actions {
    width: auto;
  }
  #settings-content .source-card {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* The header switches libraries; account and connection details live in settings. */
.library-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  order: 1;
  min-width: 0;
}
.library-switch .account-switch {
  order: 0;
  width: auto;
  max-width: 240px;
  min-width: 0;
  padding: 6px 2px;
  margin: 0;
  gap: 0;
}
#account-library {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
#library-switch-toggle {
  width: 26px;
  height: 32px;
  padding: 0;
  font-size: 15px;
}
#account-panel {
  position: fixed;
  inset: 58px 24px auto auto;
  width: 240px;
  max-width: calc(100vw - 24px);
  max-height: min(360px, calc(100dvh - 160px));
  padding: 6px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 8px 32px #0003;
  overflow-y: auto;
}
#account-panel::backdrop {
  background: transparent;
  backdrop-filter: none;
}
#account-panel .deck-link {
  margin: 0;
  padding: 10px 12px;
  width: 100%;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
#settings-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
#settings-account .connection {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 720px) {
  .library-switch .account-switch {
    width: auto;
    max-width: min(120px, calc(100vw - 240px));
  }
  #account-library {
    font-size: 12px;
  }
  #account-panel {
    top: 54px;
    right: 12px;
  }
}

.source-plugin-settings {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.source-plugin-settings h2 {
  font-size: 16px;
}
.source-plugin-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}
.source-plugin-option input {
  width: auto;
  margin: 0;
}

#startup {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.search-pagination {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

.source-options {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: -8px 0 18px;
}
.source-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.source-options select {
  width: auto;
  max-width: 100%;
}
.source-options input {
  width: min(420px, 65vw);
}

.debug-fab {
  width: auto;
  min-width: 132px;
  height: auto;
  padding: 9px 12px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  line-height: 1.3;
}
.debug-fab span {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.debug-fab[data-fault="true"] {
  border-color: var(--accent);
}
#debug.debug-drawer {
  bottom: 212px;
  max-height: calc(100dvh - 230px);
}
.debug-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.debug-controls label {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}
.debug-controls select {
  width: auto;
}
#debug-requests {
  max-height: 210px;
  overflow: auto;
}
.debug-request {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.debug-request span,
.debug-request small {
  display: block;
  font-size: 11px;
}
.debug-request small {
  color: var(--muted);
  margin-top: 3px;
}

.secondary-tabs {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.secondary-tabs button {
  border: 0;
  background: none;
  border-radius: 0;
  padding: 10px 4px;
}
.secondary-tabs button[aria-selected="true"] {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}
.cd-toolbar label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.invalid-track,
.danger {
  color: var(--accent);
}
.download-jobs {
  display: grid;
  gap: 12px;
}
.download-job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.download-job [data-delete-download] {
  align-self: start;
  font-size: 20px;
  line-height: 1;
}
.download-job small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
}
.download-job progress,
.download-job > small {
  grid-column: 1 / -1;
  width: 100%;
}

.track-version {
  margin-top: 6px;
  max-width: min(360px, 100%);
  padding: 4px 8px;
  font-size: 12px;
}

.player-lyrics {
  text-align: center;
  min-width: 0;
  margin: 2px 0 5px;
  line-height: 1.4;
}
#lyric-current,
#lyric-next {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#lyric-current {
  font-size: 13px;
  color: var(--text);
  min-height: 18px;
}
#lyric-next {
  font-size: 11px;
  color: var(--muted);
  min-height: 15px;
}
.player-lyrics.plain-lyrics {
  max-height: 36px;
  overflow-y: auto;
}
.plain-lyrics #lyric-current {
  white-space: pre-wrap;
}
.plain-lyrics #lyric-next {
  display: none;
}
.has-player-lyrics .transport-buttons {
  margin-bottom: 3px;
}
.transport {
  min-width: 0;
}
@media (max-width: 720px) {
  .has-player-lyrics .player {
    height: 166px;
  }
  .player-lyrics {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    margin: 0;
  }
  .has-player-lyrics .seek-row {
    grid-row: 3;
  }
  .has-player-lyrics main {
    padding-bottom: 205px;
  }
  .has-player-lyrics .debug-fab {
    bottom: 190px;
  }
  .has-player-lyrics #debug.debug-drawer {
    bottom: 252px;
    max-height: calc(100dvh - 275px);
  }
}

.source-search-bar {
  flex-wrap: nowrap;
}
.source-search-bar input {
  flex: 1;
  min-width: 0;
}
.source-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.source-filters[hidden] {
  display: none;
}
.source-filter-item {
  border: 1px solid var(--border, #353c49);
  border-radius: 10px;
  padding: 12px;
}
.source-filter-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}
.source-filter-heading input {
  width: auto;
}
.source-filter-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.source-filter-options:empty {
  display: none;
}
.source-filter-options label {
  flex: 1;
  min-width: 100px;
  margin-top: 12px;
}
.source-result-columns {
  display: grid;
  grid-template-columns: repeat(var(--source-count), minmax(0, 1fr));
  gap: 16px;
}
.source-result-column {
  min-width: 0;
  container-type: inline-size;
}
.source-result-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border, #353c49);
}
.source-track {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border, #353c49);
}
.source-track-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.source-track-info > * {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.source-track button {
  flex-shrink: 0;
}
.source-track-album {
  display: none;
}
@container (min-width:440px) {
  .source-track-album {
    display: block;
  }
}
.source-track-album::before {
  content: "专辑 · ";
}
@container (min-width: 640px) {
  .source-track-info {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
    column-gap: 24px;
    align-items: center;
  }
  .source-track-info > strong {
    grid-column: 1;
    grid-row: 1;
  }
  .source-track-info > span:not(.source-track-album) {
    grid-column: 1;
    grid-row: 2;
  }
  .source-track-info > .source-track-album {
    grid-column: 2;
    grid-row: 1 / 3;
  }
}
.source-result-tabs {
  display: none;
}
.results-compact .source-result-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 12px 0;
}
.source-result-tabs button {
  white-space: nowrap;
}
.source-result-tabs [aria-selected="true"] {
  color: var(--accent, #b6e185);
}
.results-compact .source-result-columns {
  display: block;
}
.results-compact .source-result-column {
  display: none;
}
.results-compact .source-result-column.result-active {
  display: block;
}

:root {
  --floating-bottom: 124px;
}
.debug-fab {
  bottom: var(--floating-bottom);
}
#notice {
  background: var(--panel2);
  max-height: min(200px, 40dvh);
  overflow-y: auto;
}
@media (max-width: 720px) {
  :root {
    --floating-bottom: 148px;
  }
  body.has-player-lyrics {
    --floating-bottom: 190px;
  }
  .has-player-lyrics .debug-fab {
    bottom: var(--floating-bottom);
  }
  #notice {
    left: 16px;
    max-width: min(480px, calc(100vw - 192px));
  }
}

.library-search-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
}
#library-search {
  width: 0;
  flex: 1;
  min-width: 0;
}
#library-search-count {
  white-space: nowrap;
}
.library-search-header .library-actions {
  width: auto;
  margin: 0;
}

.source-filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.source-filter-title .source-filter-heading {
  margin: 0;
  min-width: 0;
}
.source-filter-title [data-source-about] {
  flex-shrink: 0;
  white-space: nowrap;
}
.source-guide-section + .source-guide-section {
  margin-top: 24px;
}
.source-guide-section h3 {
  margin: 0 0 8px;
}
.source-guide-section p {
  line-height: 1.65;
}

.primary-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.primary-tabs svg,
.add-music svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.batch-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 14px;
}
.batch-toolbar #batch-count,
.batch-toolbar #cd-batch-count {
  margin-right: auto;
  font-size: 12px;
}
.tracks [data-batch-track],
.tracks [data-batch-item] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}
.library-add {
  display: flex;
  justify-content: flex-start;
}
.add-music {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  border-radius: 8px;
}
.add-plus {
  margin-left: 8px;
  font-size: 23px;
  font-weight: 400;
  line-height: 1;
}

.tracks.batch-tracks .num {
  display: table-cell;
  width: 34px;
  min-width: 34px;
  padding-left: 4px;
  padding-right: 4px;
}

.cd-toolbar #cd-select {
  width: auto;
  min-width: 150px;
  max-width: min(100%, 320px);
}

.download-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.download-toolbar .muted {
  font-size: 12px;
}

.library-pinned {
  position: sticky;
  top: 52px;
  z-index: 15;
  margin-top: -12px;
  padding-top: 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
@media (max-width: 720px) {
  .library-pinned {
    top: 48px;
  }
}

.library-search-controls {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  min-width: 0;
}
#library-sort {
  width: auto;
  max-width: 140px;
  flex-shrink: 0;
}

.autoplay-blocked {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  width: min(640px, calc(100% - 24px));
  max-height: max(160px, calc(100dvh - 240px));
  overflow-y: auto;
  padding: 18px 20px;
  border: 2px solid var(--accent);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 12px 40px #0005;
}
.autoplay-blocked-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  color: var(--accent);
}
.autoplay-blocked p {
  margin: 10px 0 14px;
}
.autoplay-blocked details {
  margin-top: 12px;
}
.autoplay-blocked summary {
  cursor: pointer;
  font-weight: 600;
}
.autoplay-blocked ul {
  margin: 10px 0 0;
  padding-left: 20px;
}
.autoplay-blocked li + li {
  margin-top: 10px;
}
.autoplay-blocked a {
  color: var(--accent);
  text-decoration: underline;
}
@media (max-width: 720px) {
  .autoplay-blocked {
    top: 58px;
    padding: 14px 16px;
  }
}

/* Diagnostics lives beside the current library, rather than over the player. */
.header-controls {
  min-width: 0;
}
.header-controls .settings-control {
  order: 3;
  flex-shrink: 0;
}
.app-header .debug-fab {
  position: static;
  inset: auto;
  order: 2;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 1px 8px;
  min-width: 0;
  height: 36px;
  padding: 4px 8px;
  border-radius: 8px;
  box-shadow: none;
  line-height: 1.2;
}
.app-header .debug-fab strong {
  grid-row: span 2;
  font-size: 11px;
}
.app-header .debug-fab span {
  font-size: 10px;
}
#app #debug.debug-drawer {
  top: 60px;
  right: 24px;
  bottom: auto;
  max-height: calc(100dvh - 84px);
}
@media (max-width: 720px) {
  .app-header .debug-fab {
    display: flex;
    justify-content: center;
    height: 30px;
    padding: 4px 6px;
  }
  .app-header .debug-fab span {
    display: none;
  }
  .library-switch .account-switch {
    max-width: min(120px, calc(100vw - 278px));
  }
  #app #debug.debug-drawer {
    top: 56px;
    right: 12px;
    max-height: calc(100dvh - 72px);
  }
}

/* Player console: one audio element and one set of controls across all views. */
:root {
  --player-height: 152px;
  --player-surface: #000000;
  --player-control: #e8ad65;
  --player-control-ink: #171717;
  --floating-bottom: calc(var(--player-height) + 16px);
}
.light {
  --player-surface: #ffffff;
  --player-control: #18181b;
  --player-control-ink: #ffffff;
}
body.has-player-lyrics {
  --floating-bottom: calc(var(--player-height) + 16px);
}
#app main {
  padding-bottom: calc(var(--player-height) + 32px);
}
#player {
  height: var(--player-height);
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(300px, 1.6fr) minmax(
      160px,
      0.75fr
    );
  align-items: center;
  gap: 28px;
  padding: 12px 28px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--player-surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 32px #00000006;
  --play-progress: 0%;
}
#player .playing-track {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  width: 100%;
  padding: 0;
  text-align: left;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
}
#player .playing-track:disabled {
  opacity: 1;
  cursor: default;
}
#player .player-artwork {
  display: block;
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1px solid #88917a66;
  padding: 3px;
  animation: player-spin 24s linear infinite;
  animation-play-state: paused;
}
#player.is-playing .player-artwork {
  animation-play-state: running;
}
@keyframes player-spin {
  to {
    transform: rotate(360deg);
  }
}
#player .playing-meta {
  display: block;
  min-width: 0;
  flex: 1;
}
#player .playing-track strong {
  font-size: 16px;
  font-weight: 600;
  max-width: 100%;
}
#player .playing-track small {
  font-size: 12px;
  line-height: 1.6;
  margin-top: 5px;
  max-width: 100%;
}
#player .transport {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  max-width: 640px;
  width: 100%;
}
#player .player-lyrics {
  width: 100%;
  margin: 0;
  grid-row: auto;
}
#player #lyric-current {
  font-size: 15px;
  min-height: 22px;
  font-weight: 600;
}
#player #lyric-next {
  font-size: 12px;
  min-height: 18px;
}
#player .player-lyrics.plain-lyrics {
  max-height: 44px;
}
#player .seek-row {
  display: flex;
  width: 100%;
  gap: 12px;
  grid-row: auto;
}
#player .seek-row time {
  min-width: 34px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
#player .transport-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin: 0;
  grid-row: auto;
}
#player .transport-buttons button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 9px;
  color: var(--text);
}
#player .transport-buttons button:hover {
  background: var(--panel2);
}
#player .transport-buttons .play-main {
  width: 44px;
  height: 44px;
  color: var(--player-control-ink);
  background: var(--player-control);
}
#player .transport-buttons .play-main:hover {
  background: var(--player-control);
  filter: brightness(1.08);
}
#player .transport-buttons svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
#player .player-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-end;
  justify-content: center;
}
#player .repeat-control,
#player .volume-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: 0;
}
#player .repeat-control span {
  font-size: 12px;
  white-space: nowrap;
}
#player #repeat {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 4px;
  border-radius: 7px;
  color: var(--muted);
}
#player #repeat.cached {
  color: var(--text);
}
#player #repeat-one {
  position: absolute;
  inset: 8px 0 auto;
  font-size: 10px;
  text-align: center;
  line-height: 16px;
}
#player .repeat-control svg,
#player .volume-control svg,
#player-collapse svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
#player .volume-control input {
  width: 104px;
}
#player input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  min-width: 0;
  margin: 0;
  height: 20px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
#player #seek {
  flex: 1;
  width: 100%;
}
#player input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(
    to right,
    var(--accent) var(--range-progress, 0%),
    #89917755 var(--range-progress, 0%)
  );
}
#player input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(
    to right,
    var(--accent) var(--range-progress, 0%),
    #89917755 var(--range-progress, 0%)
  );
}
#player input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  margin-top: -3.5px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}
#player input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}
#player input[type="range"]:hover::-webkit-slider-thumb,
#player input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.25);
}
.player-expanded-heading,
.mini-progress {
  display: none;
}
#player input:focus-visible,
#player button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.autoplay-blocked {
  z-index: 70;
}
#notice {
  max-width: min(480px, calc(100vw - 48px));
}

/* Library actions retain their existing behavior. */
.tracks td {
  padding-top: 17px;
  padding-bottom: 17px;
}
.track-info strong {
  font-size: 14px;
  font-weight: 600;
}
.track-info small {
  font-size: 11px;
  margin-top: 3px;
}
.track-actions {
  align-items: center;
  gap: 4px;
}
.track-actions button,
.track-actions a {
  border-color: transparent;
  border-radius: 6px;
  font-size: 11px;
  padding: 6px 8px;
}
.track-actions button:hover,
.track-actions a:hover {
  background: var(--panel2);
}
.tracks tr.is-current-track td {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.track-equalizer {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 20px;
}
.track-equalizer i {
  width: 3px;
  height: 9px;
  background: var(--accent);
  border-radius: 1px;
  animation: equalizer 0.9s ease-in-out infinite alternate;
  animation-play-state: paused;
}
.track-equalizer i:nth-child(2) {
  height: 16px;
  animation-delay: -0.4s;
}
.track-equalizer i:nth-child(3) {
  height: 12px;
  animation-delay: -0.7s;
}
.is-current-track .track-number {
  display: none;
}
.is-current-track .track-equalizer {
  display: inline-flex;
}
.is-row-playing .track-equalizer i {
  animation-play-state: running;
}
@keyframes equalizer {
  to {
    transform: scaleY(0.35);
  }
}
.header-controls .settings-control {
  order: 2;
}
.app-header .debug-fab {
  order: 0;
}

@media (max-width: 900px) and (min-width: 721px) {
  #player {
    grid-template-columns: minmax(160px, 1fr) minmax(260px, 1.5fr) 130px;
    gap: 16px;
    padding-left: 20px;
    padding-right: 20px;
  }
  #player .player-artwork {
    width: 64px;
    height: 64px;
  }
  #player .playing-track {
    gap: 10px;
  }
  #player .playing-track strong {
    font-size: 14px;
  }
  #player .volume-control input {
    width: 80px;
  }
}
@media (max-width: 720px) {
  :root {
    --player-height: 84px;
  }
  #player {
    height: calc(var(--player-height) + env(safe-area-inset-bottom, 0px));
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  #player .playing-track {
    gap: 12px;
    grid-column: 1;
  }
  #player .player-artwork {
    width: 48px;
    height: 48px;
    padding: 2px;
  }
  #player .playing-track strong {
    font-size: 13px;
  }
  #player .playing-track small {
    font-size: 10px;
    margin-top: 2px;
  }
  #player .transport {
    display: contents;
  }
  #player .transport-buttons {
    grid-column: 2;
    grid-row: 1;
    gap: 8px;
  }
  #player .transport-buttons .play-main {
    width: 38px;
    height: 38px;
  }
  #player .transport-buttons #next {
    width: 30px;
    height: 38px;
    padding: 6px;
  }
  #player #previous,
  #player .seek-row,
  #player .player-options,
  #player .player-lyrics {
    display: none;
  }
  #player .mini-progress {
    display: block;
    position: absolute;
    bottom: env(safe-area-inset-bottom, 0px);
    left: 0;
    right: 0;
    height: 3px;
    background: color-mix(in srgb, var(--muted) 24%, transparent);
  }
  #player .mini-progress span {
    display: block;
    height: 100%;
    width: var(--play-progress, 0%);
    background: var(--accent);
  }
  body.player-expanded {
    overflow: hidden;
  }
  #player.is-expanded {
    inset: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: clamp(10px, 2dvh, 20px);
    padding: max(12px, env(safe-area-inset-top, 0px)) 24px
      max(20px, env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    z-index: 50;
    background: var(--bg);
  }
  #player.is-expanded .player-expanded-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 40px;
    flex-shrink: 0;
  }
  #player-collapse {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }
  #player-collapse {
    display: grid;
    place-items: center;
  }
  #player.is-expanded .playing-track {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    margin: 6px 0;
  }
  #player.is-expanded .player-artwork {
    width: clamp(140px, 29dvh, 250px);
    height: clamp(140px, 29dvh, 250px);
    padding: 5px;
  }
  #player.is-expanded .playing-meta {
    flex: 0 0 auto;
    width: 100%;
    text-align: center;
  }
  #player.is-expanded .playing-track strong {
    font-size: 23px;
    font-weight: 600;
    white-space: normal;
    line-height: 1.4;
  }
  #player.is-expanded .playing-track small {
    font-size: 13px;
    margin-top: 8px;
  }
  #player.is-expanded .transport {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 18px;
    max-width: 440px;
  }
  #player.is-expanded .player-lyrics:not([hidden]) {
    display: block;
  }
  #player.is-expanded #lyric-current {
    font-size: 19px;
    min-height: 29px;
  }
  #player.is-expanded #lyric-next {
    font-size: 14px;
    min-height: 22px;
  }
  #player.is-expanded .seek-row {
    display: flex;
  }
  #player.is-expanded .transport-buttons {
    display: flex;
    justify-content: center;
    gap: 34px;
  }
  #player.is-expanded #previous {
    display: grid;
  }
  #player.is-expanded .transport-buttons #previous,
  #player.is-expanded .transport-buttons #next {
    width: 44px;
    height: 56px;
  }
  #player.is-expanded .transport-buttons .play-main {
    width: 64px;
    height: 64px;
  }
  #player.is-expanded .transport-buttons svg {
    width: 26px;
    height: 26px;
  }
  #player.is-expanded .player-options {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 390px;
    margin: 8px auto 0;
    gap: 12px;
  }
  #player.is-expanded .volume-control input {
    width: 104px;
  }
  #player.is-expanded .mini-progress {
    display: none;
  }
  #notice {
    max-width: calc(100vw - 32px);
  }
  .tracks td {
    padding-top: 14px;
    padding-bottom: 14px;
  }
  .track-info strong {
    font-size: 13px;
  }
  .track-info small {
    font-size: 10px;
  }
  .track-actions button,
  .track-actions a {
    font-size: 10px;
    padding: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #player .player-artwork,
  .track-equalizer i {
    animation: none;
  }
}

.track-more {
  align-self: flex-start;
  margin-left: auto;
}
.track-more > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  list-style: none;
}
.track-more > summary::-webkit-details-marker {
  display: none;
}
.track-more > summary:hover,
.track-more[open] > summary {
  background: var(--panel2);
}
.track-more > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.track-more-menu {
  position: fixed;
  z-index: 80;
  width: 144px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 8px 24px #0003;
}
.track-actions .track-more-menu button,
.track-actions .track-more-menu a {
  display: block;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  line-height: 20px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  box-sizing: border-box;
}
.track-actions .track-more-menu button:hover,
.track-actions .track-more-menu a:hover {
  background: var(--panel2);
}

/* Keep action columns stable when cache status changes. */
.track-actions {
  flex-wrap: nowrap;
}
.track-actions > button {
  flex-shrink: 0;
}
.track-actions > [data-cache] {
  box-sizing: border-box;
  width: 7em;
  flex: 0 0 7em;
  text-align: center;
  white-space: nowrap;
}
.track-actions > .track-more {
  flex: 0 0 32px;
  align-self: center;
  margin-left: 0;
}

.download-job {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 14px;
}
.download-job > div {
  min-width: 0;
}
.download-job strong {
  display: block;
  overflow-wrap: anywhere;
}
.download-state {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--panel2);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.download-job[data-state="completed"] .download-state {
  color: #64804d;
  background: #899a7c18;
}
.download-job[data-state="failed"] .download-state {
  color: var(--accent);
  background: #b8753412;
}
.download-job progress {
  appearance: none;
  height: 4px;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--panel2);
  accent-color: var(--accent);
}
.download-job progress::-webkit-progress-bar {
  background: var(--panel2);
}
.download-job progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 4px;
}
.download-job progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 4px;
}
.download-job > small {
  margin: 0;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.download-job[data-state="failed"] {
  --download-error-color: #b43e36;
  --download-error-tint: #b43e360b;
  border-color: #b43e3655;
  border-left: 3px solid var(--download-error-color);
  background: var(--download-error-tint);
}
.download-job[data-state="failed"] .download-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--download-error-color);
  background: #b43e3615;
  font-weight: 600;
}
.download-error {
  grid-column: 1 / -1;
  margin: 0;
  padding: 9px 11px;
  border-radius: 6px;
  background: #b43e3610;
  color: var(--download-error-color, var(--text));
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.download-error strong {
  display: inline;
  margin-right: 8px;
}
body:not(.light) .download-job[data-state="failed"] {
  --download-error-color: #ee958b;
}

.track-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.track-info > div {
  min-width: 0;
}
.track-artwork {
  display: block;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  object-fit: cover;
  background: var(--panel2);
}
#player .player-artwork {
  object-fit: cover;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  animation: none;
  background: var(--panel2);
  box-shadow: 0 4px 18px #00000012;
}
@media (max-width: 720px) {
  .track-info {
    gap: 8px;
  }
  .track-artwork {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 5px;
  }
  #player .player-artwork {
    border-radius: 8px;
  }
  #player.is-expanded .player-artwork {
    border-radius: 20px;
  }
}
@media (max-width: 720px) {
  .tracks {
    table-layout: fixed;
  }
  .tracks th:last-child {
    width: 178px;
  }
  .tracks .track-info strong,
  .tracks .track-info small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .track-info > div {
    flex: 1;
  }
  .track-version {
    max-width: 100%;
  }
  #player.is-expanded .player-artwork {
    padding: 0;
  }
}

/* A single rounded stroke language for the player's secondary controls. */
#player #previous svg,
#player #next svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#player .repeat-control svg,
#player .volume-control svg {
  stroke-width: 1.7;
}
#player #repeat-one {
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  pointer-events: none;
}
#player #repeat.cached {
  color: var(--accent);
}

.library-switch {
  gap: 4px;
  padding: 2px 4px 2px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
}
.library-switch:focus-within,
.library-switch:has(button:hover) {
  border-color: var(--line);
  background: var(--panel2);
}
.library-switch .account-switch {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-height: 36px;
  padding: 2px 0;
  text-align: left;
  background: transparent;
}
#account-library {
  width: 100%;
  font-weight: 600;
  line-height: 17px;
}
#library-switch-hint {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  opacity: 0.8;
  font-size: 10px;
  line-height: 12px;
  font-weight: 400;
}
#library-switch-hint::before {
  content: "切换至 ";
}
#library-switch-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  width: 26px;
  height: 32px;
  border-radius: 7px;
  color: var(--muted);
}
#library-switch-toggle svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s ease;
}
#library-switch-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
@media (max-width: 720px) {
  .library-switch {
    padding: 1px 2px 1px 4px;
    gap: 2px;
  }
  .library-switch .account-switch {
    min-height: 34px;
    gap: 1px;
  }
  #library-switch-hint {
    font-size: 9px;
    line-height: 11px;
  }
}
@media (max-width: 480px) {
  #library-switch-hint::before {
    content: "→ ";
  }
}
@media (prefers-reduced-motion: reduce) {
  #library-switch-toggle svg {
    transition: none;
  }
}

#settings-account,
#settings-account .account-profile {
  border-bottom: 0;
  padding-bottom: 0;
}
#default-library-form {
  margin-bottom: 28px;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #ffffff;
    --panel: #fafafa;
    --panel2: #f3f3f3;
    --text: #18181b;
    --muted: #71717a;
    --line: #e4e4e7;
    --accent: #b87534;
    --ink: #ffffff;
    --green: #527841;
    --danger: #ad4632;
  }
}

/* CD scrolls inside its song list, between the controls and player. */
body.cd-page {
  overflow: hidden;
}
.cd-page #app main {
  padding-bottom: 0;
}
.cd-pinned {
  position: relative;
  top: auto;
}
.cd-song-scroll {
  height: var(--cd-scroll-height, 50dvh);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  width: 100%;
}
.cd-song-scroll,
#player #player-lyrics,
#player.is-expanded #lyrics-full {
  scrollbar-width: none;
}
.cd-song-scroll::-webkit-scrollbar,
#player-lyrics::-webkit-scrollbar,
#lyrics-full::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.edge-scrollbar {
  position: fixed;
  right: 0;
  width: 10px;
  z-index: 16;
  touch-action: none;
  user-select: none;
  background: transparent;
}
.edge-scrollbar[hidden] {
  display: none;
}
.edge-scrollbar span {
  display: block;
  position: absolute;
  right: 1px;
  top: 0;
  width: 3px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--muted) 24%, transparent);
}
.edge-scrollbar:hover span,
.edge-scrollbar.is-dragging span,
.edge-scrollbar:focus-visible span {
  background: color-mix(in srgb, var(--muted) 48%, transparent);
}
#player .edge-scrollbar {
  z-index: 51;
}
.cd-song-scroll thead {
  position: sticky;
  top: 0;
  z-index: 14;
  background: var(--bg);
}

.quick-play-row {
  cursor: pointer;
  touch-action: manipulation;
}

#lyrics-full {
  display: none;
}
#player-lyrics {
  cursor: pointer;
}
body.player-expanded {
  overflow: hidden;
}
#player.is-expanded {
  inset: 0;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, 1.4fr);
  grid-template-rows: 44px minmax(0, 1fr) 48px;
  gap: 24px 6vw;
  padding: 24px max(32px, 6vw);
  overflow: hidden;
  z-index: 50;
  background: var(--bg);
}
#player.is-expanded .player-expanded-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
#player-collapse {
  width: 40px;
  height: 40px;
}
#player-collapse {
  display: grid;
  place-items: center;
}
#player.is-expanded .playing-track {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  min-width: 0;
}
#player.is-expanded .player-artwork {
  width: min(28vw, 320px);
  height: min(28vw, 320px);
  padding: 0;
  border-radius: 20px;
}
#player.is-expanded .playing-meta {
  text-align: center;
  flex: 0 0 auto;
  width: 100%;
}
#player.is-expanded .playing-track strong {
  font-size: 24px;
  white-space: normal;
}
#player.is-expanded .transport {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  min-height: 0;
  gap: 20px;
}
#player.is-expanded .player-lyrics:not([hidden]) {
  display: flex;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  cursor: default;
}
#player.is-expanded #lyric-current,
#player.is-expanded #lyric-next {
  display: none;
}
#player.is-expanded #lyrics-full {
  display: block;
  position: relative;
  width: 100%;
  overflow-y: auto;
  padding: var(--lyric-pad, 120px) 0;
  min-height: 0;
  height: 100%;
  text-align: center;
  mask-image: linear-gradient(transparent, black 12%, black 88%, transparent);
}
#lyrics-full p {
  margin: 0;
  padding: 12px 4px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 25px);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  opacity: 0.65;
}
#lyrics-full p.is-active {
  color: var(--text);
  font-weight: 600;
  opacity: 1;
}
#player.is-expanded .seek-row {
  display: flex;
  flex-shrink: 0;
}
#player.is-expanded .transport-buttons {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-shrink: 0;
}
#player.is-expanded #previous {
  display: grid;
}
#player.is-expanded .player-options {
  display: flex;
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: none;
  margin: 0;
}
#player.is-expanded .mini-progress {
  display: none;
}
@media (max-width: 720px) {
  #player.is-expanded {
    display: flex;
    gap: 12px;
    padding: max(10px, env(safe-area-inset-top, 0px)) 20px
      max(16px, env(safe-area-inset-bottom, 0px));
  }
  #player.is-expanded .playing-track {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 16px;
    width: 100%;
    margin: 0;
  }
  #player.is-expanded .player-artwork {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 12px;
  }
  #player.is-expanded .playing-meta {
    text-align: left;
    flex: 1;
    min-width: 0;
  }
  #player.is-expanded .playing-track strong {
    font-size: 17px;
    line-height: 1.4;
  }
  #player.is-expanded .playing-track small {
    margin-top: 5px;
    font-size: 12px;
  }
  #player.is-expanded .transport {
    flex: 1;
    gap: 14px;
  }
  #player.is-expanded #lyrics-full {
    padding: var(--lyric-pad, 120px) 0;
  }
  #lyrics-full p {
    font-size: 19px;
    padding: 10px 0;
  }
  #player.is-expanded .player-options {
    flex-shrink: 0;
    justify-content: space-between;
  }
}

#mini-lyric {
  display: none;
}
@media (max-width: 720px) {
  #player:not(.is-expanded) #mini-lyric:not([hidden]) {
    display: block;
  }
  .has-player-lyrics #player:not(.is-expanded) #playing-artist {
    display: none;
  }
}

body.contained-page {
  overflow: hidden;
}
.contained-page #app main {
  padding-bottom: 0;
}
.page-pinned {
  background: var(--bg);
}
.page-pinned .library-pinned {
  position: relative;
  top: auto;
}
.page-song-scroll {
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  width: 100%;
}
.page-song-scroll::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.page-song-scroll .tracks thead {
  position: sticky;
  top: 0;
  z-index: 14;
  background: var(--bg);
}

.cd-song-scroll,
.page-song-scroll {
  user-select: none;
  -webkit-user-select: none;
}
.cd-song-scroll img,
.page-song-scroll img {
  -webkit-user-drag: none;
}
.list-dragging,
.list-dragging .cd-song-scroll *,
.list-dragging .page-song-scroll * {
  cursor: grabbing !important;
}
.page-song-scroll input,
.page-song-scroll textarea,
.page-song-scroll [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

#player.is-expanded .transport {
  align-self: stretch;
  height: 100%;
}
#player.is-expanded .player-lyrics {
  position: relative;
}
#player.is-expanded #lyrics-full {
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: grab;
}
#player.is-expanded .is-scrubbing #lyrics-full {
  cursor: grabbing;
}
#lyrics-full p {
  transition:
    color 180ms ease,
    opacity 180ms ease;
}
#lyrics-full p.is-preview {
  color: var(--accent);
  opacity: 1;
}
#lyric-seek-preview {
  display: none;
}
#player.is-expanded .is-scrubbing #lyric-seek-preview {
  display: block;
  position: absolute;
  right: 8px;
  top: calc(50% - 36px);
  font-size: 11px;
  color: var(--accent);
  pointer-events: none;
}
@media (max-width: 720px) {
  #player.is-expanded .transport {
    height: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  #lyrics-full p {
    transition: none;
  }
}

#player.is-expanded #lyrics-full:not(.timed-lyrics) {
  touch-action: pan-y;
  cursor: auto;
}

/* Playback recovery remains clickable above pinned song column labels. */
#player:has(#autoplay-blocked:not([hidden])) {
  z-index: 55;
}

/* Expanded desktop player: a bounded listening area and one bottom control bar. */
@media (min-width: 721px) {
  #player.is-expanded {
    grid-template-columns: minmax(0, 420px) minmax(0, 560px);
    grid-template-rows: 44px minmax(0, 1fr) 28px 64px;
    justify-content: center;
    align-items: stretch;
    column-gap: clamp(32px, 5vw, 80px);
    row-gap: 16px;
    padding: 20px clamp(24px, 5vw, 72px) 28px;
  }
  #player.is-expanded .playing-track {
    grid-column: 1;
    grid-row: 2;
    align-items: center;
    gap: 20px;
    margin: 0;
    padding: 24px 0;
  }
  #player.is-expanded .player-artwork {
    width: min(100%, 340px, 38dvh);
    height: auto;
    aspect-ratio: 1;
  }
  #player.is-expanded .playing-meta {
    max-width: 360px;
  }
  #player.is-expanded .playing-track strong {
    font-size: clamp(20px, 2vw, 26px);
  }
  #player.is-expanded .transport {
    display: contents;
  }
  #player.is-expanded .player-lyrics:not([hidden]) {
    grid-column: 2;
    grid-row: 2;
    height: 100%;
    min-height: 0;
  }
  #player.is-expanded #lyrics-full p {
    font-size: clamp(18px, 1.6vw, 23px);
  }
  #player.is-expanded .seek-row {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    max-width: none;
    align-self: center;
  }
  #player.is-expanded .transport-buttons {
    grid-column: 1 / -1;
    grid-row: 4;
    justify-self: center;
    align-self: center;
    width: auto;
    gap: 32px;
  }
  #player.is-expanded .transport-buttons .play-main {
    width: 56px;
    height: 56px;
    background: var(--accent);
    color: var(--ink);
  }
  #player.is-expanded .player-options {
    display: contents;
  }
  #player.is-expanded .repeat-control {
    grid-column: 1;
    grid-row: 4;
    justify-self: start;
    align-self: center;
  }
  #player.is-expanded .volume-control {
    grid-column: 2;
    grid-row: 4;
    justify-self: end;
    align-self: center;
  }
  #player.is-expanded .volume-control input {
    width: clamp(72px, 9vw, 120px);
  }
}

#player.is-expanded .player-expanded-heading {
  justify-content: center;
  min-height: 48px;
}
#player-collapse {
  width: min(160px, 55vw);
  height: 48px;
  min-height: 48px;
  border-radius: 14px;
  touch-action: manipulation;
}
#player-collapse:hover {
  background: var(--panel2);
}
@media (min-width: 721px) {
  #player.is-expanded {
    grid-template-rows: 48px minmax(0, 1fr) 28px 64px;
  }
}

.about-app {
  padding-bottom: 24px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.about-app h2 {
  margin-bottom: 6px;
  font-size: 26px;
  letter-spacing: 0.03em;
}
.about-version {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  margin: 20px 0 16px;
  overflow-wrap: anywhere;
}
.about-update-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
#settings-panel
  :is(.about-update-actions, .library-actions, .library-member-tools)
  > :is(.primary, .secondary, .danger) {
  min-height: 40px;
  margin: 0;
  padding: 10px 16px;
  font-size: 12px;
  line-height: 1.5;
}
#update-status {
  font-size: 13px;
  margin-bottom: 8px;
}
.about-app .fine {
  margin: 0;
}
.release-entry {
  margin-bottom: 32px;
}
.release-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin-bottom: 14px;
}
.release-heading h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.release-heading time {
  color: var(--muted);
  font-size: 12px;
}
.release-entry ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.release-entry li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  line-height: 1.9;
  margin: 10px 0;
  font-size: 14px;
}
.release-badge {
  display: inline-block;
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1.7;
  padding: 1px 9px;
  border-radius: 999px;
}
.release-badge.added {
  color: #a78bfa;
  background: #8b5cf61a;
}
.release-badge.improved {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.release-badge.fixed {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, transparent);
}
.light .release-badge.added {
  color: #7050b1;
}
@media (max-width: 480px) {
  .release-heading h3 {
    font-size: 15px;
  }
  .release-entry li {
    font-size: 13px;
    gap: 9px;
  }
}
