:root {
  --blue: #26d9ff;
  --blue-dark: #1565ff;
  --red: #ff405f;
  --red-dark: #b90f34;
  --gold: #ffd166;
  --ink: #0a0d20;
  --panel: rgba(8, 12, 33, 0.82);
  --white: #f7fbff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050817;
  color: var(--white);
  font-family: "Courier New", Courier, monospace;
}

body {
  image-rendering: pixelated;
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 209, 102, 0.22), transparent 24%),
    linear-gradient(180deg, #141947 0%, #0b1031 45%, #07091a 100%);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  top: clamp(10px, 2.4vw, 24px);
  left: 50%;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  gap: clamp(8px, 2vw, 20px);
  width: min(1120px, calc(100vw - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}

.fighter-panel,
.score-panel {
  border: 3px solid rgba(255, 255, 255, 0.18);
  background: var(--panel);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.8), 0 0 22px rgba(38, 217, 255, 0.18);
  padding: 10px;
}

.fighter-panel {
  display: grid;
  gap: 6px;
}

.fighter-panel.right {
  text-align: right;
}

.fighter-name {
  font-size: clamp(0.76rem, 1.7vw, 1rem);
  text-shadow: 2px 2px 0 #000;
}

.fighter-name.blue {
  color: var(--blue);
}

.fighter-name.red {
  color: var(--red);
}

.health-frame {
  width: 100%;
  height: clamp(18px, 3vw, 26px);
  border: 2px solid #f7fbff;
  background: #1b1b2f;
  box-shadow: inset 0 0 0 2px #000;
  overflow: hidden;
}

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

.player-health {
  background: linear-gradient(90deg, var(--blue-dark), var(--blue), #c8fbff);
}

.enemy-health {
  margin-left: auto;
  background: linear-gradient(90deg, #ffd3dc, var(--red), var(--red-dark));
}

.hp-text {
  font-size: clamp(0.68rem, 1.4vw, 0.86rem);
  color: #dce8ff;
}

.score-panel {
  display: grid;
  min-width: clamp(124px, 18vw, 190px);
  place-items: center;
  text-align: center;
  color: var(--gold);
  text-shadow: 2px 2px 0 #000;
}

.score-line {
  font-size: clamp(1.35rem, 4vw, 2.2rem);
}

#pauseHint {
  color: #dce8ff;
  font-size: 0.72rem;
}

.round-message {
  position: absolute;
  top: 42%;
  left: 50%;
  z-index: 6;
  width: min(680px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  color: var(--gold);
  font-size: clamp(1.8rem, 7vw, 4.6rem);
  font-weight: 900;
  text-align: center;
  text-shadow: 4px 4px 0 #000, 0 0 28px rgba(255, 209, 102, 0.65);
  text-transform: uppercase;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(5, 8, 23, 0.78), rgba(5, 8, 23, 0.9)),
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(255, 255, 255, 0.035) 4px 6px);
}

.menu-card {
  width: min(620px, 100%);
  border: 4px solid var(--gold);
  background: rgba(8, 12, 33, 0.94);
  box-shadow: 0 0 0 4px #000, 0 0 42px rgba(255, 209, 102, 0.28);
  padding: clamp(22px, 5vw, 42px);
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.86rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(2.1rem, 8vw, 4.6rem);
  line-height: 0.96;
  text-shadow: 4px 4px 0 #000;
  text-transform: uppercase;
}

h2 {
  font-size: clamp(2rem, 7vw, 4rem);
}

.menu-copy {
  margin: 18px auto 22px;
  max-width: 48ch;
  color: #dce8ff;
  line-height: 1.5;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin: 0 auto 24px;
  max-width: 390px;
  text-align: left;
}

.controls-grid span {
  color: #9db2df;
}

.controls-grid strong {
  color: var(--white);
  text-align: right;
}

.button-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-button,
.secondary-button {
  min-width: 150px;
  border: 3px solid #fff;
  box-shadow: 4px 4px 0 #000;
  padding: 13px 18px;
  color: #071026;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.primary-button {
  background: var(--gold);
}

.secondary-button {
  background: var(--blue);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

.hidden {
  display: none !important;
}

@media (max-width: 740px) {
  .hud {
    grid-template-columns: 1fr 1fr;
  }

  .score-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 62px;
  }

  .fighter-panel {
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .hud {
    top: 8px;
    gap: 6px;
    width: calc(100vw - 12px);
  }

  .fighter-panel,
  .score-panel {
    padding: 7px;
  }

  .controls-grid {
    font-size: 0.8rem;
  }
}
