@font-face {
  font-family: "Antonio Variable";
  src: url("./assets/fonts/Antonio-Variable.ttf") format("truetype");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #02010a;
  --panel: rgba(22, 20, 56, 0.54);
  --panel-edge: rgba(139, 173, 255, 0.28);
  --panel-highlight: rgba(255, 255, 255, 0.16);
  --text: rgba(245, 246, 255, 0.96);
  --text-soft: rgba(211, 220, 255, 0.78);
  --cyan: #77d8ff;
  --cyan-glow: rgba(76, 197, 255, 0.62);
  --orange: #ff8f34;
  --orange-glow: rgba(255, 149, 61, 0.56);
  --pill-shadow: 0 18px 52px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 32%, rgba(72, 52, 152, 0.3), transparent 38%),
    radial-gradient(circle at 16% 18%, rgba(46, 92, 204, 0.15), transparent 28%),
    radial-gradient(circle at 84% 12%, rgba(255, 143, 52, 0.13), transparent 22%),
    var(--bg);
  color: var(--text);
  font-family: "Antonio Variable", "Segoe UI", sans-serif;
}

body {
  user-select: none;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.game-shell {
  position: relative;
  width: 100%;
  height: 100%;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.distance-pill {
  position: absolute;
  top: 2.2rem;
  left: 2.2rem;
  min-width: 14rem;
  padding: 0.72rem 1rem 0.82rem;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "label charge"
    "value charge";
  gap: 0.12rem 1rem;
  border: 1px solid var(--panel-edge);
  border-radius: 1.35rem;
  background:
    linear-gradient(180deg, rgba(142, 171, 255, 0.11), rgba(66, 56, 120, 0.28)),
    rgba(14, 11, 37, 0.45);
  box-shadow:
    inset 0 1px 0 var(--panel-highlight),
    0 0 28px rgba(101, 126, 255, 0.18),
    var(--pill-shadow);
  backdrop-filter: blur(16px);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.distance-pill::before {
  content: "";
  position: absolute;
  inset: 0.45rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.distance-pill__label {
  grid-area: label;
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.distance-pill__value {
  grid-area: value;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1;
  letter-spacing: 0.02em;
}

.distance-pill__charge {
  grid-area: charge;
  position: relative;
  width: 1.1rem;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(119, 216, 255, 0.34);
  box-shadow:
    0 0 18px rgba(119, 216, 255, 0.18),
    inset 0 0 12px rgba(255, 255, 255, 0.04);
}

.distance-pill__charge-track,
.distance-pill__charge-fill {
  position: absolute;
  inset: 0;
}

.distance-pill__charge-track {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
}

.distance-pill__charge-fill {
  top: auto;
  height: 100%;
  transform-origin: bottom center;
  transform: scaleY(0.62);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(119, 216, 255, 0.92) 30%, rgba(33, 124, 255, 0.86)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
  box-shadow:
    0 0 22px var(--cyan-glow),
    0 0 44px rgba(21, 106, 255, 0.4);
  transition:
    background 180ms ease,
    box-shadow 180ms ease;
}

.distance-pill[data-state="boost"] {
  border-color: rgba(255, 167, 94, 0.42);
  box-shadow:
    inset 0 1px 0 var(--panel-highlight),
    0 0 24px rgba(255, 142, 71, 0.16),
    var(--pill-shadow);
}

.distance-pill[data-state="boost"] .distance-pill__charge-fill {
  background:
    linear-gradient(180deg, rgba(255, 248, 230, 0.96), rgba(255, 176, 103, 0.95) 34%, rgba(255, 120, 44, 0.84)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
  box-shadow:
    0 0 20px rgba(255, 145, 72, 0.38),
    0 0 36px rgba(255, 145, 72, 0.24);
}

.distance-pill[data-state="danger"] {
  border-color: rgba(255, 134, 90, 0.52);
  box-shadow:
    inset 0 1px 0 var(--panel-highlight),
    0 0 32px rgba(255, 112, 82, 0.22),
    var(--pill-shadow);
  transform: translateY(-1px);
}

.distance-pill[data-state="danger"] .distance-pill__charge-fill {
  background:
    linear-gradient(180deg, rgba(255, 244, 232, 0.96), rgba(255, 152, 96, 0.95) 34%, rgba(255, 98, 66, 0.88)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
  box-shadow:
    0 0 18px rgba(255, 116, 82, 0.44),
    0 0 34px rgba(255, 116, 82, 0.24);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 200ms ease,
    visibility 200ms ease;
  visibility: hidden;
}

.overlay.is-visible,
.overlay:not([hidden]) {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 32%, rgba(119, 88, 255, 0.12), transparent 34%),
    radial-gradient(circle at 50% 72%, rgba(255, 132, 46, 0.06), transparent 28%),
    rgba(3, 2, 10, 0.18);
  backdrop-filter: blur(12px);
}

.overlay--start {
  place-items: start start;
  padding: 2.1rem;
}

.overlay--start::before {
  background:
    linear-gradient(180deg, rgba(4, 3, 12, 0.2), rgba(4, 3, 12, 0.05)),
    radial-gradient(circle at 18% 14%, rgba(58, 114, 255, 0.12), transparent 26%),
    radial-gradient(circle at 78% 18%, rgba(255, 146, 64, 0.08), transparent 24%);
}

.overlay--start .overlay__panel {
  max-width: 22rem;
  margin-top: 0.8rem;
}

.overlay__panel {
  position: relative;
  max-width: min(40rem, 92vw);
  padding: 1.8rem 1.8rem 1.55rem;
  border-radius: 1.8rem;
  border: 1px solid var(--panel-edge);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)),
    rgba(10, 9, 26, 0.64);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 32px 96px rgba(0, 0, 0, 0.44);
}

.overlay__panel--compact {
  max-width: 22rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cyan);
}

.title {
  margin: 0;
  font-size: clamp(3.6rem, 9vw, 6.6rem);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow:
    0 0 18px rgba(119, 216, 255, 0.14),
    0 0 48px rgba(134, 110, 255, 0.16);
}

.title--small {
  font-size: clamp(2.4rem, 6vw, 4rem);
}

.subtitle {
  max-width: 28rem;
  margin: 0.95rem 0 0;
  font-size: 1rem;
  letter-spacing: 0.03em;
  line-height: 1.35;
  color: var(--text-soft);
}

.subtitle--compact {
  max-width: none;
  margin-bottom: 1.4rem;
}

.control-list {
  margin: 1.35rem 0 1.4rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
  color: var(--text-soft);
  font-size: 0.94rem;
  letter-spacing: 0.04em;
}

.control-list span {
  display: inline-block;
  min-width: 7rem;
  color: var(--text);
}

.overlay__stats,
.result-grid {
  display: grid;
  gap: 0.6rem;
}

.overlay__stats {
  margin-bottom: 1.1rem;
  grid-auto-flow: column;
  justify-content: start;
  align-items: baseline;
  column-gap: 1rem;
  color: var(--text-soft);
}

.overlay__stats strong,
.result-grid strong {
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 500;
}

.result-grid {
  margin: 1.15rem 0 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.result-grid span {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.action-button {
  padding: 0.72rem 1.2rem 0.78rem;
  border: 1px solid rgba(255, 143, 52, 0.4);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 173, 99, 0.2), rgba(255, 129, 47, 0.14)),
    rgba(24, 13, 28, 0.52);
  color: var(--text);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 26px rgba(255, 143, 52, 0.16);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    border-color 140ms ease;
}

.action-button:hover,
.action-button:focus-visible {
  transform: translateY(-1px);
  outline: none;
  border-color: rgba(255, 175, 105, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 34px rgba(255, 143, 52, 0.28);
}

.action-button--ghost {
  border-color: rgba(119, 216, 255, 0.35);
  background:
    linear-gradient(180deg, rgba(140, 225, 255, 0.16), rgba(42, 134, 255, 0.1)),
    rgba(16, 15, 32, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 26px rgba(84, 173, 255, 0.18);
}

@media (max-width: 900px) {
  .distance-pill {
    top: 1.2rem;
    left: 1.2rem;
    min-width: 11.6rem;
    padding: 0.62rem 0.82rem 0.72rem;
  }

  .distance-pill__value {
    font-size: 1.8rem;
  }

  .overlay {
    padding: 1.15rem;
  }

  .overlay--start {
    padding: 1.15rem;
  }

  .overlay__panel {
    padding: 1.35rem 1.2rem 1.15rem;
  }

  .control-list span {
    min-width: 5.8rem;
  }
}
