/* Issue: monozku/projects#826 わかなの きらきらあそび v1 */
:root { --brown: #5a3a2a; --cream: #fff6e0; --cover: #ffb0c8; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
html, body { word-break: keep-all; overflow-wrap: normal; line-break: strict; margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #8fd8ff; color: var(--brown);
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif; font-weight: 800; }
button { font: inherit; color: inherit; border: 0; padding: 0; cursor: pointer; background: none; }
.hidden { display: none !important; }
img { image-rendering: pixelated; -webkit-user-drag: none; }
svg.px { image-rendering: pixelated; display: block; }

#app { position: relative; width: 100%; max-width: 480px; height: 100vh; height: 100dvh; margin: 0 auto; overflow: hidden; }

/* ---- 背景 ---- */
#bg { position: absolute; inset: 0; --sky1: #8fd8ff; --sky2: #dff4ff; --gr: #9be28b; }
#bg.sky-eve { --sky1: #c48fd8; --sky2: #ffd2a0; --gr: #8fcf7e; }
#bg.sky-night { --sky1: #1f2a5a; --sky2: #5a5ab0; --gr: #5fa86a; }
#sky { position: absolute; inset: 0 0 34% 0; background: linear-gradient(var(--sky1), var(--sky2)); }
#sunmoon { position: absolute; left: 8%; top: calc(var(--safe-t) + 100px); width: 58px; }
.sky-eve #sunmoon { top: 44%; }
#clouds .cloud { position: absolute; left: -30%; width: 96px; opacity: .95; animation: drift 80s linear infinite; }
.sky-night #clouds { opacity: .25; }
@keyframes drift { to { transform: translateX(560px); } }
#stars { display: none; }
.sky-night #stars { display: block; }
#stars span { position: absolute; width: 6px; height: 6px; background: #fff7b0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .35; } }
#ground { position: absolute; left: 0; right: 0; bottom: 0; height: 36%; border-top: 5px solid var(--brown);
  background: repeating-linear-gradient(0deg, transparent 0 20px, rgba(79, 174, 90, .28) 20px 24px), linear-gradient(#b4f0a0 0 10px, var(--gr) 10px); }
#ground .fl { position: absolute; width: 15px; }

/* ---- 画面の枠 ---- */
#screens, .screen { position: absolute; inset: 0; }
.screen { display: none; flex-direction: column; padding: calc(var(--safe-t) + 12px) 16px calc(var(--safe-b) + 16px); }
.screen.active { display: flex; }
.field { position: relative; flex: 1; min-height: 0; }
.chr-slot { position: absolute; }
.chr { position: relative; width: 100%; }
.chr img { width: 100%; display: block; }
.bob { position: relative; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.fxlayer { position: absolute; inset: 0; pointer-events: none; z-index: 8; overflow: visible; }
.pt { position: absolute; width: 8px; height: 8px; pointer-events: none; }
.pt.star { width: 13px; height: 13px; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }

/* ---- ふきだし ---- */
.bubble { background: var(--cream); border: 4px solid var(--brown); border-radius: 16px; padding: 8px 14px; font-size: 20px; line-height: 1.3; text-align: center;
  box-shadow: 0 4px 0 rgba(90, 58, 42, .3); opacity: 0; transition: opacity .15s; }
.bubble.show { opacity: 1; animation: pop .25s ease-out; }
@keyframes pop { 0% { transform: scale(.7); } 70% { transform: scale(1.06); } 100% { transform: scale(1); } }
.bubble.top { margin: 0 0 0 0; flex: 1; min-height: 56px; display: flex; align-items: center; justify-content: center; }
.bubble.mid { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; top: 44%; max-width: 96%; z-index: 9; }
.toprow { display: flex; gap: 16px; align-items: center; }

/* ---- ボタンの見た目 ---- */
.big, .sq, .mbtn { background: #ff8fb0; border: 4px solid var(--brown); border-radius: 22px; color: #fff; text-shadow: 2px 2px 0 var(--brown), -2px -2px 0 var(--brown), 2px -2px 0 var(--brown), -2px 2px 0 var(--brown), 0 2px 0 var(--brown), 0 -2px 0 var(--brown);
  box-shadow: 0 7px 0 #c05a80, inset 0 6px 0 rgba(255, 255, 255, .4); transition: transform .06s, box-shadow .06s; }
.big:active, .sq:active, .mbtn:active { transform: translateY(5px) scale(.97); box-shadow: 0 2px 0 #c05a80, inset 0 4px 0 rgba(255, 255, 255, .4); }
.big { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 96px; font-size: 32px; }
.big .ico { width: 34px; height: 34px; }
.big span { display: block; width: 34px; }
.sq { min-width: 80px; min-height: 80px; width: 80px; height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 18px; }
.sq .ico { width: 40px; height: 34px; }
.sq.dim { opacity: .35; }
.pulse { animation: hop 1.1s ease-in-out infinite; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-9px); } }
.pulse:active { animation: none; }

/* ---- 1 タイトル ---- */
.banner { align-self: center; margin-top: 18px; background: var(--cream); border: 5px solid var(--brown); border-radius: 20px; padding: 12px 20px; font-size: 34px; line-height: 1.25; text-align: center; box-shadow: 0 7px 0 rgba(90, 58, 42, .3); max-width: 340px; }
.duo { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 4px; padding-bottom: 18px; min-height: 0; }
.duo .chr.wakana { width: 40%; max-width: 160px; }
.duo .chr.pk { width: 48%; max-width: 190px; }
.duo .chr { flex: none; }
.adult-hint { margin: 14px 0 0; font-size: 12px; font-weight: 700; text-align: center; background: rgba(255, 246, 224, .85); border-radius: 10px; padding: 6px 8px; }

/* ---- 2 ぼうけん ---- */
#adv-field .wk-slot { left: 2%; bottom: 26%; width: 30%; }
#adv-field .pk-slot { left: 28%; bottom: 20%; width: 26%; }
.bush { position: absolute; display: block; }
.bush.target { right: 0; bottom: 22%; width: 48%; min-height: 80px; }
.bush.target svg { width: 100%; }
.deco-bush { width: 30%; }
.deco-bush.l { left: -10%; bottom: -2%; }
.deco-bush.r { display: none; }
.deco-bush svg { width: 100%; }
.sway { animation: sway 1s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) scale(1.04); } }
#b-bush::after { content: ""; position: absolute; left: 20%; top: -6px; width: 14px; height: 14px; background: #fff7b0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: twinkle 1s ease-in-out infinite; }
#s-adv .sq.corner { flex: none; }

/* ---- 3 であい ---- */
#enc-field .wk-slot { left: 0; bottom: 18%; width: 30%; }
#enc-field .pk-slot { left: 26%; bottom: 10%; width: 32%; }
#enc-field .unico-slot { right: 2%; bottom: 22%; width: 38%; }
#enc-field .enc-bush { position: absolute; right: 0; bottom: 16%; width: 52%; }
#enc-field .enc-bush svg { width: 100%; }
#s-enc .bubble.top { flex: none; }

/* ---- 4 バトル ---- */
.hud { display: flex; flex: none; }
.hud.top { justify-content: flex-end; }
.gauge { display: flex; align-items: center; gap: 6px; width: 72%; }
.gauge .gi { width: 40px; flex: none; }
.gauge .bar { flex: 1; height: 26px; background: var(--cream); border: 4px solid var(--brown); border-radius: 10px; overflow: hidden; }
.gauge .bar i { display: block; height: 100%; width: 100%; transition: width .9s ease-out, background-color .4s; background: linear-gradient(rgba(255, 255, 255, .45) 0 30%, transparent 30%), #8fe08a; }
.gauge[data-col="yellow"] .bar i { background: linear-gradient(rgba(255, 255, 255, .45) 0 30%, transparent 30%), #ffe066; }
.gauge[data-col="salmon"] .bar i { background: linear-gradient(rgba(255, 255, 255, .45) 0 30%, transparent 30%), #ff9a8a; }
.gauge.mine { flex-direction: row; }
.battle-field .unico-slot { right: 4%; top: 0; width: 40%; }
.battle-field .pink-slot { left: 0; bottom: 0; width: 46%; }
.battle-field .wk-slot.small { right: 4%; bottom: 0; width: 24%; }
.battle-field .bubble.mid { top: 40%; }
.hud.mine { margin: 6px 0 10px; }
.moves { display: flex; gap: 16px; justify-content: center; flex: none; padding-bottom: 8px; }
.mbtn { flex: 1; max-width: 118px; min-width: 100px; height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 2px 6px; position: relative; }
.mbtn b { font-size: 13px; white-space: nowrap; letter-spacing: 0; }
.mbtn .mi svg { width: 44px; height: 38px; }
.mbtn .pips { display: flex; gap: 3px; height: 17px; align-items: center; }
.mbtn .pips svg { width: 17px; height: 16px; }
.mbtn.orange { background: #ffb15a; box-shadow: 0 7px 0 #c47a2a, inset 0 6px 0 rgba(255, 255, 255, .4); }
.mbtn.pink { background: #ff8fb0; }
.mbtn.blue { background: #6cc8f2; box-shadow: 0 7px 0 #3a8fbf, inset 0 6px 0 rgba(255, 255, 255, .4); }
.mbtn.off { filter: grayscale(1) brightness(1.08); opacity: .6; }
.mbtn.ready { animation: glow 1.3s ease-in-out infinite alternate; }
@keyframes glow { from { box-shadow: 0 7px 0 rgba(0, 0, 0, .18), inset 0 6px 0 rgba(255, 255, 255, .4), 0 0 0 0 rgba(255, 255, 255, 0); } to { box-shadow: 0 7px 0 rgba(0, 0, 0, .18), inset 0 6px 0 rgba(255, 255, 255, .4), 0 0 16px 6px rgba(255, 255, 255, .95); } }
.mbtn.hint { animation: hint 1s ease-in-out infinite alternate; }
@keyframes hint { from { transform: scale(1); box-shadow: 0 7px 0 #3a8fbf, 0 0 10px 4px #fff; } to { transform: scale(1.08); box-shadow: 0 7px 0 #3a8fbf, 0 0 22px 10px #fff7b0; } }
.mbtn.hint::after { content: ""; position: absolute; right: -8px; top: -12px; width: 22px; height: 22px; background: #ffd84d; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: twinkle 1s ease-in-out infinite; }

.chr .horn { position: absolute; left: 30%; top: -10%; width: 34%; height: 30%; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(circle, #fff 0 14%, #fff3a0 32%, rgba(255, 216, 77, 0) 70%); }
.chr.pink .horn { left: 14%; top: -6%; width: 62%; height: 44%; }
.chr.charged .horn { opacity: 1; animation: horn 1.3s ease-in-out infinite; }
@keyframes horn { 0%, 100% { transform: scale(.85); opacity: .65; } 50% { transform: scale(1.2); opacity: 1; } }
.chr.charged img { filter: drop-shadow(0 0 8px #fff3a0); }

.beam { position: absolute; border: 4px solid var(--brown); border-radius: 14px; pointer-events: none; z-index: 7; }
.beam.mine { background: linear-gradient(#ffb0c8, #fff 50%, #ffb0c8); }
.beam.mine.st1 { box-shadow: 0 0 10px 2px #ffd0e0; }
.beam.mine.st2 { background: linear-gradient(#ff6f9f, #ffb0c8 28%, #fff 50%, #ffb0c8 72%, #ff6f9f); box-shadow: 0 0 14px 4px #ffd0e0; }
.beam.mine.st3 { background: linear-gradient(#ff6f9f, #ff8fb0 20%, #ffd0e0 38%, #fff 50%, #ffd0e0 62%, #ff8fb0 80%, #ff6f9f); box-shadow: 0 0 20px 8px #ffd0e0, 0 0 8px 2px #fff3a0; }
.beam.enemy { background: linear-gradient(#ff9a8a 0 20%, #ffd84d 20% 40%, #7fd67a 40% 60%, #6cc8f2 60% 80%, #c8a2f0 80%); }
.beam.enemy.strong { box-shadow: 0 0 16px 6px #fff3a0; }
.shield { position: absolute; width: 74px; z-index: 6; }

/* ---- ピンクちゃんの育ち ---- */
.chr.pink .deco { position: absolute; }
.chr.pink .deco.ribbon { left: 18%; top: 30%; width: 22%; transform: rotate(-12deg); }
.chr.pink .deco.crown { left: 33%; top: 28%; width: 26%; transform: rotate(-6deg); }
.chr.pink.st1 img { filter: drop-shadow(0 0 3px rgba(255, 255, 255, .9)); }
.chr.pink.st2 img { filter: drop-shadow(0 0 6px rgba(255, 255, 255, 1)); }
.chr.pink.st3 img { filter: drop-shadow(0 0 8px #fff3a0) drop-shadow(0 0 3px #fff); }
.chr.pink .spk { position: absolute; width: 14px; height: 14px; background: #fff7b0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: twinkle 1.6s ease-in-out infinite; }
.chr.pink .spk.s1 { left: 4%; top: 16%; }
.chr.pink .spk.s2 { right: 2%; top: 40%; animation-delay: -.5s; }
.chr.pink .spk.s3 { left: 70%; top: 2%; animation-delay: -1s; }
.chr.tired .bob { animation: none; }
.chr.tired img { transform: translateY(7%) scaleY(.9) rotate(-5deg); }
.chr.mini { width: 60px; }
.chr.mini .bob { animation: none; }

/* ---- 5 けっか ---- */
.stars-row { display: flex; justify-content: center; gap: 12px; height: 60px; flex: none; }
.stars-row.none { height: 12px; }
.stars-row svg { width: 54px; height: 54px; }
.stars-row svg.pop { animation: starpop .5s ease-out; }
@keyframes starpop { 0% { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(1); } }
.result-field .pink-slot { left: 0; bottom: 4%; width: 46%; }
.result-field .unico-slot { right: 2%; bottom: 6%; width: 38%; }
.result-field .wk-slot.small { left: 38%; bottom: 0; width: 22%; display: none; }
.result-field .bubble.mid { top: 52%; }
.stk-zone { position: absolute; left: 0; right: 0; top: 2%; display: flex; justify-content: center; gap: 12px; z-index: 6; }
.stk { position: relative; background: #fff; border: 4px solid var(--brown); border-radius: 16px; padding: 8px 6px 4px; width: 88px; box-shadow: 0 5px 0 rgba(90, 58, 42, .3); transform: rotate(-3deg); }
.stk + .stk { transform: rotate(3deg); }
.stk.gold { background: linear-gradient(135deg, #fff7b0, #ffe066 50%, #fff7b0); }
.stk-art { width: 100%; height: 56px; }
.stk .dots { display: flex; justify-content: center; gap: 2px; height: 16px; margin-top: 2px; }
.stk .dots svg { width: 16px; height: 15px; }
.stk.ghost { background: transparent; border-style: dashed; border-color: #cbbba8; box-shadow: none; display: flex; align-items: center; justify-content: center; height: 80px; transform: none; }
.stk.ghost svg { width: 28px; }
.izumi { position: absolute; inset: 0; z-index: 20; display: none; background: radial-gradient(circle at 50% 66%, #fffbd0 0, #bfeaff 55%, #e6d8ff 100%); }
.izumi.show { display: block; animation: fadein .3s; }
@keyframes fadein { from { opacity: 0; } }
.izumi .pool { position: absolute; left: 4%; right: 4%; bottom: 10%; }
.izumi .pool svg { width: 100%; }
.izumi .chr-slot { left: 22%; bottom: 20%; width: 56%; z-index: 3; }
.izumi .bubble.mid { top: 12%; font-size: 22px; max-width: 88%; z-index: 9; }
#b-again { flex: none; margin-top: 8px; }

/* ---- なかよし（おやつ・ハート・こうたい）---- */
.hearts { position: absolute; left: 0; right: 0; top: -15%; display: flex; justify-content: center; gap: 4px; z-index: 5; }
.hearts svg { width: 24px; height: 22px; flex: none; }
.hearts svg.pop { animation: starpop .5s ease-out; }
.flydonut { position: absolute; width: 48px; z-index: 9; pointer-events: none; }
.big.oyatsu { background: #ffb15a; box-shadow: 0 7px 0 #c47a2a, inset 0 6px 0 rgba(255, 255, 255, .4); flex: none; margin-top: 8px; }
.big.oyatsu .ico { width: 44px; height: 34px; }
.big.oyatsu span { width: 44px; }
.sq.swap { background: #fff6e0; box-shadow: 0 7px 0 rgba(90, 58, 42, .35), inset 0 6px 0 rgba(255, 255, 255, .6); position: relative; }
.sq.swap img { width: 54px; height: 54px; object-fit: contain; }
.sq.swap .ico { position: absolute; right: 2px; bottom: 2px; width: 26px; height: 26px; background: #ff8fb0; border: 3px solid var(--brown); border-radius: 9px; padding: 2px; }
.mbtn b.n8 { font-size: 12px; letter-spacing: -0.5px; }

/* ---- 6 シールちょう ---- */
.book { flex: 1; min-height: 0; margin-top: 4px; background: var(--cream); border: 6px solid var(--cover); outline: 4px solid var(--brown); outline-offset: -2px; border-radius: 18px; padding: 10px 8px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 7px 0 rgba(90, 58, 42, .3); }
.progress { display: flex; align-items: center; gap: 10px; }
.progress .pp { width: 64px; flex: none; }
.progress .slots { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; }
.progress .slot { width: 26px; height: 26px; border: 3px dashed #cbbba8; border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; }
.progress .slot.full { border: 3px solid var(--brown); background: #fff7b0; }
.progress .slot svg { width: 18px; height: 17px; }
.page { flex: 1; min-height: 0; }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px 4px; }
.cell { aspect-ratio: 1 / 1.25; display: flex; align-items: center; justify-content: center; }
.cell.empty { border: 3px dashed #d8cdbd; border-radius: 12px; margin: 3px; }
.cell .stk { width: 100%; padding: 4px 3px 2px; border-width: 3px; border-radius: 10px; transform: none !important; }
.cell .stk-art { height: 34px; }
.cell .stk .dots { height: 11px; gap: 1px; }
.cell .stk .dots svg { width: 11px; height: 10px; }
.grid.special { grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 10px; }
.grid.special .cell { aspect-ratio: 1; }
.grid.special .stk { width: 100%; padding: 8px; }
.grid.special .stk-art { height: 60px; }
.book-nav { display: flex; gap: 16px; justify-content: center; align-items: center; margin-top: 14px; flex: none; }
.book-nav .sq.back { width: 140px; flex-direction: row; gap: 8px; font-size: 22px; background: #6cc8f2; box-shadow: 0 7px 0 #3a8fbf, inset 0 6px 0 rgba(255, 255, 255, .4); }
.book-nav .sq.back .ico { width: 30px; height: 26px; }
#bk-prev svg { transform: scaleX(-1); }
.adult-dot { position: absolute; right: 8px; top: calc(var(--safe-t) + 8px); width: 36px; height: 36px; border-radius: 50%; background: rgba(90, 58, 42, .12); border: 2px solid rgba(90, 58, 42, .25); }
.adult-dot.hold { background: rgba(90, 58, 42, .35); }

/* ---- おとなの きろく ---- */
#s-kiroku { background: var(--cream); overflow-y: auto; touch-action: pan-y; }
.kiroku { font-weight: 600; font-size: 15px; line-height: 1.5; padding-bottom: 40px; overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.kiroku h2 { font-size: 20px; margin: 8px 0; }
.kiroku h3 { font-size: 16px; margin: 16px 0 4px; }
.kiroku table { width: 100%; border-collapse: collapse; }
.kiroku th, .kiroku td { text-align: left; padding: 6px 4px; border-bottom: 1px solid #e0d0b8; vertical-align: top; }
.kiroku th { font-weight: 700; width: 48%; }
.kiroku .tg { display: flex; gap: 10px; }
.kiroku .tgl { min-height: 48px; padding: 0 14px; border: 3px solid var(--brown); border-radius: 12px; background: #e8dfd2; font-weight: 700; }
.kiroku .tgl.on { background: #bfeaff; }
.kiroku .tgl.close { margin-top: 16px; width: 100%; background: #ffd0e0; }
.kiroku .note { font-size: 13px; margin-top: 14px; }

/* ---- よこむき・かくにん ---- */
#rotate { display: none; position: fixed; inset: 0; z-index: 100; background: #bfeaff; flex-direction: column; align-items: center; justify-content: center; gap: 14px; font-size: 34px; }
#rotate .rot { width: 90px; animation: rotphone 2s ease-in-out infinite; }
@keyframes rotphone { 0%, 30% { transform: rotate(-90deg); } 70%, 100% { transform: rotate(0); } }
@media (orientation: landscape) and (pointer: coarse) { #rotate { display: flex; } }
#confirm { position: fixed; inset: 0; z-index: 110; background: rgba(90, 58, 42, .45); display: flex; align-items: center; justify-content: center; }
#confirm .dlg { background: var(--cream); border: 5px solid var(--brown); border-radius: 22px; padding: 24px 28px; text-align: center; font-size: 34px; }
#confirm p { margin: 0 0 18px; }
#confirm .row { display: flex; gap: 16px; }
#confirm .yes { background: #ff9a8a; }
#confirm .no { background: #6cc8f2; box-shadow: 0 7px 0 #3a8fbf, inset 0 6px 0 rgba(255, 255, 255, .4); }

@media (max-height: 700px) {
  .banner { font-size: 28px; margin-top: 8px; }
  .big { min-height: 84px; }
  .stars-row { height: 50px; } .stars-row svg { width: 44px; height: 44px; }
  .mbtn { height: 104px; }
}
