/* Autopilot vs Human: FSD-style visualization (sim.html only) */
.page-sim .fsd-wrap {
  background: linear-gradient(180deg, #08090a 0%, #15171a 40%, #0c0d0f 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 14px 44px rgba(0, 0, 0, 0.5);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #e9edf2;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}
.page-sim .fsd-wrap canvas#sim-canvas { cursor: default; }
.page-sim .fsd-wrap.fsd-flash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 70, 50, 0.22);
  pointer-events: none;
  z-index: 4;
}

/* Top-left cluster: gear + speed, speed-limit sign, wheel icon */
.fsd-hud {
  position: absolute;
  top: 0.7rem;
  left: 0.8rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  pointer-events: none;
  z-index: 3;
}
.fsd-left { display: flex; flex-direction: column; line-height: 1; }
.fsd-gears { display: flex; gap: 0.42rem; font-size: 0.72rem; font-weight: 600; color: rgba(233, 237, 242, 0.32); letter-spacing: 0.02em; }
.fsd-gears .on { color: #fff; }
.fsd-speed { display: flex; flex-direction: column; margin-top: 0.12rem; }
.fsd-speed span { font-size: 2.65rem; font-weight: 600; letter-spacing: -0.03em; color: #fff; font-variant-numeric: tabular-nums; }
.fsd-speed small { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.1em; color: rgba(233, 237, 242, 0.6); margin-top: 0.05rem; }
.fsd-limit {
  margin-top: 0.95rem;
  width: 2.05rem;
  padding: 0.16rem 0 0.12rem;
  background: #f4f5f6;
  color: #111;
  border-radius: 0.3rem;
  border: 2px solid #111;
  box-shadow: 0 0 0 1.5px rgba(244, 245, 246, 0.8);
  text-align: center;
  line-height: 1;
}
.fsd-limit small { display: block; font-size: 0.34rem; font-weight: 700; letter-spacing: 0.04em; }
.fsd-limit b { display: block; font-size: 1rem; font-weight: 700; margin-top: 0.06rem; }
.fsd-wheel {
  margin-top: 1.05rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #7f8690;
  background: rgba(255, 255, 255, 0.06);
  transition: color 0.25s, background 0.25s, box-shadow 0.25s;
}
.fsd-wheel.on { color: #fff; background: #3e6ae1; box-shadow: 0 0 14px rgba(62, 106, 225, 0.7); }
.fsd-mode {
  position: absolute;
  top: 5.1rem;
  left: 0.85rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(233, 237, 242, 0.55);
  pointer-events: none;
  z-index: 3;
}

/* Timer + score (minimal) */
.fsd-top-right {
  position: absolute;
  top: 3.05rem;
  right: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  font-size: 0.72rem;
  color: rgba(233, 237, 242, 0.6);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 3;
}
.fsd-timer { font-size: 0.95rem; font-weight: 600; color: #fff; }
.fsd-score b { color: #fff; font-weight: 600; }

/* Status line */
.fsd-status {
  position: absolute;
  top: 6.7rem;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  max-width: 88%;
  padding: 0.36rem 0.85rem;
  border-radius: 999px;
  background: rgba(20, 22, 26, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  font-weight: 500;
  color: #f2f4f7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 3;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.fsd-status.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Penalty / collision alert */
.fsd-alert {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.55rem 1.1rem;
  border-radius: 0.8rem;
  background: rgba(24, 26, 30, 0.86);
  border: 1px solid rgba(255, 180, 60, 0.55);
  color: #ffd27a;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 5;
  text-align: center;
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.fsd-alert b { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.01em; }
.fsd-alert span { font-size: 0.74rem; color: rgba(255, 255, 255, 0.75); }
.fsd-alert.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.fsd-alert.big { background: rgba(170, 18, 18, 0.9); border-color: #ff8a7a; color: #fff; padding: 0.8rem 1.6rem; }
.fsd-alert.big b { font-size: 1.7rem; letter-spacing: 0.03em; text-transform: uppercase; }

/* Reposition inherited controls for the dark HUD */
.page-sim .fsd-wrap .brake-cue { top: 44%; font-family: inherit; }
.page-sim .fsd-wrap .sim-finish-btn {
  top: 0.7rem;
  right: 0.7rem;
  background: rgba(20, 22, 26, 0.7);
  border-color: rgba(255, 255, 255, 0.18);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.74rem;
}
.page-sim .fsd-wrap .score-screen {
  background: rgba(10, 11, 13, 0.84);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  font-family: inherit;
  z-index: 8;
}
.page-sim .fsd-wrap .score-screen h2 { color: #fff; font-weight: 600; letter-spacing: -0.01em; }
.page-sim .fsd-wrap .start-blurb { font-size: 0.86rem; line-height: 1.45; color: rgba(233, 237, 242, 0.78); }
.page-sim .fsd-wrap .start-controls { font-size: 0.78rem; color: rgba(233, 237, 242, 0.55); }
.page-sim .fsd-compare { gap: 0.55rem; grid-template-columns: 1fr 1fr; text-align: left; }
.page-sim .fsd-compare .compare-card { padding: 0.7rem 0.75rem; background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.08); }
.page-sim .fsd-compare .compare-card.winner { border-color: #3e6ae1; box-shadow: 0 0 0 1px #3e6ae1, 0 0 18px rgba(62, 106, 225, 0.35); }
.page-sim .fsd-compare .compare-card h3 { font-size: 0.9rem; margin-bottom: 0.4rem; }
.page-sim .fsd-compare .metric { font-size: 0.78rem; padding: 0.22rem 0; }
.page-sim .fsd-verdict { color: rgba(233, 237, 242, 0.65); font-size: 0.8rem; margin-top: 0.8rem; line-height: 1.4; }

.page-sim .fsd-pad button { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
