/* ========================================================
   中秋灯谜 · 通用样式（微信手机端 + 国风品牌风）
   ======================================================== */
:root {
  --main: #c8102e;
  --main-light: #e8455a;
  --gold: #d4a24c;
  --gold-light: #f0d090;
  --ink: #2b1d16;
  --ink-light: #6b5a4e;
  --bg: #fdf6ec;
  --card: #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
}

body {
  background-image: var(--bg-image, none);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;
  padding-bottom: env(safe-area-inset-bottom);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 32px;
  position: relative;
}

/* ---------- 顶部 ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: 28px 0 18px;
}

.hero .logo {
  height: 46px;
  margin: 0 auto 12px;
  width: auto;
}

.hero .deco {
  color: var(--gold);
  letter-spacing: 8px;
  font-size: 12px;
  margin-bottom: 6px;
  opacity: .85;
}

.hero h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--main);
  text-shadow: 0 2px 0 rgba(212,162,76,.35);
  line-height: 1.35;
}

.hero .sub {
  margin-top: 8px;
  font-size: 14px;
  color: var(--ink-light);
  letter-spacing: 2px;
}

/* ---------- 海报 ---------- */
.poster-wrap {
  margin: 6px 0 18px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(200,16,46,.16);
  border: 2px solid rgba(212,162,76,.5);
  background: #fff;
}
.poster-wrap img { width: 100%; }

/* ---------- 小广告位 ---------- */
.ad-wrap {
  margin: 0 0 14px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(43,29,22,.08);
  border: 1px solid rgba(212,162,76,.25);
  background: #fff;
  line-height: 0;
}
.ad-wrap img { width: 100%; display: block; }
.ad-wrap a { display: block; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: 12px;
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 12px rgba(43,29,22,.06);
  border: 1px solid rgba(212,162,76,.18);
}

.card-title {
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--main);
}
.card-title::before {
  content: "";
  width: 4px; height: 16px;
  background: linear-gradient(180deg, var(--main), var(--gold));
  border-radius: 2px;
  margin-right: 8px;
}

/* ---------- 倒计时 ---------- */
.countdown {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 8px;
}
.countdown .cd-item {
  min-width: 54px;
  background: linear-gradient(180deg, #fff6f6, #ffe9ec);
  border: 1px solid rgba(200,16,46,.18);
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
}
.countdown .cd-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--main);
  font-variant-numeric: tabular-nums;
}
.countdown .cd-label { font-size: 11px; color: var(--ink-light); }
.cd-tip { text-align: center; font-size: 13px; color: var(--ink-light); }

/* ---------- 规则 ---------- */
.rule-content {
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- 按钮 ---------- */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 50px;
  padding: 15px 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #fff;
  background: linear-gradient(135deg, var(--main-light), var(--main));
  box-shadow: 0 6px 18px rgba(200,16,46,.32);
  cursor: pointer;
  transition: all .2s;
  text-align: center;
}
.btn:active { transform: translateY(1px); box-shadow: 0 3px 10px rgba(200,16,46,.3); }
.btn[disabled], .btn.disabled {
  background: #ccc;
  box-shadow: none;
  color: #fff;
  pointer-events: none;
}
.btn.btn-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 6px 18px rgba(212,162,76,.35);
  color: #6b4b1a;
}
.btn.btn-ghost {
  background: transparent;
  border: 1px solid var(--main);
  color: var(--main);
  box-shadow: none;
}

/* ---------- 表单 ---------- */
.form-item { margin-bottom: 16px; }
.form-item label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--ink);
}
.form-item label .req { color: var(--main); margin-left: 3px; }
.form-item input,
.form-item textarea {
  width: 100%;
  border: 1px solid #e6ddd2;
  background: #fdfbf7;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color .2s;
  font-family: inherit;
}
.form-item input:focus,
.form-item textarea:focus { border-color: var(--main); background: #fff; }
.form-item textarea { resize: vertical; min-height: 78px; }
.form-tip { font-size: 12px; color: #b0a094; margin-top: 6px; }

/* ---------- 题目 ---------- */
.q-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--ink-light);
}
.q-progress .bar {
  flex: 1; height: 8px;
  background: #eee2d4;
  border-radius: 4px; overflow: hidden;
}
.q-progress .bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold), var(--main));
  border-radius: 4px;
  transition: width .3s;
}

.q-item {
  padding-top: 4px;
}
.q-item + .q-item { border-top: 1px dashed #eee2d4; margin-top: 18px; padding-top: 18px; }
.q-item .q-index {
  display: inline-block;
  background: var(--main);
  color: #fff;
  font-size: 12px;
  border-radius: 4px;
  padding: 1px 8px;
  margin-right: 8px;
  vertical-align: 1px;
}
.q-item .q-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 12px;
}
.q-item input {
  width: 100%;
  border: none;
  border-bottom: 2px solid #eadfd2;
  background: transparent;
  padding: 8px 2px;
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
  font-family: inherit;
}
.q-item input:focus { border-color: var(--main); }

/* ---------- 结果 ---------- */
.result-hero {
  text-align: center;
  padding: 24px 0 12px;
}
.result-hero .score {
  font-size: 54px;
  font-weight: 800;
  color: var(--main);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.result-hero .score small { font-size: 18px; color: var(--ink-light); font-weight: 500; }
.result-hero .rank-txt {
  margin-top: 10px;
  font-size: 15px;
  color: var(--ink-light);
}
.result-hero .rank-txt b { color: var(--main); font-size: 20px; }

.stat-grid {
  display: flex;
  text-align: center;
  border-top: 1px solid #f2e9de;
  padding-top: 14px;
}
.stat-grid .stat { flex: 1; }
.stat-grid .stat .n { font-size: 20px; font-weight: 700; color: var(--ink); }
.stat-grid .stat .l { font-size: 12px; color: var(--ink-light); margin-top: 2px; }
.stat-grid .stat + .stat { border-left: 1px solid #f2e9de; }

/* ---------- 榜单 ---------- */
.rank-row {
  display: flex;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid #f5ede4;
  font-size: 14px;
}
.rank-row:last-child { border-bottom: none; }
.rank-row .no {
  width: 28px; height: 28px; line-height: 28px;
  text-align: center; border-radius: 50%;
  background: #f0e6d8; color: var(--ink-light);
  font-weight: 700; font-size: 13px; margin-right: 12px;
  flex-shrink: 0;
}
.rank-row.top1 .no { background: linear-gradient(135deg,#f7d774,#d4a24c); color:#fff; }
.rank-row.top2 .no { background: linear-gradient(135deg,#dfe4ea,#a8b2bd); color:#fff; }
.rank-row.top3 .no { background: linear-gradient(135deg,#efc39a,#c98f5c); color:#fff; }
.rank-row .name { flex: 1; font-weight: 600; }
.rank-row .score-txt { color: var(--main); font-weight: 700; }

.award-badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #6b4b1a;
  font-weight: 700;
  margin-left: auto;
}

/* ---------- 明细 ---------- */
.detail-row {
  padding: 12px 0;
  border-bottom: 1px dashed #f0e6d8;
  font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .dt-title { font-weight: 600; margin-bottom: 6px; }
.detail-row .dt-ans { font-size: 13px; color: var(--ink-light); }
.detail-row .dt-ans .right { color: #2e8b57; }
.detail-row .dt-ans .wrong { color: var(--main); }
.detail-row .mark { float: right; font-weight: 700; }
.detail-row .mark.ok { color: #2e8b57; }
.detail-row .mark.no { color: var(--main); }

/* ---------- 状态提示 ---------- */
.status-bar {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-light);
}
.status-bar .icon { font-size: 44px; margin-bottom: 12px; }
.status-bar .txt { font-size: 16px; }

/* ---------- 底部 ---------- */
.footer {
  text-align: center;
  font-size: 12px;
  color: #8b1a1a;
  padding: 22px 0 10px;
  letter-spacing: 1px;
}

/* ---------- 弹窗 ---------- */
.toast {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  background: rgba(0,0,0,.78);
  color: #fff;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  max-width: 76%;
  text-align: center;
  line-height: 1.5;
}
.mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9998;
  display: none;
}
.mask.show { display: block; }

/* ---------- 底部固定操作栏 ---------- */
.bottom-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 14px rgba(0,0,0,.07);
  z-index: 100;
}
.bottom-bar .inner { max-width: 640px; margin: 0 auto; }
.has-bottom-bar { padding-bottom: 90px; }

/* ---------- 背景音乐悬浮按钮 ---------- */
.music-btn {
  position: fixed;
  right: 14px;
  bottom: 88px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8455a, var(--main, #c8102e));
  box-shadow: 0 4px 14px rgba(200, 16, 46, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  cursor: pointer;
  color: #fff;
  transition: transform .2s, box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}
.music-btn:active { transform: scale(.9); }

/* 暂停态：同样中国红，仅图标切为静音喇叭（不置灰、不变色） */
.music-btn.paused {
  background: linear-gradient(135deg, #e8455a, var(--main, #c8102e));
  box-shadow: 0 4px 14px rgba(200, 16, 46, .35);
}

/* 喇叭图标：默认显示静音喇叭，播放时切到有声喇叭 */
.music-btn .music-on,
.music-btn .music-mute {
  position: absolute;
  opacity: .96;
  transition: opacity .2s;
}
.music-btn .music-on { opacity: 0; }
.music-btn.paused .music-mute { opacity: .96; }
.music-btn.playing .music-mute { opacity: 0; }
.music-btn.playing .music-on { opacity: .96; }

/* 播放态音波在右侧（半圆环自带），喇叭略微左移让出音波空间 */
.music-btn.playing .music-bars { margin-left: 4px; }
.music-btn.playing .music-on { transform: translateX(-3px); }

/* 音波动画 */
.music-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  opacity: 0;
  transition: opacity .2s;
}
.music-btn.playing .music-bars { opacity: 1; }
.music-bars i {
  display: block;
  width: 3px;
  height: 5px;
  background: #fff;
  border-radius: 2px;
  animation: musicBar .9s ease-in-out infinite;
}
.music-bars i:nth-child(1) { animation-delay: 0s; }
.music-bars i:nth-child(2) { animation-delay: .2s; }
.music-bars i:nth-child(3) { animation-delay: .4s; }
.music-bars i:nth-child(4) { animation-delay: .6s; }
@keyframes musicBar {
  0%, 100% { height: 4px; }
  50% { height: 15px; }
}

/* 播放时轻微呼吸光环 */
.music-btn.playing::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(200, 16, 46, .35);
  animation: musicRing 1.6s ease-out infinite;
}
@keyframes musicRing {
  0%   { transform: scale(.85); opacity: .9; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* 未播放时的引导态：呼吸闪烁 */
.music-btn.need-tap {
  animation: musicBreathe 1.6s ease-in-out infinite;
}
@keyframes musicBreathe {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 14px rgba(200, 16, 46, .35);
  }
  50% {
    transform: scale(1.12);
    box-shadow: 0 6px 22px rgba(200, 16, 46, .55);
  }
}

/* 引导气泡 */
.music-tip {
  position: fixed;
  right: 64px;
  bottom: 98px;
  background: rgba(43, 29, 22, .86);
  color: #fff;
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: 18px;
  white-space: nowrap;
  z-index: 121;
  opacity: 0;
  transform: translateX(10px);
  animation: tipIn .35s ease forwards;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
  pointer-events: none;
}
.music-tip::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  margin-top: -5px;
  border: 5px solid transparent;
  border-left-color: rgba(43, 29, 22, .86);
  border-right: none;
}
.music-tip.hide {
  animation: tipOut .3s ease forwards;
}
@keyframes tipIn {
  to { opacity: 1; transform: translateX(0); }
}
@keyframes tipOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(10px); }
}


