/* ==========================================================
   来猜点小曲 · 古风纸墨 UI（二版）
   视觉语言：宣纸书页 + 思源宋体题名 + 朱笔圈点
   ========================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  --paper-0: #ede3cd;      /* 页面纸底（陈年宣纸） */
  --paper-1: #f9f3e4;      /* 内容纸面 */
  --paper-2: #e9dcbf;      /* 内凹纸面 */
  --paper-3: #ddcdab;      /* 纸面加深 */
  --ink-900: #33291f;      /* 墨色标题 */
  --ink-700: #4a3b2c;      /* 正文 */
  --ink-500: #7a6548;      /* 次要文字 */
  --ink-300: #a39273;      /* 弱化文字 */
  --line: #c9b48c;         /* 仿古边框 */
  --line-soft: #ddcfae;    /* 浅边框 */
  --seal: #a83a2c;         /* 朱砂 */
  --seal-deep: #862d22;
  --seal-soft: rgba(168, 58, 44, 0.12);
  --exact-bg: #d8e6c8;     /* 完全匹配：浅豆绿 */
  --exact-line: #a8bf8c;
  --partial-bg: #f2e0ae;   /* 部分匹配：浅赭黄 */
  --partial-line: #d4b86c;
  --paper-text: #fbf3e2;
  /* 标题用思源宋体：页面 <head> 需加载 @fontsource/noto-serif-sc 的 400/600/700 */
  --font-display: "Noto Serif SC", "Songti SC", "SimSun", "STSong", serif;
  /* 正文用霞鹜文楷，CDN 失效回退思源宋体/系统宋体 */
  --font-body: "LXGW WenKai", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-soft: 0 2px 8px rgba(76, 58, 38, 0.07);
  --shadow-lift: 0 8px 24px rgba(76, 58, 38, 0.13);
}

/* ---------- Reset / 基础 ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--paper-0);
  background-image:
    radial-gradient(ellipse at 16% 18%, rgba(176, 150, 110, 0.10), transparent 55%),
    radial-gradient(ellipse at 84% 82%, rgba(176, 150, 110, 0.09), transparent 50%),
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.28), transparent 46%),
    repeating-linear-gradient(0deg, rgba(120, 96, 60, 0.012) 0 1px, transparent 1px 3px);
  color: var(--ink-700);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(14px, 3vw, 30px) clamp(10px, 3vw, 28px);
}

a {
  color: inherit;
}

del {
  color: var(--ink-300);
}

/* ---------- 书页外框 ---------- */
.page-shell {
  position: relative;
  width: 100%;
  max-width: 960px;
  background: rgba(249, 243, 228, 0.55);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: clamp(20px, 3.5vw, 38px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 12px 34px rgba(90, 70, 40, 0.10);
}

.page-shell::before,
.page-shell::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  pointer-events: none;
}

.page-shell::before {
  top: 10px;
  left: 10px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.page-shell::after {
  bottom: 10px;
  right: 10px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.page-shell--narrow {
  max-width: 780px;
}

/* ---------- 页头（题名） ---------- */
.page-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(16px, 3vw, 26px);
}

.header-left {
  justify-self: start;
  display: flex;
  align-items: center;
}

.header-center {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.header-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 4.6vw, 2.4rem);
  letter-spacing: 0.16em;
  color: var(--ink-900);
  text-align: center;
  line-height: 1.35;
  margin: 0;
}

.site-title::before,
.site-title::after {
  content: "";
  display: inline-block;
  width: clamp(24px, 4vw, 44px);
  height: 1px;
  vertical-align: middle;
}

.site-title::before {
  margin-right: 16px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.site-title::after {
  margin-left: 16px;
  background: linear-gradient(90deg, transparent, var(--line));
}

.difficulty-badge {
  display: inline-block;
  padding: 3px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 4px;
  color: var(--ink-500);
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}

/* ---------- 正文区域 ---------- */
.page-body {
  border-top: 1px dashed var(--line-soft);
  padding-top: clamp(18px, 3vw, 28px);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-700);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn:hover {
  background: rgba(201, 180, 140, 0.20);
  border-color: var(--ink-500);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn:focus-visible,
input:focus-visible,
.suggestions li:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--ink-700);
  border-color: var(--ink-700);
  color: var(--paper-text);
}

.btn-primary:hover {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: var(--paper-text);
}

.btn-seal {
  background: var(--seal);
  border-color: var(--seal);
  color: var(--paper-text);
}

.btn-seal:hover {
  background: var(--seal-deep);
  border-color: var(--seal-deep);
  color: var(--paper-text);
}

.btn-outline-seal {
  color: var(--seal);
  border-color: rgba(168, 58, 44, 0.55);
}

.btn-outline-seal:hover {
  background: var(--seal-soft);
  border-color: var(--seal);
  color: var(--seal-deep);
}

.btn-soft {
  background: var(--paper-2);
  border-color: var(--line-soft);
  color: var(--ink-700);
}

.btn-soft:hover {
  background: var(--paper-3);
  border-color: var(--line);
}

.btn-ghost {
  border-color: var(--line-soft);
  background: rgba(249, 243, 228, 0.55);
}

.btn-ghost:hover {
  background: rgba(201, 180, 140, 0.24);
  border-color: var(--ink-500);
}

.btn-icon {
  padding: 8px 12px;
  font-size: 1.05rem;
}

.close-btn {
  display: block;
  flex-shrink: 0;
  margin: 16px auto 0;
}

/* ---------- 首页：题记 ---------- */
.intro {
  max-width: 660px;
  margin: 0 auto 8px;
  text-align: center;
  line-height: 2;
  color: var(--ink-700);
}

.intro p {
  margin: 10px 0;
}

.legend-hint {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--paper-1);
  border: 1px solid var(--line-soft);
  font-size: 0.85rem;
  color: var(--ink-500);
}

.chip i {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid transparent;
}

.chip-exact i {
  background: var(--exact-bg);
  border-color: var(--exact-line);
}

.chip-partial i {
  background: var(--partial-bg);
  border-color: var(--partial-line);
}

.chip-arrow {
  color: var(--seal);
  border-color: rgba(168, 58, 44, 0.4);
}

/* ---------- 首页：难度目录（朱笔圈点） ---------- */
.choose-level-prompt {
  text-align: center;
  margin: 26px 0 18px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--ink-900);
}

.choose-level-prompt::before {
  content: "— ";
  opacity: 0.5;
}

.choose-level-prompt::after {
  content: " —";
  opacity: 0.5;
}

.level-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.level-row {
  position: relative;
  display: block;
  padding: 16px 16px 14px;
  background: linear-gradient(160deg, rgba(249, 243, 228, 0.95), rgba(244, 234, 214, 0.78));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--ink-700);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.level-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: transparent;
  transition: background 0.2s;
}

.level-row:hover {
  transform: translateY(-2px);
  border-color: var(--line);
  box-shadow: var(--shadow-lift);
}

.level-row:hover::before {
  background: var(--seal);
}

.level-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 62px;
  min-height: 34px;
}

/* 序号圆圈：悬停时被朱笔圈点 */
.level-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-0);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-500);
  transition: border-color 0.2s, color 0.2s;
  user-select: none;
}

.level-row:hover .level-num {
  border-color: var(--seal);
  color: var(--seal);
}

.level-name {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--ink-900);
}

.level-count {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 2px 9px;
  font-size: 0.72rem;
  color: var(--ink-500);
  background: rgba(249, 243, 228, 0.75);
  border: 1px dashed var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.level-count b {
  font-weight: 700;
  color: var(--ink-900);
}

.level-desc {
  margin-top: 10px;
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--ink-500);
}

.level-desc .m-tag {
  font-size: 0.8rem;
  color: var(--ink-300);
}

/* ---------- 游戏页：输入与计数 ---------- */
.guess-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
  font-size: 0.95rem;
  color: var(--ink-500);
}

.guess-counter::before,
.guess-counter::after {
  content: "";
  width: clamp(24px, 8vw, 90px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line));
}

.guess-counter::after {
  background: linear-gradient(90deg, var(--line), transparent);
}

.guess-counter span {
  font-weight: 700;
  color: var(--ink-900);
}

.input-area {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 26px;
  position: relative;
}

#songInput {
  flex: 1 1 220px;
  min-width: 0;
  padding: 11px 18px;
  font-size: 1rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-700);
  outline: none;
  font-family: inherit;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

#songInput::placeholder {
  color: var(--ink-300);
}

#songInput:focus {
  border-color: var(--ink-500);
  background: #fffdf5;
  box-shadow: 0 0 0 3px rgba(122, 101, 72, 0.14);
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: var(--paper-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  max-height: 220px;
  overflow-y: auto;
  display: none;
}

.suggestions li {
  padding: 10px 14px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--ink-700);
  transition: background 0.15s, color 0.15s;
}

.suggestions li:hover {
  background: var(--seal-soft);
  color: var(--ink-900);
}

/* ---------- 游戏页：反馈卡片 ---------- */
.history {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.guess-card {
  background: var(--paper-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.2s;
}

.guess-card:hover {
  border-color: var(--line);
}

.current-guess-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--ink-500);
  margin-bottom: 2px;
}

.card-row {
  display: flex;
  gap: 10px;
}

.sub-card {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 250, 0.55);
  border: 1px solid var(--line-soft);
  font-size: 0.9rem;
  color: var(--ink-700);
}

.sub-card.exact {
  background: var(--exact-bg);
  border-color: var(--exact-line);
  color: var(--ink-900);
}

.sub-card.partial {
  background: var(--partial-bg);
  border-color: var(--partial-line);
  color: var(--ink-900);
}

.sub-card .label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--ink-500);
  margin-bottom: 3px;
}

.sub-card.exact .label,
.sub-card.partial .label {
  color: var(--ink-700);
}

.sub-card .arrow {
  font-weight: 700;
  margin-left: 4px;
  color: var(--seal);
}

.sub-card.title-card {
  flex: 1 0 100%;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink-900);
  background: transparent;
  border: none;
  padding: 4px;
}

.sub-card.title-card .label {
  display: none;
}

.answer-hint {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink-900);
  margin-bottom: 6px;
}

.new-game-bottom {
  display: none;
  margin: 18px auto 0;
}

/* ---------- 弹窗 ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(47, 36, 27, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  justify-content: center;
  align-items: flex-start;
  padding: 24px 14px;
}

.modal.show {
  display: flex;
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(92vw, 460px);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  margin: auto;
  background: var(--paper-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 30px 28px;
  box-shadow: var(--shadow-lift);
  color: var(--ink-700);
  text-align: center;
}

/* 内衬装饰框：固定在弹窗内，不随内容滚动 */
.modal-content::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius-lg) - 5px);
  pointer-events: none;
}

/* 可滚动内容区 */
.modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(82vh, 680px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

/* 风格化滚动条：与纸墨主题适配（右侧滚动条） */
.modal-scroll::-webkit-scrollbar {
  width: 4px;
}

.modal-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.modal-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}

.modal-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--seal);
}

.modal-content h2,
.win-title {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--ink-900);
  margin-bottom: 16px;
  padding-left: 12px;
}

.modal-content p {
  margin-bottom: 10px;
  line-height: 1.7;
}

.modal-buttons {
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.rules-content,
.info-content,
.update-content {
  width: min(92vw, 560px);
  text-align: left;
}

.alert-content {
  width: min(92vw, 360px);
}

.confirm-content {
  width: min(92vw, 380px);
}

.info-content h2,
.update-content h2,
.rules-content h2 {
  border-bottom: 1px dashed var(--line);
  padding-bottom: 10px;
}

.rules-text,
.info-text,
.update-text {
  line-height: 1.8;
  font-size: 0.96rem;
  padding-left: 12px;
}

.rules-text p,
.info-text p {
  margin: 10px 0;
}

.rules-text ul,
.update-text ul {
  padding-left: 22px;
  margin: 10px 0;
}

.rules-text li {
  margin-bottom: 6px;
}

.info-text a {
  color: var(--seal);
  font-weight: 600;
  text-decoration: none;
}

.info-text a:hover {
  text-decoration: underline;
}

.author-block {
  display: inline-block;
  margin-top: 4px;
}

.update-text .version {
  display: block;
  font-weight: 700;
  color: var(--ink-900);
  margin-top: 12px;
}

.update-text .version:first-of-type {
  margin-top: 0;
}

.update-text .future {
  color: var(--ink-300);
  font-style: italic;
}

.answer-line {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 3px;
  line-height: 1.5;
  color: var(--ink-900);
  margin: 10px 0 14px;
}

.answer-line .quote-mark {
  font-size: 0.72em;
  font-weight: 400;
  color: var(--ink-300);
  margin: 0 6px;
}

.answer-line strong {
  font-weight: 600;
}

#winModal .modal-content {
  padding-top: 40px;
}

/* 胜利/答案弹窗：题签式小标题，突出歌名 */
#winModal .win-title {
  font-size: 1rem;
  letter-spacing: 8px;
  color: var(--ink-500);
  margin-bottom: 4px;
  padding-left: 0;
  text-align: center;
}

#winModal .win-title::before,
#winModal .win-title::after {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--line);
  vertical-align: middle;
  margin: 0 8px;
}

#coverContainer {
  text-align: center;
  margin: 0;
}

#coverImg {
  display: none;
  margin: 4px auto 14px;
  max-width: 100%;
  max-height: 190px;
  padding: 8px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 0 0 1px var(--paper-2), var(--shadow-soft);
  background: var(--paper-1);
}

.video-btn {
  display: inline-block;
  margin: 12px 0 18px;
  padding: 9px 22px;
  background: var(--ink-700);
  color: var(--paper-text);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s;
}

.video-btn:hover {
  background: var(--ink-900);
}

/* ---------- 历史记录页：账本 ---------- */
.history-stats {
  display: flex;
  justify-content: center;
  gap: clamp(18px, 5vw, 52px);
  flex-wrap: wrap;
  padding: 13px 8px;
  margin-bottom: 22px;
  border-top: 1px dashed var(--line-soft);
  border-bottom: 1px dashed var(--line-soft);
  font-size: 0.95rem;
  color: var(--ink-500);
}

.history-stats p {
  margin: 0;
  font-weight: 600;
}

.history-stats span {
  font-weight: 700;
  color: var(--ink-900);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(249, 243, 228, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--ink-700);
  transition: border-color 0.2s, background 0.2s;
}

.history-item:hover {
  border-color: var(--line);
  background: rgba(253, 249, 239, 0.9);
}

.item-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.item-title strong {
  font-size: 1rem;
  color: var(--ink-900);
}

.guess-count {
  font-weight: 600;
  color: var(--ink-500);
  white-space: nowrap;
}

.item-time {
  font-size: 0.8rem;
  color: var(--ink-300);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.empty-hint {
  text-align: center;
  color: var(--ink-300);
  padding: 28px 0;
}

#pagination {
  display: none;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
}

.pagination span {
  font-size: 0.92rem;
  color: var(--ink-500);
}

/* ---------- BGM 播放器 ---------- */
#bgm-player {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  font-family: var(--font-body);
  color: var(--ink-700);
  user-select: none;
}

.bgm-collapsed {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--seal);
  color: var(--paper-text);
  border: 2px solid rgba(251, 243, 226, 0.55);
  box-shadow: 0 4px 14px rgba(100, 45, 25, 0.28);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.bgm-collapsed:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(100, 45, 25, 0.34);
}

.bgm-expanded {
  background: linear-gradient(180deg, var(--paper-1), #f5ecd9);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px 12px;
  box-shadow: var(--shadow-lift);
  min-width: 260px;
  max-width: 320px;
}

.bgm-song-name {
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  color: var(--ink-900);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bgm-progress {
  height: 4px;
  background: rgba(122, 101, 72, 0.22);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  margin-bottom: 4px;
  transition: height 0.15s;
}

.bgm-progress:hover {
  height: 6px;
}

.bgm-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--line), var(--ink-700));
  border-radius: 4px;
}

.bgm-time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--ink-500);
  margin: 4px 0 6px;
}

.bgm-btn-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
}

.bgm-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.bgm-btn svg {
  display: block;
}

.bgm-btn-icon {
  display: flex;
}

.bgm-btn:hover {
  background: var(--seal-soft);
  color: var(--seal);
}

.bgm-btn--play {
  background: var(--seal-soft);
  color: var(--seal);
}

.bgm-btn--play:hover {
  background: rgba(168, 58, 44, 0.2);
}

.bgm-volume-wrap {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 92px;
  background: var(--paper-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  z-index: 2;
}

.bgm-volume-track {
  width: 4px;
  height: 100%;
  background: rgba(122, 101, 72, 0.22);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
}

.bgm-volume-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 80%;
  background: linear-gradient(to top, var(--ink-700), var(--line));
  border-radius: 4px;
  transition: height 0.05s;
}

.bgm-volume-handle {
  position: absolute;
  left: 50%;
  bottom: 80%;
  transform: translate(-50%, 50%);
  width: 14px;
  height: 14px;
  background: var(--seal);
  border-radius: 50%;
  border: 2px solid var(--paper-1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  transition: bottom 0.05s;
}

/* ---------- 响应式 ---------- */
@media (max-width: 700px) {
  .page-shell::before,
  .page-shell::after {
    width: 16px;
    height: 16px;
  }

  .page-shell::before {
    top: 6px;
    left: 6px;
  }

  .page-shell::after {
    bottom: 6px;
    right: 6px;
  }

  .page-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .header-left {
    width: 100%;
    justify-content: flex-start;
  }

  .header-right {
    justify-content: center;
  }

  /* 移动端按钮整体缩小 */
  .btn {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 0.88rem;
  }

  .btn-icon {
    padding: 6px 9px;
  }

  .site-title {
    font-size: 1.6rem;
    letter-spacing: 0.12em;
  }

  .site-title::before,
  .site-title::after {
    width: 16px;
  }

  .site-title::before {
    margin-right: 8px;
  }

  .site-title::after {
    margin-left: 8px;
  }

  /* 首页标题放大（限非窄版页面） */
  .page-shell:not(.page-shell--narrow) .site-title {
    font-size: 1.95rem;
    letter-spacing: 0.1em;
  }

  .page-shell:not(.page-shell--narrow) .site-title::before,
  .page-shell:not(.page-shell--narrow) .site-title::after {
    width: 18px;
  }

  .legend-hint {
    gap: 5px;
  }

  .chip {
    font-size: 0.68rem;
    padding: 3px 8px;
    gap: 5px;
  }

  .chip i {
    width: 10px;
    height: 10px;
  }

  .level-head {
    flex-wrap: wrap;
    gap: 10px;
  }

  .input-area {
    gap: 8px;
  }

  #songInput {
    flex: 1 1 100%;
    height: 42px;
    font-size: 0.95rem;
  }

  #guessBtn,
  .surrender-btn {
    flex: 1 1 0;
  }

  .card-row {
    flex-wrap: wrap;
  }

  .sub-card {
    flex: 1 1 45%;
  }

  .sub-card.title-card {
    flex: 1 0 100%;
  }

  .modal-content {
    padding: 24px 18px;
  }

  /* 历史页移动端：返回/重置同一行，标题居中 */
  .page-header--keep-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "left right"
      "title title";
    gap: 10px 8px;
  }

  .page-header--keep-grid .header-left {
    grid-area: left;
    justify-self: start;
    width: auto;
  }

  .page-header--keep-grid .header-right {
    grid-area: right;
    justify-self: end;
  }

  .page-header--keep-grid .header-center {
    grid-area: title;
  }

  .history-item {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    padding: 12px 14px;
  }

  .item-title strong {
    font-size: 0.95rem;
  }

  .guess-count {
    font-size: 0.85rem;
  }

  .item-time {
    grid-column: 1 / -1;
    justify-self: start;
    max-width: none;
    font-size: 0.72rem;
  }

  .history-item--surrendered .guess-count {
    color: var(--seal);
  }

  #bgm-player {
    bottom: 12px;
    right: 12px;
  }

  .bgm-collapsed {
    width: 44px;
    height: 44px;
  }

  .bgm-expanded {
    width: 190px;
    min-width: 0;
    padding: 14px 8px 8px;
  }

  .bgm-song-name {
    font-size: 0.7rem;
    margin-bottom: 6px;
  }

  .bgm-btn {
    width: 30px;
    height: 30px;
  }

  .bgm-btn-row {
    height: 34px;
    gap: 3px;
  }

  .bgm-volume-wrap {
    width: 20px;
    height: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
