*, *::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(700px, 100vw);
  height: min(500px, 100vh);
}

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

#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(15,17,23,0.85);
  border-radius: 12px 12px 0 0;
  pointer-events: none;
  z-index: 5;
}

.hud-block { display: flex; flex-direction: column; gap: 2px; }
.hud-block.right { align-items: flex-end; }
.hud-label { font-size: 10px; font-weight: 700; color: #305CDE; letter-spacing: 1px; }
.hud-balls { font-size: 13px; min-height: 16px; }
.hud-turn {
  font-size: 13px;
  font-weight: 700;
  color: #FFD700;
  letter-spacing: 1px;
}

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

h1 { font-size: 2.2rem; font-weight: 800; }
p { color: #aaa; text-align: center; line-height: 1.6; }
.hint { font-size: 12px; 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); }

#msgBanner {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(48,92,222,0.9);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 24px;
  border-radius: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 6;
  white-space: nowrap;
}
#msgBanner.show { opacity: 1; }
