/* 习 · 认知规律学习平台 */
:root {
  --bg: #14161f; --bg2: #1a1d29; --card: #212536; --card2: #282d42;
  --line: #333854; --tx: #e8eaf2; --tx2: #9aa1bd; --tx3: #6b7294;
  --acc: #7cc4ff; --acc2: #5a9ee8; --ok: #6fd394; --warn: #f0b45c; --bad: #ef7f7f;
  --r: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--tx);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px; line-height: 1.6;
}
#app { max-width: 640px; margin: 0 auto; padding: 14px 14px calc(76px + env(safe-area-inset-bottom)); }

/* 顶栏 */
.top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.top h1 { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.top .sub { color: var(--tx3); font-size: 12px; }

/* 卡片 */
.card { background: var(--card); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.card h3 { font-size: 15px; margin-bottom: 8px; }
.card .hint { color: var(--tx2); font-size: 13px; }
.muted { color: var(--tx2); font-size: 13px; }
.tiny { color: var(--tx3); font-size: 12px; }

/* 按钮 */
button { font-family: inherit; }
.btn {
  display: inline-block; border: none; border-radius: 10px; cursor: pointer;
  background: var(--card2); color: var(--tx); padding: 9px 16px; font-size: 14px;
  transition: opacity .15s;
}
.btn:active { opacity: .7; }
.btn.pri { background: var(--acc2); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--tx2); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.full { width: 100%; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* 输入 */
input[type=text], textarea, select {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); color: var(--tx);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--acc2); }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--tx2); margin-bottom: 4px; }

/* 底部导航 */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around; max-width: 640px; margin: 0 auto;
  background: var(--bg2); border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
#tabbar button {
  background: none; border: none; color: var(--tx3); font-size: 11px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 12px; cursor: pointer;
}
#tabbar button .ico { font-size: 20px; line-height: 1; }
#tabbar button.on { color: var(--acc); }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--card2); color: var(--tx); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 12px; font-size: 14px; z-index: 99;
  opacity: 0; pointer-events: none; transition: opacity .25s; max-width: 86%;
}
#toast.show { opacity: 1; }

/* 阶段标签 */
.stage { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.s-cognition   { background: #2c3350; color: #9db4e8; }
.s-deconstruct { background: #233a52; color: #7cc4ff; }
.s-master      { background: #1d3f38; color: #6fd394; }
.s-thorough    { background: #3d3524; color: #f0b45c; }
.s-apply       { background: #40272c; color: #ef9a9a; }

/* 进度点（五阶） */
.dots { display: flex; gap: 5px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dot.on { background: var(--acc); }
.dot-arrow { color: var(--tx3); font-size: 10px; }

/* 列表项 */
.item {
  background: var(--card); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 600; font-size: 14px; }
.item .d { color: var(--tx3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 遮罩验收：未揭开时真遮住（合意困难——先自己回忆） */
.mask-box {
  background: var(--bg2); border: 1px dashed var(--line); border-radius: 12px;
  padding: 14px; margin: 8px 0; color: var(--tx2); font-size: 14px;
}
.mask-box:not(.open) {
  position: relative; color: transparent; text-shadow: 0 0 10px rgba(154,161,189,.55);
  cursor: pointer; user-select: none;
}
.mask-box:not(.open)::after {
  content: '🔒 已遮罩 —— 先自己回忆，再点"揭开对照"';
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--tx2); font-size: 12px; text-shadow: none; background: rgba(20,22,31,.55);
  border-radius: 12px;
}
.mask-box.open { color: var(--tx); border-style: solid; border-color: var(--acc2); }
.mask-box.open::after { display: none; }

/* 心态/金句 */
.quote { border-left: 3px solid var(--acc2); padding: 6px 12px; color: var(--tx2); font-size: 13px; margin: 8px 0; }

/* 统计格 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border-radius: var(--r); padding: 12px; text-align: center; }
.stat .n { font-size: 24px; font-weight: 700; color: var(--acc); }
.stat .l { font-size: 12px; color: var(--tx3); }

/* 方法库 markdown */
.md { background: var(--card); border-radius: var(--r); padding: 16px; font-size: 14px; }
.md h1 { font-size: 19px; margin: 14px 0 8px; }
.md h2 { font-size: 16px; margin: 14px 0 6px; color: var(--acc); }
.md h3 { font-size: 14px; margin: 12px 0 4px; }
.md p, .md li { margin: 4px 0; }
.md ul, .md ol { padding-left: 20px; }
.md blockquote { border-left: 3px solid var(--line); padding-left: 10px; color: var(--tx2); margin: 8px 0; }
.md code { background: var(--bg2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.md table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 12px; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 8px; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 12px 0; }

/* 空状态 */
.empty { text-align: center; color: var(--tx3); padding: 40px 0; font-size: 13px; }
