/* ========== 全局基础 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Noto Serif SC", "Songti SC", "SimSun", "KaiTi", serif;
  background: #f5efe0; /* 米黄底 */
  background-image: radial-gradient(circle at 20% 30%, rgba(180,150,110,0.08) 0%, transparent 50%);
  color: #4e3b2c;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 30px 20px;
}

/* ========== 主容器 ========== */
.container,
.history-page {
  width: 100%;
  max-width: 720px;
  background: rgba(255, 250, 240, 0.75); /* 半透米白 */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(160, 130, 90, 0.25);
  border-radius: 20px;
  padding: 35px 28px;
  box-shadow: 0 8px 32px rgba(100, 70, 30, 0.12);
  margin: 0 auto;
}

/* 历史页头部（返回 + 重置按钮） */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.reset-btn {
  background: transparent;
  color: #c77d5a;
  border: 1px solid #c77d5a;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-family: "PingFang SC", "Microsoft YaHei", "Heiti SC", "SimHei", sans-serif;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.reset-btn:hover {
  background: rgba(199, 125, 90, 0.1);
  border-color: #a55e3e;
  color: #a55e3e;
}

/* 调整返回按钮，使其与重置按钮对齐 */
.history-page .back-btn {
  margin-bottom: 0; /* 原样式可能有下边距，此处覆盖 */
}

/* ========== 标题 ========== */
h1 {
  text-align: center;
  font-size: 2.2rem;
  font-weight: 400;
  letter-spacing: 4px;
  color: #6b4c2a;
  margin-bottom: 20px;
  border-bottom: 1px dashed #c9ad8a;
  padding-bottom: 15px;
}

h1, h2, h3, .modal-content h2, .history-page h1 {
  font-family: "PingFang SC", "Microsoft YaHei", "Heiti SC", "SimHei", sans-serif;
  font-weight: 700;
}

/* ========== 猜测计数 ========== */
.guess-counter {
  text-align: center;
  font-size: 1rem;
  margin-bottom: 25px;
  background: rgba(210, 180, 140, 0.18);
  padding: 8px 20px;
  border-radius: 30px;
  display: inline-block;
  width: 100%;
}

/* ========== 输入区域 ========== */
.input-area {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
  position: relative;
}

#songInput {
  flex: 1 1 200px;
  padding: 12px 18px;
  font-size: 1rem;
  background: rgba(255, 255, 245, 0.9);
  border: 1px solid #c5a97e;
  border-radius: 30px;
  outline: none;
  color: #4e3b2c;
  transition: all 0.25s;
  font-family: inherit;
}

#songInput:focus {
  border-color: #8b6d4a;
  box-shadow: 0 0 0 3px rgba(139, 109, 74, 0.15);
  background: #fffef9;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  list-style: none;
  background: rgba(255, 250, 240, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid #c9ad8a;
  border-radius: 12px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  z-index: 10;
  margin-top: 6px;
  box-shadow: 0 6px 18px rgba(100, 70, 30, 0.1);
}

.suggestions li {
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.suggestions li:hover {
  background: rgba(200, 170, 130, 0.2);
}

/* ========== 按钮通用 ========== */
button,
a.button {
  padding: 10px 24px;
  border: none;
  border-radius: 30px;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  white-space: nowrap;
  font-weight: 500;
}

/* 顶部按钮组 */
.top-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 18px;   /* 这里增加间距 */
}

/* 所有按钮统一加粗黑体 */
button {
  font-family: "PingFang SC", "Microsoft YaHei", "Heiti SC", "SimHei", sans-serif;
  font-weight: bold;
  /* 保留原有其他属性 */
}

.info-btn {
  background: transparent;
  color: #7b5e3b;
  border: 1px solid #c9ad8a;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.info-btn:hover {
  background: rgba(200, 170, 130, 0.2);
  border-color: #8b6d4a;
}

/* 猜测按钮 */
#guessBtn {
  background: #9b7b56;
  color: #fffef7;
  box-shadow: 0 2px 8px rgba(100, 70, 30, 0.2);
}

#guessBtn:hover {
  background: #7e5e3b;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(100, 70, 30, 0.25);
}

/* 投降按钮 */
.surrender-btn {
  background: #c77d5a;
  color: #fffef7;
  box-shadow: 0 2px 8px rgba(140, 70, 40, 0.2);
}

.surrender-btn:hover {
  background: #a55e3e;
}

.surrender-btn:disabled {
  background: #c5b6a4;
  cursor: not-allowed;
  box-shadow: none;
}

/* 信息按钮（规则、历史） */
.info-btn {
  background: rgba(180, 150, 120, 0.4);
  color: #4e3b2c;
  border: 1px solid #b89e7a;
}

.info-btn:hover {
  background: rgba(180, 150, 120, 0.6);
}

/* 底部再来一局按钮 */
.new-game-bottom {
  display: block;
  margin: 15px auto 0;
  background: #8a9a5b; /* 竹绿色调 */
  color: white;
  padding: 10px 32px;
  border-radius: 30px;
  box-shadow: 0 2px 8px rgba(80, 70, 40, 0.2);
}

.new-game-bottom:hover {
  background: #6d7d42;
}

/* ========== 卡片区域 ========== */
.history {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.guess-card {
  background: rgba(255, 250, 240, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid #d4bb9a;
  border-radius: 16px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(120, 90, 50, 0.08);
  transition: all 0.2s;
}

.guess-card:hover {
  border-color: #b7976a;
  background: rgba(255, 252, 245, 0.8);
}

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

.sub-card {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 245, 0.8);
  border: 1px solid #e5d5bc;
  font-size: 0.9rem;
  transition: all 0.2s;
}

/* 完全匹配：浅豆绿 */
.sub-card.exact {
  background: #e6f0dc;
  border-color: #b2c89a;
}

/* 部分匹配：浅麦色 */
.sub-card.partial {
  background: #f5ecd7;
  border-color: #dbb45c;
}

.sub-card .label {
  font-weight: 600;
  margin-bottom: 4px;
  color: #7b5e3b;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sub-card .arrow {
  font-weight: bold;
  margin-left: 4px;
  color: #8b5e3c;
}

/* 歌名特殊样式（第一行） */
.sub-card.title-card {
  flex: 1 0 100%;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  background: transparent;
  border: none;
  padding: 6px;
}

.sub-card.title-card .label {
  display: none; /* 歌名卡片不显示标签 */
}

/* ========== 弹窗（胜利、规则） ========== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(60, 40, 20, 0.35);
  backdrop-filter: blur(6px);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: rgba(255, 250, 240, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid #d4bb9a;
  border-radius: 24px;
  padding: 35px 30px;
  text-align: center;
  width: 360px;
  max-width: 90%;
  box-shadow: 0 20px 40px rgba(80, 50, 20, 0.2);
  color: #4e3b2c;
}

.modal-content h2 {
  font-size: 1.8rem;
  margin-bottom: 18px;
  color: #6b4c2a;
}

.modal-content p {
  margin-bottom: 10px;
  font-size: 1rem;
}

.video-btn {
  display: inline-block;
  margin: 10px 0 20px;
  padding: 8px 24px;
  background: #9b7b56;
  color: #fffef7;
  text-decoration: none;
  border-radius: 30px;
  transition: background 0.2s;
}

.video-btn:hover {
  background: #7e5e3b;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 5px;
}

.modal-buttons button {
  padding: 8px 22px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s;
}

#playAgain {
  background: #8a9a5b;
  color: white;
}

#playAgain:hover {
  background: #6d7d42;
}

#viewResult {
  background: #c9a87c;
  color: white;
}

#viewResult:hover {
  background: #a8845a;
}

/* 规则弹窗特定样式 */
.rules-content {
  width: 480px;
  max-width: 90%;
  text-align: left;
}

.rules-text {
  margin: 20px 0;
  line-height: 1.7;
}

.rules-text ul {
  padding-left: 24px;
  margin: 12px 0;
}

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

.close-btn {
  display: block;
  margin: 25px auto 0;
  background: #c9a87c;
  color: white;
  padding: 8px 30px;
  border-radius: 30px;
}

.close-btn:hover {
  background: #b08d5a;
}

/* ========== 历史记录页面专用 ========== */
/* 历史统计中的数字黑体 */
.history-stats span {
  font-family: "PingFang SC", "Microsoft YaHei", "Heiti SC", "SimHei", sans-serif;
  font-weight: 700;
}

/* 历史卡片使用固定列宽，垂直对齐猜测次数 */
.history-item {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 250, 240, 0.7);
  backdrop-filter: blur(4px);
  border: 1px solid #e5d5bc;
  border-radius: 12px;
  transition: all 0.2s;
}

.item-title {
  flex: 0 0 50%;          /* 歌名占一半宽度 */
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;    /* 过长时显示省略号 */
  padding-right: 10px;
}

.guess-count {
  flex: 0 0 20%;          /* 猜测次数固定宽度 */
  text-align: right;
  font-weight: 500;
  padding-right: 10px;
}

.item-time {
  flex: 0 0 30%;          /* 时间列 */
  text-align: right;
  font-size: 12px;
  color: #999;
}

.history-page .back-btn {
  display: inline-block;
  margin-bottom: 20px;
  padding: 6px 16px;
  background: rgba(180, 150, 120, 0.3);
  color: #4e3b2c;
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.history-page .back-btn:hover {
  background: rgba(180, 150, 120, 0.5);
}

.history-stats {
  background: rgba(210, 180, 140, 0.2);
  padding: 18px 22px;
  border-radius: 16px;
  margin-bottom: 28px;
  font-size: 1.05rem;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 15px;
  border: 1px solid #dbc2a0;
}

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

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

.history-item {
  background: rgba(255, 250, 240, 0.7);
  backdrop-filter: blur(4px);
  border: 1px solid #e5d5bc;
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.history-item:hover {
  background: rgba(255, 252, 245, 0.9);
  border-color: #c9ad8a;
}

.history-item strong {
  font-size: 1.05rem;
  color: #5b4025;
}

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

.pagination button {
  background: rgba(180, 150, 120, 0.35);
  color: #4e3b2c;
  border: 1px solid #b89e7a;
  padding: 6px 18px;
  border-radius: 20px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
  background: rgba(180, 150, 120, 0.55);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination span {
  font-size: 0.95rem;
  color: #6b4c2a;
}

/* ========== 响应式微调 ========== */

/* 通用提示弹窗 */
.alert-content {
  width: 320px;
  max-width: 90%;
}

.alert-content p {
  margin-bottom: 20px;
  font-size: 1.1rem;
}

/* 确认弹窗 */
.confirm-content {
  width: 340px;
  max-width: 90%;
}

.confirm-content p {
  margin-bottom: 20px;
  font-size: 1rem;
}

.confirm-yes {
  background: #c77d5a;
  color: white;
  padding: 8px 24px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
}

.confirm-yes:hover {
  background: #a55e3e;
}

.confirm-no {
  background: transparent;
  color: #4e3b2c;
  border: 1px solid #b89e7a;
  padding: 8px 24px;
  border-radius: 30px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
}

.confirm-no:hover {
  background: rgba(180, 150, 120, 0.2);
}

/* 当前猜测标签 */
.current-guess-label {
  font-size: 0.8rem;
  color: #8b6d4a;
  font-weight: bold;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

/* 历史记录确认弹窗按钮已定义（见前文），若未定义请添加以下 */
.confirm-content {
  width: 340px;
  max-width: 90%;
}

.confirm-content p {
  margin-bottom: 20px;
  font-size: 1rem;
}

.confirm-yes {
  background: #c77d5a;
  color: white;
  padding: 8px 24px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
}

.confirm-yes:hover {
  background: #a55e3e;
}

.confirm-no {
  background: transparent;
  color: #4e3b2c;
  border: 1px solid #b89e7a;
  padding: 8px 24px;
  border-radius: 30px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
}

.confirm-no:hover {
  background: rgba(180, 150, 120, 0.2);
}

/* 胜利弹窗顶部留空 + 歌名放大 */
#winModal .modal-content {
  padding-top: 50px;   /* 原来 35px，增加顶部空白 */
}

.answer-line {
  margin-top: 35px;   /* 上方空白，可自由调整数值 */
  font-size: 1.5rem;  /* 顺便把歌名放大一点，更突出 */
}

/* 手机端适配：缩小搜索框高度 */
/* ========== 响应式微调（手机端） ========== */
/* ========== 手机端适配 ========== */
@media (max-width: 600px) {
  .container,
  .history-page {
    padding: 20px 16px;
  }

  .input-area {
    flex-wrap: wrap;         /* 允许换行，按钮掉到下一行 */
    gap: 8px;
  }

  #songInput {
    width: 100%;             /* 输入框占满第一行 */
    flex: none;
    padding: 6px 14px;
    font-size: 0.9rem;
    height: 38px;
    line-height: 1.2;
    border-radius: 20px;
  }

  /* 按钮行：两个按钮并排，平分宽度 */
  #guessBtn,
  .surrender-btn {
    flex: 1 1 0;             /* 等宽分配 */
    padding: 6px 0;          /* 左右用 text-align 居中，不设水平 padding */
    font-size: 0.9rem;
    height: 38px;
    line-height: 1.2;
    border-radius: 20px;
    text-align: center;
  }

  .suggestions {
    right: 0;
  }

  /* 卡片内部保持灵活换行 */
  .card-row {
    flex-wrap: wrap;
  }
  .sub-card {
    flex: 1 1 45%;
  }
  .sub-card.title-card {
    flex: 1 0 100%;
  }
}