/* Layout of the three screens: hub, learn, find. */
.chara-box { width: 100%; aspect-ratio: 1; display: block; }

/* ---------- Learn ---------- */
#learn { grid-template-rows: auto 1fr auto; }
#learn.has-board .nav { visibility: hidden; }
#learn .topbar .btn { width: 50px; height: 50px; }   /* four buttons share the bar */
#learnTitle { max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#learnStage { position: relative; display: grid; justify-items: center; align-content: center; gap: 14px; padding: 6px 16px; min-height: 0; }
#learnStage .hero { width: var(--g); aspect-ratio: 1; display: grid; place-items: center; transition: transform .5s var(--spring); }
#learnStage .hero .sticker { width: 100%; height: 100%; font-size: var(--g); }
#learnStage.revealed .hero { transform: translateY(10%) scale(.8); }
.reveal { position: absolute; top: 2%; left: 50%; transform: translateX(-50%); width: calc(var(--g) * .72); aspect-ratio: 1; display: grid; place-items: center; visibility: hidden; }
#learnStage.revealed .reveal { visibility: visible; }
.reveal .sticker { width: 100%; height: 100%; font-size: calc(var(--g) * .72); animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-5%) rotate(3deg); } }
.count { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 92vw; }
.count .sticker { width: clamp(42px, 12vw, 62px); aspect-ratio: 1; font-size: clamp(42px, 12vw, 62px); }
.examples { display: flex; gap: 14px; }
.examples .sticker { width: clamp(56px, 16vw, 80px); aspect-ratio: 1; font-size: clamp(56px, 16vw, 80px); }
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; max-width: 520px; }
.board .sticker { width: 100%; aspect-ratio: 1; font-size: min(27vw, 150px); }
#learnStage.board-mode .word { min-width: 40vw; text-align: center; }

/* ---------- Find ---------- */
#find { grid-template-rows: auto 1fr; }
#findStage { display: grid; justify-items: center; align-content: center; gap: 22px; padding: 10px 16px calc(24px + env(safe-area-inset-bottom)); }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 560px; }
.asker { width: min(34vw, 150px); aspect-ratio: 1; position: relative; }
.asker .q { position: absolute; right: -14%; top: -10%; width: 44%; aspect-ratio: 1; border-radius: 50% 50% 50% 10%; background: #fff; color: var(--ink); font-size: clamp(22px, 7vw, 36px); display: grid; place-items: center; box-shadow: 0 4px 0 #0002; animation: bob 1.6s ease-in-out infinite; }
[dir="rtl"] .asker .q { right: auto; left: -14%; border-radius: 50% 50% 10% 50%; }
.choice { aspect-ratio: .86; border-radius: 24px; background: #fff; border: 4px solid #fff; box-shadow: 0 6px 0 #0002, 0 12px 20px #0003; display: grid; place-items: center; padding: 8%; overflow: visible; transition: transform .12s; }
.choice:active { transform: scale(.94); }
.choice .chara-box, .choice .sticker { width: 100%; aspect-ratio: 1; font-size: min(26vw, 150px); }
.choice.yes { animation: jumpy .55s var(--spring) 2; box-shadow: 0 0 0 5px #ffd600, 0 6px 0 5px #c99a00; }
.choice.no { animation: shake .4s ease; }
@keyframes jumpy { 50% { transform: translateY(-26px) scale(1.08); } }
@keyframes shake { 25% { transform: translateX(-12px) rotate(-4deg); } 75% { transform: translateX(12px) rotate(4deg); } }
#celebrate { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: #2b246699; }
#celebrate .box { background: #fff; border-radius: 34px; padding: 26px 34px; text-align: center; display: grid; gap: 8px; justify-items: center; box-shadow: 0 10px 0 #0002, 0 20px 40px #0004; animation: popin .6s var(--spring); }
#celebrate .box b { font-size: 64px; line-height: 1; }
#celebrate .box span { font-size: 24px; color: var(--ink); }
@keyframes popin { from { transform: scale(.3); opacity: 0; } }

/* ---------- Win overlay: the new sticker ---------- */
#celebratePic > * { width: min(46vw, 190px); aspect-ratio: 1; font-size: min(46vw, 190px); animation: popin .7s var(--spring) .15s backwards; }

/* ---------- Balloon pop ---------- */
#pop { grid-template-rows: auto 1fr; }
#popStage { position: relative; overflow: hidden; min-height: 0; }
.bal { --w: min(23vw, 124px); position: absolute; top: 0; width: var(--w); margin-left: calc(var(--w) / -2); height: calc(var(--w) * 1.2); border-radius: 50% 50% 48% 48%; border: 4px solid #fff; box-shadow: 0 8px 14px #0002; display: grid; place-items: center; padding: 0 0 calc(var(--w) * .08);
  background: radial-gradient(circle at 30% 24%, #fff 0 9%, color-mix(in srgb, var(--c) 28%, white) 32%, color-mix(in srgb, var(--c) 60%, white)); }
.bal.solid { background: radial-gradient(circle at 30% 24%, #fff 0 6%, var(--l) 22%, var(--c) 62%, var(--d)); }
.bal::after { content: ""; position: absolute; left: 50%; top: 100%; width: 2px; height: 60%; margin-top: 4px; background: #ffffffcc; }
.bal .chara-box, .bal .sticker { width: calc(var(--w) * .74); aspect-ratio: 1; font-size: calc(var(--w) * .8); pointer-events: none; }
.bal .sticker { background: none; box-shadow: none; }
.bal .sticker::before { display: none; }
.bal .sticker .pic { width: 92%; height: 92%; }

/* ---------- Sticker album ---------- */
#album { grid-template-rows: auto 1fr auto; background: linear-gradient(#ffb3d9, #ff8cc0); }
#albumBook { margin: 14px 16px 10px; padding: 16px 14px 16px 30px; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; align-content: start;
  border-radius: 24px; border: 5px solid #fff; box-shadow: 0 8px 0 #c2185b, 0 16px 26px #0003;
  background: radial-gradient(circle, #ffd9ea 0 5px, transparent 6px) 6px 14px / 20px 48px repeat-y local, #fffdf6; }
[dir="rtl"] #albumBook { padding: 16px 30px 16px 14px; background-position: calc(100% - 6px) 14px; }
#albumBook .slot { aspect-ratio: 1; border-radius: 18px; border: 3px dashed #f3c6dc; padding: 8%; display: grid; place-items: center; }
#albumBook .slot.got { border-color: transparent; }
#albumBook .slot > * { width: 100%; aspect-ratio: 1; font-size: min(22vw, 120px); pointer-events: none; }
#albumBook .slot:not(.got) > * { filter: brightness(0) opacity(.13); }
#albumBook .slot.new > * { animation: land .9s var(--spring) .35s backwards; }
@keyframes land { 0% { transform: translateY(-60vh) scale(2.4) rotate(-25deg); opacity: 0; } 70% { transform: none; opacity: 1; } 82% { transform: scale(1.2, .84); } }
.diecut { display: grid; place-items: center; }
.diecut .pic { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff) drop-shadow(0 4px 3px #0003); }
.diecut .pic.emoji { font-size: .7em; }
#albumTabs { display: flex; justify-content: center; gap: 5px; padding: 8px 10px calc(14px + env(safe-area-inset-bottom)); }
#albumTabs button { --t: min(11vw, 56px); width: var(--t); height: var(--t); border-radius: 50%; border: 3px solid #fff; background: color-mix(in srgb, var(--c) 45%, white); box-shadow: 0 4px 0 var(--d); display: grid; place-items: center; padding: 5px; transition: transform .25s var(--spring); }
#albumTabs button > * { width: calc(var(--t) - 16px); aspect-ratio: 1; font-size: min(9vw, 40px); pointer-events: none; }
#albumTabs button .diecut .pic { filter: none; }
#albumTabs button.sel { transform: translateY(-8px) scale(1.18); background: #fff; }
