/* ============ HD53 数字化学习平台 · 样式 ============ */
:root {
  --ink: #1b2a27;
  --ink-soft: #4a5b57;
  --muted: #7d8b87;
  --line: #e7e3da;
  --paper: #f6f3ec;
  --paper-2: #fffdf8;
  --card: #ffffff;
  --primary: #0f5c52;
  --primary-d: #0a423b;
  --primary-l: #2e8076;
  --gold: #c79a3a;
  --gold-l: #e6c878;
  --danger: #c0573f;
  --ok: #3f8f6b;
  --shadow: 0 6px 24px rgba(20, 50, 45, .08);
  --shadow-s: 0 2px 8px rgba(20, 50, 45, .06);
  --r: 16px;
  --r-s: 10px;
  --sidew: 208px;
  --maxw: 940px;
  font-size: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; overflow-x: hidden; width: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; cursor: pointer; }
b { font-weight: 700; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(180deg, var(--primary), var(--primary-d));
  color: #fff;
  padding-top: env(safe-area-inset-top);
  height: calc(56px + env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.brand-mark {
  font-weight: 800; letter-spacing: .5px; font-size: 20px;
  background: var(--gold); color: var(--primary-d);
  padding: 2px 8px; border-radius: 8px;
}
.brand-mark b { color: var(--primary-d); }
.brand-name { font-size: 15px; font-weight: 600; opacity: .95; }
.streak-pill {
  background: rgba(255,255,255,.16); padding: 5px 11px; border-radius: 20px;
  font-size: 14px; font-weight: 600;
}

/* ---------- 侧边导航（桌面） ---------- */
.sidenav {
  position: fixed; top: calc(56px + env(safe-area-inset-top)); bottom: 0; left: 0;
  width: var(--sidew); padding: 16px 12px;
  background: var(--paper-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; z-index: 20;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: 12px; color: var(--ink-soft); font-weight: 600; font-size: 15px;
  transition: background .15s, color .15s;
}
.nav-item .ic { font-size: 18px; width: 22px; text-align: center; }
.nav-item:hover { background: #eef3f0; }
.nav-item.active { background: var(--primary); color: #fff; }

/* ---------- 主内容 ---------- */
.view {
  margin: calc(56px + env(safe-area-inset-top)) 0 0 var(--sidew);
  padding: 22px clamp(16px, 4vw, 36px) 60px;
  min-height: 60vh;
}
.view-inner { max-width: var(--maxw); margin: 0 auto; }

/* ---------- 底部 Tab（移动端，默认隐藏） ---------- */
.tabbar { display: none; }

/* ---------- 通用元素 ---------- */
.page-title { font-size: 22px; font-weight: 800; margin: 4px 0 2px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.section-title { font-size: 17px; font-weight: 800; margin: 26px 0 12px; display:flex; align-items:center; gap:8px;}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-s);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  padding: 11px 20px; border-radius: 12px; font-size: 15px; font-weight: 700;
  font-family: inherit; transition: transform .08s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn.gold { background: var(--gold); color: var(--primary-d); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 13px;
  border-radius: 20px; background: #eef3f0; color: var(--ink-soft);
  font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
}
.chip.active { background: var(--primary); color: #fff; }
.tag { font-size: 12px; color: var(--muted); }

/* ---------- 首页 ---------- */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-l));
  color: #fff; border-radius: var(--r); padding: 22px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero::after {
  content: "教练"; position: absolute; right: -8px; bottom: -26px;
  font-size: 120px; font-weight: 900; opacity: .07; letter-spacing: -6px;
}
.hero h1 { margin: 0 0 4px; font-size: 21px; }
.hero p { margin: 0; opacity: .92; font-size: 14px; }
.hero-stats { display: flex; gap: 22px; margin-top: 16px; }
.hero-stat b { font-size: 22px; display: block; }
.hero-stat span { font-size: 12px; opacity: .85; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* 打卡卡片 */
.checkin {
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
}
.checkin .ci-top { display: flex; align-items: center; justify-content: space-between; }
.checkin h3 { margin: 0; font-size: 16px; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--gold) calc(var(--p)*1%), #e9e4d8 0);
  display: grid; place-items: center; }
.ring i { width: 50px; height: 50px; border-radius: 50%; background: var(--card);
  display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 14px; color: var(--primary); }
.reflect-box {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px;
  font-family: inherit; font-size: 14px; resize: vertical; min-height: 64px; color: var(--ink);
  background: var(--paper-2);
}
.reflect-box:focus { outline: 2px solid var(--primary-l); border-color: transparent; }
.muted-note { color: var(--muted); font-size: 13px; }

/* 今日学习卡 */
.today-card { padding: 18px; }
.today-card .eyebrow { color: var(--gold); font-weight: 800; font-size: 12px; letter-spacing: 1px; }
.today-card h3 { margin: 6px 0; font-size: 18px; }
.today-card p { margin: 0 0 12px; color: var(--ink-soft); font-size: 14px; }

/* 快捷入口 */
.quick { padding: 16px; text-align: center; cursor: pointer; transition: transform .1s; }
.quick:hover { transform: translateY(-2px); }
.quick .qi { font-size: 28px; }
.quick .qt { font-weight: 700; margin-top: 6px; font-size: 14px; }
.quick .qd { color: var(--muted); font-size: 12px; }

/* ---------- 知识库 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.fw-card {
  padding: 16px; cursor: pointer; transition: transform .1s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 8px; position: relative;
}
.fw-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.fw-card .fw-ic { font-size: 26px; }
.fw-card h3 { margin: 0; font-size: 16px; }
.fw-card .fw-tag { font-size: 12px; color: var(--gold); font-weight: 700; }
.fw-card .fw-line { font-size: 13px; color: var(--ink-soft); }
.fw-card .fw-meta { font-size: 11px; color: var(--muted); margin-top: auto; }
.learned-dot { position: absolute; top: 12px; right: 12px; color: var(--ok); font-size: 13px; font-weight: 700; }

/* 框架详情 */
.fw-detail h2 { margin: 0 0 2px; font-size: 21px; }
.fw-detail .src { color: var(--gold); font-weight: 700; font-size: 13px; }
.fw-detail .essence { background: var(--paper); border-left: 3px solid var(--primary);
  padding: 11px 14px; border-radius: 8px; margin: 14px 0; font-size: 14px; color: var(--ink-soft); }
.item-row { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.item-row:last-child { border-bottom: none; }
.item-n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--primary);
  color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.item-row h4 { margin: 0 0 2px; font-size: 15px; }
.item-row p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.q-list { margin: 8px 0 0; padding-left: 0; list-style: none; }
.q-list li { padding: 8px 12px; background: #f0f5f2; border-radius: 8px; margin-bottom: 7px;
  font-size: 14px; color: var(--primary-d); }
.quote-line { font-style: italic; color: var(--gold); font-weight: 700; margin-top: 10px; }

/* ---------- 思维模型 ---------- */
.model-card { padding: 18px; }
.model-card h3 { margin: 0 0 12px; font-size: 17px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flow .node { background: var(--primary); color: #fff; padding: 8px 14px; border-radius: 10px;
  font-size: 13px; font-weight: 700; }
.flow .arrow { color: var(--gold); font-weight: 800; }
.pyramid { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.pyramid .lvl { background: linear-gradient(135deg,var(--primary),var(--primary-l)); color: #fff;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; text-align: center; }
.wheel { display: flex; flex-wrap: wrap; gap: 7px; }
.wheel .seg { background: #eef3f0; color: var(--primary-d); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 20px; font-size: 13px; font-weight: 700; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare .col { padding: 12px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.compare .col.a { background: #fdf3e6; color: #8a5a14; border: 1px solid #f0dcb8; }
.compare .col.b { background: #e9f4ef; color: var(--primary-d); border: 1px solid #c9e6da; }
.model-note { margin-top: 12px; color: var(--ink-soft); font-size: 13px; }

/* ---------- 学习路径 ---------- */
.path { position: relative; padding-left: 30px; }
.path::before { content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.stage { position: relative; margin-bottom: 22px; }
.stage .dot { position: absolute; left: -30px; top: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800; z-index: 1; }
.stage.done .dot { background: var(--ok); }
.stage h3 { margin: 0 0 2px; font-size: 16px; }
.stage .goal { color: var(--ink-soft); font-size: 13px; margin-bottom: 10px; }
.stage .fw-mini { display: flex; flex-wrap: wrap; gap: 7px; }
.fw-mini .m {
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  padding: 6px 11px; font-size: 13px; cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; gap: 5px;
}
.fw-mini .m.learned { border-color: var(--ok); color: var(--ok); }

/* ---------- 教练对话 ---------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 56px - env(safe-area-inset-top) - 44px); max-width: 760px; margin: 0 auto; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 10px; }
.chat-head .ai-toggle { font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 8px 2px; display: flex; flex-direction: column; gap: 14px; }
.bubble { max-width: 86%; padding: 12px 15px; border-radius: 16px; font-size: 14.5px; line-height: 1.65; }
.bubble.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.bubble.coach { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 5px; box-shadow: var(--shadow-s); }
.coach-part { margin: 0 0 9px; }
.coach-part:last-child { margin-bottom: 0; }
.coach-empathy { color: var(--ink-soft); }
.coach-knowledge { background: #f0f5f2; border-left: 3px solid var(--gold); padding: 9px 12px; border-radius: 8px; font-size: 13.5px; }
.coach-question { font-weight: 700; color: var(--primary-d); }
.coach-nudge { font-size: 12.5px; color: var(--muted); }
.stage-badge { display: inline-block; font-size: 11px; font-weight: 800; color: var(--gold); margin-bottom: 4px; letter-spacing: .5px; }
.chat-input { display: flex; gap: 8px; padding-top: 10px; }
.chat-input textarea { flex: 1; border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px;
  font-family: inherit; font-size: 14.5px; resize: none; max-height: 120px; background: var(--paper-2); }
.chat-input textarea:focus { outline: 2px solid var(--primary-l); border-color: transparent; }
.chat-send { flex: none; width: 46px; border-radius: 14px; font-size: 18px; }
.suggest { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 4px; }
.suggest .s { background: #eef3f0; border: 1px solid var(--line); border-radius: 16px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--ink-soft); }
.typing { font-size: 13px; color: var(--muted); padding-left: 6px; }

/* ---------- 自测 ---------- */
.quiz-card { padding: 20px; }
.q-progress { height: 6px; background: #e9e4d8; border-radius: 4px; overflow: hidden; margin-bottom: 16px; }
.q-progress i { display: block; height: 100%; background: var(--gold); transition: width .3s; }
.q-stem { font-size: 17px; font-weight: 700; margin: 4px 0 16px; }
.opt { display: block; width: 100%; text-align: left; padding: 13px 16px; border: 1.5px solid var(--line);
  border-radius: 12px; background: var(--card); margin-bottom: 10px; cursor: pointer; font-size: 15px;
  font-family: inherit; transition: border-color .12s, background .12s; }
.opt:hover { border-color: var(--primary-l); }
.opt.correct { border-color: var(--ok); background: #e9f6ef; }
.opt.wrong { border-color: var(--danger); background: #fbece8; }
.opt.disabled { cursor: default; }
.order-list { list-style: none; padding: 0; margin: 0 0 14px; }
.order-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line);
  border-radius: 12px; margin-bottom: 8px; background: var(--card); }
.order-item .ord-btns { margin-left: auto; display: flex; gap: 6px; }
.order-item .ord-btns button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--paper); cursor: pointer; font-size: 15px; }
.explain { background: var(--paper); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--ink-soft); margin: 8px 0 14px; }
.explain.ok { border-left: 3px solid var(--ok); }
.explain.no { border-left: 3px solid var(--danger); }
.score-big { font-size: 46px; font-weight: 900; color: var(--primary); text-align: center; }
.score-label { text-align: center; color: var(--muted); margin-bottom: 18px; }

/* ---------- 成长记录 ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .d { aspect-ratio: 1; border-radius: 8px; background: #ece8de; display: grid; place-items: center;
  font-size: 12px; color: var(--muted); }
.cal .d.on { background: var(--gold); color: var(--primary-d); font-weight: 800; }
.cal .d.today { outline: 2px solid var(--primary); }
.journal-entry { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.journal-entry .je-date { font-size: 12px; color: var(--gold); font-weight: 700; }
.journal-entry .je-text { font-size: 14px; margin-top: 4px; white-space: pre-wrap; }
.stat-row { display: flex; gap: 12px; }
.stat-box { flex: 1; padding: 16px; text-align: center; }
.stat-box b { font-size: 26px; color: var(--primary); display: block; }
.stat-box span { font-size: 12px; color: var(--muted); }

/* ---------- 弹层 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(20,30,28,.5); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal-mask[hidden] { display: none; }
.modal { background: var(--paper-2); width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 22px clamp(18px,4vw,28px) calc(28px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 40px rgba(0,0,0,.2); animation: slideUp .25s ease; }
@keyframes slideUp { from { transform: translateY(40px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal-close { position: sticky; top: 0; float: right; background: #eef3f0; border: none; width: 34px; height: 34px;
  border-radius: 50%; font-size: 18px; cursor: pointer; color: var(--ink-soft); margin: -4px -4px 0 0; }

/* ---------- 工具 ---------- */
.spacer { height: 14px; }
.center { text-align: center; }
.fade-in { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.empty { color: var(--muted); text-align: center; padding: 30px; font-size: 14px; }

/* ============ 响应式：移动端 ============ */
@media (max-width: 880px) {
  .sidenav { display: none; }
  .view { margin-left: 0; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .brand-name { display: none; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--paper-2); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 0 9px; color: var(--muted); font-size: 11px; font-weight: 600; }
  .tab .ic { font-size: 20px; }
  .tab.active { color: var(--primary); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .compare { grid-template-columns: 1fr; }
  .chat-wrap { height: calc(100vh - 56px - env(safe-area-inset-top) - 72px - env(safe-area-inset-bottom)); }
  .hero::after { font-size: 90px; }
}
@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
  .hero-stats { gap: 16px; }
}
