:root {
  color: #1d2433;
  background: #f4f6f8;
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, -apple-system,
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f4f6f8;
}

button,
input,
textarea {
  font: inherit;
}

a.secondary {
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
  text-decoration: none;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
textarea {
  width: 100%;
  border: 1px solid #d5dae3;
  border-radius: 8px;
  background: #fff;
  color: #1d2433;
  padding: 11px 12px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: #2f6fed;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.13);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: #485366;
  font-size: 14px;
  font-weight: 700;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(47, 111, 237, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(14, 165, 120, 0.12), transparent 38%),
    #eef2f6;
}

.login-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 28px;
  padding: 34px;
  border: 1px solid #dde2ea;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 70px rgba(30, 41, 59, 0.12);
}

.login-panel h1,
.page-head h2,
.song-row h3,
.modal-panel h3 {
  margin: 0;
  color: #151b28;
}

.login-panel h1 {
  margin-top: 6px;
  font-size: 34px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.app-shell.sidebar-hidden {
  grid-template-columns: 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  border-right: 1px solid #dfe4eb;
  background: #fff;
}

.sidebar-hidden .sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 250px;
  transform: translateX(-100%);
  pointer-events: none;
}

.sidebar-open .sidebar {
  z-index: 8;
}

.sidebar-toggle {
  position: fixed;
  left: 10px;
  top: 12px;
  z-index: 9;
  width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid #d5dae3;
  background: #fff;
  color: #1d2433;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #2f6fed;
  color: #fff;
  font-weight: 900;
}

.brand div {
  display: grid;
  gap: 3px;
}

.brand span:last-child {
  font-size: 13px;
  font-weight: 800;
}

.brand span:last-child,
.song-row p,
.empty,
.remark,
.muted {
  color: #687386;
}

.account-entry {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  border: 1px solid #dfe4eb;
  background: #f8fafc;
  color: #1d2433;
  text-align: left;
}

.account-entry span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #2f6fed;
  color: #fff;
  font-weight: 900;
}

.check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  color: #485366;
}

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

.content {
  padding: 28px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #2f6fed;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.primary {
  background: #2f6fed;
  color: #fff;
}

.secondary,
.ghost {
  border: 1px solid #d5dae3;
  background: #fff;
  color: #1d2433;
}

.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.wide {
  width: 100%;
}

.download-app-link {
  width: 100%;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.music-list {
  display: grid;
  gap: 12px;
}

.song-list-header,
.song-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 220px) 90px auto 76px;
  gap: 14px;
  align-items: center;
}

.song-list-header {
  padding: 0 16px;
  color: #687386;
  font-size: 13px;
  font-weight: 800;
}

.song-row {
  padding: 16px;
  border: 1px solid #dfe4eb;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.song-row:hover {
  border-color: #b8c5d8;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.song-row h3,
.song-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-row h3 {
  font-size: 17px;
}

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

.remark {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid #2f6fed;
  background: #f8fafc;
  border-radius: 6px;
  white-space: pre-wrap;
}

.row-actions {
  display: flex;
  gap: 8px;
  cursor: default;
}

.row-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: #485366;
  font-size: 14px;
  font-weight: 800;
}

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

.segmented {
  display: flex;
  gap: 0;
  padding: 3px;
  border: 1px solid #d5dae3;
  border-radius: 8px;
  background: #fff;
}

.segmented button {
  min-height: 34px;
  border-radius: 6px;
  background: transparent;
  color: #485366;
}

.segmented button.active {
  background: #2f6fed;
  color: #fff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.46);
  z-index: 10;
}

.modal-panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.25);
}

.asset-modal {
  width: min(1100px, 100%);
}

.asset-workspace {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #dfe4eb;
  border-radius: 8px;
  background: #f8fafc;
}

.asset-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.asset-section-head h4 {
  margin: 0;
  color: #151b28;
}

.asset-section-head div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.asset-detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 14px;
  align-items: start;
}

.asset-result-list {
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.asset-option {
  display: flex;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid #dfe4eb;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.asset-option input,
.image-option input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.asset-option span {
  display: grid;
  gap: 4px;
}

.asset-option em {
  color: #687386;
  font-style: normal;
  font-weight: 500;
}

.image-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.image-option {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid #dfe4eb;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.image-option img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
}

.image-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact {
  min-height: 120px;
}

.asset-detail-panel {
  display: grid;
  gap: 12px;
  min-height: 220px;
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  border: 1px solid #dfe4eb;
  border-radius: 8px;
  background: #fff;
}

.asset-detail-panel h5,
.song-detail-card h4 {
  margin: 0;
  color: #151b28;
  font-size: 18px;
}

.asset-detail-panel dl,
.song-detail-card dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.asset-detail-panel dl div,
.song-detail-card dl div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
}

.asset-detail-panel dt,
.song-detail-card dt {
  color: #687386;
  font-weight: 800;
}

.asset-detail-panel dd,
.song-detail-card dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.asset-detail-panel pre {
  max-height: 210px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
  color: #1d2433;
  font-family: inherit;
  line-height: 1.65;
  white-space: pre-wrap;
}

.asset-detail-image {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 8px;
  background: #eef2f6;
}

.song-detail-card {
  display: grid;
  gap: 16px;
}

.player-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 20px;
  align-items: start;
}

.player-media,
.lyrics-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #dfe4eb;
  border-radius: 8px;
  background: #fff;
}

.local-cache-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.player-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.player-controls button {
  min-height: 44px;
}

.player-toggle {
  font-weight: 800;
}

.cache-status {
  margin: 0;
  color: #687386;
  font-size: 13px;
  font-weight: 700;
}

.cache-status[data-type="success"] {
  color: #047857;
}

.cache-status[data-type="error"] {
  color: #b91c1c;
}

.player-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.player-images figure {
  margin: 0;
}

.player-images img,
.player-image-placeholder {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #eef2f6;
}

.player-image-placeholder {
  display: grid;
  place-items: center;
  color: #687386;
  min-height: 260px;
}

.player-images figcaption {
  margin-top: 8px;
  color: #687386;
  font-size: 13px;
}

.lyrics-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.lyrics-head h3 {
  margin: 0;
}

.lyrics-list {
  max-height: 64vh;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 8px 4px;
}

.lyric-line {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  color: #687386;
  line-height: 1.7;
  transition:
    transform 0.18s ease,
    color 0.18s ease,
    background 0.18s ease;
}

.lyric-line.active {
  color: #151b28;
  background: #eef4ff;
  font-size: 22px;
  font-weight: 900;
  transform: scale(1.04);
}

.player-empty {
  min-height: 180px;
}

.fullscreen-player {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: #000;
  overflow: hidden;
}

.fullscreen-player img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fullscreen-close {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 32;
  background: rgba(255, 255, 255, 0.86);
  color: #111827;
}

.fullscreen-lyrics {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 28px;
  z-index: 31;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 0 24px;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.fullscreen-lyrics p {
  margin: 0;
  max-width: min(1100px, 100%);
  font-size: 22px;
  line-height: 1.35;
  font-weight: 700;
}

.fullscreen-lyrics p.active {
  font-size: 34px;
  font-weight: 900;
}

.form-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-btn {
  width: 40px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.error {
  margin: 0;
  color: #b91c1c;
  font-weight: 700;
}

.hidden {
  display: none;
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    width: 250px;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
    pointer-events: auto;
  }

  .account-entry {
    width: auto;
    margin-left: auto;
    margin-top: 0;
  }

  .content {
    padding: 20px;
  }

  .page-head,
  .song-list-header,
  .song-row {
    grid-template-columns: 1fr;
  }

  .song-row {
    align-items: stretch;
  }

  .row-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .asset-detail-grid,
  .player-layout,
  .asset-search-row {
    grid-template-columns: 1fr;
  }

  .asset-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .asset-section-head div {
    justify-content: stretch;
  }

  .asset-section-head button {
    flex: 1;
  }
}

.native-app .music-list {
  gap: 8px;
}

.native-app .song-list-header.native-row,
.native-app .song-row.native-row {
  grid-template-columns: minmax(92px, 1fr) minmax(176px, 45vw) 24px;
  gap: 8px;
  align-items: center;
}

.native-app .song-list-header.native-row {
  padding: 0 10px;
}

.native-app .song-row.native-row {
  min-height: 48px;
  padding: 8px 10px;
}

.native-app .song-row.native-row h3 {
  font-size: 15px;
}

.native-app .song-row.native-row .row-actions {
  min-width: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 6px;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.native-app .song-row.native-row .row-actions::-webkit-scrollbar {
  display: none;
}

.native-app .song-row.native-row .row-actions button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 13px;
}

.native-app .song-list-header.native-row .row-check,
.native-app .song-row.native-row .row-check {
  justify-content: center;
}

.native-app .song-list-header.native-row .row-check input,
.native-app .song-row.native-row .row-check input {
  width: 18px;
  height: 18px;
}
