/* ============================================================
 * 高三语文打卡 · 样式表（二次元 · 治愈系）
 * ============================================================ */
:root {
  --pink: #FF9EC4;
  --pink-d: #F56E9C;
  --blue: #7FB6F0;
  --blue-d: #5A93DD;
  --purple: #B79CF0;
  --cream: #FFF8F0;
  --ink: #3B3A55;
  --ink-2: #736F92;
  --ink-3: #A9A5C0;
  --ok: #2FC39B;
  --ok-bg: #E2F8F1;
  --no: #F2705F;
  --no-bg: #FEEBE8;
  --card: rgba(255, 255, 255, .88);
  --line: rgba(150, 140, 190, .16);
  --shadow: 0 12px 30px rgba(150, 120, 185, .16);
  --shadow-s: 0 6px 16px rgba(150, 120, 185, .12);
  --radius: 22px;
  --radius-s: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(165deg, #FFF3E9 0%, #FDE8F3 34%, #E9F1FE 68%, #F3EDFF 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
}

/* ---------- 樱花花瓣飘落背景 ---------- */
.petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.petal {
  position: absolute;
  top: -8vh;
  width: 16px;
  height: 16px;
  opacity: .7;
  background: radial-gradient(circle at 30% 30%, #FFD7EA, #FFADCE 70%);
  border-radius: 100% 0 100% 0;
  animation: petal-fall linear infinite;
}
.petal.blue { background: radial-gradient(circle at 30% 30%, #D6EAFF, #A9CDF7 70%); }
@keyframes petal-fall {
  0% { transform: translateY(-10vh) rotate(0deg); }
  100% { transform: translateY(112vh) rotate(360deg); }
}

/* ---------- 应用主体（手机框） ---------- */
.app {
  position: relative;
  z-index: 1;
  max-width: 460px;
  margin: 0 auto;
  min-height: 100%;
  padding: 0 16px calc(96px + var(--safe-b));
}
@media (min-width: 520px) {
  body { padding: 24px 0; }
  .app {
    background: rgba(255, 255, 255, .34);
    border-radius: 34px;
    box-shadow: 0 24px 60px rgba(140, 110, 180, .22);
    min-height: calc(100vh - 48px);
    overflow: hidden;
  }
}

.screen { display: none; animation: fade-up .45s cubic-bezier(.22, 1, .36, 1); }
.screen.active { display: block; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 顶部 ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 4px 14px;
}
.hero .avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--cream);
  overflow: hidden;
  flex: none;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px rgba(255, 158, 196, .45), var(--shadow-s);
  position: relative;
}
.hero .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero .hi { font-size: 12px; color: var(--ink-2); letter-spacing: .5px; }
.hero .date { font-size: 17px; font-weight: 800; margin-top: 1px; }
.hero .date .wk { color: var(--pink-d); font-size: 13px; margin-left: 6px; font-weight: 700; }
.hero .right { margin-left: auto; text-align: right; }
.hero .lvl {
  font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  padding: 4px 10px; border-radius: 999px;
  box-shadow: 0 4px 10px rgba(183, 156, 240, .35);
  display: inline-block;
}

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card.pad-0 { padding: 0; overflow: hidden; }

.section-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  letter-spacing: .4px;
  margin: 6px 4px 10px;
}
.section-label::before {
  content: ''; width: 4px; height: 14px; border-radius: 3px;
  background: linear-gradient(180deg, var(--pink), var(--blue));
}

/* 板块徽章 */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700;
  padding: 4px 11px; border-radius: 999px;
  line-height: 1.4;
}

/* ---------- 打卡统计条 ---------- */
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-s);
  padding: 12px 8px;
  text-align: center;
}
.stat .num {
  font-size: 22px; font-weight: 900; line-height: 1.1;
  background: linear-gradient(135deg, var(--pink-d), var(--blue-d));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat .lbl { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.stat .num small { font-size: 12px; font-weight: 800; }

/* ---------- 今日任务卡 ---------- */
.today-card { position: relative; }
.today-card .head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.today-card h2 {
  font-size: 19px; font-weight: 800; margin: 6px 0 4px; letter-spacing: .3px;
}
.today-card .sub { font-size: 12.5px; color: var(--ink-2); }
.round-tag {
  font-size: 11px; font-weight: 700; color: var(--purple);
  background: #F2ECFE; padding: 3px 9px; border-radius: 999px;
}
.round-tag.real-tag {
  color: #fff; background: linear-gradient(135deg, #F58A8A, #E86A6A);
  box-shadow: 0 3px 10px rgba(232, 106, 106, .35);
}
.src-line {
  margin-top: 8px; font-size: 11.5px; color: var(--ink-3);
  line-height: 1.6; letter-spacing: .2px;
}
.src-line b { color: var(--ink-2); font-weight: 700; }
.done-flag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; color: var(--ok);
  background: var(--ok-bg); padding: 4px 10px; border-radius: 999px;
}

.point-list { list-style: none; padding: 0; margin: 12px 0 0; }
.point-list li {
  position: relative;
  padding: 8px 4px 8px 26px;
  font-size: 14px; line-height: 1.7; color: var(--ink);
  border-bottom: 1px dashed var(--line);
}
.point-list li:last-child { border-bottom: none; }
.point-list li::before {
  content: '✦';
  position: absolute; left: 4px; top: 8px;
  color: var(--pink); font-size: 12px;
}
.tip-box {
  margin-top: 12px; padding: 11px 13px;
  background: linear-gradient(135deg, #FFF4FA, #EFF6FF);
  border-radius: var(--radius-s);
  border: 1px dashed rgba(255, 158, 196, .55);
  font-size: 13px; color: var(--ink-2);
}
.tip-box b { color: var(--pink-d); }
.example-box {
  margin-top: 10px; padding: 10px 13px;
  background: #FBF9FF; border-radius: var(--radius-s);
  font-size: 13px; color: var(--ink-2);
  border-left: 3px solid var(--purple);
}

/* ---------- 按钮 ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; border: none; cursor: pointer;
  font-family: inherit; font-size: 16px; font-weight: 800; letter-spacing: .5px;
  color: #fff; padding: 15px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-d) 45%, var(--blue-d) 100%);
  box-shadow: 0 10px 22px rgba(245, 110, 156, .35);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s;
  margin-top: 6px;
}
.btn:active { transform: scale(.97); box-shadow: 0 5px 14px rgba(245, 110, 156, .3); }
.btn.ghost {
  background: #fff; color: var(--pink-d);
  box-shadow: var(--shadow-s);
  border: 1.5px solid rgba(255, 158, 196, .5);
}
.btn.ghost:active { filter: brightness(.98); }
.btn.blue {
  background: linear-gradient(135deg, var(--blue), var(--blue-d));
  box-shadow: 0 10px 22px rgba(90, 147, 221, .35);
}
.btn:disabled { opacity: .45; filter: grayscale(.3); }

/* ---------- 答题 ---------- */
.quiz-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.progress-bar {
  flex: 1; height: 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  overflow: hidden; box-shadow: inset 0 1px 3px rgba(150, 130, 190, .2);
}
.progress-bar i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--blue));
  transition: width .4s cubic-bezier(.22, 1, .36, 1);
}
.quiz-count { font-size: 12px; font-weight: 800; color: var(--ink-2); }

.q-type {
  display: inline-block; font-size: 11px; font-weight: 700;
  color: var(--blue-d); background: #E7F1FE;
  padding: 3px 9px; border-radius: 999px; margin-bottom: 8px;
}
.q-stem { font-size: 16px; font-weight: 700; line-height: 1.65; margin: 2px 0 14px; white-space: pre-line; }

.opt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 14px; margin-bottom: 10px;
  background: #fff; border: 1.5px solid var(--line);
  border-radius: var(--radius-s); cursor: pointer;
  font-size: 14.5px; line-height: 1.6;
  transition: all .18s ease;
}
.opt:active { transform: scale(.985); }
.opt .dot {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: #F1EEFA; color: var(--ink-2);
  font-size: 12.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px; transition: all .18s;
}
.opt.sel { border-color: var(--pink); background: #FFF6FA; }
.opt.sel .dot { background: var(--pink); color: #fff; }

.opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.opt.correct .dot { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--no); background: var(--no-bg); }
.opt.wrong .dot { background: var(--no); color: #fff; }
.opt.locked { cursor: default; }
.opt.disabled { opacity: .6; }

.judge-row { display: flex; gap: 12px; }
.judge-row .opt { flex: 1; justify-content: center; }
.judge-row .opt .dot { display: none; }

.fill-input {
  width: 100%; font-family: inherit; font-size: 16px;
  padding: 14px 15px; border-radius: var(--radius-s);
  border: 1.5px solid var(--line); background: #fff;
  color: var(--ink); outline: none;
}
.fill-input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(127, 182, 240, .18); }

/* 解析 */
.explain {
  margin-top: 14px; padding: 13px 15px;
  border-radius: var(--radius-s); font-size: 13.5px; line-height: 1.7;
  animation: fade-up .3s ease;
}
.explain.ok { background: var(--ok-bg); border: 1px solid rgba(47, 195, 155, .3); }
.explain.no { background: var(--no-bg); border: 1px solid rgba(242, 112, 95, .3); }
.explain .verdict { font-weight: 800; margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }
.explain.ok .verdict { color: var(--ok); }
.explain.no .verdict { color: var(--no); }
.explain .ans { color: var(--ink-2); }

/* ---------- 结算 ---------- */
.result { text-align: center; padding: 8px 4px 0; }
.result .figure {
  width: 180px; height: 180px; margin: 6px auto 12px;
  border-radius: 26px; overflow: hidden;
  background: var(--cream);
  box-shadow: var(--shadow);
  border: 4px solid #fff;
  position: relative;
}
.result .figure img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; }
.result .figure::after {
  content: ''; position: absolute; inset: 0;
  box-shadow: inset 0 0 0 1.5px rgba(255, 158, 196, .4); border-radius: 22px;
}
.score-ring {
  width: 108px; height: 108px; margin: -34px auto 6px;
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff;
  box-shadow: 0 8px 22px rgba(150, 120, 185, .25);
  position: relative; z-index: 2;
  border: 4px solid;
  border-image: linear-gradient(135deg, var(--pink), var(--blue)) 1;
  border-radius: 50%;
}
.score-ring { border: 4px solid transparent; background-image: linear-gradient(#fff, #fff), linear-gradient(135deg, var(--pink), var(--blue)); background-origin: border-box; background-clip: padding-box, border-box; }
.score-ring .n { font-size: 30px; font-weight: 900; line-height: 1; }
.score-ring .n small { font-size: 13px; color: var(--ink-3); font-weight: 700; }
.score-ring .t { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.result h2 { font-size: 20px; font-weight: 900; margin: 10px 0 4px; }
.result p { font-size: 13.5px; color: var(--ink-2); margin: 0 0 4px; }

/* ---------- 底部导航 ---------- */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 460px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 2px; padding: 8px 10px calc(8px + var(--safe-b));
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 -8px 24px rgba(150, 120, 185, .12);
  border-radius: 22px 22px 0 0;
  z-index: 30;
}
.nav button {
  background: none; border: none; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; cursor: pointer; color: var(--ink-3);
  font-size: 10.5px; font-weight: 700;
  border-radius: 14px; transition: all .2s;
}
.nav button .ic { font-size: 20px; line-height: 1; filter: grayscale(.5); opacity: .75; }
.nav button.on { color: var(--pink-d); }
.nav button.on .ic { filter: none; opacity: 1; transform: translateY(-1px) scale(1.06); }
.nav button.on::after {
  content: ''; width: 16px; height: 3px; border-radius: 3px; margin-top: 1px;
  background: linear-gradient(90deg, var(--pink), var(--blue));
}

/* ---------- 进度/日历 ---------- */
.cal {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 6px; margin-top: 12px;
}
.cal .dow { text-align: center; font-size: 10.5px; color: var(--ink-3); font-weight: 700; padding-bottom: 2px; }
.cal .day {
  aspect-ratio: 1; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--ink-3);
  background: rgba(255, 255, 255, .6);
  border: 1px solid var(--line);
  position: relative;
}
.cal .day.empty { background: transparent; border-color: transparent; }
.cal .day.done {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 10px rgba(183, 156, 240, .35);
}
.cal .day.today { outline: 2px solid var(--blue); outline-offset: 1px; }

.sec-row {
  display: flex; align-items: center; gap: 10px; margin: 12px 0;
}
.sec-row .nm { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; width: 92px; flex: none; }
.sec-row .track {
  flex: 1; height: 10px; border-radius: 999px; background: rgba(255,255,255,.8);
  overflow: hidden; box-shadow: inset 0 1px 3px rgba(150,130,190,.15);
}
.sec-row .track i { display: block; height: 100%; border-radius: 999px; transition: width .5s; }
.sec-row .pc { font-size: 11.5px; font-weight: 800; color: var(--ink-2); width: 34px; text-align: right; flex: none; }

/* ---------- 错题本 ---------- */
.wrong-item { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.wrong-item:last-child { border-bottom: none; }
.wrong-item .meta { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.wrong-item .date { font-size: 11px; color: var(--ink-3); }
.wrong-item .stem { font-size: 14px; font-weight: 700; line-height: 1.6; margin-bottom: 8px; }
.wrong-item .row { font-size: 13px; margin: 3px 0; }
.wrong-item .row .k { color: var(--ink-3); }
.wrong-item .row.your { color: var(--no); }
.wrong-item .row.right { color: var(--ok); }
.wrong-item .row .k { margin-right: 4px; }

/* ---------- 空状态 ---------- */
.empty-state { text-align: center; padding: 40px 16px; }
.empty-state .big { font-size: 44px; margin-bottom: 8px; }
.empty-state p { color: var(--ink-2); font-size: 14px; margin: 4px 0; }
.empty-state img { width: 130px; mix-blend-mode: multiply; }

/* ---------- 打卡成功浮层 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px);
  background: rgba(59, 58, 85, .92); color: #fff;
  font-size: 13.5px; font-weight: 700;
  padding: 11px 20px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: all .3s cubic-bezier(.22, 1, .36, 1);
  z-index: 60; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 撒花 */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 55; overflow: hidden; }
.confetti i {
  position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px;
  animation: confetti-fall 2.6s ease-in forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(-20px) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: .2; }
}

.pop { animation: pop .5s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- 海报 ---------- */
.poster-wrap { text-align: center; }
#posterCanvas {
  width: 100%; max-width: 340px; border-radius: 18px;
  box-shadow: var(--shadow); border: 4px solid #fff;
}
.poster-hint { font-size: 12.5px; color: var(--ink-2); margin: 12px 2px 4px; line-height: 1.7; }

/* 小工具 */
.mt { margin-top: 12px; }
.center { text-align: center; }
.muted { color: var(--ink-2); font-size: 13px; }
.hidden { display: none !important; }

/* 开关（用于演示：切换"查看历史某天"） */
.linkbtn {
  background: none; border: none; font-family: inherit;
  color: var(--blue-d); font-size: 13px; font-weight: 700; cursor: pointer;
  padding: 6px 2px;
}

/* ========== 学生身份选择遮罩 ========== */
.student-picker {
  position: fixed; inset: 0; z-index: 99;
  background: rgba(30, 15, 40, 0.55);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.student-picker.show { display: flex; }
.sp-card {
  background: #fff; border-radius: 20px; padding: 28px 22px 22px;
  width: 100%; max-width: 340px;
  box-shadow: 0 12px 32px rgba(120, 60, 110, 0.28);
  text-align: center;
}
.sp-title { font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.sp-sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 18px; }
.sp-input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--pink); border-radius: 12px;
  font-size: 15px; outline: none; box-sizing: border-box;
  background: var(--pink-bg); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.sp-input:focus { border-color: var(--pink-d); box-shadow: 0 0 0 3px rgba(230, 120, 160, 0.2); background: #fff; }
.sp-quick { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.sp-quick-label { font-size: 11.5px; color: var(--ink-3); }
.sp-chip {
  background: var(--pink-bg); color: var(--pink-d);
  border: 1px solid var(--pink); border-radius: 20px;
  padding: 4px 12px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.sp-chip:active { background: var(--pink); color: #fff; }
.sp-btn {
  margin-top: 22px; width: 100%; padding: 13px 0;
  background: linear-gradient(135deg, var(--pink), var(--pink-d));
  color: #fff; border: none; border-radius: 14px;
  font-size: 15px; font-weight: 700; font-family: inherit;
  cursor: pointer;
}
.sp-btn:active { transform: scale(0.98); }
