:root {
  --pink: #ff8fab;
  --pink-deep: #f06292;
  --blue: #7bd3ea;
  --yellow: #ffd93d;
  --green: #a8e6cf;
  --red: #ff6b6b;
  --ink: #5b4a68;
  --ink-soft: #9a8aa8;
  --card: #fffdf8;
}

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

body {
  margin: 0;
  font-family: 'Huninn', 'Baloo 2', ui-rounded, 'PingFang TC', 'Heiti TC', sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #fff3d6, #ffe3ec 55%, #e3f3ff);
  background-attachment: fixed;
  min-height: 100vh;
  padding-bottom: 96px;
}

header { max-width: 560px; margin: 0 auto; padding: 18px 16px 4px; }
h1 { font-size: 28px; margin: 0 0 12px; text-align: center; letter-spacing: 2px; }

/* ---- 小孩切換 ---- */
#kid-tabs { display: flex; gap: 10px; justify-content: center; }
.kid-chip {
  display: flex; align-items: center; gap: 6px;
  border: 3px solid transparent; border-radius: 999px;
  background: rgba(255, 255, 255, .6);
  padding: 8px 14px; font: inherit; font-size: 16px; color: var(--ink);
  cursor: pointer; transition: transform .1s;
}
.kid-chip:active { transform: scale(.95); }
.kid-chip.active { background: #fff; border-color: var(--pink); box-shadow: 0 4px 0 rgba(91, 74, 104, .12); }
.kid-emoji { font-size: 22px; }
.kid-balance { background: var(--yellow); border-radius: 999px; padding: 2px 10px; font-size: 14px; }
.kid-balance.neg { background: var(--red); color: #fff; }

/* ---- 主要區塊 ---- */
main { max-width: 560px; margin: 0 auto; padding: 12px 16px; }
.card {
  background: var(--card); border-radius: 24px; padding: 18px 20px; margin-bottom: 14px;
  box-shadow: 0 6px 0 rgba(91, 74, 104, .08);
}
.card h2 { margin: 0 0 12px; font-size: 18px; }
.loading { text-align: center; color: var(--ink-soft); }

/* ---- 今日 hero ---- */
.hero { text-align: center; }
.hero-emoji { font-size: 56px; line-height: 1.1; }
.hero-balance { font-size: 40px; font-weight: 800; font-family: 'Baloo 2', 'Huninn', sans-serif; }
.hero-balance.neg { color: var(--red); }
.hero-sub { color: var(--ink-soft); margin-top: 2px; }
.debt {
  margin-top: 8px; display: inline-block; background: #ffe1e1; color: #c0392b;
  border-radius: 999px; padding: 4px 14px; font-size: 14px;
}
.streak {
  margin-top: 8px; display: inline-block; background: #fff1c9;
  border-radius: 999px; padding: 4px 14px; font-size: 15px;
}

/* ---- 今日提醒 ---- */
.reminder { background: linear-gradient(135deg, #fff7da, #ffeff5); display: flex; gap: 14px; align-items: center; }
.reminder-emoji { font-size: 40px; }
.reminder-label { font-size: 13px; color: var(--ink-soft); margin-bottom: 2px; }
.reminder-text { font-size: 16px; line-height: 1.5; }

/* ---- 打卡 ---- */
.goal {
  display: flex; align-items: center; gap: 12px;
  background: #f7f3fb; border-radius: 16px; padding: 12px 14px; margin-bottom: 10px;
  font-size: 16px; cursor: pointer;
}
.goal input { width: 22px; height: 22px; accent-color: var(--pink-deep); flex-shrink: 0; }
.status-banner { border-radius: 16px; padding: 10px 14px; margin-bottom: 12px; font-size: 15px; text-align: center; }
.status-done { background: #e3f9e5; }
.status-honest { background: #fff3cd; }
.status-lied { background: #ffe1e1; }

/* ---- 按鈕 ---- */
.btn {
  display: block; width: 100%; border: 0; border-radius: 18px; cursor: pointer;
  font: inherit; font-size: 17px; padding: 13px; color: #fff;
  background: var(--pink-deep); box-shadow: 0 4px 0 #c2185b55;
  transition: transform .08s;
}
.btn:active { transform: translateY(3px); box-shadow: none; }
.btn + .btn { margin-top: 10px; }
.btn.danger { background: #fff; color: var(--red); box-shadow: 0 4px 0 rgba(91, 74, 104, .1); font-size: 14px; padding: 9px; }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: 0 4px 0 rgba(91, 74, 104, .1); }

.quick-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-row button {
  border: 0; border-radius: 16px; padding: 14px 6px; font: inherit; font-size: 15px;
  cursor: pointer; color: var(--ink); box-shadow: 0 4px 0 rgba(91, 74, 104, .12);
  transition: transform .08s;
}
.quick-row button:active { transform: translateY(3px); box-shadow: none; }
.quick-chore { background: var(--green); }
.quick-exam { background: var(--blue); }
.quick-adjust { background: var(--yellow); }

/* ---- 商店 ---- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.store-card {
  position: relative; background: var(--card); border-radius: 20px; padding: 16px 12px;
  text-align: center; box-shadow: 0 6px 0 rgba(91, 74, 104, .08);
}
.store-emoji { font-size: 40px; }
.store-title { font-size: 15px; margin: 6px 0 4px; min-height: 2.6em; display: flex; align-items: center; justify-content: center; }
.store-cost { color: var(--ink-soft); font-size: 14px; margin-bottom: 10px; }
.store-card .btn { font-size: 15px; padding: 9px; }
.x {
  position: absolute; top: 6px; right: 8px; border: 0; background: none;
  color: #d8cfe0; font-size: 18px; cursor: pointer; padding: 4px;
}

/* ---- 許願 ---- */
.wish-form { display: flex; gap: 10px; }
.wish-form input {
  flex: 1; border: 2px solid #eee3f3; border-radius: 16px; padding: 11px 14px;
  font: inherit; font-size: 15px; color: var(--ink); background: #fff;
}
.wish-form input:focus { outline: none; border-color: var(--pink); }
.wish-form .btn { width: auto; padding: 11px 16px; font-size: 15px; }
.wish-item {
  display: flex; align-items: center; gap: 10px;
  background: #f7f3fb; border-radius: 16px; padding: 10px 14px; margin-bottom: 8px;
}
.wish-title { flex: 1; font-size: 15px; }
.wish-status { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.wish-item button {
  border: 0; border-radius: 12px; padding: 7px 10px; font: inherit; font-size: 13px;
  cursor: pointer; white-space: nowrap;
}
.wish-approve { background: var(--green); color: var(--ink); }
.wish-reject { background: #ffe1e1; color: #c0392b; }

/* ---- 紀錄 ---- */
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.month-nav button {
  border: 0; background: #fff; border-radius: 12px; width: 38px; height: 38px;
  font-size: 18px; cursor: pointer; box-shadow: 0 3px 0 rgba(91, 74, 104, .1); color: var(--ink);
}
.month-label { font-size: 17px; font-weight: 600; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { text-align: center; font-size: 12px; color: var(--ink-soft); padding: 4px 0; }
.cal-cell {
  background: #faf6ff; border-radius: 10px; min-height: 52px; padding: 4px;
  font-size: 12px; color: var(--ink-soft); text-align: center;
}
.cal-cell.today { outline: 2px solid var(--pink); }
.cal-cell.empty { background: none; }
.cal-stamp { font-size: 18px; line-height: 1.2; }
.cal-pts { font-size: 11px; border-radius: 6px; display: inline-block; padding: 0 4px; }
.cal-pts.pos { background: #e3f9e5; color: #2e7d32; }
.cal-pts.neg { background: #ffe1e1; color: #c0392b; }

.ledger-item { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px dashed #eee3f3; }
.ledger-item:last-child { border-bottom: 0; }
.ledger-date { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.ledger-note { flex: 1; font-size: 14px; }
.ledger-delta { font-weight: 700; font-family: 'Baloo 2', sans-serif; white-space: nowrap; }
.ledger-delta.pos { color: #2e7d32; }
.ledger-delta.neg { color: var(--red); }
.empty-hint { text-align: center; color: var(--ink-soft); padding: 14px 0; font-size: 14px; }

/* ---- 底部導覽 ---- */
#tabs {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around;
  background: rgba(255, 253, 248, .95); backdrop-filter: blur(8px);
  border-top: 2px solid #f3e8f0; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
#tabs button {
  border: 0; background: none; font: inherit; font-size: 13px; color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer; padding: 4px 14px; border-radius: 14px;
}
#tabs button span { font-size: 22px; }
#tabs button.active { color: var(--ink); background: #ffeff5; }

/* ---- toast ---- */
#toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 999px; padding: 10px 20px;
  font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .25s;
  max-width: 86vw; text-align: center; z-index: 10;
}
#toast.show { opacity: 1; }

/* 加分時的星星動畫 */
@keyframes pop-star {
  0% { transform: translate(-50%, 0) scale(.4); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translate(-50%, -90px) scale(1.4); opacity: 0; }
}
.pop-star {
  position: fixed; left: 50%; top: 45%; font-size: 48px; z-index: 11;
  pointer-events: none; animation: pop-star 1s ease-out forwards;
}
