@font-face { font-family: 'Fredoka'; src: url('fonts/fredoka-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url('fonts/fredoka-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8cc8f5; font-family: 'Fredoka', 'Trebuchet MS', sans-serif; color: #fff; user-select: none; -webkit-user-select: none; touch-action: none; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; outline: none; }
.layer { position: fixed; inset: 0; display: none; pointer-events: none; }
.layer.show { display: block; }
.panel-layer.show { display: flex; align-items: center; justify-content: center; pointer-events: auto; background: rgba(20, 30, 60, 0.18); }
#title.show { background: linear-gradient(rgba(10, 30, 70, 0.05), rgba(10, 30, 70, 0.28)); }
.panel { pointer-events: auto; background: rgba(255, 255, 255, 0.94); color: #2b3150; border-radius: 26px; padding: 22px 26px 20px; width: min(380px, 92vw); max-height: 96vh; overflow: auto; text-align: center; box-shadow: 0 14px 40px rgba(20, 30, 80, 0.3), inset 0 -5px 0 rgba(0, 0, 0, 0.06); }
.panel.small { width: auto; }
.panel h2 { margin: 2px 0 12px; font-size: 30px; color: #e8584f; }
.title-panel { background: rgba(255, 255, 255, 0.9); }
.logo { margin: 0 0 4px; line-height: 0.9; font-weight: 600; }
.logo span { display: block; letter-spacing: 1px; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.12); }
.logo .l1 { font-size: 46px; color: #3f8fe0; }
.logo .l2 { font-size: 60px; color: #f2a33a; -webkit-text-stroke: 1px #d8802a; }
.tag { margin: 6px 0 14px; font-size: 15px; color: #5a6385; }
.btn { font-family: inherit; font-weight: 600; display: block; width: 100%; margin: 8px 0; padding: 11px 14px; border: 0; border-radius: 16px; background: #3f8fe0; color: #fff; font-size: 20px; cursor: pointer; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18); transition: transform 0.08s; }
.btn:active { transform: translateY(2px) scale(0.98); }
.btn.big { font-size: 26px; padding: 13px 14px 15px; background: #5bb96a; }
.btn.ghost { background: #e6e9f4; color: #4a5378; }
.btn.small { display: inline-block; width: auto; font-size: 15px; padding: 7px 16px; margin: 4px; background: #8a94b8; }
.btn.small.off { opacity: 0.45; text-decoration: line-through; }
.btn.ad { background: linear-gradient(#f6b93b, #ee8f20); line-height: 1.1; }
.btn.ad .c1 { display: block; font-size: 22px; }
.btn.ad .c2 { display: block; font-size: 15px; opacity: 0.95; margin-top: 3px; }
.btn:disabled { opacity: 0.6; }
.stats { display: flex; gap: 10px; justify-content: center; margin: 10px 0 6px; }
.stats > div { flex: 1; background: #eef2fb; border-radius: 14px; padding: 6px 4px; }
.stats small { display: block; font-size: 12px; color: #7a83a8; text-transform: uppercase; letter-spacing: 1px; }
.stats b { font-size: 22px; color: #2b3150; }
.hint { font-size: 14px; color: #5a6385; margin: 10px 0 6px; }
kbd { background: #eef2fb; border-radius: 6px; padding: 1px 6px; font-family: inherit; border: 1px solid #ccd3ea; }
.wline { margin: 8px 0 0; font-size: 18px; font-weight: 600; color: #3f8fe0; }
.nline { margin: 2px 0 8px; font-size: 14px; color: #7a83a8; }
.note { font-size: 14px; color: #a05a5a; margin: 6px 0; }
.toggles { margin-top: 6px; }

/* HUD */
.hud-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: max(10px, env(safe-area-inset-top)) 12px 0; }
.chip { pointer-events: none; background: rgba(255, 255, 255, 0.9); color: #2b3150; border-radius: 20px; padding: 6px 14px 6px 6px; font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15); max-width: 34vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip b { background: #f2a33a; color: #fff; border-radius: 50%; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex: none; }
.scorebox { text-align: center; position: absolute; left: 50%; transform: translateX(-50%); top: max(6px, env(safe-area-inset-top)); }
#score { font-size: 44px; font-weight: 600; line-height: 1; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.22), 0 0 12px rgba(0, 0, 0, 0.15); }
#floors { font-size: 15px; opacity: 0.95; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.wbar { width: 120px; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.35); margin: 5px auto 0; overflow: hidden; }
#worldBar { height: 100%; width: 0; background: #ffd23f; border-radius: 4px; transition: width 0.3s; }
.hud-right { display: flex; gap: 8px; align-items: center; }
.shields { pointer-events: none; display: flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, 0.9); color: #2b3150; border-radius: 20px; padding: 5px 12px 5px 6px; font-size: 18px; font-weight: 600; opacity: 0.5; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15); }
.shields.on { opacity: 1; }
.shields i { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #8fe8ff 45%, #3fb6e0); box-shadow: 0 0 8px #8fe8ff; }
.icon { pointer-events: auto; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.9); color: #2b3150; font-family: inherit; font-weight: 600; font-size: 18px; cursor: pointer; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15); }
#combo { position: absolute; top: 112px; left: 50%; transform: translateX(-50%); font-size: 20px; font-weight: 600; color: #ffd23f; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); opacity: 0; transition: opacity 0.2s; }
#combo.on { opacity: 1; }
#pops { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.pop { position: absolute; left: 0; top: 0; text-align: center; white-space: nowrap; font-weight: 600; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); }
.pop b { display: block; font-size: 28px; color: #fff; }
.pop span { display: block; font-size: 20px; color: #fff6c8; }
.pop.gold b { color: #ffd23f; font-size: 32px; }
.pop.warn b { color: #ffb070; }
.pop.bad b { color: #ff6f6f; font-size: 34px; }
#banner { position: fixed; left: 50%; top: 22%; transform: translate(-50%, -50%) scale(0.8); opacity: 0; pointer-events: none; text-align: center; background: rgba(255, 255, 255, 0.92); color: #2b3150; padding: 10px 34px 12px; border-radius: 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
#banner small { display: block; font-size: 14px; letter-spacing: 3px; color: #f2a33a; font-weight: 600; }
#banner b { display: block; font-size: 38px; line-height: 1.1; color: #3f8fe0; }
#banner span { display: block; font-size: 15px; color: #7a83a8; }
#banner.show { animation: bannerAnim 2.6s ease forwards; }
@keyframes bannerAnim { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 20% { transform: translate(-50%, -50%) scale(1); } 82% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }
#toast { position: fixed; left: 50%; top: 36%; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; background: linear-gradient(#8fe8ff, #3fb6e0); color: #fff; font-weight: 600; font-size: 26px; padding: 10px 26px; border-radius: 30px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); white-space: nowrap; }
#toast.show { animation: toastAnim 2.4s ease forwards; }
@keyframes toastAnim { 0% { opacity: 0; transform: translate(-50%, -30%); } 10% { opacity: 1; transform: translate(-50%, -50%); } 80% { opacity: 1; } 100% { opacity: 0; } }
#countdown { position: fixed; left: 50%; top: 52%; transform: translate(-50%, -50%); font-size: 110px; font-weight: 600; color: #fff; text-shadow: 0 6px 0 rgba(0, 0, 0, 0.25); pointer-events: none; display: none; }
#countdown.show { display: block; }
@media (max-height: 560px) {
  .panel { padding: 12px 18px; }
  .logo .l1 { font-size: 34px; } .logo .l2 { font-size: 44px; }
  .btn { margin: 5px 0; padding: 8px 12px; font-size: 18px; } .btn.big { font-size: 22px; padding: 9px 12px 11px; }
  .tag, .hint { margin: 4px 0; font-size: 13px; }
  .panel h2 { font-size: 24px; margin-bottom: 6px; }
  .stats { margin: 6px 0 4px; } .stats b { font-size: 18px; }
}
@media (max-width: 480px) {
  #score { font-size: 36px; } .chip { font-size: 14px; } .shields { font-size: 15px; }
  #combo { top: 96px; }
}
