/* 选谱页（v2）—— 暖纸底 + 橙色主色，复用 app.css 的 :root 变量 */

/* ------------------------------------------------------------------ 头部 */
.sel-hero {
  padding-bottom: 14px;
}

.sel-hero h1 {
  font-size: clamp(26px, 7vw, 34px);
  margin: 6px 0 6px;
}

/* ---------------------------------------------------------------- 额度卡 */
.quota-card {
  padding: 16px 16px 14px;
  margin-bottom: 14px;
}

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

.quota-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.quota-state {
  font-size: 12px;
  font-weight: 700;
  color: var(--success-dark);
  background: var(--success-soft);
  border-radius: 999px;
  padding: 3px 10px;
}

.quota-state.is-off {
  color: var(--danger);
  background: #fbecea;
}

.quota-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0 12px;
}

.quota-cell {
  background: var(--paper-strong);
  border-radius: 12px;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.quota-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.quota-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  line-height: 1.15;
}

.quota-cell strong {
  font-size: 22px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.quota-value i {
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
}

.quota-foot {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quota-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--paper-strong);
  overflow: hidden;
}

.quota-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #f08a3c);
  transition: width 0.45s ease;
}

.quota-note {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--danger);
}

/* 额度用完/链接过期时给一条能走的路 */
.quota-renew {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--muted);
}

.quota-renew .button {
  flex: none;
  min-height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

/* ------------------------------------------------------------ 小节标题 */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 22px 2px 8px;
}

.section-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.section-foot {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- 搜索结果 */
.sel-results {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.score-card {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.score-card:active {
  transform: scale(0.995);
}

.score-card.is-picked {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.score-thumb {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--paper-strong);
  border: 1px solid var(--line);
}

.score-main {
  min-width: 0;
}

.score-name {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-meta {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.tag {
  font-size: 11px;
  line-height: 1.5;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--paper-strong);
  color: var(--muted);
}

.tag.is-hot {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.score-add {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-dark);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  white-space: nowrap;
}

.score-add[disabled] {
  border-color: var(--line);
  color: var(--muted);
  background: var(--paper-strong);
  cursor: not-allowed;
}

.empty-hint {
  margin: 14px 2px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ----------------------------------------------------------- 手动编号 */
.manual-form {
  margin-top: 14px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.manual-form label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

.manual-form b {
  color: var(--accent-dark);
}

.manual-row {
  display: flex;
  gap: 8px;
}

.manual-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  background: #fff;
  font-size: 14px;
}

.manual-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

/* ---------------------------------------------------------------- 已选 */
.sel-cart {
  margin-top: 6px;
}

.cart-tip {
  margin: 0 2px 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.cart-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.cart-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px 14px;
}

.cart-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.cart-index {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-top: 1px;
}

.cart-name {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.cart-remove {
  flex: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  padding: 2px 4px;
}

.variant-row,
.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  line-height: 1.4;
  transition: all 0.16s ease;
}

.chip.is-on {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.chip[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
}

.cart-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--warn);
}

/* -------------------------------------------------------------- 下载记录 */
.history-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

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

.history-title {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-sub {
  font-size: 11.5px;
  color: var(--muted);
}

.history-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success-dark);
  white-space: nowrap;
}

.history-badge.is-pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.history-badge.is-dead {
  background: #fbecea;
  color: var(--danger);
}

.history-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-dark);
  text-decoration: none;
  white-space: nowrap;
}

.history-tip {
  margin: 10px 2px 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* -------------------------------------------------------------- 提交栏 */
.submit-bar {
  align-items: center;
  gap: 12px;
}

.submit-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

.submit-meta strong {
  color: var(--accent-dark);
  font-size: 15px;
}

.submit-caption {
  font-size: 12px;
  color: var(--muted);
}

/* -------------------------------------------------------------- 结果弹窗 */
.result-items {
  list-style: none;
  margin: 12px 0 4px;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 46vh;
  overflow: auto;
}

.res-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  background: var(--card);
}

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

.res-name {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-sub {
  font-size: 11.5px;
  color: var(--muted);
}

.res-action {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 7px 14px;
  text-decoration: none;
  white-space: nowrap;
}

.res-action.is-pending {
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 600;
}

/* ---------------------------------------------------------------- 下载页 */
.dl-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 18px;
}

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

.dl-title {
  margin: 12px 0 6px;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: 24px;
  font-weight: 600;
}

.dl-message {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.dl-hint {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--warn);
}

.dl-foot {
  margin: 18px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.dl-pending .spinner {
  width: 26px;
  height: 26px;
}

/* -------------------------------------------------------------- 响应式 */
@media (min-width: 720px) {
  .sel-results {
    grid-template-columns: 1fr 1fr;
  }

  .quota-cell strong {
    font-size: 26px;
  }
}

/* -------------------------------------------------- 手动编号（嵌进搜索卡） */
/* 移到搜索框正下方后要去掉重复的外框，否则白卡片里套白卡片，看着像排版错乱 */
.search-panel .manual-form {
  margin-top: 12px;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px dashed var(--line);
  border-radius: 0;
  background: none;
}

.search-panel .manual-form label {
  margin-bottom: 7px;
}

/* ---------------------------------------------------------------- 加载更多 */
.load-more {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 11px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-dark);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.load-more:active {
  background: var(--accent-soft);
}

/* display:block 会盖掉 hidden 属性自带的 display:none，这里补回来 */
.load-more[hidden] {
  display: none;
}

/* ---------------------------------------------------------- 谱面预览 */
/* 买家只靠「歌名」判断选没选对，风险太高；给一张首页图看一眼最省事。 */
.score-preview {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 9px;
  border: 1px solid rgba(232, 89, 12, 0.45);
  border-radius: 999px;
  background: rgba(232, 89, 12, 0.07);
  color: #b4490d;
  font-size: 11px;
  line-height: 1.7;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.score-preview:hover,
.score-preview:active {
  background: rgba(232, 89, 12, 0.16);
}

.preview-dialog {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 560px);
}

/* 坑：这里原本是 display:flex + align-items:center。
   图片比容器高时，flex 居中的溢出部分会**往上下两头各溢一半**，
   上溢的那半截滚不动 —— 表现为「谱面顶部被吃掉了，怎么上滑都到不了」。
   改成块级 + text-align 居中就没有这个问题。 */
.preview-body {
  display: block;
  min-height: 200px;
  max-height: 56vh;
  padding: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  border-radius: 14px;
  background: var(--paper-strong);
}

.preview-img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
  background: #fff;
}

/* 原始尺寸：谱面文字才看得清。开启后横向也能滚，不再被压缩成一条。 */
.preview-body.is-zoomed .preview-img {
  width: 900px;
  max-width: none;
}

.preview-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.preview-tools a,
.preview-tools button {
  padding: 0;
  border: 0;
  background: none;
  color: #b4490d;
  font-size: 12px;
  line-height: 1.6;
  text-decoration: none;
  cursor: pointer;
}

.preview-fail {
  margin: 0;
  padding: 26px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.preview-tip {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* 交付版本与所选不一致时的说明（比如「高级五线谱」站内没货，给了原版） */
.res-note,
.history-note {
  margin-top: 3px;
  color: #a8460f;
  font-size: 11px;
  line-height: 1.5;
}

/* 同一句话，但「实际交付 ≠ 所选」时必须刺眼一点：
   小字真的没人看——买家下载完才发现谱子上没有指法，客诉就是这么来的。 */
.res-warn,
.history-warn {
  margin-top: 6px;
  padding: 7px 9px;
  border-left: 3px solid #d99a1f;
  border-radius: 6px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}
