/* ============================================================
   嘴替健身房 · 全局样式
   模块: core (全局)
   说明: 深色健身主题,移动端优先,所有颜色通过CSS变量统一管理
   ============================================================ */

:root {
  --bg: #12121f;
  --bg-card: #1d1d33;
  --bg-card-2: #26264a;
  --primary: #7c5cff;
  --primary-light: #9d85ff;
  --accent: #ff5c8a;
  --accent-2: #ffb84d;
  --success: #3ddc97;
  --warning: #ffb84d;
  --danger: #ff5c8a;
  --text: #f2f2f8;
  --text-dim: #a8a8c0;
  --text-faint: #6b6b85;
  --border: rgba(255,255,255,0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100%;
  overscroll-behavior: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- 顶部栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--bg) 80%, transparent);
  z-index: 10;
}
.topbar .brand { font-weight: 800; font-size: 18px; letter-spacing: 0.5px; }
.topbar .brand .brain { margin-right: 4px; }
.topbar .streak {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--accent-2);
  font-weight: 600;
  background: rgba(255,184,77,0.12);
  padding: 5px 10px;
  border-radius: 999px;
}

/* ---------- 页面容器 ---------- */
.page {
  flex: 1;
  padding: 8px 18px 90px;
  animation: pageIn 0.25s ease;
}
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-title { font-size: 22px; font-weight: 800; margin: 10px 0 4px; }
.page-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(18,18,31,0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  z-index: 20;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0 4px;
  border: none;
  background: none;
  color: var(--text-faint);
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  border-radius: 12px;
}
.tab .tab-icon { font-size: 22px; line-height: 1; }
.tab.active { color: var(--primary-light); }
.tab.active .tab-icon { transform: scale(1.08); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card.clickable { cursor: pointer; transition: transform 0.15s; }
.card.clickable:active { transform: scale(0.98); }

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 18px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border: none;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: transform 0.12s, opacity 0.12s;
  user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: linear-gradient(135deg, var(--primary), #5a3fd8); color: #fff; }
.btn-accent { background: linear-gradient(135deg, var(--accent), #e03a6d); color: #fff; }
.btn-ghost { background: transparent; border: 1.5px solid var(--border); color: var(--text-dim); }
.btn-success { background: linear-gradient(135deg, var(--success), #1fae74); color: #05231a; }
.btn-block { display: flex; width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ---------- 徽章 / 标签 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-card-2);
  color: var(--text-dim);
  font-weight: 600;
}
.tag-primary { background: rgba(124,92,255,0.16); color: var(--primary-light); }
.tag-accent { background: rgba(255,92,138,0.14); color: var(--accent); }
.tag-warm { background: rgba(255,184,77,0.14); color: var(--accent-2); }
.tag-success { background: rgba(61,220,151,0.14); color: var(--success); }

/* ---------- 训练题卡 ---------- */
.scene-card {
  background: linear-gradient(160deg, var(--bg-card-2), var(--bg-card));
  border: 1px solid rgba(124,92,255,0.35);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 14px;
}
.scene-eyebrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.scene-text { font-size: 19px; font-weight: 700; line-height: 1.5; margin-bottom: 14px; }
.scene-meta { display: flex; flex-wrap: wrap; gap: 8px; }

.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
}
.timer-pill.urgent { color: var(--accent); background: rgba(255,92,138,0.14); animation: pulse 1s infinite; }
.timer-pill.calm { color: var(--text-dim); background: var(--bg-card-2); }
@keyframes pulse { 50% { opacity: 0.55; } }

/* ---------- 输入区 ---------- */
.answer-input {
  width: 100%;
  min-height: 110px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  padding: 14px;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}
.answer-input:focus { border-color: var(--primary); }
.answer-input.urgent { border-color: var(--accent); }

.input-toolbar { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.char-count { font-size: 12px; color: var(--text-faint); }

.mic-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-card-2);
  font-size: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.mic-btn.listening {
  background: rgba(255,92,138,0.2);
  border-color: var(--accent);
  animation: micPulse 1.2s infinite;
}
@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(255,92,138,0.4); }
  70% { box-shadow: 0 0 0 14px rgba(255,92,138,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,92,138,0); }
}

/* ---------- 拆解结果 ---------- */
.verdict-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.score-ring {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  flex-shrink: 0;
  background:
    radial-gradient(closest-side, var(--bg-card) 79%, transparent 80% 100%),
    conic-gradient(var(--score-color, var(--primary)) calc(var(--score-pct, 0) * 1%), rgba(255,255,255,0.08) 0);
}
.score-ring .num { font-size: 24px; font-weight: 800; line-height: 1; }
.score-ring .label { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

.breakdown-block { margin-bottom: 14px; }
.breakdown-block .bd-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.breakdown-block .bd-body { font-size: 14px; line-height: 1.7; color: #d6d6e8; background: var(--bg-card-2); border-radius: var(--radius-sm); padding: 12px 14px; }

.model-answer {
  border: 1px dashed rgba(124,92,255,0.5);
  background: rgba(124,92,255,0.08);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 15px;
  line-height: 1.7;
}
.model-answer .ma-quote { font-weight: 700; font-size: 16px; margin: 6px 0; }

.dim-progress { margin-bottom: 10px; }
.dim-progress .dim-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.dim-bar { height: 8px; background: var(--bg-card-2); border-radius: 4px; overflow: hidden; }
.dim-bar .fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.8s ease; }

/* ---------- 排行榜 ---------- */
.rank-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.rank-item:last-child { border-bottom: none; }
.rank-medal { font-size: 22px; width: 34px; text-align: center; flex-shrink: 0; padding-top: 2px; }
.rank-body { flex: 1; min-width: 0; }
.rank-answer { font-size: 15px; font-weight: 600; line-height: 1.5; margin-bottom: 5px; }
.rank-foot { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-faint); }
.like-btn {
  border: none; background: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-faint); font-family: var(--font);
  padding: 3px 8px; border-radius: 999px;
}
.like-btn.liked { color: var(--accent); background: rgba(255,92,138,0.12); }

/* ---------- PK ---------- */
.pk-arena { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.pk-side { background: var(--bg-card-2); border-radius: var(--radius-sm); padding: 14px; text-align: center; }
.pk-side .pk-avatar { font-size: 34px; margin-bottom: 6px; }
.pk-side .pk-score { font-size: 30px; font-weight: 800; margin-top: 8px; }
.pk-vs { text-align: center; font-weight: 900; color: var(--accent); font-size: 18px; margin: 10px 0; letter-spacing: 2px; }
.pk-answer { font-size: 13px; color: #d6d6e8; line-height: 1.6; margin-top: 6px; min-height: 60px; }

/* ---------- 雷达图 ---------- */
.radar-wrap { display: flex; justify-content: center; padding: 10px 0; }

/* ---------- 梗图卡片 ---------- */
.meme-card {
  background: linear-gradient(150deg, #2d2d55, #1d1d33 60%);
  border: 1px solid rgba(157,133,255,0.4);
  border-radius: 18px;
  padding: 24px 22px;
  font-family: var(--font);
}
.meme-card .meme-brand { font-weight: 800; font-size: 15px; color: var(--primary-light); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
.meme-card .meme-scene { font-size: 13px; color: var(--text-dim); margin-bottom: 4px; }
.meme-card .meme-q { font-size: 17px; font-weight: 700; margin-bottom: 14px; line-height: 1.5; }
.meme-row { display: flex; gap: 8px; margin-bottom: 8px; font-size: 14px; line-height: 1.55; align-items: flex-start; }
.meme-row .lv { flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-top: 2px; }
.meme-row .lv.low { background: rgba(255,92,138,0.16); color: var(--accent); }
.meme-row .lv.mid { background: rgba(124,92,255,0.18); color: var(--primary-light); }
.meme-row .lv.top { background: rgba(255,184,77,0.16); color: var(--accent-2); }
.meme-card .meme-foot { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-dim); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%);
  background: rgba(40,40,70,0.95);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 100;
  animation: toastIn 0.25s ease;
  max-width: 80vw;
  text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }

/* ---------- 空态 / 骨架 ---------- */
.empty { text-align: center; color: var(--text-faint); padding: 40px 20px; font-size: 14px; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 24px;
  animation: pageIn 0.2s ease;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 22px;
}

/* ---------- 首页 ---------- */
.hero {
  background: linear-gradient(160deg, rgba(124,92,255,0.22), rgba(255,92,138,0.12) 70%);
  border: 1px solid rgba(124,92,255,0.3);
  border-radius: 20px;
  padding: 24px 20px;
  margin-bottom: 16px;
}
.hero .hero-day { font-size: 13px; color: var(--primary-light); font-weight: 700; margin-bottom: 6px; }
.hero .hero-title { font-size: 24px; font-weight: 800; line-height: 1.35; margin-bottom: 10px; }
.hero .hero-sub { font-size: 13px; color: var(--text-dim); line-height: 1.6; margin-bottom: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 6px; text-align: center; }
.stat-box .s-num { font-size: 20px; font-weight: 800; }
.stat-box .s-label { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

.rank-badge-row { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
