/* ============ KET 冲刺打卡 · 游戏任务板风格 ============ */
:root {
  --paper: #FDF4E3;
  --ink: #26282B;
  --card: #FFFFFF;
  --vocab: #FF8A3D;
  --listen: #2EC4B6;
  --write: #8B7CF6;
  --speak: #FF5D73;
  --gold: #FFD166;
  --green: #06C270;
  --muted: #8A8F98;
  --radius: 18px;
  --shadow: 4px 4px 0 var(--ink);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, sans-serif;
}

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

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--paper);
  background-image: radial-gradient(rgba(38,40,43,.06) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 90px; }

/* ---------- 顶部 ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.logo { font-size: 1.25rem; font-weight: 900; letter-spacing: 1px; }
.logo .tag {
  display: inline-block; background: var(--ink); color: var(--gold);
  font-size: .7rem; padding: 2px 8px; border-radius: 99px; vertical-align: middle; margin-left: 6px;
}
.streak {
  background: var(--gold); border: 3px solid var(--ink); border-radius: 99px;
  padding: 4px 14px; font-weight: 900; box-shadow: var(--shadow); font-size: .95rem;
}

/* ---------- 倒计时横幅 ---------- */
.countdown {
  background: var(--ink); color: #fff; border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 18px; position: relative; overflow: hidden;
}
.countdown .big { font-size: 2rem; font-weight: 900; color: var(--gold); }
.countdown .sub { font-size: .85rem; opacity: .85; }
.countdown .phase {
  position: absolute; right: 14px; top: 12px; background: var(--gold); color: var(--ink);
  border-radius: 99px; padding: 3px 12px; font-weight: 900; font-size: .8rem;
}
.progressbar { height: 10px; background: rgba(255,255,255,.2); border-radius: 99px; margin-top: 10px; }
.progressbar > i { display: block; height: 100%; background: var(--gold); border-radius: 99px; transition: width .6s; }

/* ---------- 任务卡片 ---------- */
.tasks { display: grid; gap: 14px; }
.task-card {
  background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: transform .12s, box-shadow .12s; user-select: none;
  animation: pop-in .45s cubic-bezier(.2,1.4,.4,1) backwards;
}
.tasks .task-card:nth-child(1) { animation-delay: .05s; }
.tasks .task-card:nth-child(2) { animation-delay: .12s; }
.tasks .task-card:nth-child(3) { animation-delay: .19s; }
.tasks .task-card:nth-child(4) { animation-delay: .26s; }
.tasks .task-card:nth-child(5) { animation-delay: .33s; }
@keyframes pop-in { from { opacity: 0; transform: scale(.85) translateY(14px); } }
.task-card:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--ink); }
.task-card.done { opacity: .75; }
.task-card.done .task-icon { filter: grayscale(0); }
.task-icon {
  width: 56px; height: 56px; border-radius: 14px; border: 3px solid var(--ink);
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem; flex-shrink: 0;
}
.task-card[data-mod="vocab"]  .task-icon { background: var(--vocab); }
.task-card[data-mod="listen"] .task-icon { background: var(--listen); }
.task-card[data-mod="write"]  .task-icon { background: var(--write); }
.task-card[data-mod="speak"]  .task-icon { background: var(--speak); }
.task-card[data-mod="bonus"]  .task-icon { background: var(--gold); }
.task-info { flex: 1; }
.task-info h3 { font-size: 1.05rem; font-weight: 900; }
.task-info p { font-size: .82rem; color: var(--muted); }
.task-state { font-size: 1.5rem; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-block; border: 3px solid var(--ink); border-radius: 14px;
  background: var(--card); color: var(--ink); font-family: var(--font);
  font-size: 1rem; font-weight: 900; padding: 12px 22px; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .1s, box-shadow .1s; user-select: none;
}
.btn:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--gold); }
.btn.vocab { background: var(--vocab); color: #fff; }
.btn.listen { background: var(--listen); color: #fff; }
.btn.write { background: var(--write); color: #fff; }
.btn.speak { background: var(--speak); color: #fff; }
.btn.ghost { box-shadow: none; border-color: rgba(38,40,43,.25); font-weight: 700; }
.btn.small { padding: 7px 14px; font-size: .85rem; border-radius: 10px; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }

/* ---------- 模块全屏页 ---------- */
.screen {
  position: fixed; inset: 0; background: var(--paper); z-index: 50;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: slide-up .28s cubic-bezier(.2,1,.4,1);
}
@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } }
.screen-inner { max-width: 560px; margin: 0 auto; padding: 16px 16px 60px; }
.screen-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.screen-head h2 { font-size: 1.2rem; font-weight: 900; flex: 1; }
.back-btn {
  width: 42px; height: 42px; border: 3px solid var(--ink); border-radius: 12px;
  background: var(--card); font-size: 1.2rem; font-weight: 900; cursor: pointer; box-shadow: var(--shadow);
}
.pill {
  border: 2.5px solid var(--ink); border-radius: 99px; background: var(--card);
  padding: 3px 12px; font-weight: 900; font-size: .85rem;
}

/* ---------- 词汇卡 ---------- */
.flashcard {
  background: var(--card); border: 3px solid var(--ink); border-radius: 22px;
  box-shadow: 6px 6px 0 var(--ink); padding: 34px 22px; text-align: center; margin-top: 10px;
  min-height: 300px; display: flex; flex-direction: column; justify-content: center; gap: 10px;
}
.flashcard .word { font-size: 2.2rem; font-weight: 900; word-break: break-word; }
.flashcard .ipa { color: var(--muted); font-size: 1rem; }
.flashcard .pos {
  display: inline-block; align-self: center; background: var(--vocab); color: #fff;
  border: 2px solid var(--ink); border-radius: 99px; padding: 1px 12px; font-size: .8rem; font-weight: 900;
}
.flashcard .zh { font-size: 1.15rem; font-weight: 700; margin-top: 6px; }
.flashcard .ex { font-size: .9rem; color: var(--muted); font-style: italic; }
.flashcard .newtag {
  align-self: center; background: var(--green); color: #fff; border: 2px solid var(--ink);
  border-radius: 99px; padding: 2px 14px; font-weight: 900; font-size: .8rem;
}
.audio-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--ink);
  background: var(--gold); font-size: 1.4rem; cursor: pointer; box-shadow: var(--shadow);
  align-self: center;
}
.audio-btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }

.quiz-options { display: grid; gap: 10px; margin-top: 14px; }
.quiz-opt {
  border: 3px solid var(--ink); border-radius: 14px; background: var(--card);
  padding: 13px 16px; font-size: 1rem; font-weight: 700; cursor: pointer; text-align: left;
  box-shadow: var(--shadow); font-family: var(--font);
}
.quiz-opt:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.quiz-opt.right { background: var(--green); color: #fff; }
.quiz-opt.wrong { background: var(--speak); color: #fff; }

/* ---------- 听力 ---------- */
.script-box, .panel-box {
  background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.script-line { margin-bottom: 8px; font-size: .95rem; }
.script-line b { color: var(--listen); }
.q-block { margin-bottom: 18px; }
.q-block h4 { margin-bottom: 8px; font-size: 1rem; }

/* ---------- 写作 ---------- */
.prompt-points { margin: 10px 0 0 18px; font-size: .95rem; }
.panel-item { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; font-size: .95rem; }
.panel-item .num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--ink);
  background: var(--write); color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center;
}
textarea.essay {
  width: 100%; min-height: 170px; border: 3px solid var(--ink); border-radius: var(--radius);
  padding: 14px; font-size: 1.05rem; font-family: var(--font); background: var(--card);
  box-shadow: var(--shadow); resize: vertical; outline: none;
}
.wordcount { text-align: right; font-weight: 900; margin-top: 6px; font-size: .9rem; }
.wordcount.ok { color: var(--green); }
.score-row { display: flex; gap: 10px; margin: 12px 0; }
.score-chip {
  flex: 1; text-align: center; border: 3px solid var(--ink); border-radius: 14px;
  background: var(--card); padding: 10px 4px; box-shadow: var(--shadow);
}
.score-chip .n { font-size: 1.5rem; font-weight: 900; color: var(--write); }
.score-chip .t { font-size: .75rem; color: var(--muted); font-weight: 700; }
.feedback-box { background: #FBF7FF; border: 3px dashed var(--write); border-radius: var(--radius); padding: 14px; margin-top: 12px; font-size: .95rem; }
.feedback-box ul { margin-left: 18px; }
.improved { background: #F0FFF7; border: 3px dashed var(--green); border-radius: var(--radius); padding: 14px; margin-top: 12px; font-size: .98rem; }

/* ---------- 口语 ---------- */
.rec-btn {
  width: 92px; height: 92px; border-radius: 50%; border: 4px solid var(--ink);
  background: var(--speak); color: #fff; font-size: 2rem; cursor: pointer;
  box-shadow: var(--shadow); margin: 14px auto; display: block;
}
.rec-btn.recording { animation: pulse 1s infinite; background: #C81E3C; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.transcript { background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius); padding: 12px 16px; margin-top: 10px; font-size: .98rem; box-shadow: var(--shadow); }
.transcript .label { font-size: .75rem; font-weight: 900; color: var(--speak); }

/* ---------- 打卡日历 ---------- */
.section-title { font-weight: 900; font-size: 1rem; margin: 22px 0 10px; }
.calendar {
  background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px;
}
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.cal-cell {
  aspect-ratio: 1; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; color: var(--muted); border: 2px solid transparent;
}
.cal-cell.head { font-size: .7rem; aspect-ratio: auto; padding: 2px 0; }
.cal-cell.day { border-color: rgba(38,40,43,.12); }
.cal-cell.stamped { background: var(--green); color: #fff; border-color: var(--ink); }
.cal-cell.partial { background: var(--gold); border-color: var(--ink); color: var(--ink); }
.cal-cell.today { outline: 3px solid var(--ink); }

/* ---------- 统计块（家长页共用） ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.stat-card {
  background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; text-align: center;
}
.stat-card .n { font-size: 1.7rem; font-weight: 900; }
.stat-card .t { font-size: .78rem; color: var(--muted); font-weight: 700; }
table.history { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.history th, table.history td { border-bottom: 2px solid rgba(38,40,43,.1); padding: 8px 6px; text-align: left; }
table.history th { font-size: .75rem; color: var(--muted); }

/* ---------- 完成庆祝 ---------- */
.celebrate {
  position: fixed; inset: 0; z-index: 99; background: rgba(38,40,43,.55);
  display: flex; align-items: center; justify-content: center; animation: fadein .3s;
}
@keyframes fadein { from { opacity: 0; } }
.celebrate-card {
  background: var(--gold); border: 4px solid var(--ink); border-radius: 26px;
  box-shadow: 8px 8px 0 var(--ink); padding: 40px 30px; text-align: center; max-width: 320px;
  animation: pop-in .5s cubic-bezier(.2,1.6,.4,1);
}
.celebrate-card .emoji { font-size: 3.4rem; }
.celebrate-card h2 { font-size: 1.4rem; font-weight: 900; margin: 8px 0; }
.confetti { position: fixed; top: -20px; font-size: 1.4rem; animation: fall linear forwards; z-index: 100; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 99px; padding: 10px 22px;
  font-weight: 700; font-size: .9rem; z-index: 120; animation: fadein .25s; max-width: 86vw; text-align: center;
}

/* ---------- 家长入口 ---------- */
.parent-link { text-align: center; margin-top: 26px; }
.parent-link a { color: var(--muted); font-size: .82rem; text-decoration: none; font-weight: 700; }

.loading-dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

input.field, select.field {
  width: 100%; border: 3px solid var(--ink); border-radius: 12px; padding: 10px 14px;
  font-size: 1rem; font-family: var(--font); background: var(--card); outline: none;
}
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 900; font-size: .85rem; margin-bottom: 6px; }
