/* 看山炼金炉 · 移动端优先 · 品牌蓝 + 莫兰迪浅色 · Apple 风格卡片 */
:root {
  --brand: #2f6bff;
  --brand-dark: #1e4fd6;
  --brand-soft: #e9efff;
  --morandi-1: #a8b8cf;
  --morandi-2: #c9d4e6;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1c2536;
  --ink-2: #5b6b84;
  --ink-3: #93a1b8;
  --danger: #ff5a5f;
  --ok: #2fb982;
  --radius: 18px;
  --shadow: 0 8px 28px rgba(31, 58, 111, 0.08);
  --shadow-hover: 0 12px 34px rgba(31, 58, 111, 0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
}

#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ---- 顶栏 ---- */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 8px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(to bottom, var(--bg) 78%, rgba(244, 246, 251, 0));
}
#brand { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 30px;
  background: linear-gradient(135deg, #4d82ff, #2f6bff 60%, #1e4fd6);
  box-shadow: 0 4px 12px rgba(47, 107, 255, .34);
  position: relative;
}
.brand-mark::before { content: ""; position: absolute; left: 11px; top: 5px; width: 8px; height: 8px; border-radius: 3px; background: rgba(255,255,255,.92); }
.brand-mark::after { content: ""; position: absolute; left: 8px; top: 17px; width: 14px; height: 5px; border-radius: 3px 3px 5px 5px; background: rgba(255,255,255,.78); }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: .3px; color: var(--ink); }
.brand-name span { color: var(--brand); }

/* ---- 刘看山 mascot（顶栏右侧）---- */
#mascot { display: flex; align-items: center; gap: 5px; position: relative; }
#ks-gif { width: 46px; height: 46px; object-fit: contain; display: block; filter: drop-shadow(0 4px 8px rgba(31,58,111,.18)); }
#ks-badge {
  background: var(--brand); color: #fff; font-size: 10px; padding: 2px 8px;
  border-radius: 9px; white-space: nowrap; box-shadow: var(--shadow);
}

/* ---- 刘看山入场对话气泡（推入动画）---- */
#ks-bubble {
  margin: 0 20px 2px;
  background: var(--card);
  border-radius: 16px 16px 16px 4px;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.55;
  box-shadow: var(--shadow);
  color: var(--ink);
  max-width: 340px;
  align-self: flex-start;
  transform-origin: left bottom;
  animation: bubble-slide .42s cubic-bezier(.2, .9, .3, 1.2);
}
#ks-bubble.empty { display: none; }
@keyframes bubble-slide { from { opacity: 0; transform: translateX(-18px) scale(.94); } to { opacity: 1; transform: none; } }

/* ---- 主视图 ---- */
#view { flex: 1; padding: 14px 20px 40px; display: flex; flex-direction: column; gap: 16px; }

.section-title { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.section-sub { font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.6; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  animation: rise .35s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.big-number { font-size: 46px; font-weight: 800; color: var(--brand); letter-spacing: -1px; line-height: 1.1; }
.big-number small { font-size: 18px; font-weight: 600; color: var(--ink-2); }

.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand-dark); font-size: 12px; padding: 4px 10px; border-radius: 20px; font-weight: 600; }
.pill.demo { background: #fff3e0; color: #b26a00; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 16px; border: none; border-radius: 14px;
  font-size: 16px; font-weight: 600; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(47,107,255,.3); }
.btn-ghost { background: var(--brand-soft); color: var(--brand-dark); }
.btn-soft { background: #eef1f6; color: var(--ink-2); }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* ---- 登录页（两栏：左品牌/刘看山 · 右登录卡片）---- */
#view.wide { max-width: none; }
.auth {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-top: 6px;
}
.auth-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 4px; }
.auth-hero .ks-face { width: 132px; height: 132px; object-fit: contain; filter: drop-shadow(0 14px 22px rgba(31,58,111,.22)); animation: floaty 3.6s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.login-title { font-size: 28px; font-weight: 800; letter-spacing: .5px; }
.login-title span { color: var(--brand); }
.login-desc { color: var(--ink-2); font-size: 14px; line-height: 1.7; margin: 12px auto 4px; max-width: 320px; }

.auth-panel { display: flex; flex-direction: column; gap: 14px; }
.auth-panel .panel-title { font-size: 13px; font-weight: 700; color: var(--ink-2); letter-spacing: .5px; padding-left: 4px; }
.login-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 16px 18px; cursor: pointer; transition: transform .12s ease, box-shadow .15s ease;
  border: 2px solid transparent;
}
.login-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.login-card:active { transform: scale(.99); }
.login-card .lc-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.login-card.primary .lc-icon { background: var(--brand-soft); }
.login-card.secondary .lc-icon { background: #fff3e0; }
.login-card .lc-main { flex: 1; min-width: 0; }
.login-card .lc-title { font-size: 16px; font-weight: 700; }
.login-card.primary .lc-title { color: var(--brand-dark); }
.login-card .lc-desc { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; }
.login-card .lc-arrow { color: var(--ink-3); font-size: 18px; }
.login-card.disabled { opacity: .55; cursor: not-allowed; }

.banner { border-radius: 12px; padding: 10px 14px; font-size: 13px; line-height: 1.6; }
.banner-error { background: #ffecec; color: #c0392b; }
.banner-info { background: var(--brand-soft); color: var(--brand-dark); }

/* ---- 列表 ---- */
.list { display: flex; flex-direction: column; gap: 12px; }
.list-item {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  padding: 16px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  transition: box-shadow .15s ease, transform .1s ease;
}
.list-item:active { transform: scale(.99); box-shadow: var(--shadow-hover); }
.list-item .li-check { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 7px; border: 2px solid var(--morandi-2); margin-top: 2px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: transparent; transition: all .15s ease; }
.list-item.selected .li-check { background: var(--brand); border-color: var(--brand); color: #fff; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 15px; font-weight: 600; line-height: 1.5; }
.list-item .li-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.list-item .li-meta { display: flex; gap: 10px; margin-top: 8px; font-size: 11.5px; color: var(--ink-3); }
.list-item .li-num { margin-left: auto; color: var(--ink-3); font-size: 13px; font-weight: 600; }

/* ---- 炼金进度 ---- */
.progress-wrap { text-align: center; padding: 10px 0; }
.progress-step { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 15px; color: var(--ink-2); padding: 6px 0; }
.progress-step.done { color: var(--ok); font-weight: 600; }
.progress-step.active { color: var(--brand); font-weight: 700; }
.progress-bar { height: 8px; background: #e6ebf5; border-radius: 8px; overflow: hidden; margin: 14px 0 4px; }
.progress-bar > div { height: 100%; background: linear-gradient(90deg, var(--brand), #5b8dff); border-radius: 8px; transition: width .4s ease; }

/* ---- 卡片 ---- */
.cards-carousel { position: relative; }
.cards-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 16px; padding: 4px 2px 18px; scrollbar-width: none; }
.cards-track::-webkit-scrollbar { display: none; }
.kcard {
  flex: 0 0 86%; scroll-snap-align: center;
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow-hover);
  padding: 22px; display: flex; flex-direction: column; gap: 14px;
}
.kcard .kc-tag { color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.kcard .kc-concept { font-size: 18px; font-weight: 700; line-height: 1.5; }
.kcard .kc-points { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.kcard .kc-points li { font-size: 14px; line-height: 1.6; color: var(--ink); padding-left: 18px; position: relative; }
.kcard .kc-points li::before { content: "·"; position: absolute; left: 4px; color: var(--brand); font-weight: 800; }
.kcard .kc-pitfall { background: #fff4f0; color: #c2562e; border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.6; }
.kcard .kc-note { border-left: 3px solid var(--brand); padding: 6px 12px; font-size: 13px; color: var(--ink-2); background: var(--brand-soft); border-radius: 0 10px 10px 0; }
.kcard .kc-source { font-size: 12px; color: var(--ink-3); }
.kcard .kc-source a { color: var(--brand); text-decoration: none; }

.dots { display: flex; justify-content: center; gap: 6px; padding: 4px 0 12px; }
.dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--morandi-2); transition: all .2s ease; }
.dots i.on { width: 20px; background: var(--brand); }

/* ---- 出题 ---- */
.quiz-q { font-size: 17px; font-weight: 700; line-height: 1.6; }
.quiz-opt {
  width: 100%; text-align: left; background: var(--card); border: 2px solid #e6ebf5;
  border-radius: 14px; padding: 14px 16px; font-size: 15px; color: var(--ink);
  cursor: pointer; margin-top: 10px; transition: all .15s ease;
}
.quiz-opt:active { transform: scale(.99); }
.quiz-opt.correct { border-color: var(--ok); background: #e9f9f1; }
.quiz-opt.wrong { border-color: var(--danger); background: #ffecec; }
.quiz-opt:disabled { cursor: default; }
.quiz-explain { background: #f0f4ff; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.7; color: var(--ink); margin-top: 14px; }
.quiz-explain b { color: var(--brand-dark); }

.mastery { display: flex; gap: 10px; }
.mastery .m-item { flex: 1; background: var(--card); border-radius: 14px; padding: 14px; text-align: center; box-shadow: var(--shadow); }
.mastery .m-num { font-size: 26px; font-weight: 800; color: var(--brand); }
.mastery .m-num.ok { color: var(--ok); }
.mastery .m-num.danger { color: var(--danger); }
.mastery .m-label { font-size: 12px; color: var(--ink-2); margin-top: 4px; }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(28,37,54,.92); color: #fff; padding: 10px 18px; border-radius: 24px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 99; max-width: 86vw; text-align: center;
}
#toast.show { opacity: 1; }

.hidden { display: none !important; }
.fade { animation: rise .3s ease; }
.center { text-align: center; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }
.foot-note { font-size: 11.5px; color: var(--ink-3); text-align: center; line-height: 1.6; margin-top: 22px; }

/* ---- 仪表盘丰富 ---- */
#view { max-width: 520px; margin: 0 auto; width: 100%; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.dash-head .dash-hello { font-size: 20px; font-weight: 800; line-height: 1.3; }
.dash-head .dash-hello small { display: block; font-size: 13px; color: var(--ink-2); font-weight: 500; margin-top: 4px; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; }
.stat .s-num { font-size: 30px; font-weight: 800; line-height: 1.05; color: var(--brand); }
.stat .s-num.danger { color: var(--danger); }
.stat .s-num.ok { color: var(--ok); }
.stat .s-num.neutral { color: var(--ink); }
.stat .s-label { font-size: 12px; color: var(--ink-2); margin-top: 6px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.section-head .sh-title { font-size: 16px; font-weight: 700; }
.section-head .sh-more { font-size: 12.5px; color: var(--brand); font-weight: 600; cursor: pointer; }

.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.feature {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 15px; cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease;
}
.feature:active { transform: scale(.98); }
.feature .f-icon { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 10px; }
.feature .f-icon.c1 { background: var(--brand-soft); }
.feature .f-icon.c2 { background: #eef6f1; }
.feature .f-icon.c3 { background: #fff3e0; }
.feature .f-icon.c4 { background: #f3edff; }
.feature .f-title { font-size: 14.5px; font-weight: 700; }
.feature .f-desc { font-size: 12px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }

.preview-list { display: flex; flex-direction: column; gap: 10px; }
.preview-item { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.preview-item .pv-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 4px; background: var(--brand); }
.preview-item .pv-main { flex: 1; min-width: 0; }
.preview-item .pv-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-item .pv-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- 知识图谱 ---- */
.graph-wrap { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 14px; }
.graph-svg { width: 100%; height: 320px; display: block; }
.graph-legend { display: flex; gap: 16px; justify-content: center; margin-top: 6px; font-size: 12px; color: var(--ink-2); }
.graph-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* ---- 费曼 / 辩论对话 ---- */
.chat-wrap { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.chat-log { padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: 380px; overflow-y: auto; }
.chat-msg { max-width: 82%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.chat-msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.ai { align-self: flex-start; background: var(--brand-soft); color: var(--ink); border-bottom-left-radius: 4px; }
.chat-msg.ai.typing { color: var(--ink-3); }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #eef1f6; }
.chat-input input { flex: 1; border: 2px solid #e6ebf5; border-radius: 12px; padding: 11px 13px; font-size: 14px; outline: none; font-family: inherit; }
.chat-input input:focus { border-color: var(--brand); }
.chat-input button { flex: 0 0 auto; border: none; background: var(--brand); color: #fff; border-radius: 12px; padding: 0 18px; font-size: 14px; font-weight: 600; cursor: pointer; }

/* ---- 元认知报告 ---- */
.report-zone { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rzone { border-radius: 14px; padding: 14px; text-align: center; }
.rzone .rz-title { font-size: 12.5px; font-weight: 700; }
.rzone .rz-num { font-size: 26px; font-weight: 800; margin-top: 4px; }
.rzone.zone-a { background: #eef6f1; color: #1d8f63; }
.rzone.zone-b { background: #ffecec; color: #c0392b; }
.rzone.zone-c { background: #fff3e0; color: #b26a00; }
.rzone.zone-d { background: #f0f4ff; color: var(--brand-dark); }
.conf-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid #eef1f6; font-size: 13px; }
.conf-row:last-child { border-bottom: none; }
.conf-row .cr-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conf-badge { font-size: 11px; padding: 2px 8px; border-radius: 9px; font-weight: 700; flex: 0 0 auto; }
.conf-badge.done { background: #eef6f1; color: #1d8f63; }
.conf-badge.rev { background: #fff3e0; color: #b26a00; }

.conf-btn { padding: 11px 8px !important; font-size: 13.5px !important; border-radius: 12px !important; }
.conf-btn.selected { background: var(--brand) !important; color: #fff !important; }

/* ---- 桌面两栏（登录页 + 更宽容器）---- */
@media (min-width: 820px) {
  body { max-width: 900px; }
  #view { max-width: 900px; }
  .auth { grid-template-columns: 1.05fr 1fr; align-items: center; gap: 40px; }
  .auth-hero { text-align: left; align-items: flex-start; padding: 20px 8px; }
  .auth-hero .login-desc { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
