/* star bank (starbank.js), brushing teeth (brush.js), flash cards (flash.js) */

/* ---------- star bank ---------- */
.sb { background: #FFF6DE url(img/playroom.webp) center / cover no-repeat; }
.sb-goal { position: absolute; z-index: 12; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.92); padding: 8px 16px 8px 10px; border-radius: 999px;
  box-shadow: 0 .6vmin 0 rgba(107,74,58,.12); max-width: calc(100vw - 150px); }
.sb-gpic { font-size: clamp(30px, 6vmin, 46px); line-height: 1; }
.sb-gcol { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sb-gtext { font-size: clamp(15px, 3vmin, 22px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-bar { height: 10px; width: clamp(110px, 26vmin, 220px); border-radius: 99px; background: #FFE9B8; overflow: hidden; }
.sb-bar i { display: block; height: 100%; background: linear-gradient(90deg, #FFC93C, #FF9F1C); border-radius: 99px; transition: width .6s; }
.sb-main { position: absolute; inset: 84px 3vw 64px; display: flex; align-items: center; justify-content: center; gap: 5vmin; }
@media (orientation: portrait) { .sb-main { flex-direction: column; top: 90px; } }
.sb-jar { position: relative; width: min(52vmin, 360px); aspect-ratio: .82; flex: none; cursor: pointer; }
.sb-lid { position: absolute; left: 18%; right: 18%; top: 0; height: 9%; border-radius: 14px 14px 6px 6px; background: #FF9F6B;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.12); }
.sb-glass { position: absolute; left: 4%; right: 4%; top: 8%; bottom: 0; border-radius: 22% 22% 26% 26% / 14% 14% 18% 18%;
  background: rgba(225,245,255,.78); border: 5px solid rgba(255,255,255,.95); box-shadow: inset -12px 0 0 rgba(255,255,255,.55), 0 1.4vmin 0 rgba(107,74,58,.12);
  display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); align-content: end; justify-items: center; padding: 10% 8% 9%; gap: 2%; }
.sb-star { font-size: calc(min(52vmin, 360px) * .58 / var(--cols, 4)); line-height: 1.1; filter: grayscale(1) opacity(.22); transition: filter .4s; }
.sb-star.on { filter: none; }
.sb-star.new { animation: sbdrop .7s cubic-bezier(.3,1.5,.5,1); }
@keyframes sbdrop { from { transform: translateY(-160%) scale(1.6); } }
.sb-count { position: absolute; left: 50%; top: 13%; transform: translateX(-50%); background: #FFC93C; color: #6B4A3A; font-weight: 700;
  font-size: clamp(22px, 5vmin, 38px); min-width: 1.8em; text-align: center; border-radius: 99px; padding: 2px 12px; box-shadow: 0 4px 0 #E8A91A; }
.sb-jar.full .sb-glass { box-shadow: 0 0 0 6px #FFE066, 0 0 40px 10px rgba(255,214,70,.7); }
.sb-jar.party { animation: sbparty .5s ease 4; }
@keyframes sbparty { 50% { transform: rotate(-4deg) scale(1.05); } }
.sb-deeds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2vmin; max-width: min(46vw, 420px); }
@media (orientation: portrait) { .sb-deeds { grid-template-columns: repeat(4, 1fr); max-width: 94vw; } }
.sb-deed { background: rgba(255,255,255,.88); border-radius: 18px; padding: 1.4vmin 1.6vmin; display: flex; align-items: center; gap: 8px;
  font-size: clamp(13px, 2.6vmin, 19px); box-shadow: 0 .6vmin 0 rgba(0,0,0,.07); }
@media (orientation: portrait) { .sb-deed { flex-direction: column; gap: 2px; text-align: center; padding: 8px 4px; font-size: 12px; } }
.sb-deed span { font-size: clamp(22px, 4.6vmin, 34px); }
.sb-box .sb-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-box .sb-pick button { font: inherit; font-size: 15px; border: 2px solid #F1E2D0; background: #fff; border-radius: 14px; padding: 8px 10px;
  display: flex; align-items: center; gap: 6px; cursor: pointer; }
.sb-box .sb-pick button span { font-size: 22px; }
.sb-box .sb-pick button.on { border-color: #FF8F6B; background: #FFF1EA; font-weight: 700; }
.sb-box .sb-pick.n button { min-width: 64px; justify-content: center; }
.sb-swap { width: 100%; font-size: 22px; margin: 6px 0; }
.sb-log { display: flex; gap: 10px; font-size: 14px; padding: 3px 0; border-bottom: 1px dashed #F1E2D0; }
.sb-log span:nth-child(2) { flex: 1; }
.sb-minus button { font: inherit; font-size: 14px; background: none; border: 0; color: #B07A63; text-decoration: underline; cursor: pointer; padding: 0; }
.sb-toast { position: absolute; z-index: 45; left: 50%; top: 18%; transform: translateX(-50%); background: #FFF8DC; color: #6B4A3A;
  border: 3px solid #FFC93C; border-radius: 99px; padding: 10px 20px; font-size: clamp(16px, 3.4vmin, 24px); white-space: nowrap;
  box-shadow: 0 6px 0 rgba(232,169,26,.5); animation: sbtoast 3.2s ease forwards; pointer-events: none; }
@keyframes sbtoast { 0% { opacity: 0; transform: translate(-50%, -30px) scale(.8); } 12%, 82% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; } }

/* ---------- brushing teeth ---------- */
.tb { background: #DDF2FF url(img/bathroom.webp) center / cover no-repeat; touch-action: none; user-select: none; -webkit-user-select: none; }
.tb-stage { position: absolute; inset: 70px 3vw 60px; display: flex; align-items: center; justify-content: center; gap: 5vmin; }
@media (orientation: portrait) { .tb-stage { flex-direction: column; top: 80px; } }
.tb-face { --c: #8BD48B; --e: #5DB35D; position: relative; width: min(64vmin, 470px); aspect-ratio: 1.08; flex: none; border-radius: 46% 46% 40% 40%;
  background: var(--c); box-shadow: inset 0 -2.4vmin 0 var(--e), 0 1.6vmin 0 rgba(0,0,0,.1); }
.tb-ears i { position: absolute; top: -6%; width: 22%; aspect-ratio: 1; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1.4vmin var(--e); z-index: -1; }
.tb-ears i:first-child { left: 6%; } .tb-ears i:last-child { right: 6%; }
.tb-eyes { position: absolute; top: 9%; left: 0; right: 0; display: flex; justify-content: center; gap: 22%; }
.tb-eyes i { width: 14%; aspect-ratio: 1; border-radius: 50%; background: #fff; position: relative; box-shadow: 0 .5vmin 0 rgba(0,0,0,.08); }
.tb-eyes i::after { content: ""; position: absolute; width: 50%; height: 50%; left: 28%; top: 30%; border-radius: 50%; background: #3A2A24; }
.tb-badge { position: absolute; right: 4%; top: 2%; font-size: min(10vmin, 70px); transform: rotate(10deg); }
.tb-mouth { position: absolute; left: 10%; right: 10%; top: 32%; bottom: 8%; border-radius: 30% 30% 46% 46%; background: #8E2F3F;
  box-shadow: inset 0 0 0 1.4vmin #C9475B; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 2.6% 6%; }
.tb-tongue { position: absolute; left: 26%; right: 26%; bottom: 18%; height: 30%; border-radius: 50% 50% 40% 40%; background: #F07E8E; }
.tb-row { display: flex; gap: 2%; height: 34%; position: relative; z-index: 2; }
.tb-row.top { align-items: flex-start; } .tb-row.bot { align-items: flex-end; }
.tb-tooth { flex: 1; height: 100%; background: #FFFDF2; position: relative; box-shadow: inset 0 -.6vmin 0 #EADFC0; transition: background .3s, opacity .3s; }
.tb-row.top .tb-tooth { border-radius: 10% 10% 40% 40%; } .tb-row.bot .tb-tooth { border-radius: 40% 40% 10% 10%; box-shadow: inset 0 .6vmin 0 #EADFC0; }
.tb-tooth:not(.clean) { background: #F4E7B0; }
.tb-tooth.later { opacity: .55; }
.tb-tooth.clean { background: #fff; }
.tb-germ { position: absolute; font-size: min(5.4vmin, 38px); line-height: 1; transition: opacity .2s, transform .2s; animation: tbwob 1.3s ease-in-out infinite; pointer-events: none; }
@keyframes tbwob { 50% { rotate: 14deg; } }
.tb-foam { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.tb-bub { position: absolute; width: min(4.4vmin, 30px); aspect-ratio: 1; border-radius: 50%; background: rgba(255,255,255,.92);
  box-shadow: inset -3px -3px 0 rgba(190,225,255,.9); transform: translate(-50%,-50%); animation: tbbub 1.6s ease-out forwards; }
@keyframes tbbub { from { transform: translate(-50%,-50%) scale(.3); } 30% { transform: translate(-50%,-50%) scale(1.1); } to { transform: translate(-50%,-80%) scale(.9); opacity: 0; } }
.tb-face.rinse .tb-mouth { animation: tbrinse .3s ease-in-out 5; }
@keyframes tbrinse { 50% { transform: translateX(-3%); } }
.tb-face.rinse .tb-foam { background: linear-gradient(transparent 40%, rgba(160,215,255,.6)); border-radius: 0 0 40% 40%; }
.tb-face.shine .tb-tooth { box-shadow: 0 0 1.4vmin #fff, inset 0 0 0 2px #fff; animation: tbshine 1s ease 2; }
@keyframes tbshine { 50% { filter: brightness(1.15); } }
.tb-tray { display: flex; flex-direction: column; gap: 4vmin; }
@media (orientation: portrait) { .tb-tray { flex-direction: row; } }
.tb-tube, .tb-cup { width: min(19vmin, 130px); aspect-ratio: 1; border-radius: 26%; background: rgba(255,255,255,.9); display: grid; place-items: center;
  cursor: pointer; box-shadow: 0 1vmin 0 rgba(0,0,0,.08); font-size: min(11vmin, 74px); opacity: .5; transition: opacity .3s, transform .3s; position: relative; z-index: 6; }
.tb-tube span { width: 70%; height: 34%; border-radius: 10px 30px 30px 10px; background: linear-gradient(90deg, #fff 0 18%, #4FB4F0 18% 60%, #FF6B6B 60%);
  color: #fff; font-size: min(2.4vmin, 15px); font-weight: 700; display: grid; place-items: center; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.tb-tube.on, .tb-cup.on { opacity: 1; animation: tbcall 1.1s ease-in-out infinite; box-shadow: 0 0 0 5px #FFC93C, 0 1vmin 0 rgba(0,0,0,.08); }
@keyframes tbcall { 50% { transform: scale(1.1); } }
.tb-brush { position: fixed; z-index: 30; left: 70%; top: 70%; width: min(30vmin, 210px); height: min(7vmin, 48px); pointer-events: none;
  transform: translate(-12%, -50%) rotate(-24deg); transform-origin: 12% 50%; transition: transform .15s; }
.tb-brush.held { transform: translate(-12%, -50%) rotate(-24deg) scale(1.08); }
.tb-head { position: absolute; left: 0; top: 0; width: 28%; height: 100%; border-radius: 8px; background: #6EC6FF;
  background-image: repeating-linear-gradient(90deg, #fff 0 3px, #E2F4FF 3px 6px); background-size: 100% 55%; background-repeat: no-repeat; }
.tb-paste { position: absolute; left: 6%; right: 6%; top: -38%; height: 52%; border-radius: 40px; display: none;
  background: repeating-linear-gradient(90deg, #fff 0 8px, #8FD3FF 8px 12px); }
.tb-brush.pasted .tb-paste { display: block; }
.tb-handle { position: absolute; left: 26%; right: 0; top: 30%; height: 50%; border-radius: 0 30px 30px 0; background: linear-gradient(#FF8FB1, #F0668E); }

/* ---------- flash cards ---------- */
.fc { background: #EAF5FF url(img/playroom.webp) center / cover no-repeat; }
.fc-body { position: absolute; inset: 0; }
.fc-title { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: rgba(255,255,255,.92);
  padding: 8px 20px; border-radius: 99px; font-weight: 700; font-size: clamp(18px, 4vmin, 28px); white-space: nowrap; text-align: center; line-height: 1.1; }
.fc-title small { display: block; font-weight: 500; font-size: .55em; color: #8C6B5A; }
.fc-decks { position: absolute; inset: 86px 3vw 96px; overflow: auto; display: grid; gap: 2.6vmin; align-content: safe center; padding-bottom: 10px;
  grid-template-columns: repeat(auto-fill, minmax(min(40vw, 170px), 1fr)); max-width: 980px; margin: 0 auto; }
.fc-deck { background: #fff; border-radius: 22px; padding: 10px 10px 12px; text-align: center; cursor: pointer; position: relative;
  box-shadow: 0 1vmin 0 rgba(107,74,58,.12); display: flex; flex-direction: column; align-items: center; font-size: clamp(15px, 3vmin, 21px); }
.fc-deck small { color: #8C6B5A; font-size: .78em; }
.fc-deck.done::after { content: "⭐"; position: absolute; top: 6px; right: 10px; font-size: 22px; }
.fc-dpic { width: 100%; aspect-ratio: 1.2; border-radius: 16px; overflow: hidden; background: #FFF4E0; display: grid; place-items: center; margin-bottom: 6px; }
.fc-dpic > img { width: 100%; height: 100%; object-fit: cover; }
.fc-view { position: absolute; inset: 70px 2vw 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vmin; }
.fc-prog { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.fc-prog i { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,.8); box-shadow: inset 0 0 0 2px #E8D6C2; }
.fc-prog i.seen { background: #FFD66B; box-shadow: none; } .fc-prog i.on { background: #FF8F6B; transform: scale(1.3); box-shadow: none; }
.fc-row { display: flex; align-items: center; gap: 2vmin; }
.fc-arrow { font: inherit; width: clamp(48px, 10vmin, 76px); aspect-ratio: 1; border-radius: 50%; border: 0; background: #FF8F6B; color: #fff;
  font-size: clamp(20px, 4.4vmin, 32px); box-shadow: 0 .8vmin 0 #E06F4E; cursor: pointer; flex: none; }
.fc-arrow:active { transform: translateY(.5vmin); box-shadow: 0 .3vmin 0 #E06F4E; }
.fc-card { width: min(56vmin, 64vw, 400px); background: #fff; border-radius: 28px; overflow: hidden; cursor: pointer; touch-action: pan-y;
  box-shadow: 0 1.6vmin 0 rgba(107,74,58,.14); display: flex; flex-direction: column; }
@media (orientation: landscape) and (max-height: 520px) { .fc-card { width: min(46vmin, 300px); } }
@media (orientation: portrait) { .fc-card { width: min(70vw, 50vh, 440px); } .fc-row { gap: 1.4vmin; } .fc-arrow { width: 46px; font-size: 20px; } .fc-view { bottom: 100px; } }
.fc-card.flip { animation: fcflip .45s ease; }
@keyframes fcflip { 0% { transform: perspective(900px) rotateY(0); } 50% { transform: perspective(900px) rotateY(16deg) scale(1.03); } }
.fc-front { aspect-ratio: 1.15; background: #FFF4E0; display: grid; place-items: center; overflow: hidden; }
.fc-front > img { width: 100%; height: 100%; object-fit: cover; }
.fc-front .emoji, .fc-dpic .emoji, .fc-choice .emoji { font-size: 16vmin; }
.fc-words { padding: 1.4vmin 12px 2vmin; text-align: center; line-height: 1.2; }
.fc-th { font-weight: 700; font-size: clamp(26px, 6.4vmin, 48px); color: #6B4A3A; transition: color .2s, transform .2s; }
.fc-en { font-weight: 700; font-size: clamp(22px, 5.2vmin, 40px); color: #3E8EDC; font-family: "Mali", system-ui, sans-serif; transition: transform .2s; }
.fc-th.lit { color: #FF7A4D; transform: scale(1.08); } .fc-en.lit { color: #1F6FC2; transform: scale(1.08); }
.fc-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 96vw; }
.fc-chip { font: inherit; font-size: clamp(13px, 2.6vmin, 18px); border: 0; background: rgba(255,255,255,.92); border-radius: 99px; padding: 8px 14px;
  cursor: pointer; box-shadow: 0 .5vmin 0 rgba(0,0,0,.07); }
.fc-chip.on { background: #FF8F6B; color: #fff; font-weight: 700; }
.fc-col { width: 100%; height: 100%; display: grid; place-items: center; }
.fc-col i { width: 68%; aspect-ratio: 1; border-radius: 46% 54% 50% 50% / 52% 46% 54% 48%; box-shadow: inset -10px -10px 0 rgba(0,0,0,.12); }
.fc-col.white i { box-shadow: inset -10px -10px 0 rgba(0,0,0,.08), 0 0 0 4px #EADFCF; }
.fc-num { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4%; }
.fc-num b { font-size: min(22vmin, 150px); line-height: 1; color: #FF8F6B; font-family: "Mali", system-ui, sans-serif; }
.fc-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 70%; }
.fc-dots i { width: min(4.2vmin, 24px); aspect-ratio: 1; border-radius: 50%; background: #4FB4F0; }
.fc-dpic .fc-num b { font-size: min(13vmin, 80px); } .fc-dpic .fc-dots i { width: min(2.4vmin, 14px); }
.fc-ask { background: rgba(255,255,255,.94); border-radius: 99px; padding: 8px 18px 8px 8px; display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: clamp(20px, 4.6vmin, 34px); cursor: pointer; }
.fc-ask .spk { width: 48px; height: 48px; border-radius: 50%; background: #FFE9A8; display: grid; place-items: center; font-size: 24px; }
.fc-ask small { font-weight: 500; color: #8C6B5A; font-size: .6em; }
.fc-choices { display: flex; gap: 3vmin; flex-wrap: wrap; justify-content: center; }
.fc-choice { width: min(28vmin, 30vw, 230px); aspect-ratio: 1; background: #fff; border-radius: 24px; overflow: hidden; cursor: pointer;
  box-shadow: 0 1vmin 0 rgba(107,74,58,.12); display: grid; place-items: center; transition: transform .2s; }
.fc-choice > img { width: 100%; height: 100%; object-fit: cover; }
.fc-choice.ok { box-shadow: 0 0 0 6px #6BD47B, 0 1vmin 0 rgba(107,74,58,.12); transform: scale(1.06); }
.fc-choice .fc-num b { font-size: min(14vmin, 100px); } .fc-choice .fc-dots i { width: min(2.6vmin, 16px); }
.fc-end { gap: 1.4vmin; text-align: center; font-size: clamp(24px, 5.4vmin, 40px); }
.fc-end small { color: #3E8EDC; font-weight: 700; }
.fc-trophy { font-size: min(26vmin, 170px); line-height: 1; animation: sbparty .6s ease 3; }
@media (orientation: portrait) {
  .tb-face { width: min(86vw, 50vh, 470px); }
  .tb-tube, .tb-cup { width: min(24vw, 120px); }
  .sb-jar { width: min(62vw, 40vh, 360px); }
  .sb-star { font-size: calc(min(62vw, 40vh, 360px) * .58 / var(--cols, 4)); }
}
.sb-star:not(.on) { filter: grayscale(1) opacity(.35); }
.sb-box .phead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sb-box .phead h3 { margin: 0; }
.sb-box .x { font: inherit; font-size: 22px; border: 0; background: #FFF1E4; color: var(--ink); width: 44px; height: 44px; border-radius: 50%; cursor: pointer; flex: none; }
