/* Storm Night: the Blockstep look (docs/design/blockstep-style.md), adapted from the sister games' styles: white cards
   with a thin, even border all the way round and a soft shadow, pill buttons, deep navy words, one blue for the main
   action, Plus Jakarta Sans for headings and Inter for everything else. The 3D world is a storm at night; everything you
   read sits on white cards over it, so the words stay as easy to read as in daylight. Phone first: driving works best
   in landscape (the steering on the left thumb, the pedals on the right), and portrait still plays. Never a coloured
   stripe down one side of anything. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f5f7fb;
  --ink: #0e1b33;
  --ink-2: #45526e;
  --muted: #6b7690;
  --line: #e3e8f2;
  --brand: #2563eb;
  --brand-ink: #1d4ed8;
  --brand-soft: #e8f0ff;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #a16207;
  --warn-soft: #fef6e0;
  --bad: #b91c1c;
  --bad-soft: #fdecec;
  --stop: #c42020;
  --pause-bg: #fdf0c8;
  --pause-ink: #7a4b05;
  --pause-line: #ecc766;
  --danger: #dc2626;
  --critical: #d97706;
  --customers: #2563eb;
  --shadow: 0 1px 2px rgba(14, 27, 51, 0.05), 0 10px 30px rgba(14, 27, 51, 0.09);
  --shadow-sm: 0 1px 2px rgba(14, 27, 51, 0.06), 0 4px 12px rgba(14, 27, 51, 0.07);
  --shadow-night: 0 2px 6px rgba(0, 0, 0, 0.28), 0 10px 30px rgba(0, 0, 0, 0.32);
  --display: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --body: "Inter", "Segoe UI", system-ui, sans-serif;
  --panel-w: min(420px, 40vw);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: #0b1322;
  color: var(--ink);
  font: 15px/1.5 var(--body);
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
button {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}
h1,
h2,
h3 {
  font-family: var(--display);
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
p {
  margin: 0;
}
[hidden] {
  display: none !important;
}

/* ---- Layout: the world, and the job panel beside it (landscape) or under it (portrait) ---- */
.app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.app.job {
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
}
.stage {
  position: relative;
  overflow: hidden;
  background: #0b1322;
  min-width: 0;
  min-height: 0;
  touch-action: none;
}
.world-canvas {
  position: absolute;
  inset: 0;
  display: block;
}
.snap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}
.world-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}

/* ---- Pills and chips ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-night);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pill small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pill.pop {
  animation: pop 0.55s ease;
}
@keyframes pop {
  40% {
    transform: scale(1.18);
  }
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.chip.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.chip.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.chip.brand {
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.draft {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #f3e2b3;
}

/* ---- The HUD ---- */
.hud {
  position: absolute;
  inset: 10px 10px auto 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  z-index: 6;
}
.hud > * {
  pointer-events: auto;
}
.hud-mid,
.hud-right {
  display: flex;
  gap: 6px;
  align-items: center;
}
.mycard {
  cursor: pointer;
  padding: 3px 12px 3px 3px;
  text-align: left;
  line-height: 1.15;
}
.mycard img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--brand-soft);
}
.mycard b {
  display: block;
  font-size: 12.5px;
}
.mycard small {
  display: block;
}
.clock svg,
.lights svg {
  width: 20px;
  height: 20px;
  color: var(--ink-2);
}
.clock b {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.lights .lights-n {
  display: grid;
  line-height: 1.05;
}
.lights b {
  font-family: var(--display);
  font-weight: 800;
  font-size: 16px;
}
.lights .bar {
  display: block;
  width: 64px;
  height: 7px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}
.lights .bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: #f59e0b;
  transition: width 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.lights.up {
  animation: glowup 1.4s ease;
}
@keyframes glowup {
  30% {
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.35), var(--shadow-night);
  }
}
.streak b {
  font-family: var(--display);
  font-weight: 800;
  font-size: 16px;
}
.streak.hot {
  background: var(--warn-soft);
  border-color: #f3e2b3;
}
.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  cursor: pointer;
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
.stage .draft-tag {
  position: absolute;
  left: 10px;
  top: 56px;
  z-index: 5;
  font-size: 11px;
}

/* ---- The minimap ---- */
.minimap {
  position: absolute;
  right: 10px;
  top: 56px;
  z-index: 6;
  width: 168px;
  height: 124px;
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-night);
  overflow: hidden;
  cursor: pointer;
}
.minimap canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.mm-tag {
  position: absolute;
  left: 8px;
  bottom: 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 7px;
}
.minimap.ping {
  animation: ping 1s ease 2;
}
@keyframes ping {
  50% {
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.35), var(--shadow-night);
  }
}

/* ---- Messages over the world ---- */
.target {
  position: absolute;
  left: 50%;
  top: 56px;
  transform: translateX(-50%);
  z-index: 5;
  max-width: calc(100% - 380px);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13.5px;
  font-weight: 600;
  gap: 8px;
}
.target .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}
.target .dot.danger {
  background: var(--danger);
  box-shadow: 0 0 0 3px #fecaca;
}
.target .dot.critical {
  background: var(--critical);
  box-shadow: 0 0 0 3px #fde4b8;
}
.target .dot.customers {
  background: var(--customers);
  box-shadow: 0 0 0 3px #cfe0ff;
}
.target .dot.end {
  background: var(--ok);
}
.target span.t {
  overflow: hidden;
  text-overflow: ellipsis;
}
.target small {
  font-weight: 700;
  color: var(--brand-ink);
}
.radio {
  position: absolute;
  left: 50%;
  top: 100px;
  transform: translateX(-50%);
  z-index: 7;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: min(440px, calc(100% - 20px));
  padding: 9px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-night);
  font-size: 13.5px;
  line-height: 1.4;
  animation: radio-in 0.3s ease;
}
.radio svg {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--brand);
  margin-top: 1px;
}
.radio b {
  display: block;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.radio.urgent {
  border-color: #f2b8b8;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18), var(--shadow-night);
}
.radio.urgent svg {
  color: var(--danger);
}
@keyframes radio-in {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
}
.coach {
  position: absolute;
  left: 50%;
  bottom: 150px;
  transform: translateX(-50%);
  z-index: 7;
  max-width: min(520px, calc(100% - 24px));
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(14, 27, 51, 0.9);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-sm);
  animation: bubble-in 0.3s ease;
}
.app.job .coach {
  bottom: 18px;
}
.app.job .radio {
  left: 10px;
  transform: none;
  top: 96px;
  width: min(360px, calc(100% - 200px));
  animation: none;
}
.banner {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  z-index: 8;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 14px 22px 16px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-night);
  text-align: center;
  pointer-events: none;
  animation: banner-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.banner b {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.banner span {
  color: var(--ink-2);
  font-size: 14px;
}
.banner .big {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 800;
  color: #b45309;
}
.banner.low {
  top: auto;
  bottom: 120px;
  transform: translateX(-50%);
  animation: none;
}
@keyframes banner-in {
  from {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.85);
  }
}
@keyframes bubble-in {
  from {
    opacity: 0;
    margin-top: 6px;
  }
}

/* Buttons and tags over the 3D view: the zone's handles, the people to wave back, the parking spot's label. */
.marks {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}
.mark {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  will-change: transform;
}
.tag3d {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  padding: 2px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.tag3d.danger {
  border-color: #f2b8b8;
  color: var(--bad);
}
.tag3d.critical {
  border-color: #f3d39a;
  color: #92400e;
}
.tag3d.customers {
  border-color: #bcd0fb;
  color: var(--brand-ink);
}
.handle {
  min-width: 64px;
  height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 2px solid var(--bad);
  background: #fff;
  color: var(--bad);
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
  box-shadow: var(--shadow-night);
  cursor: grab;
  touch-action: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.handle.ok {
  border-color: var(--ok);
  color: var(--ok);
}
.handle svg {
  width: 16px;
  height: 16px;
}
.handle:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.06);
}
.endpin {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 2px dashed #ff7a1a;
  background: rgba(255, 255, 255, 0.95);
  color: #9a3412;
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow-night);
  cursor: pointer;
}
.endpin.on {
  border-style: solid;
  background: #ff7a1a;
  color: #fff;
}
.stopbtn {
  min-width: 70px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: var(--stop);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 0 0 4px rgba(196, 32, 32, 0.35), var(--shadow-night);
  cursor: pointer;
  animation: nudge 0.9s ease-in-out infinite;
}
.stopbtn.done {
  background: var(--ok);
  box-shadow: var(--shadow-night);
  animation: none;
}
.stopbtn.close {
  animation-duration: 0.45s;
}
@keyframes nudge {
  50% {
    box-shadow: 0 0 0 10px rgba(196, 32, 32, 0.12), var(--shadow-night);
  }
}
.bubble {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  max-width: 220px;
  padding: 6px 11px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--brand);
  box-shadow: var(--shadow-night);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  pointer-events: none;
  animation: bubble-in 0.25s ease;
}

/* ---- Driving: the speedo, the touch controls, the key hints ---- */
.drive {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}
.speedo {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 6px 10px 6px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-night);
  pointer-events: none;
}
.speedo b {
  grid-row: 1 / span 2;
  font-family: var(--display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  min-width: 2.1ch;
  text-align: right;
}
.speedo small {
  grid-column: 2;
  grid-row: 2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.speedo .limit {
  grid-column: 2;
  grid-row: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 4px solid #d81e1e;
  background: #fff;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 13px;
}
.speedo.near b {
  color: #b45309;
}
.speedo.over {
  border-color: #f2b8b8;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.3), var(--shadow-night);
}
.speedo.over b {
  color: var(--bad);
}
.speedo.over .limit {
  animation: pop 0.5s ease infinite;
}
.touch {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 calc(12px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  pointer-events: none;
}
.touch > div {
  pointer-events: auto;
  display: grid;
  gap: 10px;
}
.touch .left {
  justify-items: center;
}
.inds {
  display: flex;
  gap: 54px;
}
.ind {
  width: 54px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  color: #9aa3ad;
  box-shadow: var(--shadow-night);
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
}
.ind svg {
  width: 26px;
  height: 26px;
}
.ind.on {
  background: #fff7e6;
  border-color: #f3c46e;
  color: #b45309;
}
.ind.on.lit {
  background: #ffb020;
  border-color: #f59e0b;
  color: #fff;
}
.wheel {
  position: relative;
  width: 196px;
  height: 92px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-night);
  touch-action: none;
  cursor: ew-resize;
}
.wheel::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  border-radius: 99px;
  background: var(--line);
}
.wheel-in {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 70px;
  height: 70px;
  margin: -35px 0 0 -35px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  display: grid;
  place-items: center;
}
.wheel-in span {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 5px solid #fff;
  position: relative;
}
.wheel-in span::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 6px;
  height: 14px;
  margin-left: -3px;
  background: #f59e0b;
  border-radius: 3px;
}
.touch .right {
  justify-items: end;
}
.tools {
  display: flex;
  gap: 8px;
}
.tool {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-night);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.tool svg {
  width: 18px;
  height: 18px;
}
.tool[aria-pressed="true"] {
  background: var(--brand-soft);
  border-color: #bcd0fb;
  color: var(--brand-ink);
}
.tool.want {
  animation: nudge-b 1s ease-in-out infinite;
}
@keyframes nudge-b {
  50% {
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.25), var(--shadow-night);
  }
}
.pedals {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.pedal {
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), var(--shadow-night);
  font-family: var(--display);
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  display: grid;
  place-items: center;
}
.pedal.brake {
  width: 92px;
  height: 78px;
  background: #fff;
  color: var(--bad);
  border-color: #f2b8b8;
}
.pedal.go {
  width: 92px;
  height: 120px;
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.pedal.down {
  transform: translateY(3px) scale(0.97);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0.25), var(--shadow-night);
}
.pedal.go.down {
  background: var(--brand-ink);
}
.pedal.brake.down {
  background: var(--bad-soft);
}
.keys {
  position: absolute;
  left: 12px;
  bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(50% - 120px);
  pointer-events: none;
}
.keys span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}
kbd {
  font: 700 10.5px/1 var(--body);
  padding: 2px 5px;
  border-radius: 5px;
  border: 1px solid #c9d3e3;
  background: #fff;
  color: var(--ink);
}
.app.title .hud,
.app.title .minimap,
.app.title .drive,
.app.title .target,
.app.title .draft-tag {
  display: none !important;
}
.touch-on .keys {
  display: none;
}
.app:not(.touch-on) .touch {
  display: none;
}

/* The cab view: the windscreen, rain on the glass, the wipers. */
.cab {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.cab .dash {
  position: absolute;
  inset: auto 0 0 0;
  height: 16%;
  background: linear-gradient(#141a22, #0b0f14);
}
.cab::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 18px solid #10151c;
  border-bottom: 0;
  border-radius: 34px 34px 0 0;
}
.cab .wipers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 84%;
}
.cab #wiper-l,
.cab #wiper-r {
  transform-box: view-box;
}
.drops {
  position: absolute;
  inset: 0 0 16% 0;
  overflow: hidden;
}
.drops i {
  position: absolute;
  width: 6px;
  height: 8px;
  border-radius: 50%;
  background: rgba(210, 225, 245, 0.45);
  box-shadow: 0 1px 2px rgba(255, 255, 255, 0.35);
}

/* The near miss: letterbox and a red edge. */
.cine::before,
.cine::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  background: #05080e;
  transition: height 0.45s ease;
}
.cine::before {
  top: 0;
}
.cine::after {
  bottom: 0;
}
.cine.on::before,
.cine.on::after {
  height: 9%;
}
.cine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  box-shadow: inset 0 0 0 0 rgba(185, 28, 28, 0);
  transition: box-shadow 0.4s ease;
}
.cine.on {
  box-shadow: inset 0 0 140px 14px rgba(220, 38, 38, 0.45);
}
.flash {
  position: absolute;
  inset: 0;
  background: #e8f0ff;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
}
.flash.on {
  animation: flash 0.5s ease-out;
}
@keyframes flash {
  0% {
    opacity: 0.55;
  }
  12% {
    opacity: 0.08;
  }
  22% {
    opacity: 0.4;
  }
  100% {
    opacity: 0;
  }
}

/* ---- The job panel ---- */
.panel {
  position: relative;
  background: #fff;
  border-left: 1px solid var(--line);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  z-index: 9;
  display: flex;
  flex-direction: column;
}
.panel-in {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: grid;
  align-content: start;
  gap: 12px;
}
.jp-head {
  display: grid;
  gap: 4px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.jp-head h2 {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.15;
}
.steps-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.steps-dots span {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  border: 1px solid var(--line);
}
.steps-dots span.now {
  background: var(--brand-soft);
  color: var(--brand-ink);
  border-color: #bcd0fb;
}
.steps-dots span.done {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: #bfe3cb;
}
.do {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.do.live {
  background: var(--brand-soft);
  border-color: #bcd0fb;
  color: var(--brand-ink);
}
.sect {
  display: grid;
  gap: 8px;
}
.sect > h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sect > h3 .n {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
}
.sect.done > h3 .n {
  background: var(--ok);
}
.row-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.row-item b {
  display: block;
  font-size: 14px;
}
.row-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.row-item .acts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.row-item.open {
  border-color: #f3d39a;
  background: #fffaf0;
}
.row-item.locked {
  border-color: #bfe3cb;
  background: var(--ok-soft);
}
.row-item.wrong {
  border-color: #f2b8b8;
  background: var(--bad-soft);
}
.houses {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.house {
  display: grid;
  gap: 2px;
  min-width: 94px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-size: 12.5px;
}
.house b {
  font-size: 14px;
}
.house.gen {
  border-color: #f2b8b8;
  background: var(--bad-soft);
}
.house.safe {
  border-color: #bfe3cb;
  background: var(--ok-soft);
}
.tester {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.tester .dev {
  width: 82px;
  height: 104px;
  border-radius: 16px;
  background: #f2c200;
  border: 1px solid #c9a000;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
}
.tester .lamp {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #5a1a1a;
  border: 3px solid #2b3038;
}
.tester .lamp.live {
  background: #ff3030;
  box-shadow: 0 0 18px 6px rgba(255, 48, 48, 0.7);
  animation: blink 0.28s steps(2) infinite;
}
.tester .lamp.prove {
  background: #ff3030;
  box-shadow: 0 0 14px 4px rgba(255, 48, 48, 0.6);
}
@keyframes blink {
  50% {
    opacity: 0.35;
  }
}
.tester .lcd {
  width: 62px;
  padding: 3px 0;
  border-radius: 6px;
  background: #1c2b1f;
  color: #8ef0a8;
  font: 700 12px/1 var(--body);
  text-align: center;
}
.tester .ops {
  display: grid;
  gap: 6px;
}
.ldl {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ldl span {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}
.ldl span.got {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: #bfe3cb;
}
.ldl span.bad {
  background: var(--bad-soft);
  color: var(--bad);
  border-color: #f2b8b8;
}
.diagram {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfe;
  padding: 6px;
}
.diagram svg {
  display: block;
  width: 100%;
  height: auto;
}
.progress {
  height: 8px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
}
.gaps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.gap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid #f2b8b8;
  background: var(--bad-soft);
}
.gap.ok {
  border-color: #bfe3cb;
  background: var(--ok-soft);
}
.gap b {
  font-family: var(--display);
  font-size: 17px;
}
.gap small {
  display: block;
  font-size: 11.5px;
  color: var(--ink-2);
  font-weight: 600;
}
.gap .pm {
  display: flex;
  gap: 4px;
}
.mini {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-weight: 800;
  font-size: 16px;
  padding: 0;
}
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.toggle.need {
  border-color: #f3d39a;
  background: #fffaf0;
}
.toggle.on {
  border-color: #bfe3cb;
  background: var(--ok-soft);
}
.slot {
  display: grid;
  gap: 6px;
}
.slot > b {
  font-size: 13px;
  color: var(--ink-2);
}
.opts {
  display: grid;
  gap: 6px;
}
.opt {
  text-align: left;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.3;
}
.opt.on {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.opt.wrong {
  border-color: #f2b8b8;
  background: var(--bad-soft);
  color: var(--bad);
}
.opt:hover {
  border-color: #bcd0fb;
}
/* The papers at the tailgate. */
.papers {
  display: grid;
  gap: 10px;
}
.doc {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: slide-in 0.35s ease;
}
@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(12px) rotate(-1deg);
  }
}
.doc-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: #f1f4f9;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.doc-body {
  display: grid;
  gap: 4px;
  padding: 8px;
}
.doc-body.card {
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
}
.field {
  display: grid;
  gap: 1px;
  text-align: left;
  padding: 5px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  min-width: 0;
}
.field:hover {
  background: var(--bg-soft);
}
.field.on {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.field .lab {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field .val {
  font-size: 13.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.field img {
  width: 64px;
  height: 78px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
}
.field .sig {
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-weight: 400;
  color: #1d3b8a;
}
.field .sig.empty {
  font-family: var(--body);
  color: var(--bad);
  font-weight: 700;
}
.who {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.who img {
  width: 46px;
  height: 56px;
  border-radius: 10px;
  border: 1px solid var(--line);
  object-fit: cover;
}
.who b {
  display: block;
}
.who small {
  color: var(--muted);
}
/* Continue, Pause, Stop. */
.calls {
  display: flex;
  gap: 8px;
}
.call {
  flex: 1 1 0;
  min-width: 0;
  min-height: 60px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  border: 1px solid transparent;
  box-shadow: 0 2px 0 rgba(14, 27, 51, 0.12), var(--shadow-sm);
  touch-action: manipulation;
}
.call svg {
  width: 18px;
  height: 18px;
}
.call.continue {
  background: var(--brand);
  color: #fff;
}
.call.pause {
  background: var(--pause-bg);
  color: var(--pause-ink);
  border-color: var(--pause-line);
}
.call.stop {
  background: var(--stop);
  color: #fff;
}
.call:disabled {
  opacity: 0.42;
  cursor: default;
}
.call.slam {
  animation: slam 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes slam {
  0% {
    transform: scale(0.88) translateY(3px);
  }
  55% {
    transform: scale(1.05);
  }
}
.reasons {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 16px;
  border: 2px solid var(--stop);
  background: var(--bad-soft);
}
.reasons.pause {
  border-color: var(--pause-line);
  background: var(--pause-bg);
}
.reasons b {
  font-family: var(--display);
}
.reason {
  text-align: left;
  min-height: 42px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}
.gauge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 13px;
}
.gauge b {
  font-family: var(--display);
  font-size: 18px;
}
.gauge.bad {
  border-color: #f2b8b8;
  background: var(--bad-soft);
  color: var(--bad);
}
.ask {
  padding: 10px 12px;
  border-radius: 14px;
  border: 2px solid var(--brand);
  background: #fff;
  font-weight: 700;
}
.fb {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  animation: fb-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}
.fb b {
  font-family: var(--display);
  font-size: 16px;
}
.fb.good {
  border-color: #9fd9b4;
  background: var(--ok-soft);
}
.fb.good b {
  color: var(--ok);
}
.fb.warn {
  border-color: #f0d28a;
  background: var(--warn-soft);
}
.fb.warn b {
  color: var(--warn);
}
@keyframes fb-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 16px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.15;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s;
}
.btn:active {
  transform: scale(0.97);
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn.primary:hover {
  background: var(--brand-ink);
}
.btn.big {
  min-height: 54px;
  font-size: 16px;
  font-family: var(--display);
  font-weight: 800;
  width: 100%;
}
.btn.small {
  min-height: 36px;
  font-size: 13px;
  padding: 0 13px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn .key {
  display: none;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.75;
}
@media (hover: hover) and (pointer: fine) {
  .btn .key {
    display: inline;
  }
}
.btn.glow {
  animation: nudge-b 1.2s ease-in-out infinite;
}

/* ---- Rules ---- */
.rule {
  display: grid;
  gap: 6px;
  padding: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.rule .plain {
  font-weight: 600;
  color: var(--ink);
}
.rule blockquote {
  margin: 0;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
}
.rule .cite {
  color: var(--muted);
  font-size: 12px;
}

/* ---- Modals: the title, a night's brief, the board, the near miss card, the crew card ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 16px;
  background: rgba(5, 9, 18, 0.45);
  animation: fade 0.25s ease;
}
.modal.clear {
  background: rgba(5, 9, 18, 0.12);
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.sheet {
  width: min(620px, 100%);
  justify-self: center;
  min-width: 0;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  animation: sheet-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
}
.sheet h1 {
  font-size: clamp(30px, 6vw, 42px);
  font-weight: 800;
  line-height: 1.05;
}
.sheet h2 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
}
.sheet h3 {
  font-size: 15px;
  font-weight: 700;
}
.lead {
  color: var(--ink-2);
  font-size: 15.5px;
}
.sheet .row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.sheet .chip {
  white-space: normal;
}
.sheet .buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sheet .buttons .btn {
  flex: 1 1 180px;
  min-height: 50px;
}
.sheet > .buttons {
  position: sticky;
  bottom: -20px;
  margin-bottom: -20px;
  padding: 10px 0 20px;
  background: linear-gradient(rgba(255, 255, 255, 0), #fff 12px);
}
.checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.checks li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  font-size: 14.5px;
}
.checks li i {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ok-soft);
  color: var(--ok);
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  margin-top: 1px;
}
.credit {
  color: var(--muted);
  font-size: 12px;
}
.panel-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  display: grid;
  gap: 8px;
  background: #fff;
}
.panel-box.soft {
  background: var(--bg-soft);
}
details.more summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-2);
  font-size: 14px;
}
.verdict-head {
  display: grid;
  gap: 6px;
}
/* The board: the jobs waiting. */
.board-map {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}
.board-map canvas {
  display: block;
  width: 100%;
  height: auto;
}
.jobs {
  display: grid;
  gap: 8px;
}
.jobcard {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}
.jobcard.target {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}
.jobcard .ic {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
}
.jobcard .ic svg {
  width: 22px;
  height: 22px;
}
.jobcard .ic.danger {
  background: var(--danger);
}
.jobcard .ic.critical {
  background: var(--critical);
}
.jobcard .ic.customers {
  background: var(--customers);
}
.jobcard .ic.end {
  background: var(--ok);
}
.jobcard b {
  display: block;
  font-size: 15px;
}
.jobcard p {
  font-size: 13px;
  color: var(--ink-2);
}
.jobcard .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.board-note {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #f0d28a;
  background: var(--warn-soft);
  display: grid;
  gap: 4px;
  font-size: 13.5px;
}
.board-note b {
  font-family: var(--display);
  color: var(--warn);
}
/* The crew card. */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  gap: 2px;
  background: #fff;
}
.stat b {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.stat span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.my {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: center;
}
.my img {
  width: 76px;
  height: 92px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--brand-soft);
}
.my b {
  font-family: var(--display);
  font-size: 17px;
  display: block;
}
.my span {
  color: var(--ink-2);
  font-size: 13.5px;
}
.rungs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.rung {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.rung > span {
  min-width: 0;
}
.rung.held {
  background: var(--ok-soft);
  border-color: #bfe3cb;
}
.rung.next {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}
.rung.locked {
  opacity: 0.6;
}
.rung .n {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 13px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.rung.held .n {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
.rung b {
  display: block;
  font-size: 14px;
}
.rung small {
  color: var(--muted);
  font-size: 12px;
}
.rung .go {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
}
.rung.next .go {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.rung.levelup {
  animation: levelup 1.2s ease;
}
@keyframes levelup {
  0% {
    transform: scale(0.96);
    box-shadow: 0 0 0 0 rgba(21, 128, 61, 0.5);
  }
  40% {
    transform: scale(1.03);
    box-shadow: 0 0 0 10px rgba(21, 128, 61, 0);
  }
}
.stars {
  display: inline-flex;
  gap: 2px;
}
.stars svg {
  width: 16px;
  height: 16px;
}
.stars.big svg {
  width: 38px;
  height: 38px;
}
.stars.big svg.got {
  animation: star 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}
.stars.big svg:nth-child(2) {
  animation-delay: 0.15s;
}
.stars.big svg:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes star {
  from {
    transform: scale(0) rotate(-40deg);
  }
}
.tip-land {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #bcd0fb;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 13.5px;
  font-weight: 600;
}
.tip-land svg {
  width: 26px;
  height: 26px;
  flex: none;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 200px;
  transform: translateX(-50%);
  z-index: 30;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  max-width: calc(100vw - 24px);
  text-align: center;
}
.toast.on {
  opacity: 1;
  transform: translate(-50%, -6px);
}
.toast.good {
  background: var(--ok);
}

/* ---- Portrait and narrow screens: the panel goes under the world ---- */
@media (orientation: portrait), (max-width: 760px) and (min-aspect-ratio: 0.9) and (max-aspect-ratio: 1.2) {
  .app.job {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 54%);
  }
  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
  }
  .panel-in {
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  }
}
@media (max-width: 599px) {
  .modal {
    place-items: end stretch;
    padding: 0;
  }
  .sheet {
    width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .sheet > .buttons {
    bottom: calc(-16px - env(safe-area-inset-bottom));
    margin-bottom: calc(-16px - env(safe-area-inset-bottom));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .hud {
    inset: 8px 8px auto 8px;
    gap: 5px;
  }
  .pill {
    min-height: 34px;
    padding: 3px 9px;
    gap: 6px;
  }
  .mycard {
    padding: 2px 9px 2px 2px;
  }
  .mycard img {
    width: 28px;
    height: 28px;
  }
  .mycard small,
  .streak small,
  .lights small,
  .lights .bar {
    display: none;
  }
  .mycard b {
    font-size: 12px;
  }
  .clock b {
    font-size: 15px;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
  }
  .streak {
    display: none;
  }
  .minimap {
    width: 118px;
    height: 88px;
    top: 50px;
    right: 8px;
  }
  .stage .draft-tag {
    top: 50px;
    left: 8px;
    font-size: 10px;
  }
  .target {
    top: auto;
    bottom: 236px;
    max-width: calc(100% - 20px);
    font-size: 12.5px;
  }
  .radio {
    top: 146px;
  }
  .coach {
    bottom: 290px;
    font-size: 12.5px;
    border-radius: 16px;
  }
  .wheel {
    width: 150px;
    height: 78px;
  }
  .wheel-in {
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
  }
  .wheel-in span {
    width: 38px;
    height: 38px;
  }
  .inds {
    gap: 30px;
  }
  .ind {
    width: 50px;
    height: 42px;
  }
  .pedal.brake {
    width: 74px;
    height: 70px;
  }
  .pedal.go {
    width: 78px;
    height: 104px;
  }
  .tool span {
    display: none;
  }
  .speedo {
    bottom: 158px;
    padding: 4px 8px 4px 12px;
  }
  .speedo b {
    font-size: 26px;
  }
  .speedo .limit {
    width: 28px;
    height: 28px;
    border-width: 3px;
    font-size: 12px;
  }
  .handle {
    min-width: 54px;
    height: 38px;
    padding: 0 9px;
    font-size: 13px;
    gap: 4px;
  }
  .handle svg {
    width: 13px;
    height: 13px;
  }
  .endpin {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }
  .stopbtn {
    min-width: 62px;
    min-height: 42px;
    font-size: 15px;
  }
  .gap {
    padding: 6px 8px;
  }
  .gap b {
    font-size: 15px;
  }
  .gap .mini {
    width: 30px;
    height: 30px;
  }
}
/* Phone held sideways: low and wide. Keep the world clear: small HUD, controls in the corners. */
@media (orientation: landscape) and (max-height: 500px) {
  .hud {
    inset: 6px 8px auto 8px;
  }
  .pill {
    min-height: 32px;
    padding: 2px 9px;
  }
  .mycard small,
  .lights .bar,
  .streak small {
    display: none;
  }
  .minimap {
    top: 46px;
    width: 128px;
    height: 94px;
  }
  .stage .draft-tag {
    top: 46px;
    font-size: 10px;
  }
  .target {
    top: 44px;
    font-size: 12.5px;
    max-width: calc(100% - 300px);
  }
  .radio {
    top: 84px;
  }
  .speedo {
    bottom: 8px;
  }
  .speedo b {
    font-size: 26px;
  }
  .coach {
    bottom: 64px;
  }
  .wheel {
    width: 170px;
    height: 76px;
  }
  .pedal.go {
    height: 96px;
  }
  .pedal.brake {
    height: 66px;
  }
  .touch {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .app.job {
    --panel-w: min(380px, 46vw);
  }
  .panel-in {
    padding: 10px 12px;
    gap: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
