:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --card-hover: #22262f;
  --text: #e8e6e1;
  --muted: #8b8f98;
  --accent: #d97b2e;
  --border: #2a2e37;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; min-height: 100vh; }

/* ===== 顶部 ===== */
.top { background: #14161c; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.top-inner { max-width: 1100px; margin: 0 auto; padding: 12px 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top h1 { font-size: 19px; color: var(--accent); white-space: nowrap; }

/* 搜索框：下拉 + 输入 + 按钮 一体胶囊，靠右 */
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 420px; display: flex; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 22px; overflow: hidden; }
.search-box select {
  background: transparent; border: none; color: var(--muted); font-size: 13px;
  padding: 0 6px 0 12px; height: 36px; outline: none; flex-shrink: 0; max-width: 60px;
  -webkit-appearance: none; appearance: none;
}
.search-box select option { background: var(--card); color: var(--text); }
.search-box input {
  flex: 1; min-width: 0; background: transparent; border: none; color: var(--text);
  padding: 9px 4px; font-size: 14px; outline: none;
  border-left: 1px solid var(--border); /* | 分隔 */
}
.search-box input::placeholder { color: #5c6068; }
.search-box button {
  background: var(--accent); color: #fff; border: none; border-radius: 50%;
  width: 30px; height: 30px; font-size: 14px; cursor: pointer; line-height: 1;
  margin-right: 3px; flex-shrink: 0;
}
.search-box button:hover { filter: brightness(1.1); }

.main-nav { max-width: 1100px; margin: 0 auto; padding: 0 14px 6px; display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav-link {
  color: var(--muted); text-decoration: none; font-size: 14px;
  padding: 6px 14px; border-radius: 18px; border: 1px solid var(--border); /* 默认显示边框 */
  white-space: nowrap;
}
.nav-link:hover { color: var(--text); border-color: var(--accent); }
.nav-link.on { color: #fff; background: var(--accent); border-color: var(--accent); }

/* 宣传语：极慢滚动横幅 */
.slogan {
  max-width: 1100px; margin: 0 auto; padding: 8px 0 10px;
  overflow: hidden; white-space: nowrap; text-align: center;
  color: var(--accent); font-size: 13px;
  background: linear-gradient(90deg, rgba(217,123,46,.10), rgba(217,123,46,.18), rgba(217,123,46,.10));
  border-top: 1px solid rgba(217,123,46,.3);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.slogan-track { display: inline-flex; animation: slogan-scroll 90s linear infinite; }
.slogan-track span { padding: 0 30px; }
@keyframes slogan-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .slogan-track { animation: none; }
}

/* ===== 管理后台 ===== */
.admin-tabs { max-width: 1100px; margin: 0 auto; padding: 0 14px 6px; display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ===== 条幅广告 ===== */
.banner { max-width: 1100px; margin: 0 auto; padding: 0 14px 8px; }
.banner img { width: 100%; border-radius: 12px; display: block; max-height: 180px; object-fit: cover; }

/* ===== 首页 ===== */
main { max-width: 1100px; margin: 0 auto; padding: 14px; }
.result-bar { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.result-bar a { color: var(--accent); text-decoration: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; display: flex; gap: 10px; text-decoration: none; color: var(--text);
  transition: background .15s;
}
.card:active { background: var(--card-hover); }
.card-cover {
  width: 52px; height: 52px; border-radius: 10px; background: linear-gradient(135deg, #2b3140, #1d212b);
  display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.card-body { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.card-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-meta { font-size: 12px; color: var(--muted); }
.card-add {
  margin-top: 8px; align-self: flex-start;
  background: rgba(217,123,46,.12); color: var(--accent);
  border: 1px solid rgba(217,123,46,.4); border-radius: 8px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; line-height: 1.6;
}
.card-add:active { background: var(--accent); color: #fff; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 8px; background: #233044; color: #7fb0ff; }

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

/* ===== 使用说明（首页折叠） ===== */
.guide { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 13px 16px; margin-bottom: 14px; }
.guide summary { cursor: pointer; font-weight: 600; font-size: 14.5px; list-style: none; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary::before { content: '📖 '; }
.guide .guide-body { margin-top: 10px; font-size: 13.5px; line-height: 2.1; color: var(--text); }
.guide .guide-body b { color: var(--accent); }

/* ===== 专辑详情 ===== */
.detail { max-width: 860px; }
.back { color: var(--accent); text-decoration: none; font-size: 14px; }
.detail-head { display: flex; gap: 18px; margin: 16px 0; }
.detail-cover {
  width: 110px; height: 110px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, #2b3140, #1d212b);
  display: flex; align-items: center; justify-content: center; font-size: 50px;
}
.detail-info h2 { font-size: 20px; margin-bottom: 10px; line-height: 1.4; }
.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-meta span {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 5px 11px; font-size: 12.5px; color: var(--muted);
}
.tip { margin-top: 14px; background: #1c2117; border: 1px solid #3a4a22; color: #b8c98f; border-radius: 10px; padding: 13px 15px; font-size: 13px; line-height: 1.7; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 26px 0 36px; }

/* ===== 购物车 ===== */
.cart-btn {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 8px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text);
}
.cart-btn:active { border-color: var(--accent); }
.cart-btn b { color: #fff; }
.cart-panel {
  display: none; position: fixed; right: 10px; top: 62px; width: 380px; max-width: calc(100vw - 20px);
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5); z-index: 50; overflow: hidden;
}
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.cart-head a { color: var(--accent); font-size: 12px; margin-left: 8px; text-decoration: none; }
.cart-list { max-height: 40vh; overflow-y: auto; padding: 4px 0; -webkit-overflow-scrolling: touch; }
.cart-empty { color: var(--muted); text-align: center; padding: 22px; font-size: 13px; }
.cart-item { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 13px; border-bottom: 1px solid #20242d; }
.ci-no { color: var(--accent); font-weight: 700; width: 20px; flex-shrink: 0; font-size: 12px; }
.ci-title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-album { color: var(--muted); font-size: 11px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ci-del { color: #e06c5e; text-decoration: none; font-size: 14px; flex-shrink: 0; padding: 4px; }
.cart-foot { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.cart-foot input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font-size: 13px; outline: none; min-width: 0;
}
.cart-foot .btn { flex-shrink: 0; }

/* ===== 曲目表格 ===== */
.tracks-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
.tracks { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: 13px; }
.tracks th {
  text-align: left; padding: 10px 12px; background: #171a21; color: var(--muted);
  font-size: 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tracks td { padding: 10px 12px; border-bottom: 1px solid #20242d; }
.tracks tr:last-child td { border-bottom: none; }
.tracks tr:active td { background: #1e222b; }
.t-no { color: var(--muted); width: 44px; }
.t-title { font-weight: 600; }
.t-perf { color: var(--muted); white-space: nowrap; }
.t-file { color: var(--muted); font-size: 11px; word-break: break-all; }
.t-idx { color: var(--muted); font-size: 11px; white-space: nowrap; }
.t-album a { color: var(--accent); text-decoration: none; }
.t-ji { color: var(--muted); white-space: nowrap; }
.t-add { text-align: center; width: 48px; }
.mini-add {
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  width: 30px; height: 30px; font-size: 17px; cursor: pointer; line-height: 1;
}
.mini-add:active { filter: brightness(1.2); }

/* ===== 按钮 / 分页 / 弹窗 / toast ===== */
.btn {
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  padding: 10px 18px; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn:active { filter: brightness(1.15); }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.pg {
  padding: 7px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--border);
  color: var(--muted); text-decoration: none; font-size: 13px; cursor: pointer;
}
.pg:active { border-color: var(--accent); }
.pg.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.pg-go { display: inline-flex; gap: 4px; align-items: center; }
.pg-go input { width: 52px; background: var(--card); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 6px; text-align: center; font-size: 13px; }

#modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100;
  align-items: center; justify-content: center;
}
.modal-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 24px; max-width: 460px; width: calc(100vw - 32px); position: relative;
  text-align: center; font-size: 15px; line-height: 1.7; max-height: 85vh; overflow-y: auto;
}
.modal-close { position: absolute; top: 12px; right: 16px; cursor: pointer; color: var(--muted); font-size: 16px; padding: 4px; }
#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #2a2e37; color: var(--text); padding: 10px 22px; border-radius: 20px;
  font-size: 13px; opacity: 0; transition: all .25s; pointer-events: none; z-index: 200; white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 帮助页 ===== */
.help-sec {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 14px;
}
.help-sec h3 { font-size: 15.5px; margin-bottom: 10px; color: var(--accent); }
.help-sec ul { padding-left: 4px; list-style: none; }
.help-sec li { font-size: 13.5px; line-height: 2; color: var(--text); padding-left: 18px; position: relative; }
.help-sec li::before { content: '▸'; position: absolute; left: 0; color: var(--accent); }
.help-sec li b { color: var(--text); }

/* ===== 手机端优化 ===== */
@media (max-width: 700px) {
  .top-inner { gap: 8px; }
  .top h1 { font-size: 17px; }
  .top-inner > div:last-child { flex-basis: 100%; order: 3; justify-content: stretch; }
  .search-box { order: 3; width: 100%; max-width: none; }
  .main-nav { padding: 0 10px 6px; }
  .slogan { font-size: 12px; }
  /* 移动端不显示条幅广告（仅电脑端） */
  .banner { display: none; }
  /* 移动端歌曲列表去掉所属专辑列 */
  .tracks-list th.th-album, .tracks-list td.t-album { display: none; }
  /* 移动端首页专辑卡片去掉光盘图标 */
  .card-cover { display: none; }
  .card-body { width: 100%; }
  /* 移动端专辑详情页去掉光盘图标 */
  .detail-cover { display: none; }
  .detail-head { justify-content: center; }
  /* 移动端购物车 → 外卖风格底部悬浮胶囊 */
  #cartBtn {
    position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
    z-index: 60; background: #e03434; color: #fff; border: none;
    border-radius: 26px; padding: 11px 26px; font-size: 14px; font-weight: bold;
    box-shadow: 0 4px 18px rgba(224, 52, 52, .45);
  }
  #cartBtn b { color: #fff; }
  #cartBtn::before { content: '已选 '; }
  #cartBtn b::after { content: ' 首'; }
  #cartBtn:active { transform: translateX(-50%) scale(.96); }
  /* 首页整碟定制按钮（手机更大触控区） */
  .card-add { padding: 6px 14px; font-size: 13px; }
  /* 移动端购物车面板 → 底部弹层 */
  .cart-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; max-width: none; border-radius: 16px 16px 0 0;
    max-height: 62vh; box-shadow: 0 -6px 30px rgba(0,0,0,.5);
  }
  .cart-list { max-height: 40vh; }
  main { padding: 12px 10px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card { padding: 10px; }
  .card-title { font-size: 13px; }
  .card-meta { font-size: 11px; }
  .detail-head { flex-direction: column; align-items: center; text-align: center; }
  .detail-cover { width: 90px; height: 90px; font-size: 40px; }
  .detail-meta { justify-content: center; }
  .tracks { font-size: 12.5px; }
  .tracks th, .tracks td { padding: 9px 8px; }
  .t-no { width: 36px; font-size: 11.5px; }
  .t-perf { max-width: 70px; overflow: hidden; text-overflow: ellipsis; }
  .t-album { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .t-album a { display: block; overflow: hidden; text-overflow: ellipsis; }
  .t-ji { display: none; }
  .cart-btn { padding: 7px 12px; font-size: 12.5px; }
  .pager { gap: 5px; }
  .pg { padding: 8px 11px; font-size: 12.5px; }
  .help-sec { padding: 14px 14px; }
  .help-sec li { font-size: 13px; }
}

@media (max-width: 380px) {
  .grid { grid-template-columns: 1fr; }
  .cart-panel { top: 58px; }
}

/* ===== 订单成功卡片 / 订单号复制 / 本机订单列表 ===== */
.ocode {
  margin: 10px auto; padding: 12px 16px;
  font-size: 26px; font-weight: bold; letter-spacing: 3px; color: #e06c5e;
  background: #111318; border: 1px dashed rgba(224,108,94,.55); border-radius: 12px;
  display: inline-block; cursor: pointer; word-break: break-all;
  user-select: all; -webkit-user-select: all; -webkit-touch-callout: default;
}
.ocode:active { background: #161a20; }
.ocode-tip { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.order-banner {
  margin: 6px 0 2px; padding: 10px 14px; border-radius: 8px;
  background: rgba(94,184,126,.12); border: 1px solid rgba(94,184,126,.3);
  font-size: 13px; color: #7fd39b;
}
.saved-order {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  text-decoration: none; color: var(--text);
}
.saved-order:active { border-color: var(--accent); background: var(--card-hover); }
.saved-order b { color: var(--accent); letter-spacing: 1px; font-size: 15px; white-space: nowrap; }
.saved-order span { color: var(--muted); font-size: 12px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-order i { color: var(--accent); font-style: normal; font-size: 13px; white-space: nowrap; }

/* 手机端：成功弹窗改为底部大卡片，订单号更醒目、触控更友好 */
@media (max-width: 700px) {
  #modal { align-items: flex-end; }
  .modal-box {
    border-radius: 18px 18px 0 0; width: 100%; max-width: none;
    max-height: 90vh; padding: 22px 18px calc(26px + env(safe-area-inset-bottom, 0px));
  }
  .ocode { font-size: 24px; display: block; letter-spacing: 2px; }
  .saved-order { padding: 14px; }
}
