/* Evolution Arena - Battle Royale — chunky, mobile-first HUD and overlays. */
@font-face { font-family: "Baloo 2"; font-style: normal; font-weight: 600 800;
  font-display: swap; src: url("../assets/fonts/Baloo2-latin.woff2") format("woff2"); }
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #87c5e8;
  font-family: "Baloo 2", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none; }
#app, #app canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(20,30,40,.28) 100%); }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10;
  padding: calc(10px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right))
           calc(10px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); }

/* bottom center cluster: level badge + bars, like the reference .io games.
   Warm wood-and-cream framing so the HUD sits inside the low-poly world
   instead of floating over it like a debug overlay. */
#bottom-hud { position: absolute; bottom: calc(12px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; width: min(66vw, 460px); }
#level-badge { flex: none; display: flex; flex-direction: column; align-items: center;
  justify-content: center; width: 76px; height: 76px; border-radius: 20px;
  background: linear-gradient(#fdf0cd, #eccf92); color: #7a5423;
  border: 3px solid #5b3d21;
  box-shadow: 0 4px 0 rgba(46,28,10,.5), inset 0 2px 0 rgba(255,255,255,.65); }
#level-badge span { font-size: 14px; font-weight: 800; letter-spacing: .5px; }
#level-badge b { font-size: 27px; font-weight: 800; line-height: 1.05; }
#bars { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.bar { position: relative; height: 25px; border-radius: 14px; overflow: visible;
  background: rgba(38,24,10,.85); border: 3px solid #5b3d21;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.55), 0 2px 0 rgba(255,255,255,.14),
  0 3px 6px rgba(0,0,0,.35); }
.bar > div { height: 100%; border-radius: 9px; transition: width .18s ease-out;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.38), inset 0 -3px 0 rgba(0,0,0,.16); }
#evo-fill { width: 0%; background: linear-gradient(#8fd8ff, #4aa2e0); }
#hp-fill { width: 100%; background: linear-gradient(#ff9d8d, #ea4a3a); }
.bar span { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: #fff; font-size: 13.5px; font-weight: 800;
  text-shadow: 0 1px 0 rgba(0,0,0,.4), 0 2px 3px rgba(0,0,0,.7); letter-spacing: .3px; }
.bar .bar-ico { position: absolute; left: auto; right: -13px; top: 50%; z-index: 5;
  transform: translateY(-50%); font-size: 27px; display: block; width: auto;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); pointer-events: none; }
#sub-row { display: flex; justify-content: space-between; align-items: center;
  padding: 0 6px; }
#stage-name { color: #fff; font-size: 15px; font-weight: 800;
  text-shadow: 0 2px 3px rgba(0,0,0,.65); }
#atk-chip { display: inline-flex; align-items: center; gap: 7px; color: #fff;
  font-size: 19px; font-weight: 800; text-shadow: 0 2px 3px rgba(0,0,0,.65);
  background: rgba(38,24,10,.85); border: 3px solid #5b3d21; border-radius: 14px;
  padding: 3px 14px; box-shadow: 0 3px 6px rgba(0,0,0,.35); }
#atk-chip b { font-size: 22px; }

/* boosters, left side — cream wood chips matching the bottom cluster */
#boosters { position: absolute; left: calc(10px + env(safe-area-inset-left)); top: 34%;
  transform: translateY(-50%); display: flex; flex-direction: column; gap: 12px;
  pointer-events: auto; }
.booster { position: relative; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; width: 78px; height: 88px; padding: 6px 4px;
  border: 3px solid #5b3d21; border-radius: 16px;
  cursor: pointer; background: linear-gradient(#fdf0cd, #ecd096); color: #6b4a23;
  box-shadow: 0 4px 0 rgba(46,28,10,.45), inset 0 2px 0 rgba(255,255,255,.6);
  font-family: inherit; transition: transform .08s; }
.booster:active { transform: scale(.93); }
.booster .b-icon { font-size: 26px; line-height: 1; height: 26px; filter: drop-shadow(0 2px 1px rgba(0,0,0,.25)); }
.booster .b-label { font-size: 9.5px; font-weight: 800; text-align: center; line-height: 1.15;
  letter-spacing: .3px; }
.booster .b-timer { font-size: 11px; font-weight: 800; min-height: 13px; color: #3f7a1e; }
.booster.active { outline: 3px solid #8bd93e; }
.booster .b-ads { position: absolute; right: -6px; bottom: -6px; font-size: 10px;
  font-weight: 800; background: linear-gradient(#ffe066, #ffc93c); color: #6b4a00;
  border: 2px solid #5b3d21; border-radius: 8px;
  padding: 2px 5px; box-shadow: 0 2px 0 rgba(46,28,10,.4); }

/* Short-lived instant-Evo offer. The wrapper owns positioning while the
   button can pulse, grow and shake without moving its right-side anchor. */
#evo-offer { position: absolute; right: calc(12px + env(safe-area-inset-right)); top: 34%;
  transform: translateY(-50%); pointer-events: auto; perspective: 500px; }
#evo-offer-btn { position: relative; width: 112px; min-height: 126px; padding: 23px 8px 20px;
  overflow: hidden; border: 3px solid #5b3d21; border-radius: 20px; cursor: pointer;
  font-family: inherit; color: #fff; text-align: center;
  background: linear-gradient(145deg, #ff8b2d 0%, #f05137 56%, #c52d54 100%);
  box-shadow: 0 6px 0 rgba(76,28,15,.72), 0 10px 22px rgba(0,0,0,.36),
    inset 0 2px 0 rgba(255,255,255,.45);
  animation: evoOfferAttention 1.05s ease-in-out infinite; transform-origin: center; }
#evo-offer-btn:active { animation: none; transform: scale(.91); }
.offer-ad { position: absolute; left: 7px; top: 6px; padding: 2px 6px;
  border: 2px solid rgba(255,255,255,.84); border-radius: 7px;
  background: rgba(44,17,8,.78); font-size: 9px; font-weight: 900; letter-spacing: .7px;
  animation: offerAdPulse .58s ease-in-out infinite alternate; }
.offer-icon { display: block; height: 34px; font-size: 32px; line-height: 34px;
  filter: drop-shadow(0 3px 2px rgba(0,0,0,.34)); }
.offer-rate { display: block; font-size: 27px; font-weight: 900; line-height: 1;
  text-shadow: 0 3px 0 rgba(94,25,10,.58); }
.offer-copy { display: block; margin-top: 3px; font-size: 11px; line-height: 1;
  font-weight: 900; letter-spacing: .6px; }
.offer-cta { display: inline-block; margin-top: 7px; padding: 2px 7px;
  border-radius: 8px; background: #fff3b2; color: #7a310f; font-size: 9px;
  font-weight: 900; box-shadow: 0 2px 0 rgba(83,28,7,.42); }
.offer-progress { position: absolute; left: 7px; right: 7px; bottom: 6px; height: 6px;
  overflow: hidden; border-radius: 6px; background: rgba(51,14,7,.45); }
#evo-offer-progress { display: block; width: 100%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #fff07d, #fff); }
@keyframes evoOfferAttention {
  0%, 100% { transform: rotate(-1deg) scale(.96); }
  22% { transform: rotate(2.5deg) scale(1.06); }
  38% { transform: rotate(-2.5deg) scale(1.02); }
  54% { transform: rotate(1.5deg) scale(1.08); }
  72% { transform: rotate(0deg) scale(1); }
}
@keyframes offerAdPulse { from { transform: scale(.94); filter: brightness(.9); }
  to { transform: scale(1.08); filter: brightness(1.35); } }

#hint { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%); color: #6b4a23; font-size: 13px; font-weight: 800;
  background: rgba(253,240,205,.92); border: 2px solid #5b3d21; padding: 6px 14px;
  border-radius: 12px; transition: opacity 1s; white-space: nowrap;
  box-shadow: 0 3px 6px rgba(0,0,0,.25); }

#toast { position: absolute; top: 22%; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: clamp(18px, 3.4vw, 30px); font-weight: 900; text-align: center;
  text-shadow: 0 3px 0 rgba(0,0,0,.3), 0 6px 14px rgba(0,0,0,.4); pointer-events: none;
  animation: toastIn .35s ease-out; }
@keyframes toastIn { from { transform: translateX(-50%) scale(.5); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* ---------- dev panel (right side) ---------- */
#dev-panel { position: absolute; right: calc(10px + env(safe-area-inset-right)); top: 34%;
  transform: translateY(-50%); display: flex; flex-direction: column; align-items: flex-end;
  gap: 8px; }
#dev-toggle { width: 44px; height: 44px; border: 3px solid #5b3d21; border-radius: 13px;
  cursor: pointer; background: linear-gradient(#fdf0cd, #ecd096); color: #6b4a23;
  font-size: 20px; box-shadow: 0 4px 0 rgba(46,28,10,.45); transition: transform .08s; }
#dev-toggle:active { transform: scale(.93); }
#dev-body { display: flex; flex-direction: column; gap: 8px; padding: 12px;
  background: linear-gradient(#fdf0cd, #f0d9a6); border: 3px solid #5b3d21;
  border-radius: 14px; box-shadow: 0 4px 0 rgba(46,28,10,.45); }
#dev-body.hidden { display: none; }
.dev-title { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: #7a5423;
  text-align: center; }
.dev-row { display: flex; gap: 6px; }
#dev-level { width: 56px; border: none; border-radius: 8px; padding: 6px 8px;
  font: inherit; font-weight: 800; text-align: center; background: #fff; color: #222; }
#dev-go, #dev-reset { border: none; border-radius: 8px; padding: 6px 10px; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 800; color: #fff; background: #4c8bf5;
  box-shadow: 0 3px 0 rgba(0,0,0,.3); }
#dev-reset { background: #e04848; }
#dev-go:active, #dev-reset:active { transform: scale(.95); }

/* ---------- touch controls ---------- */
#touch-ui { display: none; }
html.touch-capable #touch-ui { display: block; }
html.touch-capable #hint,
html.touch-capable #dev-panel { display: none; }
@media (orientation: portrait) {
  /* lift the bottom cluster above the joystick / attack button */
  html.touch-capable #bottom-hud {
    bottom: calc(150px + env(safe-area-inset-bottom));
    width: min(64vw, 340px);
  }
}
#joystick { position: fixed; left: calc(18px + env(safe-area-inset-left));
  bottom: calc(22px + env(safe-area-inset-bottom)); width: 118px; height: 118px; z-index: 20;
  border-radius: 50%; background: rgba(255,255,255,.14); border: 2px solid rgba(255,255,255,.35); }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px;
  border-radius: 50%; background: rgba(255,255,255,.75); transform: translate(-50%,-50%);
  box-shadow: 0 3px 6px rgba(0,0,0,.3); }
#attack-btn { position: fixed; right: calc(20px + env(safe-area-inset-right));
  bottom: calc(30px + env(safe-area-inset-bottom)); width: 84px; height: 84px; z-index: 20;
  border-radius: 50%; border: none; font-size: 36px; background: linear-gradient(#ff8a5c, #e14b2a);
  box-shadow: 0 5px 0 rgba(0,0,0,.3); color: #fff; }
#jump-btn { position: fixed; right: calc(118px + env(safe-area-inset-right));
  bottom: calc(42px + env(safe-area-inset-bottom)); width: 64px; height: 64px; z-index: 20;
  border-radius: 50%; border: none; font-size: 28px; background: linear-gradient(#78c7ff, #3789db);
  box-shadow: 0 5px 0 rgba(0,0,0,.3); color: #fff; }
#attack-btn:active, #jump-btn:active { transform: scale(.92); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center;
  justify-content: center; background: rgba(10, 20, 30, .55); backdrop-filter: blur(3px); }
.panel { background: linear-gradient(#ffffff, #e8f2e4); border-radius: 22px; padding: 30px 38px;
  text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.4); max-width: min(86vw, 380px); }
.panel h1 { color: #3f7a1e; font-size: 30px; font-weight: 900; margin-bottom: 10px;
  text-shadow: 0 2px 0 rgba(255,255,255,.7); }
.panel p { color: #4b5563; font-weight: 700; margin-bottom: 16px; }
.logo { font-size: 34px; letter-spacing: 1px; line-height: 1.02; }
.logo span { font-size: .55em; letter-spacing: 3px; }
.big-btn { border: none; border-radius: 16px; padding: 14px 34px; font-size: 19px; font-weight: 900;
  font-family: inherit; color: #fff; cursor: pointer; background: linear-gradient(#8bd93e, #4e9e12);
  box-shadow: 0 5px 0 #35700a; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #35700a; }
.big-btn:disabled { cursor: wait; opacity: .62; transform: none; box-shadow: 0 3px 0 #35700a; }
.death-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.death-actions .big-btn { width: 100%; min-height: 58px; padding: 10px 14px;
  font-size: 15px; line-height: 1.12; }
.secondary-btn { background: linear-gradient(#738196, #4b5563); box-shadow: 0 5px 0 #303946; }
.secondary-btn:active { box-shadow: 0 2px 0 #303946; }
.go-status { margin: -5px 0 14px !important; min-height: 20px; color: #9a5a18 !important; }
.booster.spent { filter: grayscale(.65); opacity: .72; cursor: default; }

.ad-panel { background: linear-gradient(#20242c, #101318); color: #fff; }
#ad-title { font-size: 12px; letter-spacing: 2px; opacity: .6; margin-bottom: 10px; }
#ad-box { font-size: 64px; background: #000; border-radius: 14px; padding: 34px 0; margin-bottom: 12px; }
#ad-progress { height: 8px; background: rgba(255,255,255,.15); border-radius: 5px; overflow: hidden; }
#ad-progress-fill { height: 100%; width: 0%; background: #8bd93e; }
#ad-msg { margin-top: 10px; font-size: 13px; font-weight: 700; opacity: .85; }

@media (max-width: 700px) {
  #bottom-hud { width: min(78vw, 460px); gap: 7px; }
  #level-badge { width: 60px; height: 60px; border-radius: 14px; }
  #level-badge span { font-size: 12px; }
  #level-badge b { font-size: 20px; }
  .bar { height: 20px; }
  .bar .bar-ico { right: -10px; font-size: 21px; }
  .booster { width: 62px; height: 76px; padding: 4px 2px; }
  .booster .b-icon { font-size: 20px; height: 20px; }
  #boosters { top: 30%; }
}

/* Landscape phones have little vertical space. Keep the status HUD at the
   bottom center and give the controls separate, non-overlapping zones. */
@media (orientation: landscape) and (max-height: 540px) {
  html.touch-capable #bottom-hud {
    bottom: calc(7px + env(safe-area-inset-bottom));
    width: min(44vw, 360px); gap: 6px;
  }
  html.touch-capable #level-badge {
    width: 54px; height: 54px; border-width: 2px; border-radius: 12px;
  }
  html.touch-capable #level-badge span { font-size: 10px; }
  html.touch-capable #level-badge b { font-size: 19px; }
  html.touch-capable #bars { gap: 3px; }
  html.touch-capable .bar { height: 18px; border-width: 2px; }
  html.touch-capable .bar span { font-size: 10px; }
  html.touch-capable .bar .bar-ico { right: -9px; font-size: 18px; }
  html.touch-capable #sub-row { padding: 0 3px; }
  html.touch-capable #stage-name { font-size: 11px; }
  html.touch-capable #atk-chip {
    gap: 4px; padding: 1px 8px; border-width: 2px; border-radius: 10px;
    font-size: 13px;
  }
  html.touch-capable #atk-chip b { font-size: 15px; }

  html.touch-capable #boosters {
    left: calc(8px + env(safe-area-inset-left));
    top: calc(7px + env(safe-area-inset-top));
    transform: none; flex-direction: row; gap: 6px;
  }
  html.touch-capable .booster {
    width: 54px; height: 58px; padding: 3px 2px; gap: 1px;
    border-width: 2px; border-radius: 11px;
  }
  html.touch-capable .booster .b-icon { font-size: 17px; height: 17px; }
  html.touch-capable .booster .b-label { font-size: 7px; line-height: 1.05; }
  html.touch-capable .booster .b-timer { font-size: 8px; min-height: 9px; }
  html.touch-capable .booster .b-ads { font-size: 7px; padding: 1px 3px; }

  html.touch-capable #evo-offer {
    right: calc(8px + env(safe-area-inset-right));
    top: calc(8px + env(safe-area-inset-top)); transform: none;
  }
  html.touch-capable #evo-offer-btn {
    width: 78px; min-height: 84px; padding: 17px 4px 13px;
    border-width: 2px; border-radius: 13px;
  }
  html.touch-capable .offer-ad { left: 4px; top: 3px; padding: 1px 4px;
    border-width: 1px; border-radius: 5px; font-size: 6px; }
  html.touch-capable .offer-icon { height: 22px; font-size: 20px; line-height: 22px; }
  html.touch-capable .offer-rate { font-size: 19px; }
  html.touch-capable .offer-copy { margin-top: 1px; font-size: 7px; }
  html.touch-capable .offer-cta { margin-top: 4px; padding: 1px 4px; font-size: 6px; }
  html.touch-capable .offer-progress { left: 4px; right: 4px; bottom: 3px; height: 4px; }

  html.touch-capable #joystick {
    left: calc(12px + env(safe-area-inset-left));
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: 94px; height: 94px;
  }
  html.touch-capable #joy-knob { width: 42px; height: 42px; }
  html.touch-capable #attack-btn {
    right: calc(14px + env(safe-area-inset-right));
    bottom: calc(13px + env(safe-area-inset-bottom));
    width: 70px; height: 70px; font-size: 29px;
  }
  html.touch-capable #jump-btn {
    right: calc(94px + env(safe-area-inset-right));
    bottom: calc(21px + env(safe-area-inset-bottom));
    width: 54px; height: 54px; font-size: 23px;
  }
  html.touch-capable #toast { top: 12%; font-size: 18px; }
}
