/* Car Flip Challenge (the house style of Political Wars). Mobile first: the page never scrolls or zooms while playing, the
   controls stay clear of the notch and the home bar, and menus use the whole screen. */
:root {
  --cf-bg: #0b1020;
  --cf-panel: rgba(8, 13, 30, 0.9);
  --cf-line: rgba(255, 255, 255, 0.85);
  --cf-accent: #0090c1;
  --cf-yellow: #fde047;
  --cf-red: #f87171;
  --vh: 100vh;
  --controls-h: 240px;
  --btn: 84px; /* control size; shrinks on narrow phones so four fit side by side */
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--cf-bg);
  overflow: hidden;
  overscroll-behavior: none;
}

#hpg-game {
  position: relative;
  box-sizing: border-box; /* the notch padding sits inside the screen height, not on top of it */
  height: var(--vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
#hpg-game * { box-sizing: border-box; }
#hpg-game [hidden] { display: none !important; }

.cf-stage {
  position: relative;
  flex: none;
  touch-action: none;
  background: radial-gradient(120% 90% at 50% 20%, #1c2a4a 0%, #0b1020 70%); /* behind the menu while the street loads */
}

/* Portrait phone: the stage at the top, controls in their own panel below. */
#hpg-game.is-portrait { justify-content: flex-start; padding-top: env(safe-area-inset-top); }
#hpg-game.is-portrait .cf-controls {
  position: relative;
  width: 100%;
  height: var(--controls-h);
  margin-top: auto;
  padding: 12px 16px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(#141b33, #0b1020);
  border-top: 3px solid #1f2a4d;
  align-items: center;
}

/* Landscape phone: controls float over the bottom corners of the stage. */
#hpg-game.is-landscape .cf-controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 calc(14px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  pointer-events: none;
  opacity: 0.82;
}
#hpg-game.is-landscape .cf-controls > * { pointer-events: auto; }

.cf-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  touch-action: none;
}

.cf-dpad {
  position: relative;
  display: flex;
  gap: 10px;
  touch-action: none;
}
.cf-dpad span {
  width: var(--btn);
  height: var(--btn);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  border: 3px solid var(--cf-line);
  border-radius: 18px;
  background: rgba(40, 52, 90, 0.85);
  box-shadow: 0 5px 0 #000;
}
.cf-dpad span.is-on { background: var(--cf-accent); transform: translateY(3px); box-shadow: 0 2px 0 #000; }

.cf-actions {
  display: grid;
  grid-template-columns: repeat(2, auto);
  grid-template-areas: ". gas" "brake horn";
  gap: 10px 12px;
  align-items: end;
  touch-action: none;
}
.cf-btn {
  width: var(--btn);
  height: var(--btn);
  border-radius: 50%;
  border: 3px solid var(--cf-line);
  color: #fff;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.02em;
  box-shadow: 0 5px 0 #000;
  touch-action: none;
  cursor: pointer;
}
.cf-gas { grid-area: gas; background: #16a34a; }
.cf-brake { grid-area: brake; background: #b91c1c; }
.cf-horn { grid-area: horn; background: #1d4ed8; }
.cf-btn.is-on { transform: translateY(3px); box-shadow: 0 2px 0 #000; filter: brightness(1.25); }

#hpg-game.is-landscape { --btn: min(74px, 17vh); }
.cf-btn { font-size: calc(var(--btn) * 0.13); }

.cf-keys {
  margin-top: 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  line-height: 1.8;
  padding: 0 12px;
}

.cf-pause-btn {
  position: absolute;
  left: 50%;
  top: 11%;
  transform: translateX(-50%);
  width: 40px;
  height: 32px;
  border: 2px solid var(--cf-line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font: inherit;
  font-size: 10px;
  cursor: pointer;
  z-index: 3;
}

.cf-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 10px;
  background: #111827;
  border: 2px solid var(--cf-line);
  font-size: 11px;
  z-index: 20;
}

/* Menus cover the whole screen (the stage alone is too small on a phone held upright). */
.cf-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  background: rgba(5, 9, 22, 0.72);
  overflow-y: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.cf-title { background: radial-gradient(circle at 50% 30%, rgba(0, 144, 193, 0.35), rgba(5, 9, 22, 0.94) 70%); }

.cf-panel {
  width: min(520px, 100%);
  margin: auto;
  padding: 22px 18px;
  border: 3px solid var(--cf-line);
  border-radius: 14px;
  background: var(--cf-panel);
  text-align: center;
  box-shadow: 0 8px 0 #000;
}
.cf-panel-wide { width: min(760px, 100%); }
.cf-logo { height: 34px; margin-bottom: 10px; }
.cf-h1 {
  margin: 0 0 10px;
  font-size: clamp(22px, 7vw, 40px);
  line-height: 1.25;
  color: var(--cf-yellow);
  text-shadow: 3px 3px 0 #000;
}
.cf-h2 {
  margin: 0 0 14px;
  font-size: clamp(15px, 4.6vw, 24px);
  line-height: 1.4;
  text-shadow: 2px 2px 0 #000;
}
.cf-h2.is-win { color: var(--cf-yellow); }
.cf-h2.is-lose { color: var(--cf-red); }
.cf-tagline { margin: 0 0 18px; font-size: 11px; line-height: 1.7; color: #bae6fd; }
.cf-winline { margin: 0 0 18px; font-size: 12px; line-height: 1.8; }
.cf-note { font-size: 10px; line-height: 1.7; color: rgba(255, 255, 255, 0.75); }
.cf-disclaimer { margin: 16px 0 0; font-size: 8px; line-height: 1.7; color: rgba(255, 255, 255, 0.55); }
.cf-label { font-size: 10px; color: rgba(255, 255, 255, 0.75); }

.cf-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.cf-cta {
  min-width: 200px;
  padding: 18px 26px;
  border: 3px solid #fff;
  border-radius: 12px;
  background: #16a34a;
  color: #fff;
  font: inherit;
  font-size: 18px;
  box-shadow: 0 6px 0 #000;
  cursor: pointer;
}
.cf-cta:active { transform: translateY(3px); box-shadow: 0 3px 0 #000; }

.cf-chip {
  display: inline-block;
  padding: 10px 12px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-size: 10px;
  text-decoration: none;
  cursor: pointer;
}
.cf-chip.is-on { background: var(--cf-accent); border-color: #fff; }

#hpg-game button:focus-visible, #hpg-game a:focus-visible { outline: 3px solid var(--cf-yellow); outline-offset: 3px; }

.cf-loading {
  height: 16px;
  margin: 8px auto;
  width: 80%;
  border: 2px solid #fff;
  border-radius: 6px;
  overflow: hidden;
}
.cf-loading span { display: block; height: 100%; background: var(--cf-accent); transition: width 0.2s; }

.cf-how { margin-top: 16px; text-align: left; font-size: 9px; line-height: 1.9; }
.cf-how summary { cursor: pointer; text-align: center; color: #bae6fd; }
.cf-how p { margin: 8px 0 0; }

/* Candidate tiles: two across on phones, up to four on wide screens. */
.cf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
}
.cf-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px 10px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.cf-tile:hover:not(:disabled), .cf-tile:focus-visible { border-color: #22d3ee; box-shadow: 0 0 14px rgba(34, 211, 238, 0.5); }
.cf-tile.is-selected { border-color: var(--cf-yellow); }
.cf-tile:disabled { opacity: 0.45; cursor: default; }
.cf-tile-art {
  width: 100%;
  height: 132px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 44px;
}
.cf-tile-art img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.cf-tile-name { margin-top: 8px; font-size: 10px; line-height: 1.5; }
.cf-tile-random .cf-tile-art { color: var(--cf-yellow); align-items: center; }

@media (prefers-reduced-motion: reduce) {
  .cf-loading span { transition: none; }
}

/* Leaderboard: the score form after a win and the board screen. */
#hpg-game input, #hpg-game select { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.cf-input {
  font: inherit;
  font-size: 16px; /* 16px or more, or iPhones zoom in when the box is tapped */
  padding: 10px 10px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.cf-input:focus { outline: 3px solid var(--cf-yellow); outline-offset: 2px; }
.cf-initials { width: 6.2em; text-align: center; text-transform: uppercase; letter-spacing: 0.12em; }
.cf-town { max-width: 100%; font-size: 12px; min-height: 44px; }
@supports (-webkit-touch-callout: none) { .cf-town { font-size: 16px; } }
.cf-town option { color: #111; }
.cf-score { margin: 4px 0 12px; font-size: 12px; }
.cf-score strong { font-size: 20px; color: var(--cf-yellow); text-shadow: 2px 2px 0 #000; }
.cf-rank { margin: 0 0 6px; font-size: 13px; line-height: 1.6; color: #86efac; }
.cf-post { margin: 6px 0 4px; padding-top: 12px; border-top: 2px dashed rgba(255, 255, 255, 0.25); }
.cf-post .cf-note { margin: 0; }
.cf-post-msg:empty { display: none; }
.cf-post-msg { margin-top: 8px !important; color: #fca5a5; }
.cf-fine { margin: 10px 0 0; font-size: 8px; line-height: 1.7; color: rgba(255, 255, 255, 0.55); }
.cf-h3 { margin: 16px 0 6px; font-size: 11px; color: #bae6fd; }
.cf-cta-small { min-width: 150px; padding: 12px 18px; font-size: 14px; }
.cf-board { list-style: none; margin: 12px 0 4px; padding: 0; text-align: left; font-size: 10px; }
.cf-board li {
  display: grid;
  grid-template-columns: 2.6em 3.6em minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 8px 8px;
  border-radius: 8px;
  line-height: 1.4;
}
.cf-board li:nth-child(odd) { background: rgba(255, 255, 255, 0.06); }
.cf-board li.is-me { background: rgba(253, 224, 71, 0.18); box-shadow: inset 0 0 0 2px var(--cf-yellow); }
.cf-board-town { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(255, 255, 255, 0.85); }
.cf-board-pts { text-align: right; color: var(--cf-yellow); }
.cf-board-towns li { grid-template-columns: 2.6em minmax(0, 1fr) auto; }

/* ---- Car Flip Challenge additions */
.cf-pause-btn { top: calc(6px + env(safe-area-inset-top)); left: auto; right: calc(6px + env(safe-area-inset-right)); transform: none; }
#hpg-game.is-landscape { padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); box-sizing: border-box; }
.cf-h1 { color: var(--cf-yellow); }
.cf-h1 span { display: inline-block; }
.cf-h1 span + span { color: #ff5a4f; }
.cf-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.cf-tile-art { height: auto; aspect-ratio: 216 / 150; }
.cf-tile-meta { margin-top: 4px; font-size: 8px; color: #bae6fd; }
.cf-tile-best { margin-top: 4px; font-size: 8px; color: rgba(255, 255, 255, 0.7); }
.cf-tile-stars, .cf-stars { color: var(--cf-yellow); letter-spacing: 2px; }
.cf-chip.is-locked { opacity: 0.55; border-style: dashed; }
.cf-unlock { margin: 2px 0 8px; font-size: 10px; color: #ffd166; letter-spacing: 0.04em; }
#hpg-game.is-3d .cf-unlock { font-size: 15px; font-weight: 900; }
.cf-tile-stars { margin-top: 2px; font-size: 12px; font-family: system-ui, sans-serif; }
.cf-stars { margin: 0 0 8px; font-size: 22px; font-family: system-ui, sans-serif; }
.cf-score { margin: 4px 0 8px; font-size: 12px; }
.cf-score strong { font-size: 20px; color: var(--cf-yellow); text-shadow: 2px 2px 0 #000; }
.cf-best { display: inline-block; margin-left: 6px; padding: 3px 5px; font-size: 8px; color: #0b1020; background: #7ee787; border-radius: 4px; vertical-align: middle; }
.cf-stats { margin: 0 0 12px; font-size: 8px; line-height: 1.8; color: rgba(255, 255, 255, 0.8); }
.cf-rank { margin: 6px 0; font-size: 13px; line-height: 1.6; color: #86efac; }
.cf-fine { margin: 8px 0 0; font-size: 8px; line-height: 1.7; color: rgba(255, 255, 255, 0.55); }
.cf-h3 { margin: 16px 0 6px; font-size: 11px; color: #bae6fd; }
.cf-cta-small { min-width: 150px; padding: 12px 18px; font-size: 14px; }
#hpg-game input, #hpg-game select { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.cf-input { font: inherit; font-size: 16px; padding: 10px; border: 2px solid rgba(255, 255, 255, 0.75); border-radius: 10px; background: rgba(255, 255, 255, 0.08); color: #fff; }
.cf-input:focus { outline: 3px solid var(--cf-yellow); outline-offset: 2px; }
.cf-initials { width: 6.2em; text-align: center; text-transform: uppercase; letter-spacing: 0.12em; }
.cf-town { max-width: 100%; font-size: 12px; min-height: 44px; }
@supports (-webkit-touch-callout: none) { .cf-town { font-size: 16px; } }
.cf-town option { color: #111; }
.cf-post { margin: 6px 0 4px; padding-top: 12px; border-top: 2px dashed rgba(255, 255, 255, 0.25); }
.cf-post .cf-note { margin: 0; }
.cf-post-msg:empty { display: none; }
.cf-post-msg { margin-top: 8px !important; color: #fca5a5; }
.cf-board { list-style: none; margin: 12px 0 4px; padding: 0; text-align: left; font-size: 10px; }
.cf-board li { display: grid; grid-template-columns: 2.6em 3.4em minmax(0, 1fr) 3em auto; gap: 6px; align-items: center; padding: 8px; border-radius: 8px; line-height: 1.4; }
.cf-board li:nth-child(odd) { background: rgba(255, 255, 255, 0.06); }
.cf-board li.is-me { background: rgba(253, 224, 71, 0.18); box-shadow: inset 0 0 0 2px var(--cf-yellow); }
.cf-board-town { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(255, 255, 255, 0.85); }
.cf-board-tag { font-size: 8px; color: #bae6fd; }
.cf-board-pts { text-align: right; color: var(--cf-yellow); }
.cf-board-towns li { grid-template-columns: 2.6em minmax(0, 1fr) auto; }

/* ------------------------------------------------------------------ the 3D street (three.js)
   The real street in 3D, a clean sans-serif HUD and menus. .is-3d is on from the first frame. */
.cf-gl { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; background: #9fb0c4; }
#hpg-game:not(.is-3d-on) .cf-gl { visibility: hidden; } /* nothing drawn yet: the stage's dark backdrop shows */
#hpg-game.is-3d {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
#hpg-game.is-3d .cf-panel { border-width: 2px; border-radius: 18px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); background: rgba(8, 13, 30, 0.78); }
#hpg-game.is-3d .cf-h1 { font-size: clamp(34px, 10vw, 58px); font-weight: 900; font-style: italic; letter-spacing: -0.02em; line-height: 1.02; text-transform: uppercase; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.55); }
#hpg-game.is-3d .cf-h2 { font-size: clamp(22px, 6vw, 32px); font-weight: 900; font-style: italic; text-transform: uppercase; }
#hpg-game.is-3d .cf-tagline { font-size: 15px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
#hpg-game.is-3d .cf-winline, #hpg-game.is-3d .cf-rank { font-size: 16px; }
#hpg-game.is-3d .cf-note, #hpg-game.is-3d .cf-label { font-size: 14px; }
#hpg-game.is-3d .cf-disclaimer, #hpg-game.is-3d .cf-fine { font-size: 12px; }
#hpg-game.is-3d .cf-how { font-size: 14px; line-height: 1.5; }
#hpg-game.is-3d .cf-cta { font-size: 24px; font-weight: 900; font-style: italic; letter-spacing: 0.04em; border-radius: 14px; }
#hpg-game.is-3d .cf-cta-small { font-size: 17px; }
#hpg-game.is-3d .cf-chip { font-size: 14px; font-weight: 700; border-radius: 999px; }
#hpg-game.is-3d .cf-tile-name { font-size: 15px; font-weight: 800; }
#hpg-game.is-3d .cf-tile-meta, #hpg-game.is-3d .cf-tile-best, #hpg-game.is-3d .cf-best, #hpg-game.is-3d .cf-board-tag { font-size: 12px; }
#hpg-game.is-3d .cf-stats { font-size: 13px; }
#hpg-game.is-3d .cf-score { font-size: 15px; }
#hpg-game.is-3d .cf-score strong { font-size: 30px; font-weight: 900; }
#hpg-game.is-3d .cf-board, #hpg-game.is-3d .cf-town { font-size: 15px; }
#hpg-game.is-3d .cf-h3 { font-size: 14px; font-weight: 800; letter-spacing: 0.06em; }
#hpg-game.is-3d .cf-btn { font-size: calc(var(--btn) * 0.2); font-weight: 900; font-style: italic; }
#hpg-game.is-3d .cf-pause-btn { font-family: inherit; font-weight: 900; }
#hpg-game.is-3d .cf-keys { font-family: inherit; font-size: 13px; }
#hpg-game.is-3d .cf-toast { font-family: inherit; font-size: 15px; font-weight: 700; }

.cf-hud { position: absolute; inset: 0; pointer-events: none; color: #fff; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
#hpg-game:not(.is-3d-on) .cf-hud { display: none; }
.cf-hud-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 18px 12px 30px; background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0)); }
.cf-hud-score b { display: block; font-size: 22px; font-weight: 900; font-style: italic; letter-spacing: -0.01em; }
.cf-hud-pips { display: flex; gap: 4px; margin-top: 4px; }
.cf-hud-pips i { width: 16px; height: 8px; border-radius: 2px; background: #ff5a4f; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.cf-hud-pips i.is-off { background: rgba(255, 255, 255, 0.25); }
.cf-hud-clock { text-align: center; line-height: 1; }
.cf-hud-clock small { display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; opacity: 0.85; }
.cf-hud-clock b { font-size: 34px; font-weight: 900; font-style: italic; color: #ffd166; }
.cf-hud-clock.is-low b { color: #ff5a4f; animation: cf-pulse 0.5s ease-in-out infinite alternate; }
@keyframes cf-pulse { from { transform: scale(1); } to { transform: scale(1.12); } }
.cf-hud-street { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-right: 46px; } /* clear of the pause button */
.cf-hud-street span { padding: 4px 9px; border: 2px solid #fff; border-radius: 6px; background: #1f7a3d; font-size: 14px; font-weight: 800; letter-spacing: 0.04em; white-space: nowrap; max-width: 44vw; overflow: hidden; text-overflow: ellipsis; text-shadow: none; }
.cf-hud-light { display: flex; gap: 3px; padding: 3px 4px; border-radius: 6px; background: #16171b; }
.cf-hud-light i { width: 10px; height: 10px; border-radius: 50%; background: #2c2c30; }
.cf-hud-light i.is-red { background: #ff3b30; box-shadow: 0 0 8px #ff3b30; }
.cf-hud-light i.is-yellow { background: #ffcc00; box-shadow: 0 0 8px #ffcc00; }
.cf-hud-light i.is-green { background: #39ff6a; box-shadow: 0 0 8px #39ff6a; }
.cf-hud-score small { display: block; font-size: 10px; font-weight: 800; letter-spacing: 0.16em; opacity: 0.8; }
.cf-hud-town { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; opacity: 0.92; white-space: nowrap; }
/* the route: a line across the top with checkpoints (ticks), real places (dots), town lines and your car */
.cf-hud-route { position: absolute; top: 0; left: 0; right: 0; height: 14px; }
.cf-hud-route-line { position: absolute; top: 0; left: 0; right: 0; height: 5px; background: rgba(255, 255, 255, 0.2); }
.cf-hud-route-line i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #0090c1, #45d4ff); box-shadow: 0 0 8px rgba(69, 212, 255, 0.75); }
.cf-hud-route-marks i { position: absolute; top: 0; transform: translateX(-50%); }
.cf-hud-route-marks i.is-check { width: 3px; height: 11px; border-radius: 0 0 2px 2px; background: #ffd166; }
.cf-hud-route-marks i.is-town { width: 2px; height: 13px; background: #7ee787; }
.cf-hud-route-marks i.is-place { top: 7px; width: 4px; height: 4px; border-radius: 50%; background: #f3e3c8; }
.cf-hud-route-car { position: absolute; top: -3px; left: 0; width: 11px; height: 11px; margin-left: -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #0090c1, 0 0 10px #45d4ff; }
/* a real place coming up */
.cf-hud-place { position: absolute; left: 50%; top: 78px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: min(94%, 480px); padding: 7px 14px; border: 1.5px solid #f3e3c8; border-radius: 12px; background: rgba(74, 47, 24, 0.88); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); text-shadow: none; animation: cf-place 0.35s ease-out; }
.cf-hud-place div { min-width: 0; text-align: center; line-height: 1.2; }
.cf-hud-place b { display: block; font-size: 15px; font-weight: 800; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-hud-place small { display: block; font-size: 12px; font-weight: 600; color: #f3e3c8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-hud-place > i { flex: none; width: 0; height: 0; border-top: 8px solid transparent; border-bottom: 8px solid transparent; visibility: hidden; }
.cf-hud-place > i:first-child { border-right: 11px solid #f3e3c8; }
.cf-hud-place > i:last-child { border-left: 11px solid #f3e3c8; }
.cf-hud-place > i.is-on { visibility: visible; }
@keyframes cf-place { from { transform: translateX(-50%) translateY(-10px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
/* the speed dial: full at top speed, a notch where cruising ends */
.cf-hud-speed { position: absolute; left: 8px; bottom: 6px; width: 98px; height: 98px; border-radius: 50%; background: radial-gradient(circle, rgba(8, 13, 30, 0.62) 0 58%, rgba(8, 13, 30, 0) 72%); text-align: center; line-height: 1; }
.cf-hud-speed svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cf-hud-speed path { fill: none; stroke-width: 7; stroke-linecap: round; }
.cf-gauge-bg { stroke: rgba(255, 255, 255, 0.22); }
.cf-gauge-fill { stroke: #45d4ff; stroke-dasharray: 0 100; filter: drop-shadow(0 0 4px rgba(69, 212, 255, 0.8)); }
.cf-hud-speed.is-over .cf-gauge-fill { stroke: #ffb020; filter: drop-shadow(0 0 4px rgba(255, 176, 32, 0.85)); }
.cf-hud-speed path.cf-gauge-mark { stroke: #fff; stroke-width: 10; stroke-linecap: butt; stroke-dasharray: 0 100; }
.cf-hud-speed b { position: absolute; left: 0; right: 0; top: 31px; font-size: 30px; font-weight: 900; font-style: italic; }
.cf-hud-speed small { position: absolute; left: 0; right: 0; top: 63px; font-size: 10px; font-weight: 800; letter-spacing: 0.14em; opacity: 0.85; }
/* going flat out: the edges of the picture darken and streak */
.cf-hud-rush { position: absolute; inset: 0; opacity: 0; transition: opacity 0.25s linear;
  background: repeating-conic-gradient(from 0deg at 50% 54%, rgba(255, 255, 255, 0) 0deg 7deg, rgba(255, 255, 255, 0.1) 7deg 8deg), radial-gradient(ellipse at 50% 54%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.5) 100%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 54%, rgba(0, 0, 0, 0) 48%, #000 96%); mask-image: radial-gradient(ellipse at 50% 54%, rgba(0, 0, 0, 0) 48%, #000 96%); }
@media (prefers-reduced-motion: reduce) { .cf-hud-rush { display: none; } }
.cf-hud-pops { position: absolute; left: 0; right: 0; top: 36%; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cf-pop { font-size: 18px; font-weight: 900; font-style: italic; letter-spacing: 0.02em; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6); animation: cf-pop 0.25s ease-out; }
.cf-pop.is-big { font-size: clamp(24px, 7vw, 40px); }
@keyframes cf-pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cf-hud-steer { position: absolute; left: 0; right: 0; top: 52%; text-align: center; font-size: 26px; font-weight: 900; font-style: italic; color: #ffd166; animation: cf-pulse 0.2s ease-in-out infinite alternate; }
.cf-hud-stamp { position: absolute; left: 0; right: 0; top: 22%; padding: 10px 0; text-align: center; font-size: clamp(24px, 7vw, 44px); font-weight: 900; font-style: italic; color: #ff5a4f; background: rgba(0, 0, 0, 0.55); }
.cf-hud-behind { position: absolute; bottom: 14px; width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-bottom: 24px solid #ffd166; animation: cf-pulse 0.15s ease-in-out infinite alternate; }
.cf-hud-behind.is-left { left: 22%; } .cf-hud-behind.is-mid { left: calc(50% - 16px); } .cf-hud-behind.is-right { right: 22%; }
.cf-hud-count { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); width: min(92%, 420px); padding: 14px 16px; border-radius: 16px; text-align: center; background: rgba(8, 13, 30, 0.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.cf-hud-count h2 { margin: 0; font-size: clamp(26px, 8vw, 40px); font-weight: 900; font-style: italic; color: #ffd166; line-height: 1.05; }
.cf-hud-count p { margin: 6px 0 10px; font-size: 14px; font-weight: 700; letter-spacing: 0.06em; }
.cf-hud-lamps { display: inline-flex; gap: 8px; padding: 8px 10px; border-radius: 12px; background: #111; }
.cf-hud-lamps i { width: 22px; height: 22px; border-radius: 50%; background: #2a2a2e; }
.cf-hud-lamps i.is-red { background: #ff3b30; box-shadow: 0 0 14px #ff3b30; }
.cf-hud-lamps i.is-yellow { background: #ffcc00; box-shadow: 0 0 14px #ffcc00; }
.cf-hud-lamps i.is-green { background: #39ff6a; box-shadow: 0 0 14px #39ff6a; }
.cf-hud-count strong { display: block; margin-top: 6px; min-height: 1em; font-size: clamp(34px, 10vw, 54px); font-weight: 900; font-style: italic; color: #39ff6a; }
#hpg-game.is-landscape .cf-hud-top { padding-top: 14px; }
#hpg-game.is-landscape .cf-hud-place { top: 62px; }
#hpg-game.is-landscape .cf-hud-speed { bottom: 2px; left: 50%; transform: translateX(-50%) scale(0.8); transform-origin: 50% 100%; } /* between the steering pad and the pedals */

/* ---- the trip on the result screen: the real street as a line, how far you got, the places you passed */
.cf-trip { margin: 2px 0 10px; }
.cf-trip svg { display: block; width: 100%; height: auto; max-height: 120px; }
.cf-trip-line { margin: 4px 0 0; font-size: 9px; line-height: 1.7; color: #bae6fd; }
.cf-trip-places { margin: 2px 0 0; font-size: 8px; line-height: 1.7; color: rgba(255, 255, 255, 0.75); }
.cf-tile-route { margin-top: 4px; font-size: 7px; line-height: 1.6; color: rgba(255, 255, 255, 0.75); }
#hpg-game.is-3d .cf-trip-line { font-size: 14px; font-weight: 700; line-height: 1.4; }
#hpg-game.is-3d .cf-trip-places { font-size: 12.5px; line-height: 1.45; }
#hpg-game.is-3d .cf-tile-route { font-size: 11.5px; line-height: 1.35; }
/* ---- a cleaner, glassier look for the 3D game's menus */
#hpg-game.is-3d .cf-panel { border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 22px; backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); background: linear-gradient(180deg, rgba(16, 24, 48, 0.8), rgba(6, 10, 24, 0.86)); box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
#hpg-game.is-3d .cf-cta { border: 0; background: linear-gradient(180deg, #5fe07a, #1fa64a); box-shadow: 0 6px 0 #116a2c, 0 12px 26px rgba(31, 166, 74, 0.45); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); transition: transform 0.08s ease, box-shadow 0.08s ease; }
#hpg-game.is-3d .cf-cta:active { transform: translateY(4px); box-shadow: 0 2px 0 #116a2c, 0 6px 14px rgba(31, 166, 74, 0.4); }
#hpg-game.is-3d .cf-chip { border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.07); }
#hpg-game.is-3d .cf-chip.is-on { border-color: #ffd166; background: rgba(255, 209, 102, 0.18); }
#hpg-game.is-3d .cf-tile { border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 16px; overflow: hidden; background: rgba(255, 255, 255, 0.06); transition: transform 0.12s ease, border-color 0.12s ease; }
#hpg-game.is-3d .cf-tile:hover, #hpg-game.is-3d .cf-tile:focus-visible { transform: translateY(-3px); border-color: #ffd166; }

/* Mobile pass (1.6.5). Every button is at least 44 px tall, the size a thumb needs. On a phone held
   sideways (a short screen) the title packs up so PLAY shows without scrolling: the big picture shrinks
   and the long words go (they are in How to play too). */
#hpg-game .cf-chip { min-height: 44px; }
#hpg-game .cf-cta { min-height: 48px; }
@media (orientation: landscape) and (max-height: 500px) {
  #hpg-game [data-screen="title"] .cf-hero { max-height: 48px; width: auto; margin-top: 0; margin-bottom: 4px; }
  #hpg-game [data-screen="title"] .cf-lead, #hpg-game [data-screen="title"] .cf-fine { display: none; }
  #hpg-game [data-screen="title"] .cf-h1 { font-size: clamp(24px, 9vh, 40px); margin-bottom: 2px; }
  #hpg-game [data-screen="title"] .cf-tagline { margin-bottom: 4px; }
  #hpg-game [data-screen="title"] .cf-cta { margin-top: 4px; margin-bottom: 6px; padding-top: 6px; padding-bottom: 6px; }
  #hpg-game .cf-panel { padding-top: 12px; padding-bottom: 12px; }
}
/* How to play: a summary a thumb can hit. */
#hpg-game summary { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; }
#hpg-game .cf-how { font-size: 11px; }
#hpg-game .cf-how summary { font-size: 12px; }
#hpg-game .cf-pause-btn { font-size: 12px; }
#hpg-game .cf-fine { font-size: 10px; line-height: 1.6; }
#hpg-game .cf-disclaimer { font-size: 10px; line-height: 1.6; color: rgba(255, 255, 255, 0.7); }
@media (orientation: landscape) and (max-height: 500px) { #hpg-game [data-screen="title"] .cf-disclaimer, #hpg-game [data-screen="title"] .cf-how { margin-top: 6px; } }
/* Two quick taps on a menu button are two taps, never a zoom (iPhones zoom on a double tap otherwise). */
#hpg-game button, #hpg-game a, #hpg-game summary, #hpg-game select, #hpg-game input { touch-action: manipulation; }
