:root {
  --bg: rgba(14, 16, 20, 0.78);
  --bg2: rgba(22, 25, 31, 0.92);
  --line: rgba(255, 255, 255, 0.10);
  --fg: #e9ecf1;
  --muted: #98a0ad;
  --accent: #35d0ff;
  --warn: #ffb020;
  --bad: #ff4d4d;
  --ok: #3ddc84;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0d10; color: var(--fg); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
button:hover { background: rgba(255, 255, 255, 0.08); }
button.active { background: var(--accent); color: #05131a; border-color: transparent; font-weight: 600; }
.pill { border-radius: 999px; }
.pill.hot { border-color: var(--bad); color: var(--bad); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
code { font-family: var(--mono); font-size: 12.5px; }
a { color: var(--accent); }

#top { position: fixed; top: 0; left: 0; right: 0; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: linear-gradient(180deg, rgba(8, 10, 14, 0.85), rgba(8, 10, 14, 0.35)); backdrop-filter: blur(8px); z-index: 5; gap: 12px; }
#top .brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
#top .logo { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff 0 18%, #0b0d10 19% 100%); box-shadow: 0 0 0 2px var(--fg); }
#top .name { font-weight: 700; letter-spacing: 0.04em; }
#top .sub { color: var(--muted); }
#top .mid { display: flex; align-items: center; gap: 12px; }
#top .right { display: flex; align-items: center; gap: 8px; }
#top .cams { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
#top .cams button { border: 0; border-radius: 0; padding: 5px 12px; }
#clock { font-family: var(--mono); font-size: 15px; }
#conn { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 999px; border: 1px solid; }
#conn.ok { color: var(--ok); border-color: var(--ok); }
#conn.bad { color: var(--warn); border-color: var(--warn); }

aside { position: fixed; top: 60px; background: var(--bg); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 14px; z-index: 4; overflow: auto; }
#fleet { left: 12px; width: 280px; max-height: calc(100% - 290px); padding: 12px; transform: translateX(-320px); transition: transform 0.25s; }
#fleet.open { transform: none; }
#fleet h3 { margin: 4px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
#fleet .hint { color: var(--muted); font-size: 12px; }
.fleet-row { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 8px; align-items: center; width: 100%; text-align: left; border: 0; border-radius: 8px; padding: 6px 8px; }
.fleet-row.selected { background: rgba(53, 208, 255, 0.18); }
.fleet-row .swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.3); }
.fleet-row .plate { font-family: var(--mono); color: var(--muted); }
.fleet-row .status { font-size: 11px; color: var(--muted); min-width: 40px; text-align: right; }
.fleet-row .status.off { color: var(--warn); }
.fleet-row .status.crashed { color: var(--bad); }
em { font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--warn); margin-left: 4px; }

#vehicle { right: 12px; width: 380px; max-height: calc(100% - 72px); padding: 14px 16px 18px; transform: translateX(420px); transition: transform 0.25s; }
#vehicle.open { transform: none; }
#close-vehicle, .close { position: absolute; top: 8px; right: 8px; border: 0; width: 28px; height: 28px; border-radius: 50%; padding: 0; color: var(--muted); }
.vhead { display: flex; gap: 12px; align-items: center; }
.vhead h2 { margin: 0; font-size: 22px; }
.vhead .tag { color: var(--muted); }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); flex: none; }
.proto { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; background: var(--warn); color: #201400; padding: 2px 6px; border-radius: 4px; vertical-align: middle; }
.ident { margin: 12px 0; display: grid; gap: 4px; }
.ident > div { display: flex; gap: 10px; align-items: baseline; }
.ident .k { color: var(--muted); width: 44px; font-size: 12px; }
.ident code { cursor: pointer; }
.telemetry { display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: rgba(0, 0, 0, 0.3); border-radius: 10px; }
#t-speed { font-family: var(--mono); font-size: 20px; }
#t-flags { flex: 1; color: var(--muted); }
#t-flags.aeb { color: var(--bad); font-weight: 700; }
#t-flags.crashed { color: var(--bad); }
.routebar { margin: 10px 0; }
.routebar label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.routebar input { display: none; }
#v-route { font-size: 12px; margin-top: 4px; }

.fgroup { margin: 12px 0 6px; }
.fgroup h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); display: flex; justify-content: space-between; }
.lock { color: var(--warn); }
/* Read-only safety dashboard: a status lamp per system, never a control. A
   system only goes offline when its challenge is solved, so the viewer gives
   no switch to flip and no illusion that one exists. */
.feature { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); cursor: default; align-items: start; }
.fcaption { font-size: 11px; color: var(--muted); margin-bottom: 8px; line-height: 1.4; }
.fdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); margin-top: 5px; box-shadow: 0 0 7px rgba(53, 208, 124, 0.55); }
.feature.off .fdot { background: var(--bad); box-shadow: 0 0 7px rgba(255, 93, 93, 0.55); }
.feature.degraded .fdot { background: var(--warn); box-shadow: 0 0 7px rgba(240, 180, 40, 0.55); }
/* .switch is a real viewer control (e.g. the "Show its loop" route toggle),
   never a safety-system control. The safety panel uses .fdot lamps above. */
.switch { display: inline-block; width: 34px; height: 20px; border-radius: 999px; background: #3a4150; position: relative; transition: background 0.2s; vertical-align: middle; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
input:checked + .switch { background: var(--ok); }
input:checked + .switch::after { transform: translateX(14px); }
input:disabled + .switch { opacity: 0.45; }
.feature.off .fname { color: var(--muted); text-decoration: line-through; }
.fname { font-weight: 600; }
.fdesc { color: var(--muted); font-size: 12px; }
.fstatus { font-size: 11px; color: var(--ok); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }
.feature.off .fstatus { color: var(--bad); }
.feature.degraded .fstatus { color: var(--warn); text-transform: none; letter-spacing: 0; }
.actions { margin: 8px 0 14px; }
#vehicle h4 { margin: 14px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.inc-row { display: block; width: 100%; text-align: left; margin: 4px 0; font-size: 12.5px; }
.curl { background: rgba(0, 0, 0, 0.4); padding: 10px; border-radius: 8px; font-size: 11.5px; white-space: pre-wrap; cursor: pointer; margin: 0; }

#feed { position: fixed; left: 12px; bottom: 12px; width: 460px; max-height: 190px; overflow: auto; z-index: 3; font-size: 12.5px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(10px); }
.ev { display: flex; gap: 10px; padding: 2px 0; }
.ev .t { color: var(--muted); font-family: var(--mono); flex: none; }
.ev.place { cursor: pointer; }
.ev.place:hover .txt { text-decoration: underline; }
.ev-aeb .txt { color: #ff9a9a; }
.ev-crash .txt { color: var(--bad); font-weight: 700; }
.ev-hazard .txt { color: var(--warn); }
.ev-config .txt { color: var(--accent); }
.ev-slide .txt, .ev-fault .txt, .ev-evade .txt { color: #ffd27a; }
.ev-tow .txt, .ev-respawn .txt, .ev-recover .txt, .ev-home .txt { color: var(--muted); }

#chip { position: fixed; top: 60px; right: 12px; display: none; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--accent); border-radius: 999px; backdrop-filter: blur(10px); z-index: 4; font-weight: 600; }
#chip.show { display: flex; }
#chip .swatch { width: 16px; height: 16px; border-width: 1px; }
#chip button { padding: 3px 9px; font-size: 12px; font-weight: 500; }
#chip button.active { background: var(--accent); color: #05131a; }
.engbar .muted { font-weight: 400; font-size: 12px; }

#toasts { position: fixed; bottom: 158px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 8; }
.toast { background: var(--bg2); border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; opacity: 0; transform: translateY(8px); transition: all 0.3s; max-width: 380px; }
.toast.show { opacity: 1; transform: none; }
.toast.hot { border-color: var(--bad); cursor: pointer; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); display: none; align-items: center; justify-content: center; z-index: 9; }
.modal.open { display: flex; }
.modal-box { position: relative; width: min(760px, 92vw); max-height: 86vh; overflow: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; }
.modal-box .close { position: sticky; float: right; top: 0; margin: -8px -12px 0 8px; background: var(--bg2); z-index: 2; width: 36px; height: 36px; font-size: 18px; }
.modal-box h3 { padding-right: 40px; }
.toast .dismiss { margin-left: 10px; color: var(--muted); font-weight: 700; cursor: pointer; }
.modal-box h3 { margin: 0 0 10px; }
.inc-meta { color: var(--muted); margin-bottom: 8px; }
.inc-narrative { margin: 6px 0; }
.inc-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.inc-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.inc-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.inc-flags h4 { margin: 12px 0 6px; }
.flag { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: rgba(61, 220, 132, 0.1); border: 1px solid rgba(61, 220, 132, 0.35); border-radius: 10px; margin: 6px 0; }
.flag .ftitle { font-weight: 700; min-width: 120px; }
.flag code { flex: 1; color: var(--ok); }
.flag .copy { padding: 3px 8px; }

body.dusk #top { background: linear-gradient(180deg, rgba(20, 12, 22, 0.85), rgba(20, 12, 22, 0.3)); }
body.night #top { background: linear-gradient(180deg, rgba(6, 10, 20, 0.9), rgba(6, 10, 20, 0.35)); }

@media (max-width: 1100px) {
  #top .sub { display: none; }
  #top { gap: 8px; padding: 0 8px; }
  #top .mid { gap: 8px; }
  #top button { padding: 4px 8px; font-size: 13px; }
  #incidents-btn { white-space: nowrap; }
}

/* Phones: the top bar wraps into two rows, the fleet list is a sheet from the
   left, the vehicle panel a bottom sheet, and the feed makes room for it. */
@media (max-width: 760px) {
  html, body { height: 100dvh; }
  #top { height: auto; flex-wrap: wrap; padding: 6px 8px 8px; gap: 6px 8px; row-gap: 6px; }
  #top .brand { gap: 8px; }
  #top .brand .name { font-size: 13px; }
  #top .mid { margin-left: auto; gap: 8px; }
  #top .mid #conn { display: inline-block; }
  #top .right { flex-basis: 100%; justify-content: space-between; gap: 6px; }
  #top button { padding: 4px 9px; font-size: 12px; }
  #top .cams button { padding: 4px 9px; }
  #world-id { display: none; }
  #clock { font-size: 13px; }
  aside { top: 104px; }
  #fleet { left: 0; width: min(320px, 86vw); max-height: calc(100dvh - 210px); border-radius: 0 14px 14px 0; transform: translateX(-100%); }
  #vehicle { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 56dvh; padding: 12px 14px 20px; border-radius: 16px 16px 0 0; transform: translateY(110%); }
  #vehicle.open { transform: none; }
  #vehicle::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 10px; }
  .vhead h2 { font-size: 19px; }
  #feed { left: 8px; right: 8px; width: auto; bottom: 8px; max-height: 92px; font-size: 11.5px; padding: 6px 8px; }
  body.panel-open #feed { display: none; }
  #chip { position: fixed; top: 60px; right: 12px; display: none; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--accent); border-radius: 999px; backdrop-filter: blur(10px); z-index: 4; font-weight: 600; }
#chip.show { display: flex; }
#chip .swatch { width: 16px; height: 16px; border-width: 1px; }
#chip button { padding: 3px 9px; font-size: 12px; font-weight: 500; }
#chip button.active { background: var(--accent); color: #05131a; }
.engbar .muted { font-weight: 400; font-size: 12px; }

#toasts { left: 8px; right: 8px; bottom: 8px; }
  .toast { max-width: none; }
  .modal { align-items: flex-end; }
  .modal-box { width: 100vw; max-height: 88dvh; padding: 14px 16px 24px; border-radius: 16px 16px 0 0; }
  .modal-box::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 10px; }
  .inc-table { font-size: 12px; }
  .inc-table th, .inc-table td { padding: 5px 4px; }
  .flag { flex-wrap: wrap; }
  .flag code { flex-basis: 100%; word-break: break-all; }
}

/* ---------------------------------------------------------------- mission */
#mx { position: fixed; inset: 0; pointer-events: none; z-index: 40; font: inherit; }
#mx button, #mx a, #mx input, #mx .mx-stick { pointer-events: auto; }
/* Mission launch buttons live bottom-right, clear of the traffic feed and the
   pwned-car box (both bottom-left). They hide once a mission is active so they
   never sit on top of the mission note/ECU panels (also bottom-right). */
.mx-launch {
  position: fixed; right: 12px; left: auto; bottom: 12px; padding: 9px 14px; border-radius: 9px;
  background: #b3261e; color: #fff; border: 0; font-weight: 600; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.35); text-align: left;
}
.mx-launch:hover { background: #c93229; }
.mx-launch2 { right: 12px; left: auto; bottom: 60px; background: #7a4a12; }
.mx-launch2:hover { background: #8f5a1c; }
.mx-launch3 { right: 12px; left: auto; bottom: 108px; background: #7a5a12; }
.mx-launch3:hover { background: #8f6c1c; }
.mx-launch4 { right: 12px; left: auto; bottom: 156px; background: #146a8f; }
.mx-launch4:hover { background: #1a82ad; }
body.mx-active .mx-launch { display: none; }
.mx-svcpw { display: block; margin: 4px 12px 8px; width: calc(100% - 24px); box-sizing: border-box; padding: 10px; border-radius: 8px; border: 1px solid #3a4a3a; background: #0f150f; color: #dfeada; font: inherit; }
.mx-svcresult { margin: 0 12px 12px; color: #d98a3a; font-size: 13px; min-height: 16px; }
.mx-svccancel { background: #3a4048; margin-top: 6px; }
.mx-svccancel:hover { background: #474e57; }
.mx-banner {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); max-width: 90vw;
  background: rgba(20,22,28,.86); color: #f2f4f8; padding: 8px 16px; border-radius: 20px; font-size: 14px;
}
.mx-hud {
  position: fixed; left: 12px; bottom: 12px; display: flex; gap: 8px; align-items: center;
  background: rgba(20,22,28,.86); color: #e8ebf0; padding: 8px 10px; border-radius: 10px; font-size: 13px;
}
.mx-hud #mx-stage { font-weight: 600; }
.mx-dist { color: #ffd27a; font-variant-numeric: tabular-nums; }
.mx-act { background: #2f6f43; color: #fff; border: 0; border-radius: 8px; padding: 7px 12px; cursor: pointer; }
.mx-act:disabled { background: #444a52; color: #9aa2ac; cursor: default; }
.mx-quit { background: transparent; color: #9aa2ac; border: 1px solid #444a52; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.mx-laptop {
  position: fixed; right: 12px; bottom: 12px; width: min(420px, 92vw); max-height: 62vh;
  background: #0d1117; color: #cdd6e4; border: 1px solid #2b3138; border-radius: 12px;
  display: flex; flex-direction: column; box-shadow: 0 8px 30px rgba(0,0,0,.5); overflow: hidden;
}
.mx-lhead { padding: 8px 12px; background: #161b22; font-weight: 600; display: flex; justify-content: space-between; }
.mx-lclose { cursor: pointer; color: #8a929c; padding: 0 6px; }
.mx-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
.mx-chip { font-size: 11px; padding: 3px 8px; border-radius: 12px; background: #21262d; color: #8a929c; }
.mx-chip.ok { background: #16391f; color: #6ee79a; }
.mx-log { flex: 1; overflow-y: auto; padding: 8px 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; line-height: 1.5; min-height: 120px; }
.mx-l-tx { color: #9ecbff; }
.mx-l-rx { color: #6ee79a; }
.mx-l-err { color: #ff9a9a; }
.mx-l-sys { color: #7a828c; }
.mx-form { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid #21262d; }
.mx-form input { flex: 1; background: #0b0e13; color: #e8ebf0; border: 1px solid #2b3138; border-radius: 7px; padding: 7px 9px; font-family: ui-monospace, monospace; }
.mx-form button { background: #2f6f43; color: #fff; border: 0; border-radius: 7px; padding: 7px 12px; cursor: pointer; }
.mx-note { padding: 6px 12px 10px; font-size: 11px; color: #7a828c; }
.mx-note a { color: #9ecbff; }
.mx-stick {
  position: fixed; left: 18px; bottom: 74px; width: 120px; height: 120px; border-radius: 50%;
  background: rgba(20,22,28,.4); border: 1px solid rgba(255,255,255,.18); touch-action: none;
}
.mx-knob { position: absolute; left: 34px; top: 34px; width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.6); }
.mx-flag {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); text-align: center;
  background: rgba(13,17,23,.95); color: #e8ebf0; padding: 22px 26px; border-radius: 14px; border: 1px solid #2b3138;
}
.mx-flag h3 { margin: 0 0 6px; }
.mx-flag code { display: block; margin: 12px 0; padding: 10px; background: #0b0e13; border-radius: 8px; color: #6ee79a; word-break: break-all; }
.mx-flag button { background: #2f6f43; color: #fff; border: 0; border-radius: 8px; padding: 8px 16px; cursor: pointer; }

#mx [hidden] { display: none !important; }

@media (max-width: 760px) {
  body.mx-active #feed { display: none; }
  .mx-hud { bottom: 12px; left: 150px; right: 12px; flex-wrap: wrap; }
  .mx-stick { left: 14px; bottom: 14px; width: 130px; height: 130px; }
  .mx-knob { left: 39px; top: 39px; }
  .mx-launch { bottom: 108px; }
  .mx-launch2 { bottom: 148px; }
  .mx-launch3 { bottom: 188px; }
  .mx-launch4 { bottom: 228px; }
  body.mx-active .mx-launch { display: none; }
  .mx-laptop { max-height: 58vh; }
}

/* the confidential note panel */
.mx-note-panel {
  position: fixed; right: 12px; bottom: 12px; width: min(440px, 92vw); max-height: 60vh;
  background: #16110a; color: #efe6d2; border: 1px solid #6b5a2e; border-radius: 12px;
  display: flex; flex-direction: column; box-shadow: 0 8px 30px rgba(0,0,0,.5); overflow: hidden; z-index: 41;
}
.mx-nhead { padding: 9px 12px; background: #241a0d; font-weight: 700; letter-spacing: .3px; display: flex; justify-content: space-between; color: #e9c979; }
.mx-nbody { padding: 12px 14px; overflow-y: auto; font: 13px/1.6 ui-monospace, Menlo, monospace; white-space: pre-wrap; }
@media (max-width: 760px) {
  .mx-note-panel { left: 8px; right: 8px; width: auto; max-height: 52vh; }
}

/* run button and the wasted screen */
.mx-runbtn {
  position: fixed; left: 152px; bottom: 30px; width: 74px; height: 74px; border-radius: 50%;
  background: rgba(20,22,28,.5); border: 1px solid rgba(255,255,255,.25); color: #e8ebf0;
  font: 600 13px/1 system-ui, sans-serif; touch-action: none;
}
.mx-runbtn.on { background: #b3261e; border-color: #e0503f; color: #fff; }
.mx-dead {
  position: fixed; inset: 0; z-index: 60; background: rgba(6,6,8,.72);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  backdrop-filter: grayscale(1) blur(2px);
}
.mx-deadtext { font: 800 76px/1 Georgia, serif; letter-spacing: .06em; color: #b3261e; text-shadow: 0 3px 20px rgba(0,0,0,.6); }
.mx-deadsub { color: #d8d8d8; font-size: 15px; margin: 0; }
.mx-dead button { margin-top: 12px; background: #2f6f43; color: #fff; border: 0; border-radius: 9px; padding: 10px 20px; font-size: 15px; cursor: pointer; }
.mx-nlink { display: block; margin: 0 14px 12px; color: #e9c979; font: 600 12px/1.6 Arial, sans-serif; }

/* ECU chooser and the laptop link panel */
.mx-ecu, .mx-linkpanel {
  position: fixed; right: 12px; bottom: 12px; width: min(380px, 92vw);
  background: #0d141a; color: #cdd6e4; border: 1px solid #26333c; border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); z-index: 42; overflow: hidden;
}
.mx-ecus { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.mx-ecus button { text-align: left; background: #16232b; border: 1px solid #26333c; color: #dfeadf; border-radius: 8px; padding: 10px 12px; cursor: pointer; font: inherit; }
.mx-ecus button:hover { background: #1d2f39; border-color: #3a4f5c; }
.mx-ecuresult { padding: 0 12px 12px; color: #ff9a9a; font-size: 13px; min-height: 6px; }
.mx-linkpanel p { margin: 12px; color: #93a593; font-size: 13px; }
.mx-openbtn { display: block; margin: 0 12px 14px; text-align: center; background: #1f6f43; color: #fff; text-decoration: none; padding: 11px; border-radius: 9px; font-weight: 600; }
.mx-openbtn:hover { background: #238049; }
@media (max-width: 760px) { .mx-ecu, .mx-linkpanel { left: 8px; right: 8px; width: auto; } }

/* the WASTED flash is transient and must not eat clicks/keys */
.mx-dead { pointer-events: none; }

.modal-box.landing { width: min(560px, 92vw); }
.landing-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.landing-actions .pill { padding: 10px 16px; font-size: 14px; }
.landing-actions .pill.primary { background: var(--accent, #35d0ff); color: #06131a; border-color: transparent; }
.landing .err { color: #ff8080; }

.landing-create { display: grid; gap: 8px; margin-top: 16px; }
.landing-create label { font-size: 12px; color: var(--muted, #98a0ad); }
.landing-create input { padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line, #2b3444);
  background: var(--bg, #0d1017); color: inherit; font: inherit; }
.landing-create .pill { padding: 10px 16px; font-size: 14px; justify-self: start; }
.landing-create .pill:disabled { opacity: .5; cursor: not-allowed; }
#team-label { margin-right: 4px; }
/* phones: the top bar wraps instead of pushing the last buttons off screen */
@media (max-width: 760px) {
  #top { flex-wrap: wrap; row-gap: 6px; }
  #top .right { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
  #top .mid { order: 3; width: 100%; justify-content: space-between; }
}

#top .pill.danger { border-color: rgba(255,93,93,.6); color: #ff8a8a; }
#world-state .modal-box { border-color: rgba(255,176,32,.5); }
#world-state.gone .modal-box { border-color: rgba(255,93,93,.6); }

/* "pwned" follow box: cars sabotaged by solving a challenge, en route to a crash */
#pwned { position: fixed; left: 12px; bottom: 210px; width: 460px; z-index: 3; font-size: 12.5px;
  padding: 8px 10px; background: var(--bg); border: 1px solid var(--warn); border-radius: 12px; backdrop-filter: blur(10px); }
#pwned h4 { margin: 0 0 6px; font-size: 12px; color: var(--warn); }
.pwn-row { display: block; width: 100%; text-align: left; background: transparent; border: 0;
  color: inherit; padding: 3px 2px; cursor: pointer; font: inherit; }
.pwn-row:hover { text-decoration: underline; }
.pwn-row .pw-car { font-weight: 700; margin-right: 8px; }
.pwn-row .pw-sys { color: var(--muted); }
body.mx-active #pwned, body.panel-open #pwned { display: none; }
@media (max-width: 720px) { #pwned { left: 8px; right: 8px; width: auto; bottom: 110px; } }

/* operator-mission launch buttons: a subtitle naming the challenge */
.mx-launch small { display: block; font-weight: 400; opacity: .7; font-size: .78em; margin-top: 1px; }
/* minimised note / module panels: keep the header bar, hide the body */
.mx-note-panel.mx-collapsed .mx-nbody, .mx-note-panel.mx-collapsed .mx-nlink,
.mx-ecu.mx-collapsed .mx-ecus, .mx-ecu.mx-collapsed .mx-ecuresult { display: none; }
.mx-lclose { cursor: pointer; user-select: none; padding: 0 6px; }
/* earned-flags log */
.flagrow { display: flex; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.flagrow .ftitle { min-width: 180px; font-weight: 600; }
.flagrow code { cursor: pointer; }
