:root {
  color-scheme: dark;
  --bg: #0b0f13;
  --panel: #141922;
  --line: rgba(255, 255, 255, .12);
  --text: #f6f0df;
  --muted: #a9b3ba;
  --gold: #e8c65a;
  --red: #ec5d56;
  --blue: #73c6ff;
  --green: #80dc99;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 50% 0%, #24303a 0%, var(--bg) 54%);
  color: var(--text);
  font-family: ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  overflow: hidden;
}

button {
  border: 0;
  color: var(--text);
  font: inherit;
  touch-action: manipulation;
}

.shell {
  width: min(100vw, 440px);
  height: 100dvh;
  min-height: 620px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.hud,
.lowerHud {
  border: 1px solid var(--line);
  background: rgba(12, 16, 21, .88);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .28);
  backdrop-filter: blur(16px);
}

.hud {
  min-height: 90px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 8px;
}

.kicker,
h1,
.lowerHud p {
  margin: 0;
}

.kicker {
  color: var(--gold);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0;
}

h1 {
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.15;
  max-width: 230px;
}

.stats {
  display: grid;
  grid-template-columns: 58px 68px;
  gap: 6px;
}

.stats div {
  min-height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111923;
}

.stats span {
  display: block;
  color: var(--gold);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.stats small {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.arenaWrap {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
}

canvas {
  width: min(100%, calc((100dvh - 220px) * .642));
  height: min(100%, calc(100vw * 1.555));
  max-width: 420px;
  max-height: 654px;
  aspect-ratio: 360 / 560;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: #10141a;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
  image-rendering: auto;
}

.restart {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 74px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(6, 9, 12, .72);
  border: 1px solid rgba(255, 255, 255, .18);
  font-weight: 800;
}

.banner {
  position: absolute;
  inset: auto 18px 24px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(8, 11, 14, .9);
  text-align: center;
  font-weight: 900;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
}

.hidden {
  display: none;
}

.lowerHud {
  min-height: 142px;
  border-radius: 8px;
  padding: 10px 12px 12px;
}

.lowerHud p {
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.controls {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.stick {
  width: 94px;
  height: 94px;
  flex: 0 0 94px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18);
  background: radial-gradient(circle, rgba(255, 255, 255, .13), rgba(255, 255, 255, .05));
  position: relative;
  touch-action: none;
}

.knob {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  position: absolute;
  left: 26px;
  top: 26px;
  background: linear-gradient(145deg, #f2d56e, #b77838);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1;
  max-width: 230px;
}

.actions button {
  min-height: 70px;
  border-radius: 8px;
  background: #1e2933;
  border: 1px solid rgba(255, 255, 255, .16);
  font-weight: 900;
  text-transform: uppercase;
}

#doorBtn.ready {
  background: #4d3920;
  outline: 2px solid var(--gold);
}

#sprintBtn.active {
  background: #3a1720;
  outline: 2px solid var(--red);
}

@media (max-height: 680px) {
  .shell {
    min-height: 560px;
    gap: 8px;
  }

  .hud {
    min-height: 76px;
    padding: 10px;
  }

  h1 {
    font-size: 14px;
  }

  .lowerHud {
    min-height: 126px;
  }

  .stick {
    width: 82px;
    height: 82px;
    flex-basis: 82px;
  }

  .knob {
    left: 22px;
    top: 22px;
    width: 38px;
    height: 38px;
  }

  .actions button {
    min-height: 60px;
  }
}
