@import url("https://fonts.googleapis.com/css2?family=Russo+One&family=JetBrains+Mono:wght@500;700&display=swap");

:root {
  --hud: #f4f7fb;
  --panel: rgba(8, 12, 18, 0.78);
  --accent: #ffd447;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b1016;
  font-family: "JetBrains Mono", monospace;
  color: var(--hud);
  touch-action: none;
}

#game-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 30% 15%, #1a3a28 0%, transparent 50%),
    radial-gradient(ellipse at 75% 85%, #1a2838 0%, transparent 45%),
    #0b1016;
}

#game {
  width: min(92vw, calc(92vh * 420 / 720));
  height: min(92vh, calc(92vw * 720 / 420));
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  background: #3a4048;
  transform: translateZ(0);
}

#hud {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  pointer-events: none;
  z-index: 5;
  width: min(92vw, calc(92vh * 420 / 720));
  justify-content: space-between;
  padding: 0 10px;
}

.hud-block {
  min-width: 86px;
  padding: 10px 12px;
  background: #141a22;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-block.speed {
  text-align: center;
  min-width: 96px;
  border-color: rgba(255, 212, 71, 0.28);
}

#speed {
  color: #80ed99;
  transition: color 0.25s linear;
}

.hud-block .label {
  font-size: 10px;
  letter-spacing: 0.16em;
  opacity: 0.55;
}

.hud-block span:last-child {
  font-family: "Russo One", sans-serif;
  font-size: 22px;
  line-height: 1.1;
}

#hint {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: 0.03em;
  background: rgba(8, 12, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0.9;
  max-width: 90%;
  text-align: center;
}

#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 10, 16, 0.55);
  z-index: 8;
}

#overlay[hidden] {
  display: none;
}

#overlay-card {
  width: min(360px, 88vw);
  padding: 28px 24px 22px;
  background: rgba(10, 14, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
  text-align: center;
}

#again-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
  font-size: 28px;
  padding: 14px 36px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

#again-btn[hidden] {
  display: none;
}

h1,
h2 {
  font-family: "Russo One", sans-serif;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

h1 {
  font-size: 32px;
  color: var(--accent);
}

p {
  font-size: 13px;
  line-height: 1.45;
  opacity: 0.85;
  margin-bottom: 16px;
}

.controls {
  list-style: none;
  text-align: left;
  font-size: 12px;
  line-height: 1.7;
  margin: 0 0 20px;
  opacity: 0.9;
}

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  margin: 0 2px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  font-family: inherit;
  font-size: 11px;
  text-align: center;
}

button {
  font-family: "Russo One", sans-serif;
  letter-spacing: 0.08em;
  font-size: 16px;
  padding: 12px 28px;
  border: 0;
  cursor: pointer;
  background: var(--accent);
  color: #1a1400;
}

button:hover {
  filter: brightness(1.08);
}

button:active {
  transform: translateY(1px);
}

#again-btn:active {
  transform: translate(-50%, calc(-50% + 1px));
}
