/* ===================== HŨ SAO ===================== */
:root {
  --ink: #3B2A4A; --muted: #8C7C9C; --line: #EFE6F4;
  --gold: #FFC83D; --gold-d: #F0A202;
  --c: #FF6B9A;
  --c-soft: #FFE3EC; --c-mid: #FFB3C9; --c-dark: #D94A78;
  --font: 'Baloo 2', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
@supports (color: color-mix(in srgb, red, blue)) {
  * {
    --c-soft: color-mix(in srgb, var(--c) 14%, white);
    --c-mid: color-mix(in srgb, var(--c) 45%, white);
    --c-dark: color-mix(in srgb, var(--c) 78%, #3B1A3A);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--ink); font-size: 17px; line-height: 1.35;
  background: linear-gradient(165deg, #FFF5DD 0%, #FFE9F2 48%, #E4F2FF 100%) fixed;
  overscroll-behavior-y: none; -webkit-user-select: none; user-select: none; -webkit-font-smoothing: antialiased;
}
input, textarea, select { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; padding: 0; }
b { font-weight: 800; }

/* ---------- Nền trang trí ---------- */
#bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
#bg .blob { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .55; transform: translate(-50%, -50%); animation: float 16s ease-in-out infinite alternate; }
#bg .tw { position: absolute; color: #FFCB4D; opacity: .7; animation: twinkle 3.2s ease-in-out infinite; }
@keyframes float { to { transform: translate(-40%, -60%) scale(1.15); } }
@keyframes twinkle { 0%, 100% { opacity: .15; transform: scale(.7) rotate(0); } 50% { opacity: .9; transform: scale(1.15) rotate(20deg); } }

#app { position: relative; z-index: 1; min-height: 100vh; }
.screen { max-width: 1180px; margin: 0 auto; padding: calc(var(--safe-t) + 14px) 18px 30px; }

/* ---------- Nút chung ---------- */
.press { transition: transform .12s ease, box-shadow .12s ease, filter .12s; }
.press:active { transform: translateY(3px) scale(.97); filter: brightness(.97); }
.btn { white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--c); color: #fff; font-weight: 800; font-size: 18px;
  padding: 13px 24px; border-radius: 18px; box-shadow: 0 5px 0 var(--c-dark);
}
.btn:active { box-shadow: 0 1px 0 var(--c-dark); }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.btn.danger { --c: #F25C54; }
.btn.sm { padding: 9px 16px; font-size: 15px; border-radius: 14px; box-shadow: 0 4px 0 var(--c-dark); }
.btn.big { font-size: 22px; padding: 16px 38px; }
.btn[disabled] { opacity: .35; pointer-events: none; }
.pill { background: #fff; padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 15px; box-shadow: 0 4px 0 #EADCF0; }
.icon-btn { width: 46px; height: 46px; border-radius: 50%; background: #fff; font-size: 21px; box-shadow: 0 4px 0 #EADCF0; display: grid; place-items: center; flex: none; }

/* ---------- Topbar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 26px; letter-spacing: -.3px; }
.brand.small { font-size: 20px; }
.brand-ico { font-size: 30px; display: inline-block; animation: bob 2.6s ease-in-out infinite; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.sp { width: 120px; }

/* ---------- Home ---------- */
.home-hello { text-align: center; margin: 22px 0 26px; }
.home-hello .big { font-size: clamp(30px, 5vw, 44px); font-weight: 800; line-height: 1.1; }
.home-hello .sub { color: var(--muted); font-size: 20px; font-weight: 600; margin-top: 4px; }
.kid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 24px; max-width: 900px; margin: 0 auto; }
.kid-card {
  position: relative; text-align: left; background: #fff; border-radius: 34px; padding: 22px 24px 20px;
  border: 4px solid var(--c-mid); box-shadow: 0 9px 0 var(--c-mid), 0 20px 40px -18px var(--c);
  animation: popIn .55s cubic-bezier(.3, 1.5, .5, 1) both; animation-delay: calc(var(--i) * 120ms); overflow: hidden;
}
.kid-card::before { content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: var(--c-soft); }
.kid-card:active { box-shadow: 0 3px 0 var(--c-mid); }
.kc-top { position: relative; display: flex; align-items: flex-end; justify-content: space-between; }
.kc-avatar { width: 118px; height: 118px; border-radius: 50%; display: grid; place-items: center; font-size: 72px;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--c-soft) 45%, var(--c-mid) 100%); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .05); }
.kc-jar { width: 98px; }
.kc-name { position: relative; font-size: 34px; font-weight: 800; margin-top: 10px; color: var(--c-dark); }
.kc-bal { position: relative; font-size: 19px; font-weight: 600; }
.kc-bal b { font-size: 26px; color: var(--gold-d); }
.kc-progress { margin: 12px 0 14px; font-size: 15px; color: var(--muted); font-weight: 600; }
.bar { height: 14px; background: #F3EDF7; border-radius: 99px; overflow: hidden; margin-bottom: 5px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), #FF9F43); transition: width .6s cubic-bezier(.3, 1.4, .5, 1); }
.kc-go { display: inline-flex; gap: 8px; align-items: center; background: var(--c); color: #fff; font-weight: 800; font-size: 19px; padding: 10px 20px; border-radius: 16px; box-shadow: 0 4px 0 var(--c-dark); }
.kc-go span { display: inline-block; animation: nudge 1.4s ease-in-out infinite; }
.demo-badge { text-align: center; margin: 30px auto 0; background: #fff; width: fit-content; padding: 8px 18px; border-radius: 99px; color: var(--muted); font-size: 15px; box-shadow: 0 3px 0 var(--line); }

/* ---------- Màn của bé ---------- */
.kid { padding-bottom: calc(120px + var(--safe-b)); }
.kid-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.who { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar-sm { width: 54px; height: 54px; border-radius: 50%; background: var(--c-soft); display: grid; place-items: center; font-size: 34px; flex: none; border: 3px solid var(--c-mid); }
.hi { font-size: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hi b { color: var(--c-dark); }
.date { font-size: 14px; color: var(--muted); font-weight: 600; }

.kid-body { display: grid; gap: 18px; }
.hero {
  position: sticky; top: calc(var(--safe-t) + 6px); z-index: 5;
  display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-radius: 26px; border: 3px solid var(--c-soft); box-shadow: 0 8px 24px -14px var(--c);
}
.hero-jar { width: 74px; flex: none; transform-origin: 50% 90%; }
.hero-info { min-width: 0; }
.hero-count { display: flex; align-items: baseline; gap: 6px; font-weight: 700; color: var(--muted); }
.hero-count b { font-size: 44px; line-height: 1; color: var(--gold-d); display: inline-block; text-shadow: 0 2px 0 #FFE9B0; }
.hero-count .spin-star { font-size: 26px; }
.hero-next { font-size: 15px; color: var(--muted); font-weight: 600; }
.hero-next b { color: var(--ink); }
.jar-svg { width: 100%; height: auto; display: block; overflow: visible; }

@media (min-width: 860px) {
  .kid-body { grid-template-columns: 300px 1fr; align-items: start; }
  .hero { flex-direction: column; text-align: center; padding: 26px 20px 22px; top: calc(var(--safe-t) + 16px); border-radius: 34px; }
  .hero-jar { width: 210px; }
  .hero-count { justify-content: center; }
  .hero-count b { font-size: 64px; }
  .hero-next { font-size: 17px; margin-top: 6px; }
}

/* Thẻ tiến độ */
.progress-card { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 26px; padding: 14px 18px; margin-bottom: 16px; box-shadow: 0 5px 0 var(--line); }
.progress-card.all { background: linear-gradient(120deg, #FFF4C9, #FFE1EC); box-shadow: 0 5px 0 #FFD98A; }
.mascot { font-size: 46px; width: 64px; height: 64px; display: grid; place-items: center; background: var(--c-soft); border-radius: 50%; flex: none; animation: wiggle 2.4s ease-in-out infinite; }
.progress-card.all .mascot { animation: dance .8s ease-in-out infinite; background: #FFE9A8; }
.pc-body { flex: 1; min-width: 0; }
.pc-msg { font-weight: 700; font-size: 18px; }
.star-track { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 2px; }
.star-track span { font-size: 22px; color: #E9E1EF; transition: color .3s; }
.star-track span.on { color: var(--gold); text-shadow: 0 1px 0 var(--gold-d); animation: popIn .4s cubic-bezier(.3, 1.6, .5, 1) both; }
.pc-num { font-weight: 800; color: var(--c-dark); }
.pc-num b { font-size: 40px; }
.pc-num small { font-size: 20px; color: var(--muted); }

/* Thẻ việc */
.task-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .task-grid { grid-template-columns: 1fr 1fr; } }
.task {
  position: relative; display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 12px;
  text-align: left; background: #fff; border-radius: 24px; padding: 14px 14px 14px 14px;
  border: 3px solid transparent; box-shadow: 0 6px 0 #EBDFF1;
  animation: popIn .45s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: calc(var(--i) * 40ms);
}
.task:active { box-shadow: 0 2px 0 #EBDFF1; }
.t-emoji { width: 62px; height: 62px; border-radius: 20px; background: var(--c-soft); display: grid; place-items: center; font-size: 36px; transition: transform .3s; }
.t-title { font-weight: 800; font-size: 19px; line-height: 1.2; }
.t-desc { color: var(--muted); font-size: 14px; line-height: 1.3; margin-top: 2px; }
.plus { display: inline-flex; align-items: center; gap: 2px; background: #FFF4D1; color: #C77D00; font-weight: 800; font-size: 18px; padding: 6px 12px; border-radius: 999px; border: 2px dashed #FFCE5C; white-space: nowrap; }
.plus i { font-style: normal; font-size: 16px; }
.check { width: 46px; height: 46px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 800; box-shadow: 0 4px 0 var(--c-dark); animation: stamp .5s cubic-bezier(.3, 1.8, .5, 1) both; }
.task.done { background: var(--c-soft); border-color: var(--c-mid); box-shadow: 0 6px 0 var(--c-mid); }
.task.done .t-emoji { background: #fff; transform: rotate(-8deg); }
.task.done .t-title::after { content: ' 🌟'; }
.task.just { animation: jelly .6s ease both; }

/* Bảng tuần */
.week-wrap { background: #fff; border-radius: 26px; padding: 16px; box-shadow: 0 5px 0 var(--line); }
.week-sum { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--c-soft); border-radius: 18px; padding: 12px 16px; margin-bottom: 12px; }
.ws-l { font-weight: 700; }
.ws-best { font-size: 14px; color: var(--muted); font-weight: 600; }
.week-sum > b { font-size: 34px; color: var(--gold-d); white-space: nowrap; }
.week-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.week { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 560px; font-size: 15px; }
.week th, .week td { text-align: center; padding: 6px 2px; border-bottom: 2px solid #F6F0F9; }
.week th { font-weight: 800; color: var(--muted); }
.week th small { display: block; font-weight: 600; font-size: 11px; }
.week .wt { text-align: left; position: sticky; left: 0; background: #fff; font-weight: 700; padding-right: 8px; min-width: 150px; z-index: 1; }
.week .we { margin-right: 6px; }
.week .today { background: var(--c-soft); }
.week th.today { color: var(--c-dark); border-radius: 12px 12px 0 0; }
.week tfoot td { font-size: 17px; border: 0; }
.week tfoot b { color: var(--gold-d); }
.wstar { font-size: 22px; display: inline-block; }
.wdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #E9E1EF; }
.wcell { width: 40px; height: 40px; border-radius: 12px; background: #FAF6FC; border: 2px dashed #E6DCEC; }
.wcell.on { background: #FFF6D6; border: 2px solid #FFD66B; }

/* Đổi quà */
.gift-head { font-weight: 800; font-size: 20px; margin: 2px 4px 14px; }
.gift-head span { display: block; font-size: 15px; color: var(--muted); font-weight: 600; }
.gift-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.gift { background: #fff; border-radius: 26px; padding: 18px 16px 16px; text-align: center; box-shadow: 0 6px 0 var(--line); border: 3px solid transparent;
  animation: popIn .45s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: calc(var(--i) * 60ms); display: flex; flex-direction: column; gap: 6px; }
.g-emoji { font-size: 54px; line-height: 1.1; }
.g-title { font-weight: 700; font-size: 17px; line-height: 1.25; flex: 1; }
.g-cost { font-weight: 800; color: var(--gold-d); font-size: 20px; }
.g-left { font-size: 14px; color: var(--muted); font-weight: 600; }
.gift:not(.ready) .g-emoji { filter: grayscale(.5); opacity: .75; }
.gift.ready { border-color: #FFD66B; box-shadow: 0 6px 0 #FFD66B, 0 0 0 6px rgba(255, 214, 107, .25); animation: popIn .45s both, glow 2s ease-in-out infinite .5s; }
.gift.ready .g-emoji { animation: bob 1.8s ease-in-out infinite; }
.btn.shine { --c: #FF9F43; position: relative; overflow: hidden; }
.btn.shine::after { content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent); transform: skewX(-20deg); animation: shine 2.2s ease-in-out infinite; }

/* Tab bar */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--safe-b)); z-index: 20; display: flex; gap: 6px;
  background: rgba(255, 255, 255, .95); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); padding: 7px; border-radius: 28px; box-shadow: 0 12px 30px -10px rgba(80, 40, 90, .35); }
.tb { display: flex; align-items: center; gap: 6px; padding: 11px 18px; border-radius: 22px; font-weight: 800; font-size: 17px; color: var(--muted); white-space: nowrap; }
.tb span { font-size: 22px; }
.tb.on { background: var(--c); color: #fff; box-shadow: 0 4px 0 var(--c-dark); }

/* ---------- Bố mẹ ---------- */
.parent { --c: #6C63FF; padding-bottom: 60px; }
.ptabs { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px 12px; margin-bottom: 4px; }
.ptab { white-space: nowrap; background: #fff; padding: 10px 16px; border-radius: 16px; font-weight: 700; box-shadow: 0 4px 0 var(--line); }
.ptab.on { background: var(--ink); color: #fff; box-shadow: 0 4px 0 #1E1228; }
.pmain { display: grid; gap: 16px; }
.kid-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.kchip { background: #fff; padding: 9px 16px; border-radius: 99px; font-weight: 800; font-size: 17px; border: 3px solid transparent; box-shadow: 0 4px 0 var(--line); }
.kchip small { color: var(--gold-d); margin-left: 4px; }
.kchip.on { border-color: var(--c); background: var(--c-soft); }
.panel { background: #fff; border-radius: 24px; padding: 18px; box-shadow: 0 5px 0 var(--line); }
.panel h3 { margin: 0 0 6px; font-size: 20px; }
.panel h3 small { color: var(--muted); font-weight: 600; font-size: 14px; }
.panel.center { max-width: 440px; margin: 12vh auto 0; text-align: center; display: grid; gap: 12px; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.err-text { color: #E23D5A; font-weight: 700; margin: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.chip { background: #F6F1FA; padding: 8px 14px; border-radius: 99px; font-weight: 700; font-size: 15px; }
.chip.on { background: var(--c); color: #fff; }
.chips.soft .chip { font-size: 14px; font-weight: 600; background: #FFF6E5; }
input, textarea, select { font: inherit; font-size: 16px; color: var(--ink); border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; background: #FCFAFD; width: 100%; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--c); background: #fff; }
textarea { resize: vertical; margin: 4px 0 6px; }
.panel > .btn { margin-top: 8px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.prow { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 2px solid #F6F0F9; }
.prow:last-child { border: 0; }
.prow .pe { font-size: 28px; width: 36px; text-align: center; }
.prow .pt { flex: 1; font-weight: 700; }
.prow .pt small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.prow .pc { font-weight: 800; color: var(--gold-d); white-space: nowrap; }
.prow .pc.neg { color: #E23D5A; }
.prow .pc.pos { color: #1FA37C; }
.kid-edit { padding: 12px; border-radius: 18px; background: var(--c-soft); margin-top: 10px; }
.av-prev { font-size: 40px; }
.pick-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pick { width: 44px; height: 44px; border-radius: 14px; background: #fff; font-size: 26px; border: 3px solid transparent; }
.pick.on { border-color: var(--c); }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }
.edit-row { display: grid; grid-template-columns: 56px 1fr 88px 70px auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 2px solid #F6F0F9; }
.edit-row.off { opacity: .5; }
.edit-row .e-emoji { text-align: center; font-size: 24px; padding: 6px; }
.edit-row .e-main { display: grid; gap: 4px; }
.edit-row .e-desc { font-size: 14px; padding: 6px 10px; }
.edit-row .e-cost { width: 88px; }
.edit-row .unit { display: none; }
.tog { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; }
.tog input { width: 20px; height: 20px; }
@media (max-width: 600px) {
  .edit-row { grid-template-columns: 52px 1fr; }
  .edit-row select, .edit-row .e-cost, .edit-row .tog, .edit-row .btn { grid-column: span 1; }
  .sp { display: none; }
}

/* ---------- Modal ---------- */
#layer { position: relative; z-index: 50; }
.overlay { position: fixed; inset: 0; background: rgba(48, 24, 64, .45); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); display: grid; place-items: center; padding: 20px; animation: fadeIn .2s both; }
.modal { background: #fff; border-radius: 34px; padding: 28px 26px 24px; width: min(440px, 100%); text-align: center; box-shadow: 0 30px 60px -20px rgba(60, 20, 80, .5); animation: popIn .45s cubic-bezier(.3, 1.5, .5, 1) both; }
.modal h2 { margin: 6px 0 6px; font-size: 26px; line-height: 1.15; }
.modal p { color: var(--muted); font-size: 17px; margin: 0 0 18px; }
.modal p b { color: var(--ink); }
.m-emoji { font-size: 66px; line-height: 1.1; }
.m-emoji.big { font-size: 96px; }
.m-actions { display: flex; gap: 10px; justify-content: center; }
.modal.shake { animation: shake .4s; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 10px 0 18px; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #D9CCE3; transition: all .15s; }
.pin-dots i.on { background: var(--ink); border-color: var(--ink); transform: scale(1.15); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.pk { height: 64px; border-radius: 20px; background: #F6F1FA; font-size: 28px; font-weight: 800; box-shadow: 0 4px 0 #E8DDEF; }
.letter { cursor: pointer; }
.envelope { font-size: 120px; line-height: 1.1; display: inline-block; }
blockquote { margin: 10px 0 8px; background: #FFF6E5; border-radius: 20px; padding: 16px 18px; font-size: 20px; font-weight: 600; line-height: 1.4; color: var(--ink); position: relative; }
.plus-big { font-size: 40px; font-weight: 800; color: var(--gold-d); margin: 4px 0 14px; animation: bump .6s .3s both; }
.cel .modal { background: linear-gradient(180deg, #FFF8DA, #fff 60%); }
.celebrate { position: relative; padding-top: 10px; }
.cel-av { font-size: 110px; line-height: 1; display: inline-block; }
.cel-crown { position: absolute; top: -18px; left: 50%; font-size: 52px; transform: translateX(-50%) rotate(-12deg); animation: bob 1.2s ease-in-out infinite; }
.celebrate h2 { font-size: 32px; color: #E08A00; letter-spacing: .5px; }

/* ---------- Toast ---------- */
#toasts { position: fixed; top: calc(var(--safe-t) + 12px); left: 50%; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: #fff; padding: 11px 20px; border-radius: 99px; font-weight: 800; font-size: 18px; box-shadow: 0 10px 26px -8px rgba(60, 20, 80, .35); animation: toastIn .45s cubic-bezier(.3, 1.6, .5, 1) both; text-align: center; }
.toast.gold { background: linear-gradient(90deg, #FFF1BF, #FFE0EC); }
.toast.gift { background: linear-gradient(90deg, #FFD66B, #FF9F43); color: #fff; font-size: 20px; }
.toast.err { background: #FFE3E6; color: #B3243C; }
.toast.out { opacity: 0; transform: translateY(-14px); transition: all .4s; }

/* ---------- Hiệu ứng bay ---------- */
.fly-star { position: fixed; left: -22px; top: -22px; font-size: 44px; line-height: 1; z-index: 60; pointer-events: none; will-change: transform; filter: drop-shadow(0 4px 8px rgba(240, 162, 2, .55)); }
.spark { position: fixed; left: -6px; top: -6px; width: 12px; height: 12px; border-radius: 50%; z-index: 59; pointer-events: none; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 80; pointer-events: none; display: none; }
.hit { animation: jarHit .5s cubic-bezier(.3, 1.6, .5, 1); }
.jar-svg path.drop { transform-box: fill-box; transform-origin: center; animation: drop .7s cubic-bezier(.3, 1.6, .5, 1) both; }
.bump { animation: bump .5s cubic-bezier(.3, 1.8, .5, 1); }
.spin-star { display: inline-block; animation: spin 6s linear infinite; }
.bob { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
.wiggle { animation: wiggle 1s ease-in-out infinite; }
.dance { animation: dance .7s ease-in-out infinite; }
.bounce { display: inline-block; animation: bob 1s ease-in-out infinite; }

/* ---------- Keyframes ---------- */
@keyframes popIn { 0% { opacity: 0; transform: scale(.6) translateY(16px); } 100% { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes dance { 0%, 100% { transform: rotate(-10deg) translateY(0); } 50% { transform: rotate(10deg) translateY(-10px); } }
@keyframes jelly { 0% { transform: scale(1); } 30% { transform: scale(1.06, .92); } 50% { transform: scale(.95, 1.05); } 70% { transform: scale(1.02, .98); } 100% { transform: scale(1); } }
@keyframes stamp { 0% { transform: scale(2.2) rotate(-30deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes jarHit { 0% { transform: scale(1); } 30% { transform: scale(1.12, .9) rotate(-4deg); } 60% { transform: scale(.95, 1.06) rotate(3deg); } 100% { transform: none; } }
@keyframes drop { 0% { transform: translateY(-120px) scale(2); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes glow { 0%, 100% { box-shadow: 0 6px 0 #FFD66B, 0 0 0 4px rgba(255, 214, 107, .2); } 50% { box-shadow: 0 6px 0 #FFD66B, 0 0 0 12px rgba(255, 214, 107, .35); } }
@keyframes shine { 0% { left: -60%; } 60%, 100% { left: 130%; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-12px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-8px); } 80% { transform: translateX(6px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-30px) scale(.8); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* ---------- Điện thoại ---------- */
@media (max-width: 520px) {
  .screen { padding-left: 14px; padding-right: 14px; }
  .tabbar { left: 12px; right: 12px; transform: none; justify-content: space-between; }
  .tb { flex: 1; flex-direction: column; gap: 0; padding: 7px 4px; font-size: 13px; justify-content: center; }
  .tb span { font-size: 22px; }
  .kc-avatar { width: 96px; height: 96px; font-size: 58px; }
  .kc-jar { width: 80px; }
  .kc-name { font-size: 28px; margin-top: 6px; }
  .home-hello { margin: 14px 0 18px; }
  .t-emoji { width: 54px; height: 54px; font-size: 32px; border-radius: 18px; }
  .task { grid-template-columns: 54px 1fr auto; gap: 10px; padding: 12px; }
  .t-title { font-size: 18px; }
  .hi { font-size: 18px; }
  .progress-card { padding: 12px 14px; }
  .mascot { width: 54px; height: 54px; font-size: 38px; }
  .star-track span { font-size: 19px; }
  .pc-num b { font-size: 34px; }
}

/* ---------- Nhiều gia đình: chào mừng, chia sẻ mã, mật khẩu ---------- */
.fam-name { display: inline-block; background: #fff; padding: 6px 16px; border-radius: 99px; font-weight: 700; color: var(--muted); box-shadow: 0 3px 0 var(--line); margin-bottom: 8px; }
.link-soft { color: var(--muted); font-weight: 600; text-decoration: none; font-size: 15px; }
.link-soft:hover { text-decoration: underline; }
.pw-grid, .pw-form { display: grid; gap: 10px; text-align: left; }
.pw-form .m-actions { margin-top: 4px; }
.lbl { display: grid; gap: 4px; font-weight: 700; font-size: 15px; }
.lbl small { color: var(--muted); font-weight: 600; }
.err-text:empty { display: none; }
.share-box { background: #FFF8E6; border: 2px dashed #F5C451; border-radius: 18px; padding: 14px; margin-top: 12px; text-align: center; }
.share-l { color: var(--muted); font-weight: 700; font-size: 14px; }
.share-code { font-size: clamp(22px, 6vw, 30px); font-weight: 800; letter-spacing: 2px; margin: 2px 0 6px; font-variant-numeric: tabular-nums; user-select: all; -webkit-user-select: all; }
.share-box .row { justify-content: center; }
.kid-edit.off { opacity: .55; }
.panel.center .btn { width: 100%; }
.panel.center .share-box .btn { width: auto; }
.modal .err-text { color: #E23D5A; font-size: 15px; margin: 0; }
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 6px; }
.wn-label { font-weight: 800; font-size: 18px; text-align: center; display: grid; }
.wn-label .link-soft { font-size: 13px; background: none; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; font-weight: 600; margin: 4px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 2px; background: var(--line); }
.who-mail { margin: -2px 0 12px !important; font-size: 15px !important; font-weight: 700; }
.code-in { font-size: 24px; letter-spacing: 8px; text-align: center; font-weight: 800; }
.logout-pill { color: var(--muted); }
.parent .topbar .pill { white-space: nowrap; }
@media (max-width: 520px) { .parent .topbar .brand.small { display: none; } }
