/* ============ Bloop Bounce — visual identity ============ */
:root{
  --ink:#22314a;
  --ink-soft:#42597c;
  --navy:#1d2b42;
  --navy-2:#27395a;
  --cream:#fffaf1;
  --sky:#8fd8ff;
  --grass:#5fbf45;
  --accent:#ff8b3d;
  --accent-deep:#f0622c;
  --mint:#35c9a0;
  --purple:#8a6cf5;
  --pink:#ff6f9c;
  --gold:#ffc93c;
  --shadow:0 10px 0 rgba(20,32,50,.18);
}

*{box-sizing:border-box;}
html,body{height:100%;margin:0;padding:0;}
body{
  background:var(--navy);
  font-family:Fredoka,"Trebuchet MS",Verdana,sans-serif;
  color:var(--ink);
  overscroll-behavior:none;
  -webkit-tap-highlight-color:transparent;
  -webkit-user-select:none;
  user-select:none;
}
button{font-family:inherit;}

.game-root{
  position:relative;
  height:100vh;
  height:100dvh;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:var(--navy);
}

/* ---------------- HUD ---------------- */
.hud{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  background:linear-gradient(180deg,var(--navy-2),var(--navy));
  color:#fff;
  box-shadow:0 2px 0 rgba(0,0,0,.18);
  z-index:20;
}
.hud-left,.hud-right{display:flex;align-items:center;gap:6px;}
.hud-center{
  flex:1 1 auto;
  min-width:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  line-height:1;
}
.score-k{
  font-size:9px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:rgba(255,255,255,.55);
  font-weight:600;
}
.score-v{
  font-size:19px;
  font-weight:600;
  color:var(--gold);
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:100%;
}
.pill{
  display:flex;
  align-items:center;
  gap:5px;
  padding:4px 9px;
  border-radius:999px;
  background:rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.14);
}
.stat-k{
  font-size:9px;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:rgba(255,255,255,.6);
  font-weight:600;
}
.stat-v{font-size:15px;font-weight:600;font-variant-numeric:tabular-nums;}
.hearts{display:flex;gap:3px;align-items:center;}
.heart{width:14px;height:14px;display:block;}
.heart svg{width:100%;height:100%;display:block;}
.heart path{fill:var(--pink);transition:fill .2s;}
.heart.off path{fill:rgba(255,255,255,.2);}
.icon-btn{
  width:36px;height:36px;
  flex:0 0 auto;
  display:flex;align-items:center;justify-content:center;
  border:none;border-radius:12px;
  background:rgba(255,255,255,.12);
  color:#fff;
  cursor:pointer;
  transition:background .15s,transform .1s;
}
.icon-btn svg{width:20px;height:20px;}
.icon-btn .ico-off{display:none;}
.icon-btn.muted .ico-on{display:none;}
.icon-btn.muted .ico-off{display:block;}
.icon-btn:active{transform:scale(.93);background:rgba(255,255,255,.22);}
.icon-btn:focus-visible{outline:3px solid var(--gold);outline-offset:2px;}

/* ---------------- Play field ---------------- */
.stage-wrap{
  position:relative;
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
  background:var(--sky);
}
#game{
  display:block;
  width:100%;
  height:100%;
  touch-action:none;
  cursor:crosshair;
}

/* ---------------- Controls dock ---------------- */
.dock{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:10px;
  padding:9px 12px;
  background:linear-gradient(180deg,var(--navy),var(--navy-2));
  color:#fff;
  z-index:20;
}
.ctl-group{display:flex;align-items:center;gap:8px;}
.ctl-group-right{margin-inline-start:auto;}
.ctl{
  border:none;
  cursor:pointer;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:transform .1s,filter .15s,opacity .2s;
  touch-action:none;
}
.ctl-step{
  width:64px;height:64px;
  border-radius:22px;
  background:linear-gradient(180deg,#3d5а84,#2c3f60);
  background:linear-gradient(180deg,#3d5a84,#2c3f60);
  box-shadow:inset 0 2px 0 rgba(255,255,255,.18),0 4px 0 rgba(0,0,0,.25);
}
.ctl-step svg{width:30px;height:30px;}
.ctl-fire{
  min-width:112px;
  height:64px;
  flex-direction:column;
  gap:1px;
  border-radius:22px;
  background:linear-gradient(180deg,#ffb03d,#f0622c);
  color:#3a1b06;
  box-shadow:inset 0 2px 0 rgba(255,255,255,.45),0 5px 0 #b8451a;
}
.ctl-fire svg{width:26px;height:26px;}
.ctl-fire-label{font-size:11px;font-weight:700;letter-spacing:.12em;}
.ctl:active{transform:translateY(2px) scale(.97);filter:brightness(1.06);}
.ctl:focus-visible{outline:3px solid var(--gold);outline-offset:2px;}
.ctl:disabled{opacity:.42;pointer-events:none;}
.power-wrap{
  flex:1 1 auto;
  min-width:56px;
  display:flex;
  flex-direction:column;
  gap:4px;
  align-items:center;
}
.power-label{
  font-size:9px;
  letter-spacing:.16em;
  text-transform:uppercase;
  color:rgba(255,255,255,.55);
  font-weight:600;
}
.power-bar{
  width:100%;
  height:16px;
  border-radius:999px;
  background:rgba(0,0,0,.32);
  border:1px solid rgba(255,255,255,.14);
  overflow:hidden;
  box-shadow:inset 0 2px 3px rgba(0,0,0,.35);
}
.power-fill{
  width:62%;
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg,var(--mint),var(--gold) 55%,var(--accent-deep));
  transition:width .06s linear;
}

/* ---------------- Overlays ---------------- */
.overlay{
  position:absolute;
  inset:0;
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  overflow-y:auto;
  background:rgba(19,30,48,.74);
  backdrop-filter:blur(9px);
  -webkit-backdrop-filter:blur(9px);
  animation:overlayIn .22s ease-out;
}
.overlay.hidden{display:none !important;}
@keyframes overlayIn{from{opacity:0;}to{opacity:1;}}

.card{
  width:100%;
  max-width:410px;
  margin:auto;
  background:var(--cream);
  color:var(--ink);
  border-radius:28px;
  padding:22px 22px 20px;
  box-shadow:0 18px 0 rgba(10,18,30,.28),0 2px 0 rgba(255,255,255,.6) inset;
  text-align:center;
  animation:cardIn .3s cubic-bezier(.2,1.3,.5,1);
}
.card-small{max-width:330px;}
@keyframes cardIn{from{transform:translateY(18px) scale(.96);opacity:0;}to{transform:none;opacity:1;}}

.logo-row{display:flex;align-items:center;gap:12px;justify-content:center;}
.logo-boop{
  width:86px;height:86px;
  flex:0 0 auto;
  object-fit:contain;
  animation:boop 2.4s ease-in-out infinite;
}
@keyframes boop{0%,100%{transform:translateY(0) scale(1);}50%{transform:translateY(-8px) scale(1.04,0.97);}}
.logo-text{text-align:left;}
.title{
  margin:0;
  font-size:34px;
  line-height:.95;
  font-weight:600;
  letter-spacing:-.01em;
  color:var(--ink);
}
.title span{display:block;color:var(--accent-deep);}
.tagline{
  margin:6px 0 0;
  font-size:13px;
  line-height:1.4;
  color:var(--ink-soft);
}
.howto{
  list-style:none;
  margin:18px 0 0;
  padding:14px 16px;
  background:#fff;
  border-radius:18px;
  text-align:left;
  font-size:14px;
  line-height:1.5;
  color:var(--ink-soft);
  display:flex;
  flex-direction:column;
  gap:8px;
  box-shadow:inset 0 0 0 1px rgba(34,49,74,.08);
}
.howto b{color:var(--accent-deep);}
.chips{
  display:flex;
  gap:8px;
  justify-content:center;
  margin-top:16px;
}
.chips-stack{flex-direction:column;align-items:stretch;}
.chip{
  flex:1 1 0;
  min-width:0;
  background:#fff;
  border-radius:16px;
  padding:8px 10px;
  display:flex;
  flex-direction:column;
  gap:2px;
  box-shadow:inset 0 0 0 1px rgba(34,49,74,.08);
}
.chip span{
  font-size:10px;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:var(--ink-soft);
  font-weight:600;
}
.chip b{font-size:19px;font-weight:600;color:var(--ink);}
.chip-gold b{color:var(--accent-deep);}
.btn{
  display:block;
  width:100%;
  margin-top:16px;
  padding:15px 18px;
  border:none;
  border-radius:20px;
  font-size:19px;
  font-weight:600;
  letter-spacing:.02em;
  cursor:pointer;
  transition:transform .1s,box-shadow .1s,filter .15s;
}
.btn-primary{
  background:linear-gradient(180deg,#ffb03d,#f0622c);
  color:#3a1b06;
  box-shadow:0 5px 0 #b8451a;
}
.btn-primary:active{transform:translateY(3px);box-shadow:0 2px 0 #b8451a;}
.btn-ghost{
  background:#fff;
  color:var(--ink);
  box-shadow:0 4px 0 rgba(34,49,74,.18);
  font-size:16px;
  padding:12px 16px;
}
.btn-ghost:active{transform:translateY(2px);box-shadow:0 2px 0 rgba(34,49,74,.18);}
.btn:focus-visible{outline:3px solid var(--purple);outline-offset:3px;}
.fineprint{
  margin:12px 0 0;
  font-size:11px;
  color:var(--ink-soft);
  opacity:.85;
}
.card-title{margin:0;font-size:28px;font-weight:600;color:var(--ink);}
.card-sub{
  margin:8px 0 4px;
  font-size:14px;
  line-height:1.5;
  color:var(--ink-soft);
}

/* ---------------- Narrow phones ---------------- */
@media (max-width:430px){
  .stat-k{display:none;}
  .pill{padding:4px 8px;}
  .stat-v{font-size:14px;}
  .score-k{display:none;}
  .score-v{font-size:17px;}
  .icon-btn{width:34px;height:34px;border-radius:11px;}
  .icon-btn svg{width:18px;height:18px;}
  .heart{width:12px;height:12px;}
  .hud{padding:6px 8px;gap:6px;}
  .dock{padding:8px 10px;gap:8px;}
  .ctl-step{width:58px;height:58px;border-radius:20px;}
  .ctl-fire{min-width:98px;height:58px;}
  .power-label{display:none;}
}
@media (max-width:360px){
  .ctl-step{width:54px;height:54px;}
  .ctl-fire{min-width:88px;height:54px;}
  .ctl-fire-label{font-size:10px;}
}

/* ---------------- Short (landscape phone) ---------------- */
@media (max-height:480px){
  .hud{padding:5px 10px;}
  .dock{padding:6px 12px;}
  .ctl-step{width:54px;height:54px;border-radius:18px;}
  .ctl-fire{height:54px;min-width:104px;}
  .logo-boop{width:64px;height:64px;}
  .title{font-size:28px;}
  .howto{font-size:13px;padding:12px 14px;gap:6px;}
  .card{padding:18px;max-width:460px;}
  .btn{margin-top:12px;padding:12px 16px;font-size:17px;}
}

@media (prefers-reduced-motion: reduce){
  .logo-boop{animation:none;}
  .overlay{animation:none;}
  .card{animation:none;}
  .power-fill{transition:none;}
}