:root {
  --bg: #faf6f0;
  --card: #ffffff;
  --primary: #ff7a3d;
  --primary-deep: #f05a1e;
  --accent: #ffb800;
  --green: #4caf7d;
  --text: #3d3229;
  --sub: #9b8a76;
  --line: #f0e6da;
  --danger: #e5484d;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(120, 90, 50, 0.08);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px calc(76px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* ---------- 启动屏 ---------- */
.boot {
  padding: 38vh 0 0;
  text-align: center;
  color: var(--sub);
}
.boot__logo {
  font-size: 52px;
}
.boot__t {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-top: 10px;
}
.boot__s {
  margin-top: 6px;
  font-size: 13px;
}

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card__t {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.grow {
  flex: 1;
  min-width: 0;
}
.center {
  text-align: center;
}
.tiny {
  font-size: 12px;
  color: var(--sub);
}
.sub {
  color: var(--sub);
}
.muted {
  color: var(--sub);
  font-size: 13px;
}
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; }
.bold { font-weight: 700; }
.big { font-size: 26px; font-weight: 800; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff3ea;
  color: var(--primary-deep);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.chip--green {
  background: #e8f6ee;
  color: #2c8a5b;
}
.chip--gray {
  background: #f2ede6;
  color: var(--sub);
}

.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  background: #f2ede6;
  color: var(--text);
  font-family: inherit;
  transition: opacity 0.15s;
}
.btn:active {
  opacity: 0.8;
}
.btn--primary {
  background: linear-gradient(135deg, #ff9a52, var(--primary-deep));
  color: #fff;
  box-shadow: 0 6px 16px rgba(240, 90, 30, 0.28);
}
.btn--ghost {
  background: transparent;
  border: 1.5px solid var(--line);
  font-weight: 600;
}
.btn--danger {
  background: #fdeaea;
  color: var(--danger);
}
.btn--small {
  display: inline-block;
  width: auto;
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 10px;
}
.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  background: #fffdf9;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
}
.field {
  margin-bottom: 14px;
}
.field__label {
  font-size: 13px;
  color: var(--sub);
  margin-bottom: 6px;
  font-weight: 600;
}
.link {
  color: var(--primary-deep);
  cursor: pointer;
  font-size: 13px;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

/* ---------- 顶部 ---------- */
.pagehead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.pagehead__back {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  flex: none;
}
.pagehead__t {
  font-size: 18px;
  font-weight: 800;
}

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  z-index: 50;
}
.tabbar__item {
  flex: 1;
  max-width: 96px;
  text-align: center;
  cursor: pointer;
  color: var(--sub);
  font-size: 11px;
  padding: 2px 0;
  border-radius: 10px;
}
.tabbar__item .ico {
  font-size: 21px;
  display: block;
  filter: grayscale(1) opacity(0.55);
}
.tabbar__item--on {
  color: var(--primary-deep);
  font-weight: 700;
}
.tabbar__item--on .ico {
  filter: none;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%) translateY(8px);
  background: rgba(40, 32, 24, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 99;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  max-width: 80vw;
  text-align: center;
}
.toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 登录 ---------- */
.auth-hero {
  text-align: center;
  padding: 36px 0 20px;
}
.auth-hero__logo {
  font-size: 56px;
}
.auth-hero__t {
  font-size: 22px;
  font-weight: 800;
  margin-top: 8px;
}
.auth-hero__s {
  color: var(--sub);
  font-size: 13px;
  margin-top: 4px;
}
.code-row {
  display: flex;
  gap: 10px;
}
.code-row input {
  flex: 1;
}
.code-row .btn--small {
  flex: none;
  white-space: nowrap;
}
.role-pick {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.role-pick__item {
  flex: 1;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
}
.role-pick__item--on {
  border-color: var(--primary);
  background: #fff7f1;
}
.role-pick__e {
  font-size: 30px;
}
.role-pick__t {
  font-weight: 700;
  margin-top: 6px;
}
.avatar-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.avatar-pick span {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
}
.avatar-pick span.on {
  border-color: var(--primary);
  background: #fff3ea;
}

/* ---------- 首页 ---------- */
.home-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.home-head__ava {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex: none;
}
.home-head__n {
  font-size: 19px;
  font-weight: 800;
}
.today-card {
  background: linear-gradient(135deg, #ff9a52, #f05a1e);
  border-radius: var(--radius);
  color: #fff;
  padding: 20px 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(240, 90, 30, 0.28);
}
.today-card .tiny {
  color: rgba(255, 255, 255, 0.85);
}
.today-card__btn {
  background: #fff;
  color: var(--primary-deep);
  border: 0;
  border-radius: 999px;
  padding: 9px 22px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.progress {
  height: 10px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
.progress > i {
  display: block;
  height: 100%;
  background: #fff;
  border-radius: 999px;
  transition: width 0.4s;
}
.week-row {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
}
.week-cell {
  text-align: center;
  font-size: 11px;
  color: var(--sub);
}
.week-cell__dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f2ede6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  margin: 4px auto 0;
}
.week-cell__dot--done {
  background: var(--green);
  color: #fff;
}
.week-cell--today .week-cell__dot {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.stat-grid {
  display: flex;
  gap: 10px;
}
.stat-grid > div {
  flex: 1;
  background: #fffdf9;
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}
.stat-grid .big {
  font-size: 20px;
  color: var(--primary-deep);
}
.msg-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.msg-item:last-child {
  border-bottom: 0;
}
.msg-item__e {
  font-size: 20px;
}
.book-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.book-card {
  flex: none;
  width: 108px;
  background: #fffdf9;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}
.book-card__e {
  font-size: 26px;
}
.book-card__t {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  line-height: 1.3;
  height: 31px;
  overflow: hidden;
}

/* ---------- 打卡 ---------- */
.mode-row {
  display: flex;
  gap: 10px;
}
.mode-item {
  flex: 1;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
}
.mode-item--on {
  border-color: var(--primary);
  background: #fff7f1;
}
.mode-item__e {
  font-size: 24px;
}
.stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stepper button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: #f2ede6;
  font-size: 18px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}
.stepper .val {
  min-width: 64px;
  text-align: center;
  font-weight: 800;
  font-size: 17px;
}
.book-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.book-pick span {
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  background: #fffdf9;
}
.book-pick span.on {
  border-color: var(--primary);
  background: #fff3ea;
  color: var(--primary-deep);
  font-weight: 700;
}
.hist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.hist-item:last-child {
  border-bottom: 0;
}
.hist-item__del {
  color: var(--danger);
  font-size: 12px;
  cursor: pointer;
  flex: none;
}

/* ---------- 报告 ---------- */
.level-track {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin-top: 10px;
}
.level-step {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--sub);
}
.level-step__e {
  font-size: 22px;
  filter: grayscale(1) opacity(0.4);
  display: block;
}
.level-step--on {
  color: var(--primary-deep);
  font-weight: 700;
}
.level-step--on .level-step__e {
  filter: none;
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 110px;
  margin-top: 10px;
}
.bars > i {
  flex: 1;
  background: linear-gradient(180deg, #ffb98a, var(--primary));
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}
.bars > i.zero {
  background: var(--line);
}
.comment-item {
  background: #fffdf9;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

/* ---------- 榜单 ---------- */
.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 12px;
}
.rank-item--me {
  background: #fff3ea;
  outline: 1.5px solid #ffc59e;
}
.rank-item__no {
  width: 26px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--sub);
}
.rank-item__ava {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f2ede6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.rank-item__num {
  font-weight: 800;
  color: var(--primary-deep);
}

/* ---------- 日历 ---------- */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-head button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: #f2ede6;
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: #f7f2ea;
  color: var(--sub);
  cursor: pointer;
}
.cal-cell--out {
  opacity: 0.35;
}
.cal-cell--l1 { background: #ffe3cf; color: var(--text); }
.cal-cell--l2 { background: #ffc59e; color: var(--text); }
.cal-cell--l3 { background: #ff9a52; color: #fff; font-weight: 700; }
.cal-cell--today {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.cal-cell--sel {
  outline: 2px solid var(--primary-deep);
  outline-offset: 1px;
}

/* ---------- 统计 ---------- */
.seg {
  display: flex;
  background: #f2ede6;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg > span {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  border-radius: 9px;
  font-size: 14px;
  color: var(--sub);
  cursor: pointer;
}
.seg > span.on {
  background: #fff;
  color: var(--text);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(120, 90, 50, 0.1);
}
.ratio {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
.ratio .ear {
  background: var(--accent);
}
.ratio .read {
  background: var(--primary);
}
.legend {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--sub);
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 4px;
}

/* ---------- 老师 / 管理 ---------- */
.kid-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.kid-item:last-child {
  border-bottom: 0;
}
.kid-item__ava {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f2ede6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  flex: none;
}
.kid-item--warn {
  background: #fff8ef;
  border-radius: 12px;
  padding: 11px 10px;
}
.code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fffdf9;
  border: 1.5px dashed #e4cdb4;
  border-radius: 12px;
  padding: 10px 14px;
}
.code-box b {
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--primary-deep);
}
.chart-line {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 90px;
  margin-top: 8px;
}
.chart-line > i {
  flex: 1;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}

.empty {
  text-align: center;
  color: var(--sub);
  padding: 26px 0;
  font-size: 13px;
}
.empty__e {
  font-size: 34px;
  display: block;
  margin-bottom: 6px;
}
