/* My Token Jar — child side: bright, rounded, picture-first.
   Grown-up side: clean white/grey with one teal accent. */
:root {
  --coral: #FF6B5E;
  --coral-dark: #E14B3F;
  --amber: #FFB52E;
  --teal: #12B5A5;
  --teal-dark: #0A8F83;
  --purple: #8B6FD8;
  --sky: #4FA8E0;
  --cream: #FFF7EA;
  --ink: #26303B;
  --muted: #7A8794;
  --card: #FFFFFF;
  --radius: 22px;
  --kid-font: "Baloo 2", "Fredoka", ui-rounded, "Comic Sans MS", "PingFang HK", "Microsoft JhengHei", system-ui, sans-serif;
  --adult-font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang HK", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { background: var(--cream); color: var(--ink); font-family: var(--kid-font); }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; }
svg.animal { width: 100%; height: auto; display: block; }
svg.icon { width: 56px; height: 56px; }
svg.icon.big-icon { width: 120px; height: 120px; }
svg.coin { width: 34px; height: 34px; }

#app { max-width: 620px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }

/* ------------------------------ Kid chrome ------------------------------ */
.kid-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px 4px;
}
.kid-head .who { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 800; }
.kid-head .who .mini-animal { width: 52px; }
.spacer { flex: 1; }
.lang-toggle {
  background: var(--sky); color: #fff; font-weight: 800; font-size: 18px;
  border-radius: 999px; padding: 10px 18px; box-shadow: 0 3px 0 rgba(0,0,0,.12);
}
.grownup-corner {
  font-family: var(--adult-font); font-size: 12px; color: var(--muted);
  border: 1px solid #E3DCCB; background: #FFFDF6; border-radius: 999px; padding: 8px 12px;
}
main { flex: 1; padding: 8px 16px 110px; width: 100%; }

.kid-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 620px; display: flex; justify-content: space-around;
  background: #fff; border-top: 3px solid #F3E7CE; padding: 8px 4px calc(10px + env(safe-area-inset-bottom));
  z-index: 30;
}
.kid-nav button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 15px; font-weight: 800; color: var(--muted); min-width: 64px; min-height: 62px;
  border-radius: 16px; padding: 6px 2px;
}
.kid-nav button.active { color: var(--ink); background: #FFF1D6; }
.kid-nav .nav-ico { font-size: 26px; line-height: 1; }
.kid-nav svg.icon { width: 30px; height: 30px; }

/* ------------------------------- Jar home ------------------------------- */
.jar-wrap { display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.greeting { font-size: 30px; font-weight: 800; text-align: center; margin: 4px 0 0; }
.greeting-row { display: flex; align-items: flex-end; gap: 8px; width: 100%; }
.greeter { width: 118px; flex: none; animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.jar-box { position: relative; width: 210px; margin: 6px auto 0; cursor: pointer; }
.jar-count {
  text-align: center; font-size: 54px; font-weight: 800; line-height: 1; margin-top: 2px;
}
.jar-count small { font-size: 22px; color: var(--muted); font-weight: 700; }
.jar-hint { text-align: center; color: var(--muted); font-weight: 700; margin-top: 2px; }
.waiting-badge {
  display: flex; align-items: center; gap: 10px; background: #E7F7F5; border: 2px solid var(--teal);
  border-radius: var(--radius); padding: 8px 14px; margin: 14px auto 0; max-width: 420px; font-weight: 800; font-size: 18px;
}
.waiting-badge .mini-animal { width: 44px; flex: none; }
.goal-bar-card {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-top: 16px;
  box-shadow: 0 4px 14px rgba(90, 60, 0, .08); width: 100%;
}
.goal-bar-card .goal-top { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; }
.goal-bar-card .goal-top .pic { width: 54px; height: 54px; flex: none; display: grid; place-items: center; }
.goal-bar-card .goal-top img { width: 54px; height: 54px; object-fit: cover; border-radius: 14px; }
.fillbar { height: 26px; background: #F1E7CF; border-radius: 999px; overflow: hidden; margin-top: 10px; }
.fillbar > div { height: 100%; background: linear-gradient(90deg, var(--amber), var(--coral)); border-radius: 999px; transition: width .6s ease; }
.goal-nums { font-weight: 800; color: var(--muted); margin-top: 6px; font-size: 16px; }

/* -------------------------------- Cards --------------------------------- */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
@media (max-width: 380px) { .card-grid { grid-template-columns: 1fr; } }
.big-card {
  background: var(--card); border-radius: var(--radius); padding: 14px 12px 12px; text-align: center;
  box-shadow: 0 4px 14px rgba(90, 60, 0, .08); display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-height: 196px; position: relative;
}
.big-card .pic { height: 92px; display: grid; place-items: center; }
.big-card .pic img { width: 92px; height: 92px; object-fit: cover; border-radius: 18px; }
.big-card .pic svg.icon { width: 84px; height: 84px; }
.big-card .card-name { font-size: 21px; font-weight: 800; line-height: 1.15; }
.price-row { display: flex; align-items: center; gap: 5px; font-size: 20px; font-weight: 800; color: #B97A0B; }
.price-row svg.coin { width: 26px; height: 26px; }
.big-btn {
  margin-top: auto; background: var(--coral); color: #fff; font-size: 21px; font-weight: 800;
  border-radius: 999px; padding: 13px 22px; min-height: 56px; min-width: 150px; box-shadow: 0 4px 0 var(--coral-dark);
}
.big-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--coral-dark); }
.big-btn.teal { background: var(--teal); box-shadow: 0 4px 0 var(--teal-dark); }
.big-btn.purple { background: var(--purple); box-shadow: 0 4px 0 #6D54B8; }
.big-btn:disabled { background: #D8D2C2; box-shadow: 0 4px 0 #BDB49C; }
.big-card.affordable { outline: 4px solid var(--amber); animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 0%,100% { outline-color: rgba(255,181,46,.45); } 50% { outline-color: rgba(255,181,46,1); } }
.big-card .mini-fill { width: 100%; height: 14px; }
.big-card .mini-fill .fillbar { height: 14px; margin-top: 2px; }
.waiting-chip {
  margin-top: auto; background: #E7F7F5; color: var(--teal-dark); font-weight: 800; font-size: 18px;
  border-radius: 999px; padding: 12px 18px; display: flex; gap: 8px; align-items: center;
}
.speak-btn {
  position: absolute; top: 8px; right: 8px; width: 48px; height: 48px; border-radius: 50%;
  background: #FFF1D6; font-size: 22px; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.cash-amount { font-size: 44px; font-weight: 800; color: #3E7D32; line-height: 92px; }
.section-title { font-size: 26px; font-weight: 800; margin: 10px 0 2px; }
.empty-note { text-align: center; color: var(--muted); font-weight: 700; font-size: 19px; padding: 30px 10px; }
.pick-title { text-align: center; font-size: 30px; font-weight: 800; margin: 26px 0 6px; }
.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 10px 4px; }
.pick-card { background: #fff; border-radius: var(--radius); padding: 16px 10px; box-shadow: 0 4px 14px rgba(90,60,0,.1); }
.pick-card .pname { font-size: 24px; font-weight: 800; text-align: center; margin-top: 6px; }

/* -------------------------------- Games --------------------------------- */
.game-card-host { width: 74px; margin: 0 auto; }
.game-head { display: flex; align-items: center; gap: 10px; }
.game-head .game-host { width: 64px; flex: none; }
.game-head .game-title { font-size: 24px; font-weight: 800; flex: 1; }
.round-btn { width: 52px; height: 52px; border-radius: 50%; background: #fff; font-size: 22px; box-shadow: 0 2px 8px rgba(0,0,0,.12); flex: none; display: grid; place-items: center; }
.game-dots { display: flex; gap: 6px; }
.game-dots .dot { width: 14px; height: 14px; border-radius: 50%; background: #EADFC6; }
.game-dots .dot.done { background: var(--amber); }
.game-q { font-size: 27px; font-weight: 800; text-align: center; margin: 16px 0 6px; position: relative; }
.game-q .speak-btn { position: static; display: inline-grid; vertical-align: middle; margin-left: 8px; }
.count-stage { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 18px 8px; background: #fff; border-radius: var(--radius); margin-top: 8px; min-height: 150px; align-content: center; }
.count-item { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 16px; animation: pop-in .3s ease backwards; animation-delay: var(--d, 0s); cursor: pointer; }
.count-item svg.icon { width: 56px; height: 56px; }
.count-item.counted { background: #FFF1D6; outline: 3px solid var(--amber); }
@keyframes pop-in { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.add-stage { display: flex; align-items: center; justify-content: center; gap: 8px; background: #fff; border-radius: var(--radius); padding: 16px 8px; margin-top: 8px; flex-wrap: wrap; }
.add-group { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 42%; }
.add-group .count-item { width: 52px; height: 52px; }
.add-group .count-item svg.icon { width: 46px; height: 46px; }
.add-plus { font-size: 44px; font-weight: 800; color: var(--purple); }
.game-hint { text-align: center; font-weight: 800; color: var(--teal-dark); font-size: 19px; margin-top: 10px; min-height: 24px; }
.choice-row { display: flex; gap: 14px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.choice-btn {
  min-width: 84px; min-height: 76px; font-size: 38px; font-weight: 800; background: #fff;
  border-radius: 20px; box-shadow: 0 4px 0 #E3D6B8; padding: 8px 18px;
}
.choice-btn.right { background: #DFF5D8; box-shadow: 0 4px 0 #9CCB8E; }
.choice-btn.nudge { animation: nudge .45s ease; }
@keyframes nudge { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.choice-row.words .word-btn { font-size: 30px; text-transform: lowercase; }
.word-pic { display: flex; align-items: center; justify-content: center; gap: 8px; background: #fff; border-radius: var(--radius); padding: 16px; margin-top: 8px; position: relative; }
.word-pic .animal { width: 130px; }
.word-pic .speak-btn { position: static; }
.game-feedback { text-align: center; font-size: 24px; font-weight: 800; color: var(--teal-dark); min-height: 34px; margin-top: 14px; }

/* ----------------------------- Celebrations ----------------------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(38, 48, 59, .45); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.celebrate-card {
  background: var(--cream); border-radius: 28px; padding: 22px; max-width: 430px; width: 100%;
  text-align: center; position: relative; overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,.3);
}
.celebrate-card .cel-animal { width: 170px; margin: 0 auto; }
.celebrate-card h2 { font-size: 30px; margin: 8px 0 4px; }
.celebrate-card p { font-size: 21px; font-weight: 700; margin: 4px 0 12px; }
.falling-coins { position: absolute; inset: 0; pointer-events: none; }
.falling-coins svg { position: absolute; top: -44px; animation: fall 1.15s ease-in forwards; }
@keyframes fall { to { transform: translateY(340px) rotate(160deg); opacity: .9; } }
.confetti-bit { position: absolute; width: 12px; height: 12px; border-radius: 3px; top: -16px; animation: fall 1.3s ease-in forwards; }

/* ------------------------------ Grown-ups ------------------------------- */
body.adult { background: #F5F6F8; font-family: var(--adult-font); }
.adult-wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.adult-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.adult-top h1 { font-size: 20px; margin: 0; }
.adult-card { background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.adult-card h2 { font-size: 16px; margin: 0 0 10px; }
.adult-card h3 { font-size: 14px; margin: 14px 0 6px; color: #444; }
.btn {
  display: inline-block; background: var(--teal); color: #fff; font-weight: 700; font-size: 15px;
  border-radius: 10px; padding: 10px 16px; min-height: 44px;
}
.btn.secondary { background: #EDF1F4; color: var(--ink); }
.btn.danger { background: #FDECEA; color: #B3261E; }
.btn.small { padding: 7px 12px; min-height: 38px; font-size: 14px; }
.btn:disabled { opacity: .45; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #EEF1F4; }
.list-row:last-child { border-bottom: none; }
.list-row .thumb { width: 48px; height: 48px; flex: none; display: grid; place-items: center; }
.list-row .thumb img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; }
.list-row .thumb svg.icon { width: 44px; height: 44px; }
.badge { background: var(--coral); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 800; padding: 2px 9px; }
.badge.soft { background: #E7F7F5; color: var(--teal-dark); }
.muted { color: var(--muted); font-size: 13px; }
input[type="text"], input[type="number"], select, textarea {
  font: inherit; font-size: 15px; padding: 10px 12px; border: 1.5px solid #D5DCE3; border-radius: 10px;
  background: #fff; width: 100%; color: var(--ink);
}
label.field { display: block; font-size: 13px; font-weight: 700; color: #555; margin: 10px 0 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.picker button { border: 2.5px solid transparent; border-radius: 14px; padding: 4px; background: #F7F9FA; width: 60px; height: 60px; display: grid; place-items: center; }
.picker button.sel { border-color: var(--teal); background: #E7F7F5; }
.picker button svg.icon { width: 44px; height: 44px; }
.picker button .animal { width: 50px; }
.child-switcher { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.child-chip { display: flex; align-items: center; gap: 8px; background: #fff; border: 2.5px solid #E3E8ED; border-radius: 999px; padding: 5px 14px 5px 6px; font-weight: 700; }
.child-chip.sel { border-color: var(--teal); }
.child-chip .animal { width: 36px; }
.gate-box { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.gate-q { font-size: 40px; font-weight: 800; margin: 12px 0; }
.gate-input { font-size: 30px; text-align: center; letter-spacing: 2px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { padding: 9px 14px; border-radius: 999px; background: #fff; font-weight: 700; font-size: 14px; border: 1.5px solid #E0E6EB; min-height: 42px; }
.tabs button.sel { background: var(--ink); color: #fff; border-color: var(--ink); }
.ledger-delta { font-weight: 800; min-width: 52px; text-align: right; }
.ledger-delta.plus { color: #2E7D32; }
.ledger-delta.minus { color: #B3261E; }
.notice { background: #FFF6E0; border: 1.5px solid var(--amber); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 12px; }
.file-label { display: inline-block; }
.file-label input { display: none; }
.kid-exit { font-size: 13px; }
@media (prefers-reduced-motion: reduce) {
  .greeter, .big-card.affordable, .count-item { animation: none; }
}
