:root {
  --bg: #080b18;
  --panel: #101629;
  --panel-deep: #080d1b;
  --text: #eff4ff;
  --muted: #8190b5;
  --cyan: #28e6ef;
  --pink: #fb2d74;
  --gold: #f8cf45;
  --line: rgba(95, 120, 173, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", "Noto Sans TC", Arial, sans-serif;
  background:
    radial-gradient(circle at 50% 20%, rgba(29, 82, 155, 0.27), transparent 38%),
    linear-gradient(150deg, #050711, #11162c 52%, #070913);
}

.game-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.28em;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 57px);
  line-height: 0.9;
  font-style: italic;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-shadow: 3px 3px 0 rgba(251, 45, 116, 0.9);
}

.restart,
#playButton {
  border: 1px solid #273654;
  border-radius: 6px;
  color: var(--text);
  background: #141c30;
  font-weight: 700;
  cursor: pointer;
  transition: transform 130ms ease, border-color 130ms ease, background 130ms ease;
}

.restart {
  padding: 14px 24px;
  color: #d3dcf1;
  font-size: 16px;
}

.restart:hover,
#playButton:hover {
  transform: translateY(-1px);
  border-color: var(--cyan);
}

.arena-card {
  overflow: hidden;
  border: 1px solid #1c2744;
  border-radius: 9px;
  background: var(--panel-deep);
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.36);
}

.hud {
  display: grid;
  grid-template-columns: 1fr 106px 1fr;
  gap: 26px;
  align-items: center;
  padding: 20px 27px 17px;
  border-bottom: 1px solid rgba(38, 54, 91, 0.55);
  background: linear-gradient(180deg, #111932, #090f20);
}

.hud-name {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.13em;
}

.hud-name strong {
  color: #f5f7ff;
  font-size: 20px;
  font-style: italic;
  letter-spacing: -0.02em;
}

.cpu-hud .hud-name {
  flex-direction: row-reverse;
}

.health-track {
  position: relative;
  height: 15px;
  overflow: hidden;
  border: 1px solid rgba(20, 33, 56, 0.92);
  background: #1b2439;
  transform: skewX(-16deg);
}

.health-fill {
  height: 100%;
  transition: width 190ms ease-out;
}

.player-health {
  width: 100%;
  background: linear-gradient(90deg, #16bccb, var(--cyan));
  box-shadow: 0 0 13px rgba(40, 230, 239, 0.55);
}

.cpu-health {
  width: 100%;
  margin-left: auto;
  background: linear-gradient(90deg, #ff396f, #ed155a);
  box-shadow: 0 0 13px rgba(251, 45, 116, 0.55);
}

.round-display {
  text-align: center;
  color: #67799e;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.26em;
}

.round-display strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 40px;
  line-height: 1;
  font-style: italic;
  letter-spacing: -0.04em;
}

.canvas-wrap {
  position: relative;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  background: #0b1022;
}

.message-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 18, 0.48);
  backdrop-filter: blur(2px);
  opacity: 1;
  transition: opacity 180ms ease;
}

.message-screen.hidden {
  pointer-events: none;
  opacity: 0;
}

.message-screen p {
  margin: 0;
  color: var(--cyan);
  font-weight: 700;
  letter-spacing: 0.2em;
}

.message-screen h2 {
  margin: 0 0 12px;
  font-size: clamp(58px, 12vw, 92px);
  line-height: 0.9;
  font-style: italic;
  text-shadow: 4px 4px var(--pink);
}

#playButton {
  padding: 14px 32px;
  border-color: rgba(40, 230, 239, 0.65);
  background: var(--cyan);
  color: #071324;
  font-size: 17px;
}

.controls {
  display: flex;
  gap: 34px;
  align-items: center;
  margin-top: 13px;
  padding: 17px 25px;
  border: 1px solid #18233d;
  border-radius: 8px;
  background: rgba(10, 15, 29, 0.82);
}

.control-heading {
  min-width: 150px;
}

.control-heading h2 {
  margin: 0;
  font-size: 22px;
}

.control-list {
  display: flex;
  flex: 1;
  gap: clamp(15px, 3vw, 38px);
}

.control-list div {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9aa8c6;
  font-weight: 600;
}

kbd {
  display: inline-grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border: 1px solid #263552;
  border-radius: 5px;
  color: #e9f0ff;
  background: #121a2d;
  font-family: inherit;
  font-weight: 800;
}

.tip {
  max-width: 165px;
  margin: 0;
  color: #7585a8;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .game-shell {
    width: calc(100% - 22px);
    padding-top: 17px;
  }

  .hud {
    grid-template-columns: 1fr 63px 1fr;
    gap: 10px;
    padding: 14px 12px;
  }

  .hud-name strong {
    font-size: 15px;
  }

  .round-display strong {
    font-size: 28px;
  }

  .controls {
    display: block;
    padding: 16px;
  }

  .control-list {
    flex-wrap: wrap;
    margin-top: 15px;
  }

  .tip {
    max-width: none;
    margin-top: 14px;
  }
}
