@font-face {
  font-family: "GMarketSans";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansLight.woff") format("woff");
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "GMarketSans";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansMedium.woff") format("woff");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "GMarketSans";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansBold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #080915;
  --panel: #111521;
  --ink: #f5fbff;
  --muted: #94a6b8;
  --line: #263244;
  --cyan: #36e8ff;
  --pink: #ff4fd8;
  --gold: #ffd166;
  --red: #ff5d6c;
  --violet: #8b5cf6;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 79, 216, 0.16), transparent 28%),
    radial-gradient(circle at 80% 12%, rgba(54, 232, 255, 0.13), transparent 30%),
    linear-gradient(180deg, #0b1020 0%, var(--bg) 72%);
  color: var(--ink);
  font-family:
    "GMarketSans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.preload-image {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

button {
  border: 0;
  color: var(--ink);
  font: inherit;
}

.shell {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 18px;
}

.game-panel {
  width: min(1180px, 100%);
  border: 1px solid rgba(54, 232, 255, 0.22);
  border-radius: 8px;
  background: rgba(9, 13, 24, 0.9);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.48);
  overflow: hidden;
}

.topbar,
.fight-hud,
.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
}

.topbar {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#restartButton,
#pauseButton {
  min-width: 96px;
  min-height: 40px;
  border: 1px solid rgba(255, 79, 216, 0.5);
  border-radius: 6px;
  background: rgba(255, 79, 216, 0.14);
  cursor: pointer;
}

#restartButton:hover,
#restartButton:focus-visible,
#pauseButton:hover,
#pauseButton:focus-visible {
  background: rgba(255, 79, 216, 0.28);
  outline: 2px solid rgba(255, 79, 216, 0.45);
  outline-offset: 2px;
}

.fight-hud {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.team {
  width: min(38%, 390px);
  display: grid;
  gap: 6px;
}

.team span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.team small {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.team-right {
  text-align: right;
}

.round-clock {
  min-width: 112px;
  display: grid;
  justify-items: center;
  gap: 2px;
}

.round-clock span {
  color: var(--gold);
  font-size: 34px;
  font-weight: 950;
  line-height: 1;
}

.round-clock small {
  color: var(--muted);
  font-size: 12px;
}

.meter {
  height: 12px;
  border: 1px solid rgba(245, 251, 255, 0.2);
  background: #111827;
}

.meter i {
  display: block;
  width: 100%;
  height: 100%;
  transition: width 120ms linear;
}

.meter.hp i {
  background: linear-gradient(90deg, var(--red), var(--gold));
}

.meter.psy {
  height: 8px;
}

.meter.psy i {
  background: linear-gradient(90deg, var(--cyan), var(--pink));
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #07101d;
  image-rendering: pixelated;
}

.score-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: rgba(8, 10, 22, 0.96);
}

.score-form[hidden] {
  display: none;
}

.score-form label,
.score-form small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.score-form input {
  min-height: 36px;
  width: min(220px, 42vw);
  border: 1px solid rgba(245, 251, 255, 0.2);
  border-radius: 6px;
  background: rgba(245, 251, 255, 0.08);
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
}

.score-form button {
  min-height: 36px;
  border: 1px solid rgba(54, 232, 255, 0.45);
  border-radius: 6px;
  background: rgba(54, 232, 255, 0.12);
  cursor: pointer;
}

.controls {
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.controls span {
  padding: 6px 8px;
  border: 1px solid rgba(245, 251, 255, 0.1);
  border-radius: 4px;
  background: rgba(245, 251, 255, 0.04);
}

@media (max-width: 720px) {
  .shell {
    padding: 8px;
  }

  .topbar,
  .fight-hud,
  .controls {
    padding: 10px;
  }

  .fight-hud {
    gap: 8px;
  }

  .team {
    width: 36%;
  }

  .round-clock {
    min-width: 76px;
  }

  .round-clock span {
    font-size: 26px;
  }
}
