:root {
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: #f7fbff;
  background: #081422;
  letter-spacing: 0;
  --ink: #081422;
  --navy: #10233f;
  --cyan: #29d6e7;
  --coral: #ff567d;
  --yellow: #ffd84d;
  --green: #4ce58a;
  --line: rgba(255, 255, 255, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #081422;
  overflow-x: hidden;
}

button,
a {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.game-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto minmax(420px, 1fr) auto auto;
  background: #10233f;
  border-inline: 1px solid rgba(255, 255, 255, 0.08);
}

.game-header {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(110px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: #10233f;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  color: var(--ink);
  border-radius: 6px;
  font-size: 12px;
}

.game-header h1 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: center;
  font-size: 19px;
  line-height: 1.2;
}

.policy-link {
  color: #bfeaf0;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: #0c1a2b;
}

.stats div {
  min-width: 0;
  padding: 9px 12px;
  text-align: center;
  border-right: 1px solid var(--line);
}

.stats div:last-child {
  border-right: 0;
}

.stats span,
.stats strong {
  display: block;
}

.stats span {
  color: #a9c2d3;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.stats strong {
  margin-top: 2px;
  font-size: 22px;
  line-height: 1;
}

.playfield {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  background: #143248 url("./neon-step-sprint-icon.jpg") center / cover no-repeat;
  isolation: isolate;
}

.playfield::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: rgba(8, 20, 34, 0.58);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 28px;
  text-align: center;
  background: rgba(8, 20, 34, 0.82);
}

.screen[hidden] {
  display: none;
}

.screen img {
  width: clamp(112px, 26vw, 156px);
  aspect-ratio: 1;
  object-fit: cover;
  border: 3px solid #fff;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34);
}

.screen-label {
  margin: 20px 0 7px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.screen h2 {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(30px, 8vw, 50px);
  line-height: 1.02;
}

.screen-score {
  min-height: 22px;
  margin: 12px 0 0;
  color: #d8e6ef;
  font-weight: 800;
}

.start-button {
  min-height: 48px;
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
  border: 0;
  border-radius: 6px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.flash {
  position: absolute;
  top: 18px;
  left: 50%;
  min-width: 128px;
  transform: translateX(-50%);
  text-align: center;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
}

.flash.show {
  animation: flash 700ms ease;
}

@keyframes flash {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  25% { opacity: 1; transform: translate(-50%, 0); }
  75% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: #0c1a2b;
}

.controls button {
  height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  background: #193450;
  color: #fff;
  font-size: 27px;
  font-weight: 900;
  cursor: pointer;
}

.controls button:active {
  background: var(--cyan);
  color: var(--ink);
}

.controls button:focus-visible,
.start-button:focus-visible,
.brand:focus-visible,
.policy-link:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

footer {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 18px calc(8px + env(safe-area-inset-bottom));
  color: #8fa9bb;
  background: #081422;
  font-size: 10px;
}

@media (max-width: 520px) {
  .game-shell {
    grid-template-rows: auto auto minmax(360px, 1fr) auto auto;
  }

  .game-header {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 9px;
    padding-inline: 12px;
  }

  .brand span:last-child {
    display: none;
  }

  .game-header h1 {
    font-size: 16px;
  }

  .playfield {
    min-height: 360px;
  }

  .controls {
    padding-inline: 12px;
  }

  footer {
    padding-inline: 12px;
  }
}

@media (max-height: 700px) and (orientation: landscape) {
  .game-shell {
    grid-template-rows: auto auto minmax(310px, 1fr) auto auto;
  }

  .playfield {
    min-height: 310px;
  }

  .screen img {
    width: 92px;
  }

  .screen-label {
    margin-top: 10px;
  }
}
