* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #1f2328; background: #f4f6fa;
  -webkit-font-smoothing: antialiased;
}
.hide { display: none !important; }

/* 进入页 */
.gate {
  height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1f2937 0%, #2f6fed 100%);
  padding: 24px;
}
.gate-box { text-align: center; color: #fff; width: 100%; max-width: 340px; }
.logo { font-size: 40px; font-weight: 800; letter-spacing: 2px; }
.sub { font-size: 13px; color: #c9d6ef; margin: 4px 0 34px; letter-spacing: 4px; }
.gate .hint { font-size: 12px; color: #a9b8d4; margin-top: 16px; }

button { font-family: inherit; cursor: pointer; border: none; }
.primary {
  background: #2f6fed; color: #fff; border-radius: 10px; font-size: 15px;
  font-weight: 600; padding: 0 20px; height: 46px;
}
.primary.big { width: 100%; height: 52px; font-size: 16px; }
.primary:active { transform: scale(.98); }
.ghost {
  background: #fff; color: #2f6fed; border: 1px solid #cfdcf5;
  border-radius: 10px; height: 40px; padding: 0 16px; font-size: 14px;
}
.mini {
  background: #fff; color: #2f6fed; border: 1px solid #cfdcf5;
  border-radius: 8px; height: 30px; padding: 0 12px; font-size: 13px;
}
.mini.danger { color: #c62828; border-color: #f3cfcc; }
.mini.gray { color: #6b7078; border-color: #dde3ea; }

/* 骨架 */
.app { height: 100%; display: flex; flex-direction: column; }
header {
  height: 52px; flex: none; display: flex; align-items: center; gap: 10px;
  padding: 0 16px; background: #fff; border-bottom: 1px solid #e8edf4;
}
header .brand { font-weight: 800; letter-spacing: 1px; color: #2f6fed; }
header .sp { flex: 1; }
header .who { font-size: 13px; color: #6b7078; }

main {
  flex: 1; overflow: auto; padding: 14px;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 56px;
  display: flex; background: #fff; border-top: 1px solid #e8edf4;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; color: #8b9099; font-size: 11px;
  text-decoration: none; cursor: pointer;
}
.tabbar a i { font-style: normal; font-size: 18px; line-height: 1; }
.tabbar a.on { color: #2f6fed; }

/* 卡片 */
.card {
  background: #fff; border-radius: 14px; padding: 16px;
  margin-bottom: 12px; box-shadow: 0 1px 3px rgba(20,30,60,.05);
}
.card h3 { margin: 0 0 10px; font-size: 15px; }
.stat-row { display: flex; gap: 12px; }
.stat { flex: 1; background: #fff; border-radius: 14px; padding: 14px; text-align: center; }
.stat .v { font-size: 24px; font-weight: 700; color: #2f6fed; }
.stat .k { font-size: 12px; color: #8b9099; margin-top: 2px; }

.row { display: flex; align-items: center; gap: 10px; }
.row .sp { flex: 1; }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 12px; background: #eef2ff; color: #2f6fed;
}
.tag.gray { background: #f1f3f6; color: #6b7078; }
.tag.green { background: #e8f5e9; color: #2e7d32; }
.tag.red { background: #fdecea; color: #c62828; }
.tag.amber { background: #fff8e1; color: #b26a00; }

.empty { text-align: center; color: #9aa0a6; font-size: 13px; padding: 36px 0; }

/* 老师 / 时段 */
.teacher {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  background: #fff; border-radius: 14px; margin-bottom: 10px;
  cursor: pointer; border: 1px solid transparent;
}
.teacher:hover { border-color: #cfdcf5; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; background: #eef3ff;
  color: #2f6fed; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex: none;
}
.teacher .info { flex: 1; min-width: 0; }
.teacher .name { font-weight: 600; }
.teacher .desc { font-size: 12px; color: #8b9099; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }

.weeknav { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.weeknav .sp { flex: 1; }
.weeknav .range { font-size: 13px; color: #46505f; font-weight: 600; }

.dayline {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
}
.dayline .d { width: 66px; flex: none; font-size: 12px; color: #6b7078; }
.dayline .d b { display: block; font-size: 14px; color: #26313d; }
.slots { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.slotbtn {
  border-radius: 9px; padding: 7px 12px; font-size: 13px;
  background: #eef7ee; color: #1f4d24; border: 1px solid #cfe6d1;
}
.slotbtn:disabled { background: #f4f5f7; color: #a9aeb6; border-color: #e6e9ee; }
.slotbtn.taken { background: #fdecea; color: #a3251c; border-color: #f6cfcb; }
.slotbtn.past { background: #f6f7f9; color: #b6bbc3; border-color: #ebedf1; }

/* 周统计小图 */
.wchart { display: flex; align-items: flex-end; gap: 8px; height: 66px; margin-top: 10px; }
.wcol { flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 4px; height: 100%; }
.wbar { width: 100%; max-width: 26px; background: #2f6fed; border-radius: 4px 4px 0 0; }
.wbar.future { background: #e6ebf3; }
.wlab { font-size: 11px; color: #8b9099; }

/* 做题 */
.qstem { font-size: 15px; line-height: 1.75; margin-bottom: 12px; white-space: pre-wrap; }
.opt {
  display: flex; gap: 9px; padding: 11px 13px; border: 1px solid #e3e8ef;
  border-radius: 10px; margin-bottom: 8px; font-size: 14px; line-height: 1.55;
  background: #fff; cursor: pointer; transition: .12s;
}
.opt b { color: #2f6fed; flex: none; }
.opt.on { border-color: #2f6fed; background: #eef3ff; }
.opt.right { border-color: #a5d6a7; background: #eef7ee; }
.opt.wrong { border-color: #f3b6b2; background: #fdecea; }
.result { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.result.ok { background: #eef7ee; color: #1f4d24; }
.result.bad { background: #fdecea; color: #a3251c; }
.ana {
  margin-top: 10px; padding: 10px 12px; background: #f7f9fc;
  border-radius: 10px; font-size: 13px; color: #46505f; line-height: 1.75;
}
.ana b { display: block; margin-bottom: 4px; color: #26313d; }

/* 资料阅读 */
.reader {
  position: fixed; inset: 0; background: #0f1115; z-index: 400;
  display: flex; flex-direction: column;
}
.rd-bar {
  height: 46px; flex: none; display: flex; align-items: center; gap: 12px;
  padding: 0 14px; color: #cfd3d9; font-size: 13px;
  padding-top: env(safe-area-inset-top);
}
.rd-bar .sp { flex: 1; }
.rd-x { font-size: 26px; color: #cfd3d9; cursor: pointer; line-height: 1; }
.rd-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 0 6px 16px; min-height: 0;
}
.rd-body img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  background: #fff; border-radius: 4px;
}
.rd-nav {
  width: 40px; height: 64px; flex: none; border: none; border-radius: 8px;
  background: rgba(255,255,255,.12); color: #fff; font-size: 24px;
}
.rd-nav:disabled { opacity: .2; }

.mat-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 0;
  border-bottom: 1px solid #eef2f7; cursor: pointer;
}
.mat-item:last-child { border-bottom: none; }
.mat-item .ico {
  width: 38px; height: 38px; border-radius: 9px; background: #eef3ff;
  color: #2f6fed; display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex: none;
}
.mat-item .mi { flex: 1; min-width: 0; }
.mat-item .mt { font-weight: 600; font-size: 14px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.mat-item .ms { font-size: 12px; color: #8b9099; }

/* 课程条目 */
.lesson {
  background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 10px;
  border-left: 4px solid #2f6fed;
}
.lesson.cancelled { border-left-color: #d0d4da; opacity: .68; }
.lesson .t { font-weight: 600; font-size: 15px; }
.lesson .meta { font-size: 12px; color: #8b9099; margin-top: 2px; }

.input {
  width: 100%; height: 44px; border: 1px solid #dde3ea; border-radius: 10px;
  padding: 0 12px; font-size: 15px; font-family: inherit;
}
.input:focus { outline: none; border-color: #2f6fed; box-shadow: 0 0 0 3px rgba(47,111,237,.12); }

.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%);
  background: rgba(20,22,26,.9); color: #fff; padding: 9px 18px;
  border-radius: 10px; font-size: 13px; opacity: 0; transition: opacity .2s;
  pointer-events: none; z-index: 300; max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; }
