:root {
  --bg: #0d0a06;
  --panel: #161009;
  --panel-2: #291c0d;
  --text: #dbdbdb;
  --muted: #b7a37f;
  --accent: #fd760e;
  --danger: #ff8d6b;
  --ok: #8fbe6e;
  --line: #3a2d17;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100%;
}

body {
  padding-bottom: env(safe-area-inset-bottom);
}

body.has-player {
  padding-bottom: calc(128px + env(safe-area-inset-bottom));
}

button {
  font: inherit;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--panel-2);
  color: var(--text);
}

button.primary {
  background: var(--accent);
  color: #1b1102;
  font-weight: 600;
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

input,
textarea,
select {
  font: inherit;
  width: 100%;
  background: #120c05;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 6px;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.topbar .title {
  flex: 1;
  font-weight: 600;
}

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

.chip {
  border: 1px solid #4a3a1e;
  border-radius: 999px;
  padding: 6px 12px;
  background: transparent;
  font-size: 14px;
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1b1102;
}

.group-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.group-row .main {
  flex: 1;
  min-width: 0;
}

.group-row h3 {
  margin: 0 0 2px;
}

.audio-card h4 {
  margin: 0 0 6px;
  padding-right: 40px;
  font-size: 17px;
}

.audio-card {
  position: relative;
}

.pin-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.pin-btn.pinned {
  background: var(--panel-2);
  color: var(--accent);
}

.brand-title {
  color: #d9d7fa;
}

.audio-title {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-title .download-hint {
  font-size: 13px;
  color: var(--muted);
  font-weight: normal;
}

/* 循环播放标记：放在音频名称左边 */
.loop-hint {
  display: inline-block; /* transform 对行内元素无效，需要块级化 */
  flex: none;
  font-size: 15px;
  color: var(--accent);
  cursor: help;
  transform: rotate(30deg); /* 顺时针 30° */
}

.no-file-title {
  color: #6a6a6a;
  cursor: default;
}

.scale-note {
  white-space: pre-wrap;
  background: var(--panel-2);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

#changelog-fab {
  position: fixed;
  right: 14px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 45;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

body.has-player #changelog-fab {
  bottom: calc(132px + env(safe-area-inset-bottom));
}

.changelog-day {
  margin-bottom: 14px;
}

.changelog-date {
  font-weight: 600;
  margin-bottom: 6px;
}

.changelog-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 6px 0;
  font-size: 14px;
}

.changelog-type {
  flex: 0 0 auto;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--accent);
}

.changelog-type.fix-u {
  color: var(--danger);
}

.changelog-type.perf {
  color: var(--ok);
}

.eq-setting {
  margin: 14px 0;
}

.eq-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 4px;
}

.eq-label span:last-child {
  color: var(--accent);
}

.eq-desc {
  font-size: 12px;
  margin-top: 2px;
}

input[type="range"] {
  padding: 0;
  background: transparent;
  accent-color: var(--accent);
}

.audio-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.tag-pill,
.score-pill {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-2);
}

.audio-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.btn-row button {
  flex: 1;
  min-width: 110px;
}

.search-row {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.search-row input {
  flex: 1;
}

.search-row button {
  flex: 0 0 auto;
}

.chain-card {
  border: 1px solid var(--line);
}

.chain-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.chain-name {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 2px;
}

.chain-items {
  margin-top: 10px;
}

.chain-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding: 8px 0;
}

.chain-item:first-child {
  border-top: 0;
}

.chain-item-main {
  flex: 1;
  min-width: 0;
}

.chain-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chain-plus,
.chain-remove {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  color: var(--accent);
  font-size: 18px;
}

.chain-remove {
  color: var(--danger);
}

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

.chain-hint {
  flex: none;
  font-size: 15px;
}

.pin-hint {
  color: var(--accent);
  margin-right: 4px;
}

.picker-list {
  margin-top: 10px;
  max-height: 46vh;
  overflow: auto;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.picker-item:first-child {
  border-top: 0;
}

.picker-item-main {
  flex: 1;
  min-width: 0;
}

.picker-item-main > div:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  background: transparent;
  padding: 6px 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}

.modal {
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow: auto;
  background: var(--panel);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}

.modal h2 {
  margin: 0 0 4px;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-head h2 {
  flex: 1;
  margin: 0;
}

.modal.changelog-modal {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal.changelog-modal #changelog-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions button {
  flex: 1;
}

.banner {
  background: #241808;
  border: 1px solid #8a5a17;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  color: #ffe4b0;
}

.banner .headline {
  font-weight: 600;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  background: #f8d9a0;
  color: #241505;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  z-index: 100;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 12px;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
}

.history-item {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.history-item:last-child {
  border-bottom: 0;
}

.score-input-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.score-input-row button {
  flex: 0 0 40px;
  padding: 8px 0;
  border-radius: 8px;
}

.score-input-row button.selected {
  background: var(--accent);
  color: #1b1102;
}

#player-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(22, 15, 7, 0.97);
  border-top: 1px solid #6b4a16;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  z-index: 40;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35);
}

#player-bar .pb-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

#pb-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#player-bar .pb-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pb-chapter-name {
  margin: -2px 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pb-time {
  font-size: 12px;
  color: var(--muted);
  min-width: 38px;
}

.pb-seek-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

#pb-seek {
  width: 100%;
  padding: 0;
  background: transparent;
  accent-color: var(--accent);
}

.pb-chapters {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 18px;
  transform: translateY(-50%);
  pointer-events: none;
}

.pb-chapter-dot {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.pb-chapter-dot.active {
  background: #fff0d6;
  box-shadow: 0 0 0 2px var(--accent);
}

#pb-volume {
  flex: 1;
  padding: 0;
  background: transparent;
  accent-color: var(--accent);
}

.pb-vol-label {
  font-size: 12px;
  color: var(--muted);
}

#pb-toggle {
  min-width: 46px;
  padding: 6px 10px;
}
