/* ============================================================
   绕口令节奏 — 样式（Chrome 61 基线，无 gap/clamp/aspect-ratio/:has/dvh）
   语言系列·绿系（与看图说话排序 / 反义词配对一致）
   ============================================================ */
:root {
  --brand: #2fbe9e;        /* 语言系列主色 */
  --brand-dark: #249a80;
  --brand-soft: #e3f7f1;
  --ink: #33413c;
  --muted: #8a9993;
  --card: #ffffff;
  --bg: #f0fbf8;
  --warn: #ff6b57;
  --ok: #2fbe9e;
  --line: #e3eee9;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
button { font-family: inherit; cursor: pointer; }

/* ---------- 布局骨架 ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  min-height: 52px;
}
.app-header .hd-title { font-size: 17px; font-weight: 700; color: var(--ink); }
.app-header .hd-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.app-header .hd-logo { width: 30px; height: 30px; border-radius: 8px; }

.app-main {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
body { display: flex; flex-direction: column; }

.view { padding: 14px 16px calc(90px + var(--safe-bottom)); }

.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
}

/* ---------- 通用组件 ---------- */
.page-title { font-size: 20px; font-weight: 700; text-align: center; margin: 8px 0 4px; }
.home-hint { font-size: 14px; color: var(--muted); text-align: center; margin-bottom: 16px; }

.btn-main {
  display: block;
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  margin-top: 14px;
}
.btn-main:active { background: var(--brand-dark); }
.btn-ghost {
  display: block;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  margin-top: 10px;
}
.btn-ghost:active { background: var(--brand-soft); }

/* ---------- 难度选择 ---------- */
.diff-list { margin-top: 8px; }
.diff-btn {
  display: block;
  width: 100%;
  min-height: 78px;
  margin-bottom: 12px;
  border: none;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(47, 190, 158, 0.10);
  text-align: left;
  padding: 12px 16px;
}
.diff-btn .diff-head { display: block; font-size: 17px; font-weight: 700; color: var(--ink); }
.diff-btn .diff-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.diff-btn:active { background: var(--brand-soft); }

/* ---------- 绕口令列表（档位内） ---------- */
.rap-list { margin-top: 8px; }
.rap-btn {
  display: block;
  width: 100%;
  min-height: 74px;
  margin-bottom: 12px;
  border: none;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(47, 190, 158, 0.10);
  text-align: left;
  padding: 12px 16px;
}
.rap-btn .rap-head { display: block; font-size: 16px; font-weight: 700; color: var(--ink); }
.rap-btn .rap-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.rap-btn .rap-best { display: block; font-size: 12px; color: var(--brand-dark); margin-top: 4px; }
.rap-btn:active { background: var(--brand-soft); }

/* ---------- 节奏赛局 ---------- */
.round-head { text-align: center; margin-bottom: 6px; }
.round-title { font-size: 15px; font-weight: 700; }
.round-prog { font-size: 12px; color: var(--muted); margin-top: 2px; }

.speed-row {
  display: flex;
  justify-content: center;
  margin: 8px 0 4px;
}
.speed-btn {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  margin: 0 5px;
}
.speed-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.speed-btn:active { background: var(--brand-soft); }
.speed-btn.on:active { background: var(--brand-dark); }

.full-list {
  background: var(--card);
  border-radius: 16px;
  padding: 16px 14px;
  margin: 12px 0 14px;
  box-shadow: 0 2px 8px rgba(47, 190, 158, 0.08);
}
.fl-line { font-size: 14px; line-height: 1.9; color: var(--muted); }
.fl-line.on { color: var(--ink); font-weight: 700; }
.fl-line .fl-idx { display: inline-block; width: 22px; color: var(--brand); font-weight: 700; }
.fl-line.on .fl-idx { font-weight: 800; }
.fl-line.done { color: #b7c7c0; }
.fl-line.done .fl-idx { color: #b7c7c0; }

.cur-box {
  background: var(--card);
  border: 2px solid var(--brand);
  border-radius: 18px;
  padding: 24px 14px;
  min-height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 12px 0 18px;
  box-shadow: 0 4px 14px rgba(47, 190, 158, 0.12);
}
.cur-line {
  font-size: 7.2vw;
  line-height: 1.5;
  font-weight: 700;
  color: var(--ink);
}
@media (min-width: 480px) {
  .cur-line { font-size: 34px; }
}

.rhythm-block { margin: 14px 0 8px; }
.rhythm-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.rhythm-label .rl-hit { color: var(--ok); font-weight: 700; }
.rhythm-label .rl-miss { color: var(--warn); font-weight: 700; }
.rhythm-bar {
  height: 14px;
  border-radius: 7px;
  background: var(--line);
  overflow: hidden;
}
.rhythm-fill {
  height: 100%;
  width: 100%;
  border-radius: 7px;
  background: var(--brand);
  transition: none;
}
.rhythm-fill.urgent { background: var(--warn); }
.remain-text { text-align: center; font-size: 12px; color: var(--muted); margin-top: 6px; }

.cur-now { display: block; font-size: 14px; color: var(--ink); font-weight: 700; margin-bottom: 4px; }

/* ---------- 结算浮层 ---------- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(20, 40, 35, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.overlay-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 20px;
  padding: 22px 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  text-align: center;
}
.overlay-title { font-size: 22px; font-weight: 800; }
.overlay-sub { font-size: 14px; color: var(--muted); margin-top: 6px; }
.stars-line { font-size: 30px; letter-spacing: 4px; margin-top: 8px; }
.record-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 12px;
  background: #fff4d6;
  color: #b8860b;
  font-size: 13px;
  font-weight: 700;
}
.checkin-line { font-size: 13px; color: var(--ok); margin-top: 10px; }

/* ---------- 打卡日历 ---------- */
.calendar {
  background: var(--card);
  border-radius: 16px;
  padding: 14px 12px;
  box-shadow: 0 2px 8px rgba(47, 190, 158, 0.08);
}
.calendar-grid {
  display: flex;
  flex-wrap: wrap;
  margin-top: 8px;
}
.cal-day {
  width: 12.5%;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
  border-radius: 8px;
  margin: 2px 0;
}
.cal-day.done { background: var(--brand); color: #fff; font-weight: 700; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--brand); color: var(--ink); font-weight: 700; }
.cal-day.today.done { box-shadow: inset 0 0 0 2px #fff; }
.streak-info { text-align: center; font-size: 14px; color: var(--ink); margin-top: 12px; }
.streak-info b { color: var(--brand); font-size: 18px; }

/* ---------- 页脚按钮 ---------- */
.btn-hit {
  display: block;
  width: 100%;
  min-height: 58px;
  border: none;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(47, 190, 158, 0.25);
}
.btn-hit:active { background: var(--brand-dark); transform: scale(0.98); }
.btn-back {
  display: block;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
}
.btn-back:active { background: var(--brand-soft); }

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