/* Cartoon look to match the canvas: cream "paper", dark ink outlines, and
   hard offset shadows instead of soft blurs. --ink matches INK in game.js. */
:root {
  --ink: #231f2e;
  --paper: #fffbea;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #e8dfc6;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
}

canvas {
  display: block;
  touch-action: none;
}

.hud {
  position: fixed;
  top: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* Each player's HUD is a small badge: "P1" (plus key hint until they first
   drive) and a coin count, in the player's color. */
.hud-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 4px 11px;
}

.hud-title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.hud-coins {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 18px;
  font-weight: 900;
}

/* Darker than the car colors themselves, to read on the cream badge. */
.hud-p1 { color: #1b86cc; }
.hud-p2 { color: #d9690f; }

/* Matches the in-game coin (drawCoin): gold face, ink rim. */
.coin-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffd23f;
  border: 2px solid var(--ink);
  box-sizing: border-box;
}

/* Autopilot toggle: a little cartoon push button in the badge, filled with
   the player's color while the AI is driving. The HUD ignores the mouse,
   so the button opts back in. */
.auto-btn {
  pointer-events: auto;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: inherit;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 2px 2px 0 var(--ink);
  padding: 2px 7px;
}

.auto-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.auto-btn.on { color: var(--paper); }
.hud-p1 .auto-btn.on { background: #1b86cc; }
.hud-p2 .auto-btn.on { background: #d9690f; }

.hint {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 700;
  width: max-content;
  max-width: 90vw;
  text-align: center;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 2px 2px 0 var(--ink);
  padding: 3px 12px;
  pointer-events: none;
  transition: opacity 1.5s ease;
}

.hint.faded {
  opacity: 0;
}
