*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #0F1117;
  color: #fff;
  font-family: system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
  touch-action: none;
}

#app {
  position: relative;
  width: min(480px, 100vw);
  height: min(700px, 100vh);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: #1A1D27;
}

#ui {
  position: absolute;
  top: 0; left: 0; right: 0;
  pointer-events: none;
}

#hud {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(15,17,23,0.7);
  border-radius: 12px 12px 0 0;
}

#powerBarContainer {
  position: absolute;
  right: 12px;
  bottom: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
#powerBarContainer.visible { opacity: 1; }
#powerLabel { font-size: 11px; font-weight: 700; color: #305CDE; letter-spacing: 1px; }
#powerBarBg {
  width: 14px;
  height: 120px;
  background: rgba(255,255,255,0.1);
  border-radius: 7px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
#powerBar {
  width: 100%;
  height: 0%;
  background: linear-gradient(to top, #305CDE, #e74c3c);
  border-radius: 7px;
  transition: height 0.05s;
}

#overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,17,23,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
#overlay.active { opacity: 1; pointer-events: all; }

h1 { font-size: 2.4rem; font-weight: 800; }
p { color: #aaa; text-align: center; line-height: 1.6; }
.hint { font-size: 13px; color: #555; }

button {
  background: #305CDE;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 40px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
button:hover { background: #4a70e8; transform: translateY(-2px); }
button:active { transform: translateY(0); }

#celebrationText {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 2.2rem;
  font-weight: 900;
  color: #FFD700;
  text-shadow: 0 0 20px rgba(255,215,0,0.8);
  pointer-events: none;
  transition: transform 0.2s, opacity 0.4s;
  white-space: nowrap;
}
#celebrationText.show {
  transform: translate(-50%, -50%) scale(1.1);
  opacity: 1;
}
#celebrationText.hide {
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
}
