* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #0F1117;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
  font-family: system-ui, sans-serif;
  touch-action: none;
}
#gameContainer {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#gameCanvas {
  display: block;
  background: #1a1d27;
}
#ui {
  position: absolute;
  top: 0; left: 0; right: 0;
  pointer-events: none;
  padding: 8px 12px;
  z-index: 10;
}
#hud {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  background: rgba(26,29,39,0.92);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #305CDE33;
}
#p1Hud, #p2Hud {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
#p2Hud { flex-direction: row-reverse; }
.fighterName { font-size: 12px; font-weight: 700; color: #aaa; min-width: 46px; text-align: center; }
.hpBarOuter {
  height: 14px;
  background: #333;
  border-radius: 7px;
  flex: 1;
  overflow: hidden;
}
.hpBar { height: 100%; border-radius: 7px; transition: width 0.1s; }
.p1Bar { background: linear-gradient(90deg,#44cc44,#88ff88); }
.p2Bar { background: linear-gradient(90deg,#ff4444,#ff8888); float:right; }
.hpVal { font-size: 13px; font-weight: 700; color: #fff; min-width: 28px; text-align: center; }
#roundInfo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 80px;
}
#timer {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}
#roundLabel { font-size: 11px; color: #888; }
#winDots { display: flex; align-items: center; gap: 4px; }
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #333;
  border: 1px solid #555;
  display: inline-block;
}
.dot.filled { background: #305CDE; border-color: #305CDE; }
.vs { font-size: 10px; color: #555; padding: 0 3px; }
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15,17,23,0.94);
  color: #fff;
  z-index: 20;
  gap: 12px;
}
.screen h1 {
  font-size: clamp(32px, 8vw, 64px);
  font-weight: 900;
  color: #305CDE;
  text-align: center;
  text-shadow: 0 0 30px #305CDE88;
  line-height: 1.1;
}
.screen p { font-size: 15px; color: #aaa; text-align: center; }
.controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #666;
  text-align: center;
  border: 1px solid #333;
  padding: 10px 20px;
  border-radius: 8px;
}
button {
  margin-top: 8px;
  padding: 12px 36px;
  font-size: 18px;
  font-weight: 700;
  background: #305CDE;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: system-ui, sans-serif;
  transition: background 0.2s;
}
button:hover { background: #4a7aff; }
button:active { transform: scale(0.97); }
.hiscore { color: #305CDE; font-size: 14px; }
#goRecord { font-size: 18px; color: #aaa; }
#mobileControls {
  position: absolute;
  bottom: 12px;
  left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 15;
  pointer-events: none;
}
#leftDpad {
  position: relative;
  width: 130px;
  height: 100px;
  pointer-events: all;
}
.dpad {
  position: absolute;
  width: 42px; height: 42px;
  background: rgba(48,92,222,0.3);
  border: 1.5px solid #305CDE66;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.dpad:active { background: rgba(48,92,222,0.6); }
#dpadLeft { left: 0; top: 29px; }
#dpadRight { left: 88px; top: 29px; }
#dpadUp { left: 44px; top: 0; }
#dpadDown { left: 44px; top: 58px; }
#rightButtons {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  pointer-events: all;
}
.actionBtn {
  width: 58px; height: 58px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  border: 2px solid;
}
.actionBtn span { font-size: 9px; font-weight: 400; }
.punch { background: rgba(255,80,80,0.3); border-color: #ff5050; color: #ff8888; }
.kick { background: rgba(255,160,0,0.3); border-color: #ffa000; color: #ffcc44; }
.block { background: rgba(0,180,255,0.3); border-color: #00b4ff; color: #44ccff; }
.actionBtn:active { opacity: 0.7; transform: scale(0.95); }
@media (pointer: fine) {
  #mobileControls { display: none; }
}
