/* Fredoka (SIL OFL 1.1, see fonts/OFL.txt) bundled so the app works offline */
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(../fonts/fredoka-latin.woff2) format('woff2'); }
:root {
  --bg: #fff6ec; --ink: #2b2340; --card: #ffffff; --line: #2b2340;
  --pink: #ff5fa2; --blue: #3b7bff; --yellow: #ffd23f; --green: #2ecc71; --red: #ff3b4e;
  --k1: #ffe3ee; --k2: #fff1c7; --k3: #dfe9ff; --k4: #d8f7e7;
  --font: 'Fredoka', ui-rounded, 'Arial Rounded MT Bold', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --shadow: 0 5px 0 var(--line);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font); }
body { overscroll-behavior: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
button { font-family: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
.ic { width: 1em; height: 1em; display: block; }
.ic-slot { display: inline-flex; }
[hidden] { display: none !important; }

/* ---------- background tiers ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); transition: background .6s; }
.bg > div { position: absolute; inset: 0; opacity: 0; transition: opacity .6s; }
.bg-grid { opacity: 1 !important; background-image: linear-gradient(#f3e6d6 1px, transparent 1px), linear-gradient(90deg, #f3e6d6 1px, transparent 1px); background-size: 22px 22px; }
.bg-rays { inset: -60% !important; background: repeating-conic-gradient(from 0deg, #ffd6e8 0 10deg, #fff3c4 10deg 20deg, #d9edff 20deg 30deg); animation: spin 14s linear infinite; }
.bg-rainbow { background: linear-gradient(120deg, #ff9ac8, #ffd97a, #9df0c4, #9cc6ff, #d2a8ff, #ff9ac8); background-size: 400% 400%; animation: rainbow 6s linear infinite; mix-blend-mode: multiply; }
.bg-cosmic { background: radial-gradient(circle at 30% 20%, #6a4cff 0, transparent 40%), radial-gradient(circle at 80% 70%, #ff5fa2 0, transparent 40%), #1a1040; }
.bg-cosmic::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(#fff 1px, transparent 1.5px); background-size: 38px 38px; animation: twinkle 2s ease-in-out infinite alternate; }
.bg[data-tier="3"] .bg-rays, .bg[data-tier="4"] .bg-rays { opacity: .55; }
.bg[data-tier="5"] .bg-rays, .bg[data-tier="6"] .bg-rays, .bg[data-tier="7"] .bg-rays { opacity: .75; }
.bg[data-tier="5"] .bg-rainbow, .bg[data-tier="6"] .bg-rainbow, .bg[data-tier="7"] .bg-rainbow { opacity: .65; }
.bg[data-tier="8"] .bg-cosmic { opacity: 1; }
.bg[data-tier="8"] .bg-rays { opacity: .25; }
.bg.fever .bg-rainbow { opacity: .9; animation-duration: 1.2s; }
.bg.fever .bg-rays { opacity: .9; animation-duration: 3s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rainbow { to { background-position: 400% 0; } }
@keyframes twinkle { from { opacity: .3; } to { opacity: 1; } }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 30; pointer-events: none; }
#app { position: relative; z-index: 10; height: 100%; max-width: 520px; margin: 0 auto; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; padding: calc(8px + var(--safe-t)) 14px calc(10px + var(--safe-b)); }
.screen.active { display: flex; }
#overlay { position: fixed; inset: 0; z-index: 40; pointer-events: none; overflow: hidden; }
#flash { position: fixed; inset: 0; z-index: 35; background: #fff; opacity: 0; pointer-events: none; }

/* ---------- shared pieces ---------- */
.icon-btn { width: 48px; height: 48px; border-radius: 16px; background: #fff; border: 3px solid var(--line); box-shadow: 0 3px 0 var(--line); display: grid; place-items: center; font-size: 26px; position: relative; }
.icon-btn.sm { width: 42px; height: 42px; font-size: 22px; border-radius: 14px; }
.icon-btn:active { transform: translateY(3px); box-shadow: none; }
.coin { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3b0, #ffc83d 45%, #e59a00); border: 2px solid #b87800; flex: none; }
.hold-ring { position: absolute; inset: -6px; border-radius: 20px; border: 4px solid var(--pink); opacity: 0; }
.hold-ring.on { opacity: 1; animation: hold 2s linear forwards; }
@keyframes hold { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* ---------- home ---------- */
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.total-pill { display: flex; align-items: center; gap: 8px; background: var(--yellow); border: 3px solid var(--line); box-shadow: 0 3px 0 var(--line); border-radius: 18px; padding: 6px 14px; font-size: 26px; font-weight: 700; min-width: 0; overflow: hidden; }
.total-pill b { white-space: nowrap; }
.home-hero { flex: 1 1 auto; min-height: 120px; display: flex; align-items: flex-end; justify-content: center; gap: 2%; padding: 8px 0; }
.home-hero .chr { width: 23%; max-width: 110px; animation: bob 1.1s ease-in-out infinite; filter: drop-shadow(0 4px 0 rgba(43,35,64,.15)); }
.home-hero .chr:nth-child(2) { animation-delay: -.3s; } .home-hero .chr:nth-child(3) { animation-delay: -.6s; } .home-hero .chr:nth-child(4) { animation-delay: -.9s; }
.play-big { align-self: center; width: min(70%, 280px); height: 84px; border-radius: 28px; background: var(--blue); color: #fff; border: 4px solid var(--line); box-shadow: 0 7px 0 var(--line); display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 44px; animation: pulse 1.2s ease-in-out infinite; margin: 6px 0 14px; }
.play-big .op { width: 48px; height: 48px; color: #fff; border: 3px solid #fff; border-radius: 14px; display: grid; place-items: center; font-size: 26px; }
.play-big:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--line); animation: none; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.mode-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mode { background: #fff; border: 3px solid var(--line); box-shadow: 0 4px 0 var(--line); border-radius: 18px; padding: 6px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.mode:active { transform: translateY(4px); box-shadow: none; }
.mode.sel { background: #fff3c4; }
.mode .opic { font-size: 24px; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.mode .chr { width: 100%; max-width: 64px; }
.mode .lv { display: flex; align-items: center; gap: 2px; font-weight: 700; font-size: 15px; }
.mode .lv .ic { width: 15px; height: 15px; }
.mini-bar { width: 86%; height: 7px; border-radius: 4px; background: #eee3d6; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--yellow)); border-radius: 4px; }
.op-add { background: #ff5fa2; } .op-sub { background: #3b7bff; } .op-mul { background: #f5a400; } .op-div { background: #1fb57a; } .op-mix { background: #9b5de5; }
.home-nav { display: flex; justify-content: center; gap: 18px; margin-top: 14px; }
.nav-btn { width: 76px; height: 60px; border-radius: 20px; background: #fff; border: 3px solid var(--line); box-shadow: 0 4px 0 var(--line); display: grid; place-items: center; font-size: 30px; position: relative; }
.nav-btn:active { transform: translateY(4px); box-shadow: none; }
.badge { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; font-size: 24px; }

/* ---------- play ---------- */
.hud { display: flex; align-items: center; gap: 8px; }
.hud-combo, .hud-maru { display: flex; align-items: center; gap: 4px; background: #fff; border: 3px solid var(--line); border-radius: 14px; padding: 3px 10px 3px 6px; font-size: 22px; font-weight: 700; height: 42px; }
.hud-combo .ic, .hud-maru .ic { width: 24px; height: 24px; }
.hud-combo.hot { background: #fff1c7; animation: hotpulse .5s ease-in-out infinite; }
@keyframes hotpulse { 50% { transform: scale(1.08) rotate(-2deg); } }
.dopa-pill { margin-left: auto; display: flex; align-items: center; gap: 6px; background: var(--yellow); border: 3px solid var(--line); box-shadow: 0 3px 0 var(--line); border-radius: 14px; padding: 4px 10px; font-size: 21px; font-weight: 700; height: 42px; min-width: 0; max-width: 60%; }
.dopa-pill b { white-space: nowrap; }
.evo { display: flex; align-items: center; gap: 8px; margin: 8px 2px 0; }
.evo-lv { display: flex; align-items: center; gap: 2px; font-weight: 700; font-size: 18px; }
.evo-lv .ic { width: 20px; height: 20px; }
.evo-bar { flex: 1; height: 14px; border-radius: 8px; background: #fff; border: 2.5px solid var(--line); overflow: hidden; }
.evo-bar i { display: block; height: 100%; width: 15%; background: linear-gradient(90deg, #ff5fa2, #ffd23f, #2ecc71); transition: width .35s cubic-bezier(.2,1.6,.4,1); }
.evo.near .evo-bar { animation: hotpulse .6s ease-in-out infinite; }
.evo-need { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 2px; min-width: 40px; justify-content: flex-end; }
.evo-need .ic { width: 16px; height: 16px; }

.stage { position: relative; flex: 0 0 auto; height: clamp(110px, 21vh, 190px); margin-top: 4px; }
.bunting { position: absolute; left: -14px; right: -14px; top: 0; width: calc(100% + 28px); height: 34px; opacity: 0; transform: translateY(-20px); transition: .4s cubic-bezier(.2,1.6,.4,1); }
.stage.t2 .bunting { opacity: 1; transform: none; }
.main-char { position: absolute; left: 50%; bottom: -12px; width: 38%; max-width: 170px; transform: translateX(-50%); z-index: 3; }
.main-char .chr { width: 100%; animation: bob 0.9s ease-in-out infinite; filter: drop-shadow(0 5px 0 rgba(43,35,64,.18)); }
.main-char.jump .chr { animation: jump .45s cubic-bezier(.2,1.6,.4,1); }
.main-char.shake .chr { animation: shakeX .3s; }
@keyframes bob { 50% { transform: translateY(-5%) scaleY(1.03); } }
@keyframes jump { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-22%) scale(1.12, .92); } 100% { transform: translateY(0) scale(1); } }
@keyframes shakeX { 20%, 60% { transform: translateX(-8%); } 40%, 80% { transform: translateX(8%); } }
.crowd { position: absolute; inset: 0; z-index: 2; }
.buddy { position: absolute; width: 17%; max-width: 72px; transform: translateX(-50%); animation: dropIn .5s cubic-bezier(.2,1.6,.4,1) both; }
.buddy > * { width: 100%; display: block; animation: bob .7s ease-in-out infinite; animation-delay: var(--d, 0s); }
.buddy img { aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 3px 0 rgba(43,35,64,.2)); }
.buddy.out { animation: popOut .35s forwards; }
@keyframes dropIn { from { transform: translate(-50%, -160%) scale(.4); opacity: 0; } }
@keyframes popOut { to { transform: translate(-50%, 40%) scale(0); opacity: 0; } }
.gift-slot { position: absolute; right: 2%; bottom: 4px; z-index: 5; }
.gift { width: 64px; height: 64px; font-size: 64px; pointer-events: auto; animation: giftDrop .6s cubic-bezier(.2,1.6,.4,1) both, giftWiggle 1s .6s ease-in-out infinite; filter: drop-shadow(0 4px 0 rgba(43,35,64,.25)); }
.gift.shake { animation: giftShake .18s 3; }
@keyframes giftDrop { from { transform: translateY(-300%) rotate(-30deg); } }
@keyframes giftWiggle { 0%, 60%, 100% { transform: rotate(0) scale(1); } 70% { transform: rotate(-12deg) scale(1.1); } 80% { transform: rotate(12deg) scale(1.1); } 90% { transform: rotate(-6deg); } }
@keyframes giftShake { 25% { transform: rotate(-18deg) scale(1.15); } 75% { transform: rotate(18deg) scale(1.15); } }

.card-wrap { position: relative; flex: 1 1 auto; min-height: 170px; margin: 10px 0 12px; }
.card { position: absolute; inset: 0; background: var(--card); border: 3.5px solid var(--line); border-radius: 26px; box-shadow: 0 6px 0 var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; will-change: transform; }
.card.fever { box-shadow: 0 6px 0 var(--line), 0 0 0 5px #ff5fa2, 0 0 30px 8px #ffd23f; }
.card-tag { position: absolute; top: 10px; left: 12px; display: flex; align-items: center; gap: 4px; }
.card-tag .opic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-size: 18px; }
.card-tag .lv { display: flex; align-items: center; font-weight: 700; font-size: 16px; gap: 1px; }
.card-tag .lv .ic { width: 16px; height: 16px; }
.card-no { position: absolute; top: 12px; right: 14px; font-weight: 700; font-size: 17px; color: #9a8fae; }
.timer { position: absolute; left: 0; bottom: 0; height: 7px; width: 100%; background: linear-gradient(90deg, #ffd23f, #ff9f1c); transform-origin: left; }
.timer.gone { background: #e8dfd3; }
.bolt-tag { position: absolute; bottom: 12px; right: 12px; font-size: 24px; opacity: .9; }
.bolt-tag.gone { opacity: .15; filter: grayscale(1); }
.fever-tag { position: absolute; bottom: 14px; left: 12px; background: #ff5fa2; color: #fff; font-weight: 700; font-size: 20px; padding: 1px 12px; border-radius: 12px; border: 2.5px solid var(--line); animation: hotpulse .4s infinite; }

.prob { font-weight: 700; color: var(--ink); line-height: 1; }
.grid { display: grid; gap: 0 2px; justify-content: center; }
.cell { width: var(--cw); height: var(--ch); display: grid; place-items: center; font-size: var(--fs); position: relative; }
.cell.carry { height: calc(var(--ch) * .5); font-size: calc(var(--fs) * .45); color: var(--pink); opacity: 0; transform: translateY(8px); transition: .25s cubic-bezier(.2,1.6,.4,1); }
.cell.carry.show { opacity: 1; transform: none; }
.cell.opc { color: var(--blue); }
.rule { grid-column: 1 / -1; height: 4px; background: var(--ink); border-radius: 2px; margin: 4px 0 6px; }
.box { width: calc(var(--cw) * .92); height: calc(var(--ch) * .96); border-radius: 12px; background: #eef3ff; border: 2.5px dashed #b9c7ff; display: grid; place-items: center; font-size: var(--fs); position: relative; }
.box.cur { background: #fff; border: 3px solid var(--blue); box-shadow: 0 0 0 4px rgba(59,123,255,.18); animation: curpulse 1s ease-in-out infinite; }
.box.done { background: #e8fbef; border: 2.5px solid var(--green); animation: digitPop .35s cubic-bezier(.2,1.8,.4,1); }
.box.bad { animation: shakeX .3s; background: #ffe6ea; border-color: var(--red); }
.box .ghost { color: #c9c2d6; }
.box .x { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--fs) * .9); pointer-events: none; animation: xfade .5s forwards; }
@keyframes xfade { from { opacity: 1; transform: scale(1.3); } to { opacity: 0; transform: scale(1); } }
@keyframes curpulse { 50% { box-shadow: 0 0 0 8px rgba(59,123,255,.08); } }
@keyframes digitPop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.row-prob { display: flex; align-items: center; gap: 6px; font-size: var(--fs); }
.row-prob .opc { color: var(--blue); }
.row-prob .boxes { display: flex; gap: 4px; }

.keypad { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key { height: clamp(50px, 8.2vh, 68px); border-radius: 18px; background: #fff; border: 3px solid var(--line); box-shadow: 0 5px 0 var(--line); font-size: 30px; font-weight: 700; touch-action: manipulation; transition: background .15s; }
.key.k0 { grid-column: 1 / -1; }
.key.down { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.key.bad { background: #ffb8c3 !important; animation: shakeX .3s; }
.key.good { background: #b8f3cf !important; }
.keypad.tint .key:nth-child(3n+1) { background: var(--k1); } .keypad.tint .key:nth-child(3n+2) { background: var(--k2); } .keypad.tint .key:nth-child(3n) { background: var(--k3); } .keypad.tint .key.k0 { background: var(--k4); }

/* ---------- overlay pieces ---------- */
.popnum { position: absolute; font-weight: 700; font-size: 28px; color: #fff; -webkit-text-stroke: 1.5px var(--line); paint-order: stroke fill; text-shadow: 0 3px 0 var(--line); white-space: nowrap; transform: translate(-50%, -50%); }
.popnum.big { font-size: 40px; color: var(--yellow); }
.stamp { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 6px; font-size: 110px; font-weight: 700; color: #fff; -webkit-text-stroke: 4px var(--line); paint-order: stroke fill; text-shadow: 0 8px 0 var(--line); white-space: nowrap; }
.stamp .ic { width: 1em; height: 1em; }
.band { position: absolute; left: -10%; right: -10%; top: 38%; height: 96px; background: repeating-linear-gradient(-45deg, #ffd23f 0 26px, #ffc21a 26px 52px); border-block: 5px solid var(--line); display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 64px; font-weight: 700; color: #fff; -webkit-text-stroke: 3px var(--line); paint-order: stroke fill; transform: rotate(-6deg); }
.band.dark { background: repeating-linear-gradient(-45deg, #2b2340 0 26px, #3d3160 26px 52px); }
.band.pink { background: repeating-linear-gradient(-45deg, #ff5fa2 0 26px, #ff86bb 26px 52px); }
.band .ic { width: 64px; height: 64px; }
.evo-scene { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle, rgba(255,246,236,.9) 20%, rgba(43,35,64,.55)); }
.evo-scene .rays { position: absolute; width: 180vmax; height: 180vmax; background: repeating-conic-gradient(#fff3 0 8deg, transparent 8deg 16deg); animation: spin 6s linear infinite; }
.evo-scene .who { position: relative; width: min(60vw, 280px); animation: evoIn 1s cubic-bezier(.2,1.6,.4,1); }
.evo-scene .who .chr { width: 100%; }
.evo-scene .lvl { position: absolute; bottom: 18%; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; font-size: 60px; font-weight: 700; color: #fff; -webkit-text-stroke: 3px var(--line); paint-order: stroke fill; }
.evo-scene .lvl .ic { width: 56px; height: 56px; }
@keyframes evoIn { 0% { transform: scale(.2) rotate(-200deg); filter: brightness(8); } 60% { transform: scale(1.2) rotate(10deg); filter: brightness(2); } 100% { transform: scale(1); filter: none; } }
.friend-card { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); background: #fff; border: 4px solid var(--line); border-radius: 26px; box-shadow: 0 8px 0 var(--line); padding: 14px; width: 190px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.friend-card img, .friend-card .chr { width: 150px; height: 150px; object-fit: contain; }
.friend-card .row { display: flex; align-items: center; gap: 6px; font-size: 34px; font-weight: 700; }
.friend-card .row .ic { width: 34px; height: 34px; }
.fever-bar { position: absolute; left: 0; right: 0; top: 0; height: 8px; background: linear-gradient(90deg, #ff5fa2, #ffd23f, #2ecc71, #3b7bff, #9b5de5); transform-origin: left; }

/* ---------- draw ---------- */
.sub-top { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; }
.sub-title { justify-self: center; display: flex; align-items: center; gap: 8px; font-size: 34px; font-weight: 700; }
.sub-title .ic { width: 36px; height: 36px; }
.op-pick { display: flex; justify-content: center; gap: 10px; margin: 10px 0; }
.op-pick button { width: 54px; height: 54px; border-radius: 16px; border: 3px solid var(--line); font-size: 28px; color: #fff; display: grid; place-items: center; opacity: .35; }
.op-pick button.sel { opacity: 1; box-shadow: 0 4px 0 var(--line); transform: translateY(-3px); }
.canvas-box { flex: 0 0 auto; display: grid; place-items: center; }
#paint { width: min(100%, calc(100dvh - 380px)); min-width: 200px; }
#paint, .ed-canvas { aspect-ratio: 1; background: #fff; border: 3.5px solid var(--line); border-radius: 22px; box-shadow: 0 5px 0 var(--line); touch-action: none; background-image: linear-gradient(45deg, #f7f2ea 25%, transparent 25%, transparent 75%, #f7f2ea 75%), linear-gradient(45deg, #f7f2ea 25%, transparent 25%, transparent 75%, #f7f2ea 75%); background-size: 24px 24px; background-position: 0 0, 12px 12px; }
.palette { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 12px; }
.swatch { width: 27px; height: 27px; border-radius: 50%; border: 3px solid var(--line); }
.swatch.sel { transform: scale(1.22); box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--line); }
.tools { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.tool { width: 42px; height: 44px; border-radius: 14px; background: #fff; border: 3px solid var(--line); box-shadow: 0 3px 0 var(--line); display: grid; place-items: center; font-size: 24px; }
.tool.sel { background: #fff3c4; transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.tool .dot { border-radius: 50%; background: var(--ink); }
.send-big { align-self: center; margin-top: 12px; width: min(70%, 260px); height: 64px; border-radius: 22px; background: var(--pink); color: #fff; border: 4px solid var(--line); box-shadow: 0 6px 0 var(--line); display: grid; place-items: center; font-size: 36px; }
.send-big:disabled { opacity: .4; }
.send-big:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--line); }
.my-subs { flex: 1 1 auto; align-items: flex-start; display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 2px; min-height: 64px; }
.sub-thumb { flex: none; width: 56px; height: 56px; border-radius: 14px; background: #fff; border: 2.5px solid var(--line); position: relative; }
.sub-thumb img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
.sub-thumb .st { position: absolute; right: -6px; top: -6px; width: 22px; height: 22px; font-size: 22px; }
.fly-mail { position: absolute; font-size: 90px; width: 90px; height: 90px; }

/* ---------- collection ---------- */
.col-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; overflow-y: auto; padding: 12px 2px 20px; }
.col-card { background: #fff; border: 3px solid var(--line); border-radius: 20px; box-shadow: 0 4px 0 var(--line); padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; }
.col-card .pic { width: 100%; aspect-ratio: 1; display: grid; place-items: center; }
.col-card .pic .chr, .col-card .pic img { width: 100%; height: 100%; object-fit: contain; }
.col-card.locked .pic img { filter: brightness(0); opacity: .18; }
.col-card.locked .lockic { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); font-size: 30px; color: #b1a7c3; }
.col-card .lv { display: flex; align-items: center; gap: 2px; font-weight: 700; }
.col-card .lv .ic { width: 16px; height: 16px; }
.col-card .opic { position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; border-radius: 7px; color: #fff; display: grid; place-items: center; font-size: 14px; }
.stars { display: flex; }
.stars .ic { width: 14px; height: 14px; }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(43,35,64,.55); display: grid; place-items: center; padding: 16px; }
.sheet { position: relative; background: #fff; border: 4px solid var(--line); border-radius: 26px; box-shadow: 0 8px 0 var(--line); padding: 22px 18px 18px; width: min(100%, 380px); display: flex; flex-direction: column; gap: 14px; }
.sheet-row { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.toggle { width: 110px; height: 56px; border-radius: 18px; border: 3px solid var(--line); background: #eee3d6; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 28px; }
.toggle.on { background: #b8f3cf; }
.toggle .lamp { width: 16px; height: 16px; border-radius: 50%; background: #bbb; border: 2px solid var(--line); }
.toggle.on .lamp { background: var(--green); }
.timer-row .ic-lead { font-size: 30px; }
.chip { min-width: 52px; height: 46px; border-radius: 14px; border: 3px solid var(--line); background: #fff; font-size: 20px; font-weight: 700; padding: 0 8px; }
.chip.sel { background: var(--yellow); box-shadow: 0 3px 0 var(--line); }
.close-x { position: absolute; top: -18px; right: -14px; width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 3px solid var(--line); display: grid; place-items: center; font-size: 22px; }
.danger { width: 80px; height: 50px; border-radius: 16px; background: #ffe3e7; border: 3px solid var(--line); display: grid; place-items: center; font-size: 26px; position: relative; overflow: hidden; }
.danger .fill { position: absolute; inset: 0; background: #ff8fa0; transform-origin: left; transform: scaleX(0); }
.danger.holding .fill { transition: transform 3s linear; transform: scaleX(1); }
.danger .ic { position: relative; }
.sleep { background: linear-gradient(#1a1040, #3d2c7a); }
.sleep-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; color: #fff; }
.moon { font-size: 90px; width: 90px; height: 90px; animation: bob 3s ease-in-out infinite; }
.sleep-chars { display: flex; gap: 6px; }
.sleep-chars .chr { width: 70px; animation: bob 3s ease-in-out infinite; }
.sleep-stats { display: flex; gap: 12px; font-size: 30px; font-weight: 700; flex-wrap: wrap; justify-content: center; }
.sleep-stats > div { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.12); border-radius: 16px; padding: 6px 14px; }
.sleep-stats .ic { width: 30px; height: 30px; }

.spin { animation: spin 5s linear infinite; }

@media (prefers-reduced-motion: reduce) { .bg-rays, .bg-rainbow { animation: none; } }
.reduce .bg-rays, .reduce .bg-rainbow, .reduce .spin { animation: none !important; }
@media (max-height: 720px) {
  .stage { height: 92px; } .keypad { gap: 6px; } .key { height: 44px; font-size: 26px; border-radius: 14px; box-shadow: 0 4px 0 var(--line); }
  .card-wrap { margin: 8px 0 10px; min-height: 150px; } .evo { margin-top: 4px; }
  .home-hero { min-height: 80px; } .play-big { height: 68px; } .op-pick { margin: 6px 0; } .op-pick button { width: 46px; height: 46px; }
}
.sleep .icon-btn { color: var(--ink); }

/* ---------- photo characters ---------- */
.photo-tool { background: #dff3ff; }
.draw-actions { display: flex; justify-content: center; gap: 12px; margin-top: 12px; }
.draw-actions .send-big { margin-top: 0; width: min(44%, 170px); position: relative; overflow: hidden; }
.draw-actions .send-big .ic { position: relative; }
.send-big.gated { background: #9b5de5; }
.hold-fill { position: absolute; inset: 0; background: rgba(255,255,255,.4); transform-origin: left; transform: scaleX(0); }
.send-big.holding .hold-fill { transition: transform 2s linear; transform: scaleX(1); }
.keep-big { width: min(44%, 170px); height: 64px; border-radius: 22px; background: #fff3c4; border: 4px solid var(--line); box-shadow: 0 6px 0 var(--line); display: grid; place-items: center; font-size: 40px; }
.keep-big:disabled { opacity: .4; }
.keep-big:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--line); }
.photo-sheet { align-items: center; }
.photo-cv { width: min(78vw, 340px); aspect-ratio: 1; border-radius: 18px; border: 3px solid var(--line); touch-action: none;
  background-color: #fff; background-image: linear-gradient(45deg, #f1ebe2 25%, transparent 25%, transparent 75%, #f1ebe2 75%), linear-gradient(45deg, #f1ebe2 25%, transparent 25%, transparent 75%, #f1ebe2 75%); background-size: 20px 20px; background-position: 0 0, 10px 10px; }
.photo-sheet .chip { display: grid; place-items: center; font-size: 24px; color: var(--ink); }
.photo-sheet .toggle { font-size: 30px; }
.col-card.mine { cursor: pointer; }
.col-card.partner { background: #fff8d6; border-color: #d99a00; box-shadow: 0 4px 0 #d99a00; }
.mine-badge { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; font-size: 24px; }
.mine-del { position: relative; overflow: hidden; width: 40px; height: 30px; border-radius: 10px; border: 2px solid var(--line); background: #fff; display: grid; place-items: center; font-size: 18px; }
.mine-del .ic { position: relative; }
.mine-del .fill { position: absolute; inset: 0; background: #ff8fa0; transform-origin: left; transform: scaleX(0); }
.mine-del.holding .fill { transition: transform 1.5s linear; transform: scaleX(1); }
.chr.photo image { filter: drop-shadow(0 3px 0 rgba(43,35,64,.2)); }
