/* ============================================================
   小书桌 · 多巴胺风格
   硬边框 + 错位硬阴影 + 糖果色，尽量少用灰
   ============================================================ */

:root {
  --ink: #2b2340;
  --paper: #fff7ec;
  --white: #ffffff;

  --pink: #ff6fa5;
  --pink-2: #ff9bc2;
  --coral: #ff8a5b;
  --lemon: #ffd93d;
  --lemon-2: #ffe87a;
  --mint: #3ddc97;
  --mint-2: #8bf0c4;
  --sky: #5ac8fa;
  --sky-2: #9be0ff;
  --grape: #a78bfa;
  --grape-2: #cdbdff;

  --shadow: 0 8px 0 var(--ink);
  --shadow-sm: 0 5px 0 var(--ink);
  --radius: 28px;
  --radius-sm: 18px;

  --f: "Nunito", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--f);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(circle at 8% 8%, #ffe0cf 0 16%, transparent 16.5%),
    radial-gradient(circle at 92% 4%, #d6f0ff 0 14%, transparent 14.5%),
    radial-gradient(circle at 84% 92%, #e9ddff 0 18%, transparent 18.5%),
    radial-gradient(circle at 6% 88%, #d9fbe9 0 15%, transparent 15.5%),
    linear-gradient(160deg, #fffaf1, #fff2f7 50%, #eef9ff);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── 背景漂浮色块 ───────────────────────────────────────── */
.bg-blobs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.blob {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .55;
  animation: drift 18s ease-in-out infinite alternate;
}
.b1 { width: 260px; height: 260px; left: -80px; top: 12%; background: var(--pink-2); }
.b2 { width: 200px; height: 200px; right: -60px; top: 28%; background: var(--sky-2); animation-delay: -6s; }
.b3 { width: 300px; height: 300px; right: 8%; bottom: -120px; background: var(--lemon-2); animation-delay: -12s; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(14px, -22px, 0) scale(1.06); }
}

/* ── 通用 ───────────────────────────────────────────────── */
main { position: relative; z-index: 1; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  background: var(--white);
  white-space: nowrap;
}
.chip-lemon { background: var(--lemon); }
.chip-mint { background: var(--mint-2); }
.chip-soft { background: #fff; color: #6b6480; border-color: #d9d2e6; }

.hint { color: #6b6480; font-size: 15px; line-height: 1.7; margin: 0; }
.kid .hint { text-align: center; }
.tiny { color: #8a829c; font-size: 13px; line-height: 1.6; margin: 10px 0 0; }
.error {
  color: #c02b4e;
  background: #ffe3ec;
  border: 3px solid #c02b4e;
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 700;
  margin: 4px 0;
}

/* ── 按钮 ───────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 17px 22px;
  border: 4px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  font-family: inherit;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: .02em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .08s ease, box-shadow .08s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--ink);
}
.btn-primary { background: linear-gradient(135deg, var(--pink-2), var(--pink)); }
.btn-sky { background: linear-gradient(135deg, var(--sky-2), var(--sky)); }
.btn-mint { background: linear-gradient(135deg, var(--mint-2), var(--mint)); }
.btn-lemon { background: linear-gradient(135deg, var(--lemon-2), var(--lemon)); }
.btn-ghost { background: rgba(255, 255, 255, .62); box-shadow: none; }
.btn-ghost:active { transform: translateY(2px); box-shadow: none; }
.btn-xl {
  font-size: clamp(26px, 7vw, 34px);
  padding: 26px 24px;
  border-radius: 30px;
  border-width: 4px;
  box-shadow: 0 9px 0 var(--ink);
}

/* ── 输入 ───────────────────────────────────────────────── */
.input, .textarea {
  width: 100%;
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  background: var(--white);
  border: 4px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  outline: none;
}
.input:focus, .textarea:focus { box-shadow: 0 5px 0 var(--ink), 0 0 0 5px var(--lemon-2); }
.textarea { resize: vertical; line-height: 1.8; min-height: 140px; }
.input-code {
  font-size: 42px;
  font-weight: 900;
  text-align: center;
  letter-spacing: .35em;
  padding-left: .35em;
}

/* ── 孩子端外壳 ─────────────────────────────────────────── */
.kid .kid-shell {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 620px;
  margin: 0 auto;
  padding: 24px 22px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mascot {
  font-size: clamp(72px, 20vw, 116px);
  line-height: 1;
  filter: drop-shadow(0 8px 0 rgba(43, 35, 64, .18));
  animation: float 3.6s ease-in-out infinite;
}
.mascot.bounce { animation: bounce 1.1s ease-in-out infinite; }
.mascot.float { animation: float 3.6s ease-in-out infinite; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-12px) rotate(3deg); }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  45%      { transform: translateY(-18px) scale(1.06); }
  65%      { transform: translateY(0) scale(.97); }
}

.hero-title {
  font-size: clamp(30px, 8.4vw, 44px);
  line-height: 1.35;
  font-weight: 900;
  margin: 6px 0;
  text-align: center;
}

.big-num {
  display: inline-block;
  color: var(--pink);
  font-size: 1.35em;
  transform: rotate(-5deg);
  text-shadow: 3px 3px 0 var(--lemon);
  padding: 0 .06em;
}

.dots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 6px 0 4px;
}
.dots i {
  width: 18px;
  height: 18px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--white);
}
.dots i:nth-child(3n+1) { background: var(--pink-2); }
.dots i:nth-child(3n+2) { background: var(--sky-2); }
.dots i:nth-child(3n)   { background: var(--lemon-2); }

.progress {
  height: 18px;
  border: 4px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--sky));
  transition: width .45s cubic-bezier(.2, .9, .3, 1.2);
}

/* ── 任务卡 ─────────────────────────────────────────────── */
.task-card {
  background: var(--white);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 40vh;
  padding: 30px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}
.task-emoji {
  font-size: clamp(52px, 15vw, 78px);
  line-height: 1;
  transform: rotate(-6deg);
}
.task-text {
  font-size: clamp(26px, 7.2vw, 38px);
  font-weight: 900;
  line-height: 1.55;
  margin: 0;
  word-break: break-word;
}

.pop { animation: pop .35s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes pop {
  from { transform: scale(.94); opacity: .4; }
  to   { transform: scale(1); opacity: 1; }
}

.actions { display: grid; gap: 12px; }

/* ── 求助面板 ───────────────────────────────────────────── */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 35, 64, .38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 40;
}
.backdrop.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(620px, 100%);
  transform: translate(-50%, 110%);
  transition: transform .28s cubic-bezier(.2, .9, .3, 1.1);
  background: var(--paper);
  border: 4px solid var(--ink);
  border-bottom: 0;
  border-radius: 30px 30px 0 0;
  padding: 16px 22px 28px;
  z-index: 50;
  display: grid;
  gap: 12px;
}
.sheet.open { transform: translate(-50%, 0); }
.sheet h3 { margin: 4px 0 8px; font-size: 24px; text-align: center; }
.sheet-handle {
  width: 64px;
  height: 7px;
  border-radius: 999px;
  background: var(--ink);
  opacity: .2;
  margin: 0 auto 6px;
}

/* ── 完成页 ─────────────────────────────────────────────── */
.done-shell { text-align: center; }
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.stat {
  background: var(--white);
  border: 4px solid var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat b { font-size: clamp(34px, 9vw, 46px); line-height: 1.1; }
.stat span { font-size: 14px; color: #6b6480; font-weight: 700; }

/* ── 居中页（配对 / 登录）──────────────────────────────── */
.center .center-shell {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 460px;
  margin: 0 auto;
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 16px;
  text-align: center;
}
.brand {
  font-size: clamp(30px, 8vw, 40px);
  font-weight: 900;
  margin: 0;
}
.stack { display: grid; gap: 14px; margin-top: 6px; }

/* ── 家长端 ─────────────────────────────────────────────── */
.pnav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 250, 241, .92);
  backdrop-filter: blur(10px);
  border-bottom: 4px solid var(--ink);
  padding: 12px 18px 10px;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
}
.logo-sm { font-size: 24px; }
.logout {
  margin-left: auto;
  color: #6b6480;
  font-size: 14px;
  text-decoration: none;
  font-weight: 700;
}
.tabs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.tab {
  padding: 8px 16px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.tab.active { background: var(--pink-2); }

.wrap {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: 18px 16px 60px;
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--white);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.panel.soft { background: #fffdf6; }
.panel.center { text-align: center; }
.panel h2 { margin: 0 0 6px; font-size: 22px; }
.panel h3 { margin: 0 0 10px; font-size: 18px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-head h2, .panel-head h3 { margin: 0; }

.row-gap { display: flex; gap: 8px; }

.mini-btn {
  display: inline-block;
  padding: 6px 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--lemon);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.status-card h2 { margin: 0 0 4px; font-size: 21px; }
.status-card p { margin: 0; color: #5d5670; font-size: 14px; font-weight: 600; }
.status-emoji { font-size: 46px; line-height: 1; }
.status-empty { background: linear-gradient(135deg, #fff2dd, #ffe4cc); }
.status-ready { background: linear-gradient(135deg, #e9f8ff, #d6f0ff); }
.status-doing { background: linear-gradient(135deg, #e8f7ff, #cdeeff); }
.status-done  { background: linear-gradient(135deg, #fff6d6, #ffe9a8); }

.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 3px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--white);
  padding: 12px 14px;
}
.task-main { flex: 1; min-width: 0; }
.task-line { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.55; word-break: break-word; }
.task-meta { display: flex; gap: 6px; color: #7b7391; font-size: 13px; font-weight: 600; margin-top: 2px; }

.dot {
  width: 16px;
  height: 16px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--white);
  flex: 0 0 auto;
}
.status-doing .dot { background: var(--sky); }
.status-done .dot { background: var(--mint); }
.status-skipped .dot { background: var(--lemon); }
.dot.ok { background: var(--mint); }

.icon-btn {
  border: 3px solid transparent;
  background: transparent;
  color: #b3aac6;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 12px;
  font-family: inherit;
}
.icon-btn:hover { color: #c02b4e; border-color: #f3c3d0; }

.empty { text-align: center; padding: 18px 0 8px; display: grid; gap: 12px; }
.empty p { margin: 0; color: #6b6480; font-weight: 700; }

.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.kpis > div {
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kpis b { font-size: 26px; line-height: 1.2; }
.kpis span { font-size: 12px; color: #6b6480; font-weight: 700; }

.week-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.week-table th {
  text-align: left;
  font-size: 12px;
  color: #8a829c;
  padding: 6px 8px;
  border-bottom: 3px solid var(--ink);
}
.week-table td {
  padding: 10px 8px;
  border-bottom: 2px solid #f0e9dc;
  font-weight: 700;
}
.week-table tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.badge.ok { background: var(--mint-2); }
.badge.open { background: var(--pink-2); }
.badge.rest { background: var(--sky-2); }
.badge.none { background: #f0e9dc; color: #7b7391; }

.pair-code {
  font-size: clamp(44px, 13vw, 64px);
  font-weight: 900;
  letter-spacing: .18em;
  padding-left: .18em;
  margin: 14px 0;
  color: var(--ink);
  text-shadow: 4px 4px 0 var(--lemon);
}
.inline-form { display: flex; gap: 10px; align-items: stretch; }
.inline-form .input { flex: 1; }
.inline-form .btn { width: auto; white-space: nowrap; padding: 14px 22px; font-size: 17px; }

/* ── 小提示 ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  padding: 12px 22px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 999;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── 彩纸 ───────────────────────────────────────────────── */
.confetti-piece {
  position: fixed;
  top: -20px;
  width: 12px;
  height: 16px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  z-index: 999;
  pointer-events: none;
  animation: fall 2.6s linear forwards;
}
@keyframes fall {
  to { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}

/* ── 小屏微调 ───────────────────────────────────────────── */
@media (max-width: 420px) {
  .kid-shell { padding: 18px 16px 34px; gap: 18px; }
  .task-card { min-height: 36vh; padding: 24px 18px; }
  .btn-xl { padding: 22px 18px; }
  .kpis b { font-size: 22px; }
  .week-table { font-size: 13px; }
  .week-table th, .week-table td { padding: 8px 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
