html,body{height:100%;margin:0}
body{display:flex;align-items:center;justify-content:center;background:#fff;color:#000;font-family:system-ui,Arial;user-select:none;-webkit-user-select:none}
img{-webkit-user-drag:none;user-select:none;-webkit-user-select:none}
canvas#game-canvas{background:#fff;border:0;image-rendering:pixelated;display:block}

.site-ui-btn,
#respawn-btn{
  height:44px;
  padding:0 14px;
  border:1px solid rgba(255, 179, 71, 0.55);
  border-radius:999px;
  background:#000;
  color:#fff;
  font:700 14px/1 system-ui, Arial;
  box-shadow:0 12px 28px rgba(0,0,0,0.45);
  cursor:pointer;
  transition:transform .2s ease, box-shadow .2s ease, background-color .2s ease;
  position: relative;
  overflow: hidden;
}

.site-ui-btn:hover,
#respawn-btn:hover{
  transform:translateY(-3px) scale(1.01);
  box-shadow:0 14px 30px rgba(0,0,0,0.55);
}

.site-ui-btn::before,
#respawn-btn::before{
  content:"";
  position:absolute;
  width:34px;
  height:34px;
  border-radius:50%;
  right:-10px;
  top:-10px;
  background:rgba(255, 107, 74, 0.28);
  pointer-events:none;
}

/* sprite layer sits above the canvas and holds inline SVG characters */
#game-wrapper{position:relative}
#leave-btn{
  position:absolute;
  top:12px;
  right:12px;
  z-index:30;
  height:44px;
  padding:0 16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  border-radius:999px;
  font:700 14px/1 system-ui, Arial;
  border:1px solid rgba(255, 179, 71, 0.55);
  color:#fff;
  background:#000;
  box-shadow:0 12px 28px rgba(0,0,0,0.45);
  transition:transform .2s ease, box-shadow .2s ease, background-color .2s ease;
  overflow:hidden;
}
#leave-btn:hover{
  transform:translateY(-3px) scale(1.01);
  box-shadow:0 14px 30px rgba(0,0,0,0.55);
}
#leave-btn::before{
  content:"";
  position:absolute;
  width:34px;
  height:34px;
  border-radius:50%;
  right:-10px;
  top:-10px;
  background:rgba(255, 107, 74, 0.28);
  pointer-events:none;
}
#sprite-layer{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;overflow:visible}
.character-sprite{width:100%;height:100%;display:block}
.character-sprite.running{ /* smaller specificity for potential external overrides */ }

/* ensure the inline SVG doesn't capture clicks */
#sprite-layer svg{pointer-events:none}

/* peel animation when running */
#sprite-layer svg .peel{transform-box:fill-box;transform-origin:70% 10%;transition:transform 0.12s ease}
#sprite-layer svg.running .peel{animation:peel-flap 0.36s ease-in-out infinite}
#sprite-layer svg.running .peel:nth-child(2){animation-delay:0.06s}
#sprite-layer svg.running .peel:nth-child(3){animation-delay:0.12s}
@keyframes peel-flap{0%{transform:rotate(0deg)}50%{transform:rotate(18deg)}100%{transform:rotate(0deg)}}

/* hands and legs animation */
#sprite-layer svg .hand, #sprite-layer svg .leg{transform-box:fill-box;transition:transform 0.12s ease}
#sprite-layer svg.running .hand{animation:hand-swing 0.36s ease-in-out infinite}
#sprite-layer svg.running .hand:nth-child(2){animation-delay:0.04s}
#sprite-layer svg.running .hand:nth-child(3){animation-delay:0.08s}
@keyframes hand-swing{0%{transform:rotate(0deg)}50%{transform:rotate(-26deg)}100%{transform:rotate(0deg)}}

#sprite-layer svg.running .leg{animation:leg-kick 0.36s ease-in-out infinite}
#sprite-layer svg.running .leg:nth-child(2){animation-delay:0.04s}
#sprite-layer svg.running .leg:nth-child(3){animation-delay:0.08s}
@keyframes leg-kick{0%{transform:rotate(0deg)}50%{transform:rotate(26deg) translateY(2px)}100%{transform:rotate(0deg)}}

/* UI overlay styling */
#ui-overlay{display:none;position:absolute;left:0;top:0;width:100%;height:100%;align-items:center;justify-content:center;pointer-events:auto}
#ui-overlay .you-died{box-shadow:0 6px 18px rgba(0,0,0,0.5)}
#ui-overlay button{border:1px solid #d9e0f5}
#ui-overlay button:focus{outline:2px solid rgba(255,255,255,0.2)}
#ui-overlay input{user-select:text;-webkit-user-select:text}

/* Bell notification tab */
#notification-bell{
  position:fixed;
  top:170px;
  right:14px;
  z-index:31;
  width:44px;
  height:44px;
  border:1px solid rgba(255, 179, 71, 0.55);
  border-radius:999px;
  background:#000;
  color:#fff;
  cursor:pointer;
  font-size:19px;
  line-height:1;
  box-shadow:0 12px 28px rgba(0,0,0,0.45);
}
#notification-bell .badge{
  position:absolute;
  top:-4px;
  right:-4px;
  min-width:18px;
  height:18px;
  padding:0 4px;
  border-radius:999px;
  background:#e53935;
  color:#fff;
  font-size:11px;
  font-weight:700;
  display:none;
  align-items:center;
  justify-content:center;
}
#notification-panel{
  position:fixed;
  top:224px;
  right:14px;
  z-index:31;
  width:min(92vw, 420px);
  max-height:min(70vh, 520px);
  overflow:auto;
  border:1px solid rgba(255, 179, 71, 0.55);
  border-radius:14px;
  background:#000;
  color:#fff;
  box-shadow:0 12px 28px rgba(0,0,0,0.45);
  padding:10px;
  display:none;
  position: fixed;
  overflow: auto;
}

#notification-panel::before{
  content:"";
  position:absolute;
  width:120px;
  height:120px;
  border-radius:50%;
  right:-42px;
  top:-42px;
  background:rgba(255, 107, 74, 0.20);
  pointer-events:none;
}
#notification-panel h3{
  margin:0 0 8px;
  font:700 14px/1.2 system-ui, Arial;
}
#notification-list{
  margin:0;
  padding-left:18px;
  font:500 13px/1.4 system-ui, Arial;
}

#mobile-controls{
  position:fixed;
  left:12px;
  right:12px;
  bottom:14px;
  z-index:45;
  display:none;
  grid-template-columns:80px 1fr 72px;
  align-items:end;
  gap:8px;
}

#mobile-controls .touch-btn,
#joystick{
  height:64px;
  width:64px;
  border:1px solid rgba(255, 179, 71, 0.55);
  border-radius:50%;
  background:#000;
  color:#fff;
  font:700 20px/1 system-ui, Arial;
  box-shadow:0 12px 28px rgba(0,0,0,0.45);
  position:relative;
  overflow:hidden;
  touch-action:none;
  display:flex;
  align-items:center;
  justify-content:center;
}

#mobile-controls .touch-btn::before,
#joystick::before{
  content:"";
  position:absolute;
  width:30px;
  height:30px;
  border-radius:50%;
  right:-8px;
  top:-8px;
  background:rgba(255, 107, 74, 0.28);
  pointer-events:none;
}

#mobile-controls .touch-btn:active{
  transform:translateY(1px) scale(0.99);
}

#joystick{
  justify-self:start;
}

#joystick-thumb{
  width:30px;
  height:30px;
  border-radius:50%;
  border:1px solid rgba(255, 179, 71, 0.7);
  background:rgba(255, 107, 74, 0.24);
  box-shadow:0 6px 14px rgba(0,0,0,0.4);
  transition:transform .05s linear;
}

#jump-btn{
  justify-self:end;
}

@media (max-width: 900px), (pointer: coarse) {
  #mobile-controls{
    display:grid;
  }
}
