* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fd6ff; font-family: 'Fredoka', 'Jua', system-ui, sans-serif; color: #fff; touch-action: none; overscroll-behavior: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button, a { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; text-decoration: none; }
[hidden] { display: none !important; }
body.loading::after { content: ''; position: fixed; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border: 6px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; z-index: 99; }
@keyframes spin { to { transform: rotate(360deg); } }
#nogl { display: none; position: fixed; inset: 0; place-items: center; font-size: 40px; background: #234; z-index: 99; }
body.nogl #nogl { display: grid; }
#hurt, #flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; z-index: 8; }
#hurt { background: radial-gradient(circle, rgba(255,60,90,0) 40%, rgba(255,60,90,.55)); }
#flash { background: #fff; z-index: 9; }
.t { text-shadow: 0 2px 0 rgba(7,19,29,.45), 0 0 6px rgba(7,19,29,.25); }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: none; }
#hud button { pointer-events: auto; }
#hearts { position: absolute; left: calc(12px + env(safe-area-inset-left)); top: calc(10px + env(safe-area-inset-top)); font-size: 26px; letter-spacing: 1px; filter: drop-shadow(0 2px 0 rgba(7,19,29,.35)); }
#score { position: absolute; left: 50%; top: calc(6px + env(safe-area-inset-top)); transform: translateX(-50%); font: 700 34px 'Fredoka'; text-shadow: 0 3px 0 rgba(7,19,29,.45), 0 0 8px rgba(7,19,29,.3); font-variant-numeric: tabular-nums; }
#combo { position: absolute; left: 50%; top: calc(50px + env(safe-area-inset-top)); transform: translateX(-50%) scale(0); font: 400 26px 'Jua'; color: #ffe066; text-shadow: 0 2px 0 #c4520a, 0 0 8px rgba(0,0,0,.3); transition: transform .15s; }
#combo.on { transform: translateX(-50%) scale(1); }
.ic-btn { width: 44px; height: 44px; border-radius: 14px; background: rgba(7,19,29,.38); display: grid; place-items: center; font-size: 18px; color: #fff; }
#btnPause { position: absolute; right: calc(12px + env(safe-area-inset-right)); top: calc(10px + env(safe-area-inset-top)); }
#prog { position: absolute; left: calc(14px + env(safe-area-inset-left)); right: calc(66px + env(safe-area-inset-right)); top: calc(48px + env(safe-area-inset-top)); height: 8px; border-radius: 4px; background: rgba(7,19,29,.35); display: none; }
#prog.on { display: block; }
#progFill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: linear-gradient(90deg, #ffd43b, #ff9f43); }
#progDog { position: absolute; top: -6px; left: 0; width: 20px; height: 20px; border-radius: 50%; background: #2fd6ee; border: 3px solid #fff; box-sizing: border-box; transform: translateX(-50%); }
#prog em { position: absolute; right: -4px; top: -10px; font-size: 20px; font-style: normal; }
#bossbar { position: absolute; left: 50%; top: calc(76px + env(safe-area-inset-top)); width: min(86%, 380px); transform: translateX(-50%); text-align: center; }
#bossbar b { font: 400 18px 'Jua'; text-shadow: 0 2px 0 rgba(7,19,29,.5); }
.trk { height: 14px; border-radius: 8px; background: rgba(7,19,29,.45); overflow: hidden; border: 2px solid rgba(255,255,255,.85); margin-top: 2px; }
#bossFill { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff5d7a, #ff9f43); transition: width .1s; }
#powers { position: absolute; left: calc(12px + env(safe-area-inset-left)); top: calc(70px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 6px; }
.pw { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(7,19,29,.4) 0); position: relative; }
.pw::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: rgba(7,19,29,.55); z-index: 0; }
.pw span { position: relative; z-index: 1; }
.bomb-btn { position: absolute; right: calc(14px + env(safe-area-inset-right)); bottom: calc(22px + env(safe-area-inset-bottom)); width: 96px; height: 96px; border-radius: 50%; font-size: 44px; background: radial-gradient(circle at 35% 30%, #ffb36b, #ff7a1a); box-shadow: 0 5px 0 #c4520a, 0 10px 20px rgba(0,0,0,.25); display: grid; place-items: center; }
.bomb-btn b { position: absolute; right: -2px; top: -2px; min-width: 26px; height: 26px; border-radius: 13px; background: #fff; color: #c4520a; font-size: 16px; line-height: 26px; text-align: center; }
.bomb-btn.off { filter: grayscale(1); opacity: .5; }
#touchzone { position: absolute; inset: 0; pointer-events: none !important; }
#pops { position: fixed; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.pop { position: absolute; transform: translate(-50%, -50%); font: 400 26px 'Jua'; color: #fff; text-shadow: 0 3px 0 #ff5d9e, 0 0 10px rgba(255,255,255,.7); opacity: 0; white-space: nowrap; }
.pop.big { font-size: 42px; }
.pop.good { color: #fff7b0; text-shadow: 0 3px 0 #2bc46a; }
.pop.bad { color: #fff; text-shadow: 0 3px 0 #e03131; }
.pop[data-on] { animation: popUp .8s ease-out forwards; }
@keyframes popUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.4); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.25); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }
#banner { position: fixed; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; z-index: 7; opacity: 0; transform: scale(.7); transition: opacity .3s, transform .3s; text-shadow: 0 4px 0 rgba(7,19,29,.5), 0 0 16px rgba(7,19,29,.25); }
#banner.on { opacity: 1; transform: scale(1); }
#banner b { display: block; font: 400 56px 'Jua'; color: #ffe066; }
#banner span { display: block; font: 400 30px 'Jua'; }

/* 화면 */
.screen { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: calc(24px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom)); }
.screen.dim { background: rgba(7,19,29,.45); justify-content: center; }
 








#stageGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.tile { position: relative; height: 62px; border-radius: 16px; background: rgba(255,255,255,.92); color: #1c2b6b; font: 700 24px 'Fredoka'; display: grid; place-items: center; box-shadow: 0 4px 0 rgba(28,43,107,.35); line-height: 1; padding-bottom: 14px; }
.tile small { position: absolute; left: 0; right: 0; bottom: 6px; font-size: 12px; letter-spacing: 1px; color: #ffb000; }
.tile.lock { background: rgba(255,255,255,.4); color: rgba(28,43,107,.4); box-shadow: none; }
.tile.cur { outline: 4px solid #ffd43b; }
.tile:active:not(.lock) { transform: translateY(3px); box-shadow: none; }
.big-btn { display: flex; align-items: center; justify-content: center; gap: 12px; min-width: 230px; height: 70px; padding: 0 34px; border-radius: 999px; font: 700 30px 'Fredoka'; color: #fff; background: linear-gradient(180deg, #ffb13b, #ff7a1a); box-shadow: 0 7px 0 #c4520a, 0 14px 28px rgba(196,82,10,.35); text-shadow: 0 2px 0 rgba(0,0,0,.18); animation: pulse 1.6s ease-in-out infinite; }
.big-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 #c4520a; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.row { display: flex; gap: 10px; align-items: center; justify-content: center; }
.row.col { flex-direction: column; gap: 18px; }
.mid-btn { min-width: 62px; height: 54px; padding: 0 18px; border-radius: 18px; background: rgba(255,255,255,.92); color: #1c2b6b; font: 700 22px 'Fredoka'; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 0 rgba(28,43,107,.35); }
.mid-btn:active { transform: translateY(3px); box-shadow: none; }

.panel { width: min(92%, 400px); max-height: 100%; overflow-y: auto; padding: 18px 16px 14px; border-radius: 28px; background: rgba(255,255,255,.94); color: #1c2b6b; display: flex; flex-direction: column; align-items: center; gap: 12px; box-shadow: 0 16px 40px rgba(7,19,29,.35); }




.mini { display: flex; gap: 16px; font-size: 20px; }





.panel .big-btn { height: 62px; font-size: 26px; min-width: 200px; }
#toast { position: fixed; left: 50%; bottom: 14%; transform: translateX(-50%); padding: 8px 18px; border-radius: 16px; background: rgba(7,19,29,.7); opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 30; }
#toast.on { opacity: 1; }

@media (max-height: 700px) { .tile { height: 50px; } }
@media (min-width: 700px) {   }

#lines { position: fixed; inset: 0; pointer-events: none; opacity: 0; z-index: 7; background: repeating-conic-gradient(from 0deg at 50% 45%, rgba(255,255,255,.0) 0 5deg, rgba(255,255,255,.55) 5deg 6.5deg); -webkit-mask-image: radial-gradient(circle at 50% 45%, transparent 22%, #000 70%); mask-image: radial-gradient(circle at 50% 45%, transparent 22%, #000 70%); }
.pop.huge { font-size: 76px; color: #fff176; text-shadow: 0 5px 0 #e03131, 0 0 18px #fff; -webkit-text-stroke: 3px #7a1f1f; paint-order: stroke fill; }

.weapon-btn { position: absolute; left: calc(14px + env(safe-area-inset-left)); bottom: calc(22px + env(safe-area-inset-bottom)); width: 96px; height: 96px; border-radius: 50%; font-size: 44px; background: radial-gradient(circle at 35% 30%, #9be8ff, #2f9bff); box-shadow: 0 5px 0 #1b5fb8, 0 10px 20px rgba(0,0,0,.25); display: grid; place-items: center; pointer-events: auto; }
.weapon-btn:active { transform: translateY(3px); }
.weapon-btn b { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); min-width: 44px; padding: 0 8px; height: 26px; border-radius: 13px; background: #fff; color: #1b5fb8; font-size: 16px; line-height: 26px; text-align: center; }
#wslots { position: absolute; left: calc(14px + env(safe-area-inset-left)); bottom: calc(128px + env(safe-area-inset-bottom)); display: flex; gap: 6px; }
#wslots i { font-style: normal; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: rgba(7,19,29,.4); opacity: .7; }
#wslots i.on { opacity: 1; outline: 3px solid #ffd43b; background: rgba(7,19,29,.6); }


#vig { position: fixed; inset: 0; pointer-events: none; z-index: 4; background: radial-gradient(ellipse at 50% 55%, rgba(0,0,0,0) 55%, rgba(10,20,50,.28) 100%); }
#score { background: rgba(7,19,29,.42); padding: 2px 18px 0; border-radius: 22px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
#hearts { background: rgba(7,19,29,.42); padding: 3px 10px; border-radius: 20px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
#hearts { font-size: 20px; padding: 3px 8px; } #score { font-size: 28px; left: 58%; }

@media (max-height: 700px) { .weapon-btn, .bomb-btn { width: 76px; height: 76px; font-size: 34px; bottom: calc(14px + env(safe-area-inset-bottom)); } #wslots { bottom: calc(100px + env(safe-area-inset-bottom)); } }
