:root {
  --green: #1D9E75;
  --green-dark: #0F6E56;
  --gold: #BA7517;
  --gold-bg: #FAEEDA;
  --bg: #F1EFE8;
  --card: #FFFFFF;
  --text: #2C2C2A;
  --text-2: #888780;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--green); color: #fff;
  box-shadow: var(--shadow);
}
.brand { font-weight: 700; font-size: 18px; }
.kid-code { font-size: 13px; background: rgba(255,255,255,.2); padding: 3px 10px; border-radius: 999px; }

.view { padding: 16px 16px 88px; max-width: 720px; margin: 0 auto; }
.loading, .error { text-align: center; color: var(--text-2); padding: 40px 0; }

.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.card h3 { margin: 0 0 10px; font-size: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.muted { color: var(--text-2); font-size: 13px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--gold-bg); color: var(--gold);
  padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.chip.green { background: #E3F5EE; color: var(--green-dark); }

.btn {
  border: none; border-radius: var(--radius-sm); padding: 10px 16px;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: filter .15s;
}
.btn:active { filter: brightness(.95); }
.btn.primary { background: var(--green); color: #fff; }
.btn.gold { background: var(--gold); color: #fff; }
.btn.ghost { background: #EFEDE7; color: var(--text); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: #fff; border-top: 1px solid #ECEAE3;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-2); padding: 4px 0; font-size: 11px;
}
.tab .tab-icon { font-size: 20px; }
.tab.active { color: var(--green); }

/* 进度条 */
.bar { height: 10px; background: #ECEAE3; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); }

/* 今日清单 */
.today-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; cursor: pointer; }
.today-item:active { background: #FAF9F5; }
.today-item .ic { font-size: 26px; width: 40px; text-align: center; }
.today-item .meta { flex: 1; }
.today-item .meta .t { font-weight: 600; }
.today-item .meta .d { font-size: 13px; color: var(--text-2); }
.today-item .done { color: var(--green); font-size: 20px; }
.today-item.coming { opacity: .6; }

/* 成就墙 */
.ach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ach {
  background: #F6F5F1; border-radius: 12px; padding: 12px 6px; text-align: center;
  font-size: 12px; color: var(--text-2);
}
.ach.on { background: var(--gold-bg); color: var(--gold); }
.ach .a-ic { font-size: 24px; display: block; }
.ach.off .a-ic { filter: grayscale(1); opacity: .5; }

/* 选项 / 答题 */
.opt {
  display: block; width: 100%; text-align: left; margin: 8px 0;
  padding: 12px 14px; border: 1px solid #E5E3DC; border-radius: 12px;
  background: #fff; font-size: 15px; cursor: pointer;
}
.opt:active { background: #F6F5F1; }
.opt.correct { border-color: var(--green); background: #E3F5EE; }
.opt.wrong { border-color: #D9534F; background: #FBE9E8; }
.qtypes { font-size: 12px; color: var(--text-2); }
.feedback { margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.feedback.ok { background: #E3F5EE; color: var(--green-dark); }
.feedback.no { background: #FBE9E8; color: #B23B37; }

input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #E0DED7; border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
textarea { resize: vertical; }

/* 列表行 */
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #F0EEE8; }
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; }

/* 家长面板 */
.panel { margin-bottom: 14px; }
.panel > .head { font-weight: 700; margin: 4px 0 8px; display: flex; align-items: center; gap: 6px; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none;
  align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-overlay.show { display: flex; }
.modal-card {
  background: #fff; border-radius: var(--radius); padding: 20px; width: 100%;
  max-width: 420px; max-height: 86vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.modal-card h3 { margin: 0 0 14px; }
.modal-form .field { display: block; margin-bottom: 12px; }
.modal-form .field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: #2C2C2A; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 60; max-width: 86%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: var(--green-dark); }
.toast.err { background: #B23B37; }

/* 伙伴 */
.companion { text-align: center; margin: 4px 0 14px; }
.companion img { width: 96px; height: 96px; }
