/* =========================================================
   松鼠點數收集 · 歐的樂星球 — PWA styles
   風格：精緻女性向 lifestyle（hairline / 柔光暈 / 中黑字 / 暖橘擴散光）
   品牌色：#FEFBF9 / #FFF3EE / #F7DCD1 / #C78E78 / #DA844F / #5E5453
   ========================================================= */

:root {
  --white: #FEFBF9;
  --pink-bg: #FFF3EE;
  --light-pink: #F7DCD1;
  --lotus: #C78E78;
  --lotus-deep: #a8725f;
  --orange: #DA844F;
  --orange-deep: #b96a38;
  --orange-soft: #e89a6a;
  --ink: #5E5453;
  --ink-soft: #7a706e;
  --ink-muted: #9c938f;
  --pink: #DB6D66;
  --cheek: #F5A3A4;
  --honey: #EBB95E;
  --moss: #A4AE92;

  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --pill: 999px;

  /* 線條：1px hairline 取代 2-3px 黑邊 */
  --hairline:        rgba(94, 84, 83, 0.10);
  --hairline-strong: rgba(94, 84, 83, 0.16);
  --hairline-bold:   rgba(94, 84, 83, 0.22);

  /* 陰影：柔和擴散光暈取代平面 drop offset */
  --shadow-xs:   0 1px 2px  rgba(94, 84, 83, 0.04);
  --shadow-sm:   0 4px 12px rgba(94, 84, 83, 0.05);
  --shadow:      0 10px 30px rgba(94, 84, 83, 0.08);
  --shadow-lg:   0 20px 50px rgba(94, 84, 83, 0.10);
  --shadow-soft: 0 8px 24px rgba(94, 84, 83, 0.10);

  /* 暖橘擴散光（主按鈕、affordable card） */
  --shadow-warm: 0 8px 24px rgba(218, 132, 79, 0.28), 0 2px 6px rgba(218, 132, 79, 0.18);
  --shadow-warm-lg: 0 16px 40px rgba(218, 132, 79, 0.32), 0 4px 10px rgba(218, 132, 79, 0.20);

  /* focus ring */
  --ring-warm: 0 0 0 3px rgba(218, 132, 79, 0.12);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Chiron GoRound TC', system-ui, -apple-system, 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  color: var(--ink);
  background: var(--pink-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.005em;
}
body {
  min-height: 100dvh;
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
a { color: inherit; }

/* App shell */
#app {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--pink-bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ---------- screen wrapper ---------- */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}
.screen[hidden] { display: none !important; }
body.on-unlock {
  overflow: hidden;
  touch-action: none;
}
body.on-unlock #dock { display: none; }

/* ---------- common ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px;
  border: 1px solid var(--hairline);
  border-radius: var(--pill);
  font-weight: 600; font-size: 15px;
  letter-spacing: 0.02em;
  background: var(--white); color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.btn:active { transform: translateY(1px); box-shadow: var(--shadow-xs); }
.btn-primary {
  background: var(--orange); color: var(--white);
  border-color: transparent;
  box-shadow: var(--shadow-warm);
  font-weight: 600;
}
.btn-primary:active { box-shadow: 0 4px 12px rgba(218, 132, 79, 0.20); }
.btn-pink { background: var(--light-pink); color: var(--ink); border-color: transparent; }
.btn-ghost {
  background: transparent; border: 1px dashed var(--hairline-bold);
  color: var(--lotus); box-shadow: none;
}
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; box-shadow: var(--shadow-xs); }
.btn-icon {
  width: 40px; height: 40px; padding: 0; border-radius: 14px;
}
.btn-danger {
  background: var(--pink); color: var(--white); border-color: transparent;
  box-shadow: 0 8px 20px rgba(219, 109, 102, 0.24);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-trash { width: 50px; height: 50px; padding: 0; border-radius: 16px; }

.icon { display: inline-block; flex-shrink: 0; vertical-align: middle; }

.title { font-size: 22px; font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: 0.01em; }
.muted { color: var(--ink-muted); font-size: 13px; }
.kicker {
  font-size: 11px; font-weight: 600; letter-spacing: 0.18em;
  color: var(--lotus); text-transform: uppercase;
}

.empty {
  background: var(--white); border: 1px dashed var(--hairline-bold);
  border-radius: var(--radius); padding: 22px;
  text-align: center; color: var(--ink-soft); font-size: 14px; line-height: 1.6;
}

/* ---------- screen 1: today ---------- */
.today-header {
  background: var(--light-pink);
  border-bottom-left-radius: 32px;
  border-bottom-right-radius: 32px;
  padding: calc(env(safe-area-inset-top) + 8px) 20px 10px;
  position: relative;
  overflow: visible;
}
.today-header::after {
  content: ""; position: absolute; right: -10px; top: 60px;
  width: 90px; height: 90px;
  background: radial-gradient(circle, rgba(218,132,79,0.16) 0%, transparent 60%);
  border-radius: 50%;
}
.greet-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-top: 12px; padding-right: 36px; }
body.parent-mode .greet-row { padding-right: 0; }
.greet-copy { min-width: 0; flex: 1; }
.greet-date {
  font-size: 12px; font-weight: 500; color: var(--lotus-deep);
  letter-spacing: 0.14em; text-transform: uppercase;
}
.greet-name {
  font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 8px;
  letter-spacing: 0.01em;
}
.greet-sub { font-size: 14px; color: var(--ink-soft); margin-top: 4px; font-weight: 500; }
.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.streak-pill {
  background: var(--white); padding: 8px 14px;
  border: 1px solid var(--hairline); box-shadow: var(--shadow-sm);
  border-radius: var(--pill);
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.squirrel-wrap {
  display: flex; justify-content: center; margin-top: -20px; margin-bottom: -8px;
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.squirrel-wrap img {
  width: 216px; height: 216px;
  animation: breathe 3.2s ease-in-out infinite;
  filter: drop-shadow(0 12px 28px rgba(94,84,83,0.18));
}
.squirrel-wrap:active img { transform: translateY(2px) scale(.98); }
.squirrel-bubble {
  position: absolute;
  left: calc(50% + 22px);
  top: -4px;
  width: 122px;
  height: 52px;
  background: url("assets/speach_bubbles30.svg") center / contain no-repeat;
  color: var(--orange);
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 8px 14px 22px 18px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@keyframes breathe {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50%      { transform: translateY(-6px) rotate(1deg); }
}

.list-section {
  flex: 1;
  padding: 18px 18px 200px;
  overflow-y: auto;
}
.today-mode-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin: 0 0 18px;
  background: linear-gradient(135deg, var(--white), var(--light-pink));
  border: 1px solid rgba(218,132,79,0.22);
  border-radius: 22px;
  box-shadow: 0 8px 24px rgba(218,132,79,0.10);
}
.mode-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--white);
  border: 1px solid var(--hairline);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.mode-card-text {
  flex: 1;
  min-width: 0;
}
.mode-card-kicker {
  color: var(--lotus-deep);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
}
.mode-card-title {
  margin-top: 2px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
}
.mode-card-sub {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.38;
  font-weight: 500;
}
.today-mode-card .btn {
  flex-shrink: 0;
}
.reflection-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 16px 0 0;
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.reflection-card.done {
  background: linear-gradient(135deg, var(--white), rgba(247,220,209,0.58));
  border-color: rgba(218,132,79,0.18);
}
.reflection-card-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--pink-bg);
  display: grid;
  place-items: center;
  border: 1px solid var(--hairline);
}
.reflection-card-sticker {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--pink-bg);
  display: grid;
  place-items: center;
  border: 1px solid var(--hairline);
}
.reflection-card-sticker img,
.reflection-card-sticker svg {
  width: 68%;
  height: 68%;
  object-fit: contain;
  display: block;
}
.reflection-card-copy {
  min-width: 0;
}
.reflection-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}
.reflection-card-sub {
  margin-top: 3px;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.35;
}
.list-section h2 {
  font-size: 14px; font-weight: 600; margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
  letter-spacing: 0.06em;
}
#reflection-card:not(:empty) + h2 {
  margin-top: 18px;
}
.list-section h2 .count {
  margin-left: auto; font-size: 12px; color: var(--ink-muted); font-weight: 500;
}
.add-btn-row { margin-top: 14px; }

/* habit row */
.habit {
  display: flex; align-items: center; gap: 12px;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  transition: all .25s var(--ease);
}
.habit.done { background: var(--light-pink); opacity: 0.78; box-shadow: var(--shadow-xs); }
.habit.timed {
  border-color: #EBB95E;
  box-shadow: 0 8px 24px rgba(235,185,94,0.16);
}
.habit.timed.timing {
  border-color: #EBB95E;
  box-shadow: 0 8px 24px rgba(235,185,94,0.22);
}
.habit-icon-box {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--pink-bg);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.habit.done .habit-icon-box { background: var(--white); }
.habit-text { flex: 1; min-width: 0; }
.habit-title { font-size: 18px; font-weight: 600; letter-spacing: 0.01em; }
.habit.done .habit-title { text-decoration: line-through; }
.habit-sub {
  font-size: 14px; color: var(--ink-muted); margin-top: 4px;
  display: inline-flex; align-items: center; gap: 5px;
  flex-wrap: wrap;
}
.habit-sub .habit-points { font-weight: 500; }
.timed-badge,
.timer-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 22px;
  padding: 3px 9px;
  border-radius: var(--pill);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.timed-badge {
  background: #EBB95E;
  color: var(--white);
}
.timer-pill {
  background: var(--pink-bg);
  color: var(--ink-soft);
  border: 1px solid var(--hairline);
}
.timer-pill.live {
  background: var(--lotus);
  color: var(--white);
  border-color: transparent;
}
.habit-row-actions { display: flex; gap: 6px; align-items: center; }
.timed-start {
  min-width: 58px;
  padding: 9px 12px;
  color: var(--white);
  background: var(--lotus);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(199,142,120,0.28);
}
.habit-edit {
  width: 32px; height: 32px; border-radius: 10px;
  background: transparent; border: 1px dashed var(--hairline-bold); color: var(--ink-muted);
  display: grid; place-items: center; padding: 0;
  box-shadow: none;
}
.check {
  width: 36px; height: 36px; border-radius: 12px;
  background: var(--white); border: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow-xs);
  display: grid; place-items: center; padding: 0;
  transition: all .2s var(--ease);
}
.check.done {
  background: var(--orange); border-color: transparent;
  box-shadow: var(--shadow-warm);
}
.check:active { transform: translateY(1px); box-shadow: none; }

/* bottom dock for screen 1 — 玻璃感 */
.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  padding: 14px 18px calc(env(safe-area-inset-bottom) + 18px);
  background: rgba(254, 251, 249, 0.72);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--hairline);
  border-top-left-radius: 24px; border-top-right-radius: 24px;
  box-shadow: 0 -8px 30px rgba(94,84,83,0.06);
  z-index: 20;
}
.dock-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dock-label { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; letter-spacing: 0.04em; }
.dock-points { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.dock-points b { color: var(--orange); font-size: 20px; font-weight: 600; }
.dock-btns { display: flex; gap: 8px; margin-top: 12px; }
.dock-btns .btn { flex: 1 1 0; min-width: 0; height: 48px; padding: 10px 2px; font-size: 13px; white-space: nowrap; gap: 4px; }
.dock-btns .btn svg { flex-shrink: 0; }

.progress {
  height: 8px; background: rgba(94,84,83,0.08);
  border-radius: var(--pill); border: none;
  overflow: hidden;
}
.progress > div {
  height: 100%; background: linear-gradient(90deg, var(--orange-soft), var(--orange));
  border-radius: var(--pill);
  transition: width .6s var(--ease);
  box-shadow: 0 0 12px rgba(218,132,79,0.30);
}

/* ---------- screen 5: bingo ---------- */
.bingo-header { background: var(--lotus); }
.bingo-hero {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  border-radius: 22px;
  padding: 12px 14px 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 112px;
}
.bingo-hero > div {
  flex: 1 1 auto;
  min-width: 0;
}
.bingo-hero img {
  width: 190px;
  height: 190px;
  flex-shrink: 0;
  margin: -64px -20px -50px auto;
  filter: drop-shadow(0 8px 20px rgba(94,84,83,0.12));
  animation: breathe 3.2s ease-in-out infinite;
}
.bingo-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
}
.bingo-title {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 6px;
}
.bingo-sub {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}
.bingo-section {
  flex: 1;
  padding: 18px 18px 220px;
  overflow-y: auto;
}
.bingo-board-wrap {
  position: relative;
  background: rgba(254, 251, 249, 0.6);
  border-radius: 22px;
  padding: 10px;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
}
.bingo-board {
  display: grid;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.bingo-board.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bingo-board.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.bingo-board.rows-3 { aspect-ratio: 1 / 1; }
.bingo-board.rows-4 { aspect-ratio: 1 / 1; }
.bingo-cell {
  min-width: 0;
  border-radius: 17px;
  background: var(--white);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  text-align: center;
  transition: transform .22s var(--ease), background .22s var(--ease), box-shadow .22s var(--ease);
}
.bingo-board.spinning .bingo-cell {
  animation: bingo-card-wiggle .34s ease-in-out infinite alternate;
}
.bingo-cell.done {
  background: var(--light-pink);
  border-color: rgba(219,109,102,0.2);
  box-shadow: 0 8px 22px rgba(219,109,102,0.12);
}
.bingo-cell.empty {
  opacity: .58;
  background: rgba(254,251,249,.55);
  border-style: dashed;
}
.bingo-cell.empty.acorn {
  opacity: .72;
}
.bingo-cell.free {
  background: #EBB95E;
  color: var(--white);
  border-color: rgba(218,132,79,0.22);
  box-shadow: 0 8px 22px rgba(218,132,79,0.14);
}
.bingo-cell-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255,243,238,0.8);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.bingo-cell-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.22;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.cols-4 .bingo-cell { border-radius: 14px; padding: 8px 4px; gap: 4px; }
.cols-4 .bingo-cell-icon { width: 28px; height: 28px; border-radius: 10px; }
.cols-4 .bingo-cell-title { font-size: 10.5px; line-height: 1.16; }
.bingo-lines {
  position: absolute;
  inset: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  z-index: 3;
  pointer-events: none;
}
.bingo-line {
  stroke: var(--orange);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  filter: drop-shadow(0 3px 8px rgba(218,132,79,0.35));
}
.bingo-line.show {
  animation: bingo-line-draw .52s var(--ease) forwards;
}

/* ---------- screen 6: after school ---------- */
.after-school-header {
  background: var(--lotus);
  color: var(--white);
  border-bottom-left-radius: 32px;
  border-bottom-right-radius: 32px;
  padding: calc(env(safe-area-inset-top) + 18px) 18px 18px;
  position: relative;
}
.after-school-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  padding: 0;
  background: transparent;
  color: rgba(255,255,255,.9);
  font-weight: 600;
  font-size: 13px;
}
.after-school-time {
  position: absolute;
  right: 58px;
  top: calc(env(safe-area-inset-top) + 16px);
  background: var(--white);
  color: var(--lotus-deep);
  border-radius: var(--pill);
  box-shadow: var(--shadow-sm);
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
}
.after-school-settings-btn {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 17px);
  right: 18px;
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.55);
  color: var(--white);
}
.after-school-title {
  margin-top: 12px;
  font-size: 28px;
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: pre-line;
}
.after-school-sub {
  margin-top: 6px;
  color: rgba(255,255,255,.86);
  font-size: 14px;
  font-weight: 500;
}
.after-school-alarm-toggle {
  margin-top: 12px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--pill);
  border: 1px solid rgba(255,255,255,0.54);
  background: rgba(255,255,255,0.18);
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(94,84,83,0.14);
}
.after-school-alarm-toggle.ready {
  background: var(--white);
  color: var(--orange);
}
.after-school-ticket {
  margin-top: 16px;
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.ticket-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
}
.ticket-sub {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}
.ticket-reminder {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.ticket-reminder-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: var(--pill);
  background: var(--pink-bg);
  color: var(--lotus-deep);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.ticket-reminder-pill.alert {
  background: var(--pink);
  color: var(--white);
}
.ticket-gate {
  border-radius: 16px;
  padding: 10px 12px;
  background: #f4efe9;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
.ticket-gate.open {
  background: var(--honey);
  color: var(--white);
}
.after-school-section {
  flex: 1;
  padding: 16px 18px 220px;
  overflow-y: auto;
}
.after-school-phase {
  margin-bottom: 16px;
}
.after-school-phase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 2px 8px;
}
.after-school-phase-title {
  color: var(--lotus-deep);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
}
.after-school-phase-time {
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.phase-reminder {
  padding: 3px 8px;
  border-radius: var(--pill);
  background: var(--pink-bg);
  color: var(--lotus-deep);
}
.after-school-task {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 13px 14px;
  margin-bottom: 9px;
  box-shadow: var(--shadow-sm);
}
.after-school-task.done {
  background: var(--light-pink);
}
.after-school-task.current {
  border-color: rgba(218,132,79,.32);
  box-shadow: 0 10px 26px rgba(218,132,79,.14);
  background: linear-gradient(180deg, #fff 0%, #fff8f1 100%);
}
.after-school-task-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--pink-bg);
  border: 1px solid var(--hairline);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.after-school-task.done .after-school-task-icon {
  background: var(--white);
}
.after-school-task-text {
  flex: 1;
  min-width: 0;
}
.after-school-task-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}
.after-school-task-sub {
  margin-top: 5px;
  color: var(--ink-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.after-school-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 9px;
  border-radius: var(--pill);
  background: var(--pink-bg);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.after-school-tag.good {
  background: var(--lotus);
  color: var(--white);
}
.after-school-tag.warn {
  background: rgba(235,185,94,.22);
  color: var(--orange-deep);
}
.after-school-inline-next {
  margin-top: 9px;
  min-height: 36px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--pill);
  background: var(--orange);
  color: var(--white);
  box-shadow: 0 8px 18px rgba(218,132,79,.22);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.after-school-inline-next:active {
  transform: translateY(1px);
}
.after-school-next {
  display: none;
  margin-top: 4px;
  min-height: 54px;
}

.bingo-result {
  margin: 16px 0 12px;
  background: var(--white);
  border-radius: 22px;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
}
.bingo-result-label {
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
}
.bingo-result-num {
  color: var(--orange);
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  margin-top: 6px;
}
.bingo-result-sub {
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 6px;
}
.bingo-spin-btn {
  margin-top: 14px;
  height: 54px;
}
.bingo-spin-btn:disabled {
  opacity: .62;
  box-shadow: var(--shadow-sm);
}
.bingo-intro-card {
  background: var(--pink-bg);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}
@keyframes bingo-card-wiggle {
  from { transform: translateY(0) rotate(-.5deg); }
  to   { transform: translateY(-3px) rotate(.5deg); }
}
@keyframes bingo-line-draw {
  to { stroke-dashoffset: 0; }
}

/* ---------- screen 2: rewards ---------- */
.page-header {
  background: var(--lotus); color: var(--white);
  border-bottom-left-radius: 32px; border-bottom-right-radius: 32px;
  padding: calc(env(safe-area-inset-top) + 18px) 18px 18px;
}
.page-header-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding-right: 40px; }
.page-header-row .btn {
  width: 40px; height: 40px; padding: 0; border-radius: 14px;
  background: var(--white); color: var(--ink); flex-shrink: 0;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}
.page-header-title { font-size: 20px; font-weight: 600; flex: 1; letter-spacing: 0.02em; }

.points-card {
  background: var(--white); color: var(--ink);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  border-radius: 22px; padding: 18px 18px;
  display: flex; align-items: center; gap: 14px;
  min-height: 110px;
}
.points-card .acorn-box {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--pink-bg); border: 1px solid var(--hairline);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.points-card .stat {
  flex: 1; min-width: 0;
}
.points-card .stat-label {
  font-size: 11px; font-weight: 600; color: var(--ink-muted);
  letter-spacing: 0.18em; text-transform: uppercase;
}
.points-card .stat-value { font-size: 22px; font-weight: 600; line-height: 1.2; margin-top: 4px; white-space: nowrap; letter-spacing: 0.01em; }
.points-card img { width: 96px; height: 96px; }
.points-card-squirrel {
  width: 96px !important; height: 96px !important;
  flex-shrink: 0;
  filter: drop-shadow(0 8px 20px rgba(94,84,83,0.12));
  animation: breathe 3.2s ease-in-out infinite;
  margin: -14px -6px -14px 0;
}
.points-card-squirrel.cheer {
  width: 150px !important; height: 150px !important;
  margin: -38px 0 -38px -16px;
}
.points-card-squirrel.mine {
  width: 185px !important; height: 185px !important;
  margin: -57px -20px -52px 0;
}
.points-card-flip { padding: 22px 18px; min-height: 130px; }
.points-card-flip .stat-value { font-size: 24px; }
.points-card-flip .stat-label { font-size: 11px; }
.points-card-mine .stat-value { font-size: 24px; white-space: nowrap; }
.points-card-mine .stat-label { font-size: 11px; }

.rewards-section {
  flex: 1;
  padding: 18px 18px 220px;
  overflow-y: auto;
}
.rewards-section .kicker { margin-bottom: 12px; display: block; }
.rewards-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 14px;
  letter-spacing: 0.06em;
}

.reward {
  background: var(--white); border-radius: 22px; padding: 18px 16px;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 14px;
  position: relative;
  transition: all .25s var(--ease);
  min-height: 100px;
}
.reward.next-goal {
  border: 1px dashed var(--orange);
  background: var(--white);
  box-shadow: 0 8px 24px rgba(218,132,79,0.10);
}
.reward.next-goal::before {
  content: "下個目標";
  position: absolute; top: -10px; right: 14px;
  background: #EBB95E; color: var(--white);
  padding: 4px 12px; border-radius: var(--pill);
  font-size: 11px; font-weight: 600; border: 1px solid var(--hairline);
  letter-spacing: 0.06em;
}
.reward.affordable {
  border-color: transparent;
  box-shadow: var(--shadow-warm);
  background: var(--white);
}
.reward.locked {
  background: var(--pink-bg); opacity: 0.78;
}
.reward-icon-box {
  width: 72px; height: 72px; border-radius: 18px;
  background: #EBB95E; border: 1px solid var(--hairline);
  display: grid; place-items: center; flex-shrink: 0;
  position: relative;
}
.reward .reward-icon-box {
  background: #EBB95E;
}
.reward.affordable .reward-icon-box {
  background: #EBB95E;
  box-shadow: 0 0 24px rgba(235,185,94,0.42);
  border-color: transparent;
}
.reward.locked .reward-icon-box { background: var(--pink-bg); }
.reward-lock-overlay {
  position: absolute; inset: 0; background: rgba(247,220,209,0.55);
  border-radius: 16px; display: grid; place-items: center;
}
.reward-text { flex: 1; min-width: 0; }
.reward-title { font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: 0.01em; }
.reward.locked .reward-title { color: var(--ink-muted); }
.reward-sub { font-size: 13px; color: var(--ink-soft); margin-top: 3px; line-height: 1.4; font-weight: 400; }
.reward.locked .reward-sub { color: var(--ink-muted); }
.reward-tags { margin-top: 8px; display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--light-pink); color: var(--ink);
  padding: 4px 12px; border-radius: var(--pill);
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--hairline);
  letter-spacing: 0.03em;
}
.tag.ok { background: var(--moss); color: var(--white); border-color: transparent; }
.tag.ok svg { stroke: var(--white); }
.tag.warn { background: #EBB95E; color: var(--white); border-color: transparent; }
.reward .ribbon {
  position: absolute; top: -8px; right: 14px;
  background: var(--light-pink); color: var(--ink);
  padding: 4px 12px; border-radius: var(--pill);
  font-size: 11px; font-weight: 600; border: 1px solid var(--hairline);
  letter-spacing: 0.08em;
  box-shadow: var(--shadow-xs);
  display: inline-flex; align-items: center; gap: 4px;
}
.reward.locked .ribbon { background: var(--light-pink); color: var(--ink); box-shadow: var(--shadow-xs); }

.reward-actions { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; align-items: stretch; min-width: 64px; }
.reward-actions .btn { padding: 10px 14px; font-size: 13px; }
.reward-actions .habit-edit { width: 100%; height: 32px; border-radius: 12px; }

/* ---------- screen 3: unlock ---------- */
#screen-unlock {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: min(100%, 480px);
  margin: 0 auto;
  background: linear-gradient(180deg, var(--light-pink) 0%, var(--pink-bg) 100%);
  text-align: center;
  padding: calc(env(safe-area-inset-top) + 42px) 24px calc(env(safe-area-inset-bottom) + 34px);
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  min-height: 100dvh;
}
#screen-unlock:not([hidden]) { display: flex; }
.unlock-top { position: relative; z-index: 10; flex-shrink: 0; text-align: center; }
.unlock-mid { position: relative; z-index: 10; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; margin: 24px 0 18px; }
.unlock-bottom { position: relative; z-index: 10; flex-shrink: 0; }
.unlock-kicker {
  font-size: 12px; font-weight: 600; letter-spacing: 0.22em;
  color: var(--orange); margin-bottom: 10px;
  text-transform: uppercase;
}
.unlock-title {
  font-size: 36px; font-weight: 600; line-height: 1.15;
  margin: 0; letter-spacing: 0.02em;
}
.unlock-title b { color: var(--orange); display: block; margin-top: 2px; font-weight: 600; }
.unlock-reward-name {
  font-size: 30px; font-weight: 600; color: var(--orange);
  margin-top: 6px; line-height: 1.2;
  letter-spacing: 0.02em;
}
.unlock-sub {
  font-size: 15px; color: var(--ink-soft); margin-top: 16px; line-height: 1.6;
  display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center;
  font-weight: 500;
}
.unlock-sub b { color: var(--ink); font-weight: 600; }
.unlock-sub2 {
  font-size: 14px; color: var(--ink-soft); margin-top: 4px; font-weight: 400;
}
.unlock-squirrel-circle {
  margin: 0 auto;
  width: 210px; height: 210px; border-radius: 50%;
  background: var(--white); border: 1px solid var(--hairline);
  box-shadow: var(--shadow-warm-lg);
  display: grid; place-items: center;
  position: relative; z-index: 10;
  animation: bounce-soft 2.4s ease-in-out infinite;
}
.unlock-squirrel-circle img { width: 174px; height: 174px; }
@keyframes bounce-soft {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}
.glow {
  position: absolute; top: 38%; left: 50%;
  transform: translate(-50%, -50%);
  width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle, rgba(251,229,168,0.55) 0%, rgba(247,220,209,0) 70%);
  animation: pulse 2.4s ease-in-out infinite; pointer-events: none; z-index: 1;
}
@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
  50%      { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

.unlock-reward-card {
  margin: 0 auto 14px;
  background: var(--white); border: 1px solid var(--hairline); box-shadow: var(--shadow);
  border-radius: 20px; padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 360px;
  position: relative; z-index: 10;
}
.unlock-reward-card .reward-icon-box { width: 56px; height: 56px; border-radius: 14px; background: var(--honey); border-color: transparent; }
.unlock-reward-card .label {
  font-size: 11px; font-weight: 600; color: var(--orange);
  letter-spacing: 0.18em; text-align: left; text-transform: uppercase;
}
.unlock-reward-card .name { font-size: 17px; font-weight: 600; text-align: left; letter-spacing: 0.01em; }
.unlock-reward-card .sub { font-size: 12px; color: var(--ink-muted); text-align: left; font-weight: 400; }

#unlock-cta {
  width: 100%; max-width: 360px; height: 56px; font-size: 17px;
  box-shadow: var(--shadow-warm-lg);
  position: relative; z-index: 10;
  letter-spacing: 0.04em; font-weight: 600;
}

@media (max-height: 760px) {
  #screen-unlock {
    padding-top: calc(env(safe-area-inset-top) + 28px);
    padding-bottom: calc(env(safe-area-inset-bottom) + 22px);
  }
  .unlock-kicker { margin-bottom: 6px; }
  .unlock-title { font-size: 30px; }
  .unlock-reward-name { font-size: 25px; margin-top: 4px; }
  .unlock-sub { margin-top: 10px; font-size: 14px; line-height: 1.4; }
  .unlock-mid { margin: 22px 0 14px; }
  .unlock-squirrel-circle { width: 176px; height: 176px; }
  .unlock-squirrel-circle img { width: 146px; height: 146px; }
  .unlock-reward-card { padding: 14px 16px; margin-bottom: 12px; }
  #unlock-cta { height: 56px; }
}

/* 背景裝飾 icon (星星 / 愛心 / 橡實) 持續放大縮小 */
.bg-icons { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.bg-icon {
  position: absolute;
  opacity: 0.55;
  animation: bg-icon-pulse 2.6s ease-in-out infinite;
}
@keyframes bg-icon-pulse {
  0%, 100% { transform: scale(1) rotate(var(--rot, 0deg)); opacity: 0.4; }
  50%      { transform: scale(1.35) rotate(var(--rot, 0deg)); opacity: 0.85; }
}

/* confetti */
.confetti-piece {
  position: absolute; top: -30px;
  width: 10px; height: 10px;
  border-radius: 99px;
  pointer-events: none;
  z-index: 5;
}
@keyframes confetti-fall {
  0%   { transform: translateY(-30px) translateX(0) rotate(0deg); opacity: 0; }
  8%   { opacity: 1; }
  60%  { transform: translateY(50vh)  translateX(calc(var(--sway, 0px) * 0.5)) rotate(360deg); }
  100% { transform: translateY(130vh) translateX(var(--sway, 0px)) rotate(900deg); opacity: 0.85; }
}

/* ---------- screen 4: mine ---------- */
.mine-section {
  flex: 1;
  padding: 18px 18px 220px;
  overflow-y: auto;
}
.mine-week-card {
  background: var(--white);
  border: 1px solid var(--hairline); box-shadow: var(--shadow);
  border-radius: 22px; padding: 18px;
}
.mine-week-stats {
  display: flex; gap: 8px; margin-bottom: 16px;
  padding-bottom: 14px; border-bottom: 1px dashed var(--hairline-strong);
}
.mine-week-num {
  flex: 1; text-align: center;
}
.mine-week-num b {
  display: block; font-size: 26px; font-weight: 600; color: var(--orange); line-height: 1.1;
  letter-spacing: 0.01em;
}
.mine-week-num span {
  font-size: 11px; color: var(--ink-muted); font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-top: 4px; display: block;
}
.mine-week-bars {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 6px; align-items: end;
  height: 130px;
}
.mine-bar-col {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  height: 100%; justify-content: end;
}
.mine-bar-val {
  font-size: 11px; font-weight: 600; color: var(--orange); height: 14px;
}
.mine-bar {
  width: 100%; min-height: 6px;
  background: linear-gradient(180deg, var(--orange-soft), var(--orange));
  border: none;
  border-radius: 8px 8px 4px 4px;
  box-shadow: 0 2px 8px rgba(218,132,79,0.18);
  transition: height .4s var(--ease);
}
.mine-bar.zero { background: var(--pink-bg); border: 1px solid var(--hairline); box-shadow: none; min-height: 4px; }
.mine-bar.today { background: linear-gradient(180deg, var(--lotus), var(--lotus-deep)); }
.mine-bar-day {
  font-size: 11px; font-weight: 500; color: var(--ink-muted);
}
.mine-bar-col.today .mine-bar-day { color: var(--orange); font-weight: 600; }

.mine-redeemed {
  display: flex; align-items: center; gap: 12px;
  background: var(--white); border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
  border-radius: 18px; padding: 14px 16px; margin-bottom: 10px;
}
.mine-redeemed .reward-icon-box { width: 48px; height: 48px; border-radius: 14px; border-color: transparent; }
.mine-redeemed .info { flex: 1; min-width: 0; }
.mine-redeemed .info-title { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.mine-redeemed .info-sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; font-weight: 400; }
.mine-redeemed .cost-pill {
  background: var(--light-pink); padding: 6px 12px; border-radius: var(--pill);
  font-size: 12px; font-weight: 500; color: var(--ink);
  border: none;
  display: inline-flex; align-items: center; gap: 4px;
}

/* monthly calendar heat map */
.mine-calendar-card {
  background: var(--white);
  border: 1px solid var(--hairline); box-shadow: var(--shadow);
  border-radius: 22px; padding: 18px;
}
.mine-cal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.mine-cal-month { font-size: 15px; font-weight: 600; letter-spacing: 0.04em; }
.mine-cal-legend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--ink-muted); font-weight: 500;
  letter-spacing: 0.06em;
}
.mine-cal-legend i {
  display: inline-block; width: 14px; height: 14px; border-radius: 4px;
  border: 1px solid var(--hairline);
}
.mine-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.mine-cal-dow {
  text-align: center; font-size: 10px; font-weight: 600; color: var(--ink-muted);
  padding: 4px 0; letter-spacing: 0.08em;
}
.mine-cal-day {
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--pink-bg);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 500; color: var(--ink-muted);
  position: relative;
}
.mine-cal-day.empty { background: transparent; border: none; }
.mine-cal-day.today {
  border: 1px solid var(--orange);
  box-shadow: var(--ring-warm);
}
.mine-cal-day.lv1 { background: #F7DCD1; color: var(--ink); border-color: transparent; }
.mine-cal-day.lv2 { background: #EBB95E; color: var(--white); border-color: transparent; }
.mine-cal-day.lv3 { background: #e89a6a; color: var(--white); border-color: transparent; }
.mine-cal-day.lv4 { background: var(--orange); color: var(--white); border-color: transparent; }

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.sticker-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.sticker-chip.compact {
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}
.sticker-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(218,132,79,0.10);
  border: 1px solid var(--hairline);
}
.sticker-icon img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  display: block;
}
.sticker-chip.compact .sticker-icon {
  width: 40px;
  height: 40px;
  border-radius: 13px;
}
.sticker-copy {
  min-width: 0;
}
.sticker-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}
.sticker-date {
  margin-top: 2px;
  font-size: 11px;
  color: var(--ink-muted);
}
.sticker-album-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.sticker-album-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.sticker-slot {
  aspect-ratio: 1 / 1.16;
  border-radius: 14px;
  border: 1px dashed rgba(94,84,83,0.16);
  background: rgba(254,251,249,0.58);
  display: grid;
  grid-template-rows: 1fr 18px;
  align-items: center;
  justify-items: center;
  padding: 6px 4px 5px;
}
.sticker-slot.collected {
  border-style: solid;
  background: var(--white);
  box-shadow: var(--shadow-xs);
}
.sticker-slot-img {
  width: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
}
.sticker-slot-img img {
  width: 96%;
  height: 96%;
  max-width: 76px;
  max-height: 76px;
  object-fit: contain;
  display: block;
}
.sticker-slot-date {
  min-height: 14px;
  font-size: 10px;
  line-height: 1;
  color: var(--ink-muted);
  font-weight: 700;
}

/* ---------- check animation: flying acorn + pop ---------- */
.check.done svg { animation: check-pop .35s var(--ease); }
@keyframes check-pop {
  0%   { transform: scale(.4); opacity: 0; }
  60%  { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); }
}
.flying-acorn {
  position: fixed; z-index: 300; pointer-events: none;
  width: 42px; height: 42px;
  filter: drop-shadow(0 4px 12px rgba(218,132,79,0.4));
}
@keyframes acorn-fly {
  0%   { transform: translate(0,0) scale(.6) rotate(0deg); opacity: 0; }
  15%  { transform: translate(0,-10px) scale(1.5) rotate(40deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.7) rotate(540deg); opacity: 0; }
}
.dock-points b.bump {
  animation: bump .4s var(--ease);
  display: inline-block;
}
@keyframes bump {
  0%   { transform: scale(1); color: var(--orange); }
  40%  { transform: scale(1.4); color: var(--pink); }
  100% { transform: scale(1); color: var(--orange); }
}

/* ---------- 家長模式 ---------- */
.parent-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 6px);
  right: 10px;
  width: 36px; height: 36px;
  padding: 0;
  border-radius: 12px;
  background: var(--white);
  border: 1.5px solid rgba(94,84,83,0.18);
  color: var(--ink-soft);
  display: grid; place-items: center;
  z-index: 50;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(94,84,83,0.12);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.parent-toggle:active { transform: translateY(1px); box-shadow: 0 1px 3px rgba(94,84,83,0.10); }
body.parent-mode .parent-toggle {
  background: var(--orange);
  color: var(--white);
  border-color: rgba(94,84,83,0.25);
}
.parent-toggle .ic-unlock { display: none; }
body.parent-mode .parent-toggle .ic-lock { display: none; }
body.parent-mode .parent-toggle .ic-unlock { display: block; }
.parent-toggle.long-press {
  animation: long-press-pulse 5s linear forwards;
}
@keyframes long-press-pulse {
  0%   { transform: scale(1.0); background: rgba(255,255,255,0.78); border-color: rgba(94,84,83,0.25); color: var(--ink-soft); }
  50%  { transform: scale(1.10); background: #DB6D66;                 border-color: var(--ink); color: var(--white); box-shadow: 0 2px 0 var(--ink); }
  100% { transform: scale(1.25); background: var(--orange);           border-color: var(--ink); color: var(--white); box-shadow: 0 3px 0 var(--ink); }
}

.parent-banner {
  position: fixed; top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top) + 6px) 56px 6px 16px;
  background: var(--orange);
  color: var(--white);
  font-size: 12px; font-weight: 800; letter-spacing: 0.05em;
  text-align: center;
  z-index: 49;
  cursor: pointer;
}
.parent-banner:active { background: var(--orange-deep); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
body.parent-mode .parent-banner { display: block !important; }
body.parent-mode #app { padding-top: 24px; }

/* 危險區（清掉全部資料）只在家長設定 modal 內顯示 */
.danger-zone { text-align: center; padding: 14px; border: 1.5px dashed rgba(219,109,102,0.5); border-radius: 14px; background: rgba(219,109,102,0.06); }
.danger-zone-title { font-size: 13px; font-weight: 800; color: var(--pink); letter-spacing: 0.05em; margin-bottom: 6px; }
.danger-zone-sub { font-size: 12px; color: var(--ink-soft); margin: 0 0 12px; line-height: 1.5; }
.danger-zone-btn { width: 100%; }

/* 兒童模式：隱藏所有編輯／管理／刪除／改名按鈕 */
body.child-mode .habit-edit,
body.child-mode #btn-manage-habits,
body.child-mode #btn-manage-rewards,
body.child-mode #btn-edit-name,
body.child-mode #btn-child-profiles,
body.child-mode [data-delete-habit],
body.child-mode [data-delete-reward] { display: none !important; }

.child-profile-btn {
  width: auto;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--orange);
  background: var(--white);
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 430px) {
  body.parent-mode .greet-row { gap: 8px; }
  .header-tools { gap: 6px; }
  .child-profile-btn {
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }
  .streak-pill {
    padding: 8px 12px;
    font-size: 13px;
  }
}
.child-profile-list { display: grid; gap: 10px; }
.child-profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--white);
}
.child-profile-row.active {
  border-color: rgba(218,132,79,0.55);
  background: var(--pink-bg);
}
.child-profile-name { font-size: 15px; font-weight: 800; color: var(--ink); }
.child-profile-meta { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.child-profile-actions { display: flex; gap: 6px; flex-shrink: 0; }
.child-profile-actions .btn { height: 34px; padding: 0 10px; font-size: 12px; }
.settings-subtitle {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}
.reflection-settings-blockers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.reflection-settings-blockers .field {
  margin-bottom: 0;
}
.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.checkline input { width: 18px; height: 18px; accent-color: var(--orange); }

/* ---------- modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(94,84,83,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100; display: grid; place-items: end center;
  animation: fade-in .25s var(--ease);
}
.modal-backdrop[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal {
  background: var(--white);
  border-top-left-radius: 28px; border-top-right-radius: 28px;
  width: 100%; max-width: 480px;
  padding: 22px 20px calc(env(safe-area-inset-bottom) + 22px);
  box-shadow: 0 -16px 40px rgba(94,84,83,0.16);
  animation: slide-up .3s var(--ease);
  max-height: 92dvh; overflow-y: auto;
}
.modal-handle {
  width: 48px; height: 5px; border-radius: 99px;
  background: rgba(94,84,83,0.14); margin: -8px auto 14px;
}
.modal-title { font-size: 20px; font-weight: 600; margin: 0 0 4px; letter-spacing: 0.01em; }
.modal-sub { font-size: 13px; color: var(--ink-muted); margin: 0 0 18px; font-weight: 400; }

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; font-weight: 500; margin-bottom: 6px;
  color: var(--ink-soft); letter-spacing: 0.08em; text-transform: uppercase;
}
.field input, .field textarea, .field select {
  width: 100%; padding: 14px 16px;
  border: 1px solid var(--hairline-strong); border-radius: 14px;
  font-size: 16px; background: var(--white); color: var(--ink);
  outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  box-shadow: var(--shadow-xs);
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--orange);
  box-shadow: var(--ring-warm);
}
.field select {
  appearance: none;
  -webkit-appearance: none;
}
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.switch-field {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--pink-bg);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 13px 14px;
  margin-bottom: 14px;
}
.switch-field input {
  width: 20px;
  height: 20px;
  accent-color: var(--orange);
  flex-shrink: 0;
}
.switch-field b {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.switch-field small {
  display: block;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.4;
  margin-top: 2px;
}
.timed-fields {
  background: rgba(235,185,94,0.12);
  border: 1px dashed rgba(235,185,94,0.65);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}
.timed-fields[hidden],
.timed-custom[hidden] {
  display: none !important;
}

.icon-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  margin-bottom: 6px;
}
.icon-pick {
  aspect-ratio: 1; border-radius: 14px;
  background: var(--pink-bg); border: 1px solid var(--hairline);
  display: grid; place-items: center;
  cursor: pointer; padding: 0;
  transition: all .2s var(--ease);
  box-shadow: var(--shadow-xs);
}
.icon-pick:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.icon-pick.active {
  background: var(--light-pink); border-color: var(--orange);
  box-shadow: var(--ring-warm);
}

.modal-actions {
  display: flex; gap: 10px; margin-top: 8px;
}
.modal-actions .btn { flex: 1; }
.modal-actions .btn-danger { flex: 0 0 auto; padding: 14px; }

.reflection-form {
  display: grid;
  gap: 16px;
}
.reflection-question {
  background: var(--pink-bg);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 14px;
}
.reflection-question-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 10px;
}
.reflection-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.reflection-moods {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.reflection-moods .reflection-option {
  min-width: 0;
  padding-left: 5px;
  padding-right: 5px;
}
.reflection-option {
  min-height: 48px;
  padding: 9px 8px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  display: grid;
  place-items: center;
  gap: 4px;
  box-shadow: var(--shadow-xs);
}
.reflection-option.selected {
  border-color: var(--orange);
  background: var(--light-pink);
  box-shadow: var(--ring-warm);
}
.reflection-face {
  font-size: 15px;
  line-height: 1;
  color: var(--orange);
  white-space: nowrap;
  letter-spacing: 0;
}
.reflection-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  border: 1px dashed rgba(218,132,79,0.36);
  background: rgba(235,185,94,0.10);
}
.reflection-preview-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.reflection-preview-label {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 600;
  letter-spacing: 0.08em;
}
.reflection-preview-message {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  font-weight: 700;
}
.reflection-preview-hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-soft);
  font-weight: 500;
}
.reflection-preview-sticker {
  width: 82px;
  height: 82px;
  flex: 0 0 82px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,0.82);
  box-shadow: 0 4px 12px rgba(94,84,83,0.08);
}
.reflection-preview-sticker img,
.reflection-preview-sticker svg {
  width: 68%;
  height: 68%;
  object-fit: contain;
  display: block;
}
.reflection-sticker-big {
  padding: 16px;
  background: var(--pink-bg);
  border: 1px solid var(--hairline);
  border-radius: 20px;
}
.reflection-collected-sticker {
  display: flex;
  align-items: center;
  gap: 14px;
}
.reflection-collected-icon {
  width: 94px;
  height: 94px;
  flex: 0 0 94px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,0.86);
  box-shadow: 0 5px 14px rgba(94,84,83,0.08);
}
.reflection-collected-icon img,
.reflection-collected-icon svg {
  width: 70%;
  height: 70%;
  object-fit: contain;
  display: block;
}
.reflection-collected-copy {
  min-width: 0;
  font-size: 18px;
  line-height: 1.35;
  color: var(--ink);
  font-weight: 800;
}
.reflection-bingo-btn {
  margin-top: 14px;
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 120px;
  transform: translateX(-50%);
  background: var(--ink); color: var(--white);
  padding: 12px 20px; border-radius: var(--pill);
  font-size: 13px; font-weight: 500;
  box-shadow: 0 12px 30px rgba(94,84,83,0.30);
  z-index: 200;
  letter-spacing: 0.04em;
  animation: toast-in .25s var(--ease), toast-out .25s var(--ease) 1.8s forwards;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- after-school alarm ---------- */
.alarm-overlay {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(94,84,83,0.42);
  backdrop-filter: blur(8px);
}
.alarm-overlay[hidden] {
  display: none !important;
}
.alarm-card {
  width: min(100%, 360px);
  border-radius: 28px;
  padding: 24px 20px 20px;
  background: var(--white);
  color: var(--ink);
  border: 2px solid var(--orange);
  box-shadow: var(--shadow-warm);
  text-align: center;
}
.alarm-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: var(--pill);
  background: var(--pink-bg);
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.alarm-card h2 {
  margin: 14px 0 8px;
  font-size: 24px;
  line-height: 1.25;
}
.alarm-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 600;
}
.alarm-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 18px;
}

/* ---------- editor list (manage habits/rewards) ---------- */
.manage-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--white); border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
  border-radius: 18px; padding: 12px 14px; margin-bottom: 10px;
  transition: all .2s var(--ease);
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}
.manage-row:hover { box-shadow: var(--shadow); }
.manage-row.long-pressing { background: #FFF1E5; }
.manage-row.reorder-active {
  background: #FFE8D5; border-color: var(--orange);
  box-shadow: 0 4px 14px rgba(218,132,79,0.25);
}
.manage-row.dragging {
  background: var(--white);
  border-color: var(--orange);
  box-shadow: var(--shadow-warm);
  transform: scale(1.02);
  z-index: 2;
}
#manage-list.sorting .manage-row {
  touch-action: none;
}
.drag-sorting,
.drag-sorting * {
  cursor: grabbing !important;
}
.manage-row .reward-icon-box, .manage-row .habit-icon-box { width: 40px; height: 40px; border-radius: 12px; }
.manage-row .info { flex: 1; min-width: 0; }
.manage-row .info-title { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.manage-row .info-sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; font-weight: 400; }
.manage-row .drag-grip {
  width: 32px; height: 32px; border-radius: 10px;
  color: var(--ink-muted);
  background: var(--pink-bg);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(.92);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.manage-row.reorder-active .drag-grip { opacity: 1; transform: scale(1); }
.manage-row.reorder-active .chevron-right { display: none; }
.manage-hint {
  font-size: 12px; color: var(--ink-muted);
  margin: 0 0 10px; padding: 8px 12px;
  background: #FFF7EE; border-radius: 10px;
  border: 1px dashed var(--orange);
}

.after-school-editor {
  display: grid;
  gap: 14px;
}
.after-school-editor-phase {
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 14px;
  background: var(--pink-bg);
}
.after-school-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.after-school-editor-kicker {
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}
.after-school-editor-title {
  margin-top: 2px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}
.after-school-editor-task-list {
  display: grid;
  gap: 8px;
}
.after-school-editor-task {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-xs);
}
.after-school-editor-task-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--pink-bg);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.after-school-editor-task-text {
  flex: 1;
  min-width: 0;
}
.after-school-editor-task-text b,
.after-school-editor-task-text small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.after-school-editor-task-text b {
  font-size: 14px;
  font-weight: 700;
}
.after-school-editor-task-text small {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 500;
}
.after-school-editor-task-edit {
  color: var(--lotus-deep);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.section-tabs {
  display: flex; gap: 8px; padding: 14px 18px 4px;
}
.section-tabs button {
  flex: 1; padding: 12px; border-radius: 14px;
  background: var(--white); border: 1px solid var(--hairline);
  font-weight: 600; font-size: 14px; color: var(--ink-soft);
  box-shadow: var(--shadow-xs);
  letter-spacing: 0.04em;
  transition: all .2s var(--ease);
}
.section-tabs button.active {
  background: var(--orange); color: var(--white);
  border-color: transparent;
  box-shadow: var(--shadow-warm);
}

/* small util */
.row { display: flex; align-items: center; gap: 8px; }
.row.sb { justify-content: space-between; }
.spacer { flex: 1; }
