#canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.players, .results ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.players li, .results li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  background: var(--panel);
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.dot { flex: none; width: 14px; height: 14px; border-radius: 50%; }
.tag { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.results { border-left: 4px solid var(--sun); padding-left: 10px; }
.results h2 { margin: 0 0 6px; color: var(--sun); }
.waiting { margin: 0; text-align: center; color: var(--muted); }

#hud { position: fixed; inset: 0; pointer-events: none; user-select: none; -webkit-user-select: none; }

.hud-top {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 12px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}
.hud-rank b { font-size: 46px; font-weight: 900; font-style: italic; line-height: 1; }
.hud-rank small { font-size: 18px; font-weight: 700; margin-left: 2px; }
.hud-info { font-weight: 700; font-size: 15px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.hud-quit {
  pointer-events: auto;
  width: 34px;
  height: 34px;
  font-size: 14px;
  color: var(--ink);
  background: rgba(0, 0, 0, .45);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.board {
  position: absolute;
  top: calc(max(10px, env(safe-area-inset-top)) + 62px);
  left: max(12px, env(safe-area-inset-left));
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}
.board li { display: flex; align-items: center; gap: 6px; line-height: 1.5; }
.board li.me { color: var(--sun); }
.board .dot { width: 9px; height: 9px; }
@media (max-height: 520px), (max-width: 560px) { .board { display: none; } }

.notice {
  position: absolute;
  top: 24%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(26px, 7vw, 54px);
  font-weight: 900;
  font-style: italic;
  text-shadow: 0 3px 10px rgba(0, 0, 0, .8);
}
.notice.big { font-size: min(26vw, 30vh); color: var(--sun); top: 12%; }

.speed {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 5px rgba(0, 0, 0, .85);
}
.speed small { font-size: 12px; margin-left: 3px; font-style: normal; }

.touch {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.touch-group { display: flex; align-items: flex-end; gap: 10px; }
.pad {
  pointer-events: auto;
  touch-action: none;
  width: 78px;
  height: 78px;
  font: inherit;
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  background: rgba(20, 16, 30, .5);
  border: 2px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.pad.on { background: rgba(255, 255, 255, .4); }
.pad.gas { width: 92px; height: 92px; font-size: 13px; border-color: var(--sun); }
.pad.brake { width: 66px; height: 66px; font-size: 12px; }

@media (max-width: 480px) {
  .pad { width: 68px; height: 68px; }
  .pad.gas { width: 80px; height: 80px; font-size: 12px; }
  .pad.brake { width: 58px; height: 58px; font-size: 11px; }
  .touch-group { gap: 6px; }
  .speed { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 96px); }
}

.vehicle-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.vehicle-card {
  flex: none;
  width: 92px;
  padding: 4px 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.vehicle-card.on { border-color: var(--sun); color: var(--sun); }
.vehicle-card canvas { display: block; width: 80px; height: 47px; }
.vehicle-stats { display: flex; flex-direction: column; gap: 4px; }
.vehicle-stats div { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.vehicle-stats i { display: block; height: 7px; overflow: hidden; background: var(--line); border-radius: 4px; }
.vehicle-stats b { display: block; height: 100%; background: var(--sun); border-radius: 4px; }

.effect {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(max(10px, env(safe-area-inset-top)) + 58px);
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  font-style: italic;
  color: var(--sun);
  text-shadow: 0 2px 5px rgba(0, 0, 0, .85);
}

#canvas3d, #overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
#overlay { pointer-events: none; }

.bot-control { display: grid; grid-template-columns: 1fr 44px 28px 44px; align-items: center; gap: 6px; font-weight: 700; }
.bot-control b { text-align: center; font-variant-numeric: tabular-nums; }
.bot-control .btn { padding: 0; font-size: 20px; }
