/* ===== Seven 学习工具 · 白底蓝主色 卡片风 ===== */
:root {
  --blue: #1677ff;
  --blue-dark: #0958d9;
  --blue-bg: #e8f1ff;
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --text: #1f2329;
  --text2: #646a73;
  --line: #eef0f3;
  --bg: #f5f7fa;
  --card: #ffffff;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px;
}
.hide { display: none !important; }

/* ---- 登录页 ---- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--card); border-radius: 20px;
  padding: 36px 28px; box-shadow: 0 8px 30px rgba(22,119,255,.08);
}
.login-logo { font-size: 44px; text-align: center; }
.login-card h1 { font-size: 22px; text-align: center; margin: 8px 0 4px; }
.login-sub { text-align: center; color: var(--text2); font-size: 13px; margin-bottom: 24px; }
.login-alt { text-align: center; margin-top: 16px; font-size: 13px; }
.login-alt a { color: var(--blue); text-decoration: none; }

/* ---- 主框架 ---- */
.app-wrap { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text2); }
.topbar-right .pts { color: var(--orange); font-weight: 600; }
.child-tabs { display: flex; gap: 8px; padding: 10px 16px 0; background: #fff; }
.child-tabs .chip {
  padding: 5px 14px; border-radius: 999px; background: var(--bg); font-size: 13px; cursor: pointer;
}
.child-tabs .chip.on { background: var(--blue); color: #fff; }
.view { flex: 1; padding: 14px 16px 90px; }

/* ---- 底部导航 ---- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; background: #fff; border-top: 1px solid var(--line);
  display: flex; padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 20;
}
.tabbar .tab {
  flex: 1; text-align: center; font-size: 11px; color: var(--text2); cursor: pointer; padding: 3px 0;
}
.tabbar .tab .ico { font-size: 21px; display: block; }
.tabbar .tab.on { color: var(--blue); font-weight: 600; }

/* ---- 卡片与通用 ---- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.card h3 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.card h3 .more { font-size: 12px; color: var(--blue); font-weight: 400; cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--blue-bg); border-radius: 12px; padding: 12px; text-align: center; }
.stat .num { font-size: 22px; font-weight: 700; color: var(--blue); }
.stat .lbl { font-size: 12px; color: var(--text2); margin-top: 2px; }
.stat.gold .num { color: var(--orange); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 15px; background: #fff; color: var(--text); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); }
.field textarea { min-height: 90px; resize: vertical; }

.btn {
  border: none; border-radius: 10px; padding: 10px 18px; font-size: 15px; cursor: pointer;
  background: var(--bg); color: var(--text);
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:active { background: var(--blue-dark); }
.btn.small { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn.warn { background: #fff1f0; color: var(--red); }
.btn.gold { background: #fff7e6; color: var(--orange); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.list-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-size: 15px; }
.list-item .s { font-size: 12px; color: var(--text2); margin-top: 3px; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--bg); color: var(--text2); margin-right: 4px; }
.tag.blue { background: var(--blue-bg); color: var(--blue); }
.tag.green { background: #ecfdf3; color: var(--green); }
.tag.orange { background: #fff7e6; color: var(--orange); }
.tag.red { background: #fff1f0; color: var(--red); }

.empty { text-align: center; color: var(--text2); padding: 30px 0; font-size: 13px; }

/* ---- 打卡 ---- */
.habit-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.habit-row:last-child { border-bottom: none; }
.habit-check {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid #d0d5dd; background: #fff;
  cursor: pointer; font-size: 15px; color: transparent; flex-shrink: 0;
}
.habit-check.on { background: var(--green); border-color: var(--green); color: #fff; }
.habit-week { display: flex; gap: 4px; }
.habit-week i { width: 7px; height: 7px; border-radius: 50%; background: #e5e7eb; }
.habit-week i.hit { background: var(--green); }

/* ---- 星宠 ---- */
.pet-stage { text-align: center; padding: 10px 0 4px; }
.pet-emoji { font-size: 84px; line-height: 1.2; transition: transform .3s; }
.pet-emoji:active { transform: scale(1.1); }
.pet-name { font-size: 16px; font-weight: 600; margin-top: 6px; }
.pet-bars { margin-top: 12px; display: grid; gap: 8px; }
.pbar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); }
.pbar span { width: 34px; }
.pbar .track { flex: 1; height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.pbar .fill { height: 100%; border-radius: 99px; }
.skins { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.skin { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; border: 2px solid transparent; background: var(--bg); }
.skin.on { border-color: var(--blue); background: var(--blue-bg); }
.skin.lock { opacity: .4; }

/* ---- 游戏 ---- */
.game-wrap { position: relative; }
canvas#game { width: 100%; border-radius: var(--radius); background: #dff0d8; display: block; }
.game-hud { display: flex; justify-content: space-between; padding: 8px 4px; font-size: 14px; }
.game-hud b { color: var(--orange); }
.gq-box { background: #fff; border-radius: 12px; padding: 12px; text-align: center; }
.gq-ans { display: flex; gap: 10px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }

/* ---- 报告图表 ---- */
.chart { width: 100%; overflow: hidden; }
.chart svg { width: 100%; height: auto; display: block; }

/* ---- 弹层 / toast ---- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; width: 100%; max-width: 560px; border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); max-height: 85vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 14px; font-size: 16px; }
@media (min-width: 560px) {
  .modal-mask { align-items: center; }
  .modal { border-radius: 20px; }
}
.toast {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.75); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 99; max-width: 80%; text-align: center;
}
.img-prev { max-width: 100%; border-radius: 10px; margin-top: 8px; }

/* 桌面微调 */
@media (min-width: 800px) {
  body { background: #eceff3; }
  .app-wrap, .tabbar { box-shadow: 0 0 40px rgba(0,0,0,.06); }
  .app-wrap { background: var(--bg); }
}
