/* ---------- font (bundled so the sim works offline; SIL OFL, see fonts/OFL.txt) ---------- */
@font-face { font-family: "RC Encode"; src: url(../fonts/encode-sans-sc-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "RC Encode"; src: url(../fonts/encode-sans-sc-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "RC Encode"; src: url(../fonts/encode-sans-sc-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "RC Encode"; src: url(../fonts/encode-sans-sc-800.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
  /* red & white theme */
  --red: #e63946;
  --red-bright: #ff5866;
  --red-deep: #a4161a;
  --white: #ffffff;
  --text: #f6f2f2;
  --muted: #b9abac;
  --amber: #ffb81c;
  --ok: #2fd27a;
  --bad: #ff3b4a;

  --bg: rgba(18, 10, 11, 0.74);       /* HUD boxes: dark with a slight red cast */
  --bg-solid: #151011;
  --bg-raise: #241a1b;
  --line: rgba(255, 255, 255, 0.12);
  --glass: rgba(10, 5, 6, 0.42);      /* menu panels over the blurred field */
  --glass-2: rgba(255, 255, 255, 0.10);

  --accent: var(--red);
  --font: "RC Encode", "Arial Narrow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text); font: 500 14px/1.4 var(--font); }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#scene.swap { animation: field-in 0.5s ease-out; } /* a newly loaded field fades in */
@keyframes field-in { from { opacity: 0.2; } }
.hidden { display: none !important; }
body.hud-off #hud, body.hud-off #hud-right, body.hud-off #sticks, body.hud-off #tx-flags, body.hud-off #help-bar { display: none; }
/* the home menu replaces the flying HUD */
body.in-menu #hud, body.in-menu #hud-right, body.in-menu #sticks, body.in-menu #tx-flags, body.in-menu #help-bar, body.in-menu #brand-badge,
body.in-menu #scenery-credit, body.in-menu #warn, body.in-menu #center-msg, body.in-menu #pause-tag { display: none !important; }

/* ---------- logo ---------- */
.logo {
  display: inline-flex; align-items: center; color: var(--white); font-weight: 800; line-height: 1;
  font-size: 64px; letter-spacing: -0.01em; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28); white-space: nowrap;
}
.logo .logo-plane {
  width: 1.05em; height: 1.05em; margin: 0 0.02em 0 0.06em; fill: var(--red);
  transform: rotate(32deg); filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.28));
}
.logo em { font-style: normal; font-size: 0.42em; color: var(--red-bright); margin: 0.75em 0 0 0.12em; align-self: flex-end; letter-spacing: 0; }

/* ---------- HUD ---------- */
.hud-box {
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 8px 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-variant-numeric: tabular-nums;
}
#hud { position: fixed; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
#hud-flight { border-left: 3px solid var(--red); }
#hud-flight div, #hud-right div { display: flex; align-items: baseline; gap: 6px; min-width: 150px; }
.lbl { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; width: 64px; }
.hud-box b { font-size: 19px; font-weight: 700; min-width: 44px; text-align: right; color: var(--white); }
.hud-box small { color: var(--muted); }
#hud-link { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
#hud-right { position: fixed; top: 12px; right: 12px; pointer-events: none; border-right: 3px solid var(--red); }
#h-wind-arrow { display: inline-block; font-size: 16px; }

#sticks { position: fixed; bottom: 34px; right: 16px; display: flex; gap: 12px; pointer-events: none; }
.gimbal {
  position: relative; width: 86px; height: 86px; border-radius: 6px;
  background: var(--bg); border: 1px solid var(--line);
}
.gimbal .cross::before, .gimbal .cross::after { content: ""; position: absolute; background: var(--line); }
.gimbal .cross::before { left: 50%; top: 8px; bottom: 8px; width: 1px; }
.gimbal .cross::after { top: 50%; left: 8px; right: 8px; height: 1px; }
.stick-dot {
  position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; left: 50%; top: 50%;
  border-radius: 50%; background: var(--white); border: 3px solid var(--red); box-shadow: 0 0 10px rgba(230, 57, 70, 0.8);
}
/* trim bars along the bottom / right edge, like the trim display on a transmitter screen */
.gimbal .trim { position: absolute; background: rgba(255, 255, 255, 0.1); border-radius: 2px; }
.gimbal .trim.h { left: 12px; right: 12px; bottom: 3px; height: 3px; }
.gimbal .trim.v { top: 12px; bottom: 12px; right: 3px; width: 3px; }
.gimbal .trim.off { visibility: hidden; }
.gimbal .trim i { position: absolute; background: var(--muted); border-radius: 1px; }
.gimbal .trim.h i { top: -2px; bottom: -2px; width: 3px; margin-left: -1.5px; left: 50%; }
.gimbal .trim.v i { left: -2px; right: -2px; height: 3px; margin-top: -1.5px; top: 50%; }
.gimbal .trim i.on { background: var(--white); box-shadow: 0 0 4px var(--red); }
#tx-flags { position: fixed; bottom: 128px; right: 16px; display: flex; gap: 6px; pointer-events: none; }
#tx-flags span {
  background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 3px;
  padding: 2px 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; color: var(--white);
}
#h-bat-row.hidden { display: none; }
#h-bat-row.low b { color: var(--amber); }
#h-bat-row.crit b { color: var(--red-bright); }

#warn {
  position: fixed; top: 22%; left: 50%; transform: translateX(-50%);
  color: #fff; background: rgba(214, 30, 44, 0.9); padding: 6px 20px; border-radius: 3px;
  font-weight: 800; font-size: 18px; letter-spacing: 0.15em; animation: blink 0.6s steps(2) infinite; pointer-events: none;
}
@keyframes blink { 50% { opacity: 0.35; } }

#center-msg {
  position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%); text-align: center;
  background: var(--bg); border: 1px solid var(--line); border-top: 3px solid var(--white); border-radius: 4px; padding: 18px 28px;
  font-size: 24px; font-weight: 700; pointer-events: none; max-width: 80vw;
}
#center-msg small { display: block; font-size: 14px; font-weight: 500; color: var(--muted); margin-top: 6px; }
#center-msg.bad { border-top-color: var(--red); }

#toast {
  position: fixed; top: 14%; left: 50%; transform: translateX(-50%); z-index: 25;
  background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 4px; padding: 8px 18px;
  font-size: 17px; font-weight: 600; pointer-events: none; transition: opacity 0.3s;
}
#pause-tag {
  position: fixed; bottom: 44px; left: 14px; color: var(--white); background: var(--red);
  padding: 4px 10px; border-radius: 3px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
}
#help-bar {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  color: var(--muted); font-size: 12.5px; font-weight: 600; background: var(--bg); padding: 4px 12px; border-radius: 4px; white-space: nowrap;
}
kbd {
  font: 11px var(--mono); background: rgba(255, 255, 255, 0.12); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 3px; padding: 1px 5px; margin: 0 1px; color: var(--white);
}

/* ---------- Setup page (the home menu's Setup tab) ----------
   A vertical menu of sections on the left (number, title, one-line summary); the chosen section fills the right. */
#panel {
  position: absolute; z-index: 1; top: 150px; bottom: 112px; left: 50%; transform: translateX(-50%);
  width: min(1180px, 94vw); display: grid; grid-template-columns: 310px 1fr; gap: 14px;
  animation: menu-in 0.25s ease-out; user-select: text; -webkit-user-select: text;
}
#menu:not([data-tab="setup"]) #panel { display: none; }
#menu[data-tab="setup"] .m-right, #menu[data-tab="setup"] .m-slot, #menu[data-tab="setup"] .m-stage { display: none; }
.s-nav { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; }
.s-item {
  display: grid !important; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px;
  align-items: center; text-align: left; padding: 13px 16px !important; background: var(--glass) !important; border-radius: 0 !important;
  border: 2px solid rgba(255, 255, 255, 0.08) !important; transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.s-item.hidden { display: none !important; } /* transmitter-only sections while on the keyboard */
.s-item:hover { background: rgba(255, 255, 255, 0.14) !important; transform: translateX(3px); }
.s-item.on { border-color: var(--red) !important; background: rgba(230, 57, 70, 0.22) !important; box-shadow: inset 4px 0 0 var(--red); }
.s-item .num {
  grid-row: span 2; display: grid; place-items: center; width: 30px; height: 30px; background: var(--red);
  color: var(--white); font-size: 15px; font-weight: 800;
}
.s-item b { font-size: 19px; font-weight: 800; text-transform: uppercase; line-height: 1.1; color: var(--white); }
.s-item .sec-sum {
  min-width: 0; font-size: 12.5px; font-weight: 700; color: rgba(255, 255, 255, 0.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.s-item .sec-sum.ok { color: var(--ok); }
.s-item .sec-sum.bad { color: var(--red-bright); }
.s-nav-foot { margin-top: auto; padding-top: 6px; }
.s-nav-foot #btn-close { width: 100%; padding: 12px !important; font-size: 18px; }
.s-content {
  min-height: 0; overflow-y: auto; padding: 22px 28px 28px; background: rgba(14, 8, 9, 0.86);
  border-top: 3px solid var(--red); color: var(--text); font-size: 14px;
}
.s-content > section { max-width: 780px; animation: menu-in 0.2s ease-out; }
.s-content > section:not(.on) { display: none; }
#panel h2 { margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
#panel h2 .num {
  display: inline-grid; place-items: center; width: 30px; height: 30px; background: var(--red); color: var(--white);
  font-size: 15px; font-weight: 800;
}
#panel h2 b { font-size: 26px; font-weight: 800; text-transform: uppercase; color: var(--white); letter-spacing: 0.01em; }
#panel > footer { display: none; } /* "Reset settings" lives in the menu footer */
@media (max-height: 760px) { #panel { top: 124px; } }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0; }
code { font: 12px var(--mono); background: rgba(255, 255, 255, 0.08); padding: 1px 4px; border-radius: 3px; color: var(--text); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

button, select, input[type=number] {
  font: inherit; font-weight: 600; color: var(--text); background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: 3px; padding: 6px 12px; cursor: pointer;
}
button:hover { background: #33272a; }
button.primary {
  background: var(--red); color: var(--white); border-color: transparent; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em; box-shadow: inset 0 -3px 0 var(--red-deep);
}
button.primary:hover { background: var(--red-bright); }
button.danger { color: var(--red-bright); }
button.small { padding: 2px 8px; font-size: 12px; }
button.active { outline: 2px solid var(--red); }
select { padding: 5px 8px; }
label { color: var(--muted); font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 4px; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.seg button { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; font-weight: 800; }
.seg button small { font-weight: 500; color: var(--muted); font-size: 11px; }
.seg button.on { background: var(--white); color: var(--red-deep); box-shadow: inset 0 -3px 0 var(--red); }
.seg button.on small { color: #6b4a4c; }

.status { margin-top: 10px; font-size: 13.5px; font-weight: 600; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--red-bright); }
.raw-line { font: 11px var(--mono); color: var(--muted); margin-top: 4px; min-height: 14px; word-break: break-all; }

#ch-bars { display: grid; gap: 5px; margin-top: 12px; }
.ch { display: grid; grid-template-columns: 44px 1fr 64px; gap: 8px; align-items: center; font: 12px var(--mono); }
.ch .name { color: var(--muted); }
.ch .name b { color: var(--red-bright); font-weight: 600; }
.bar { position: relative; height: 12px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar .fill { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(90deg, var(--red-deep), var(--red-bright)); border-radius: 2px; }
.bar .mid { position: absolute; top: 0; bottom: 0; width: 1px; left: 50%; background: rgba(255, 255, 255, 0.5); }
.bar .range { position: absolute; top: 0; bottom: 0; border: 1px dashed var(--white); border-radius: 2px; }
.ch .val { text-align: right; }

#map-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
#map-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; padding: 4px 2px; text-transform: uppercase; letter-spacing: 0.05em; }
#map-table td { padding: 4px 2px; }
#map-table select { width: 76px; }
#map-table .out { width: 110px; }
#map-table .bar .fill { background: linear-gradient(90deg, #d8cfcf, var(--white)); }
.learn-hint {
  margin-top: 10px; padding: 10px 12px; border-radius: 3px; background: rgba(230, 57, 70, 0.14);
  border: 1px solid rgba(230, 57, 70, 0.45); border-left-width: 3px; color: var(--text); font-size: 13.5px;
}

#rates { display: grid; gap: 10px; }
.rate-row { display: grid; grid-template-columns: 72px 1fr 1fr 1fr; gap: 10px; align-items: center; font-size: 13.5px; font-weight: 600; }
.trim-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 13.5px; font-weight: 600; }
.trim-row .lbl { width: 62px; }
#trim-vals { display: flex; gap: 14px; flex: 1; color: var(--muted); }
#trim-vals b { color: var(--muted); font-variant-numeric: tabular-nums; }
#trim-vals .on b { color: var(--white); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.grid > label { min-width: 0; }
.grid select { width: 100%; }
.slider { margin: 8px 0; }
.slider output { color: var(--text); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--red); }
input[type=checkbox] { accent-color: var(--red); }
.checks { display: grid; gap: 6px; margin-top: 8px; }
.checks label { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; }
.custom-photo { margin: 8px 0 12px; flex-wrap: nowrap; align-items: flex-start; }
.custom-photo .hint { margin: 0; font-size: 12px; }
.file-btn {
  flex: none; cursor: pointer; color: var(--text); background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: 3px; padding: 6px 12px; font-size: 13px;
}
.file-btn:hover { background: #33272a; }
.file-btn input { display: none; }
#panel section > label { margin-bottom: 4px; }

/* ---------- loading ---------- */
#loading {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(circle at 50% 42%, #3a1418, #120809 70%); z-index: 30; font-size: 15px; font-weight: 600; color: var(--muted);
}
#loading .brand-by { font-size: 15px; font-weight: 700; color: var(--red-bright); letter-spacing: 0.06em; text-transform: uppercase; margin: -4px 0 18px; }
.load-bar { position: relative; width: 240px; height: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.load-bar i { position: absolute; top: 0; bottom: 0; width: 35%; background: var(--red); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { left: -35%; } to { left: 100%; } }
#scenery-credit { position: fixed; bottom: 14px; right: 16px; font-size: 10.5px; color: rgba(255, 255, 255, 0.55); pointer-events: none; text-shadow: 0 1px 2px #000; }
body.hud-off #scenery-credit { display: none; }

/* ---------- branding ---------- */
#brand-badge {
  position: fixed; bottom: 14px; left: 14px; font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, 0.8);
  background: var(--bg); padding: 4px 10px; border-radius: 3px; pointer-events: none; border-left: 3px solid var(--red);
}
#brand-badge b { color: var(--red-bright); font-weight: 700; }
body.hud-off #brand-badge { display: none; }
#center-msg.soft { top: 26%; font-size: 19px; padding: 12px 22px; border-top-color: var(--white); }

/* =====================================================================
   Home menu
   ===================================================================== */
#menu {
  position: fixed; inset: 0; z-index: 6; color: var(--white); user-select: none; -webkit-user-select: none;
  animation: menu-in 0.35s ease-out;
}
@keyframes menu-in { from { opacity: 0; } }
#menu button:not(:where(#panel *)) { font-family: var(--font); border: 0; border-radius: 0; cursor: pointer; color: inherit; background: none; padding: 0; }
#menu h3 { margin: 0; }

/* top band: logo · transmitter, tabs underneath */
.m-top {
  position: absolute; top: 0; left: 0; right: 0; height: 150px;
  background: linear-gradient(rgba(10, 4, 5, 0.72), rgba(10, 4, 5, 0.55));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}
.m-logo { position: absolute; left: 50%; top: 20px; transform: translateX(-50%); }
.m-tx {
  position: absolute; right: 56px; top: 38px; display: flex; align-items: center; gap: 12px;
  background: var(--glass-2) !important; padding: 8px 18px !important; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
  transition: background 0.15s;
}
.m-tx:hover { background: rgba(255, 255, 255, 0.18) !important; }
.m-tx-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.m-tx-text b { font-size: 17px; font-weight: 800; }
.m-tx-text small { font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, 0.6); }
.m-tx.pulse { animation: pulse 1.6s ease-in-out infinite; }
.m-tx.pulse small { color: var(--red-bright); }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.75), 0 0 22px rgba(230, 57, 70, 0.55); } }

.m-tabs { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); display: flex; gap: 6px; }
.m-tabs button {
  position: relative; padding: 10px 22px 13px !important; font-size: 20px; font-weight: 800; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.66) !important; letter-spacing: 0.01em; transition: color 0.15s, background 0.15s;
}
.m-tabs button:hover { color: var(--white) !important; }
.m-tabs button.on { color: var(--white) !important; background: rgba(255, 255, 255, 0.08) !important; }
.m-tabs button.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--red); }

/* centre: the aircraft is drawn on the canvas behind this, between two "slots" to switch planes */
.m-stage { position: absolute; left: 0; right: 0; top: 150px; bottom: 0; cursor: grab; }
.m-stage.dragging { cursor: grabbing; }
.m-slot {
  position: absolute; top: calc(38% - 110px); width: 96px; height: 220px;
  background: rgba(255, 255, 255, 0.06) !important; border: 2px solid rgba(255, 255, 255, 0.06) !important;
  font-size: 64px !important; font-weight: 500; color: rgba(255, 255, 255, 0.45) !important; transition: all 0.15s;
}
.m-slot.prev { left: calc(50% - 15vw - 150px); }
.m-slot.next { right: calc(50% - 15vw - 150px); }
.m-slot:hover { color: var(--white) !important; background: rgba(230, 57, 70, 0.22) !important; border-color: rgba(230, 57, 70, 0.5) !important; }

/* left: pilot log (where an event panel would be) */
.m-left { position: absolute; left: 0; top: 232px; width: 300px; }
.m-ltabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 28px 10px; }
.m-ltab {
  display: grid; place-items: center; height: 40px; font-size: 20px; font-weight: 800;
  background: var(--glass) !important; color: rgba(255, 255, 255, 0.62) !important;
}
.m-ltab.big { grid-column: 1 / -1; margin: 0 22px; color: var(--white) !important; border-bottom: 3px solid var(--red); }
.m-ltabs button.m-ltab:hover { color: var(--white) !important; }
.m-ltabs button.m-ltab.on { background: var(--white) !important; color: var(--red-deep) !important; }
.m-lbody { background: var(--glass); padding: 22px 24px 26px; }
.m-lbody h3 { font-size: 22px; font-weight: 800; padding-bottom: 8px; border-bottom: 2px solid rgba(255, 255, 255, 0.3); margin-bottom: 12px !important; }
.m-log { margin: 0; display: grid; gap: 8px; }
.m-log div { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; font-weight: 700; }
.m-log dt { color: rgba(255, 255, 255, 0.62); }
.m-log dd { margin: 0; font-variant-numeric: tabular-nums; }

/* right: aircraft card */
.m-right { position: absolute; right: 0; top: 232px; width: 300px; background: var(--glass); padding: 22px 24px 24px; border-top: 3px solid var(--red); }
.m-chip {
  display: inline-block; background: var(--amber); color: #2a1a00; font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; transform: rotate(-2deg);
}
.m-right h3 { font-size: 26px; font-weight: 800; line-height: 1.05; margin: 10px 0 6px !important; }
.m-right p { margin: 0 0 14px; color: rgba(255, 255, 255, 0.7); font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.m-stats-bars { display: grid; gap: 6px; }
.m-stat { display: grid; grid-template-columns: 76px 1fr; align-items: center; font-size: 14px; font-weight: 700; color: rgba(255, 255, 255, 0.75); }
.m-stat i { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.m-stat b { height: 9px; background: rgba(255, 255, 255, 0.14); transform: skewX(-18deg); }
.m-stat b.on { background: var(--white); }
.m-stat:nth-child(1) b.on { background: var(--red-bright); }
.m-specs { margin: 16px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.m-specs div { border-left: 3px solid var(--red); padding-left: 8px; }
.m-specs dt { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(255, 255, 255, 0.55); }
.m-specs dd { margin: 0; font-size: 18px; font-weight: 800; }
.m-specs sup { font-size: 0.6em; line-height: 0; }

/* bottom centre: FLY + field card, then two secondary buttons and the conditions line */
.m-play { position: absolute; left: 50%; bottom: 26px; width: 330px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 12px; }
.m-row { display: flex; gap: 12px; position: relative; }
.m-fly {
  flex: 1; height: 86px; background: var(--red) !important; color: var(--white) !important;
  font-size: 66px !important; font-weight: 800 !important; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1;
  box-shadow: inset 0 -5px 0 var(--red-deep), 0 6px 24px rgba(230, 57, 70, 0.35); text-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  transition: background 0.12s, transform 0.08s;
}
.m-fly:hover { background: var(--red-bright) !important; }
.m-fly:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--red-deep); }
.m-mode {
  position: absolute !important; left: calc(100% + 12px); top: 0; width: 148px; height: 86px;
  display: flex; flex-direction: column; background: var(--white) !important; color: var(--red-deep) !important;
  box-shadow: inset 0 -4px 0 #d9cdce; transition: transform 0.1s;
}
.m-mode:hover { transform: translateY(-2px); }
.m-mode b { flex: 1; display: grid; place-items: center; font-size: 26px; font-weight: 800; line-height: 1; padding: 6px 8px 0; }
.m-mode small {
  display: block; height: 24px; line-height: 22px; background: #f3e5e6; color: #5a2a2d; font-size: 12.5px; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px;
}
.m-flag {
  position: absolute; right: -14px; top: -11px; background: var(--red); color: var(--white); font-size: 11.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; transform: rotate(3deg); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.m-btn {
  flex: 1; height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  background: var(--glass-2) !important; color: rgba(255, 255, 255, 0.85) !important; font-size: 24px !important; font-weight: 800 !important;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18); transition: background 0.12s;
}
.m-btn small { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.55); margin-bottom: 3px; }
.m-btn:hover { background: rgba(255, 255, 255, 0.2) !important; }
.m-status { text-align: center; font-size: 19px; font-weight: 800; color: rgba(255, 255, 255, 0.78); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }

/* hangar / fields tabs: a row of cards along the bottom */
.m-cards {
  position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%); display: none;
  flex-wrap: wrap; justify-content: center; gap: 12px; width: max-content; max-width: min(1180px, 94vw);
}
#menu[data-tab="hangar"] #m-hangar, #menu[data-tab="fields"] #m-fields { display: flex; }
#menu:not([data-tab="fly"]) .m-play, #menu:not([data-tab="fly"]) .m-left { display: none; }
#menu[data-tab="fields"] .m-right, #menu[data-tab="fields"] .m-slot { display: none; }
/* the field is drawn sharp on the Fields tab: darken the top and bottom so the header and cards stay readable */
#menu[data-tab="fields"]::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(8, 4, 5, 0.55) 0, rgba(8, 4, 5, 0) 26%, rgba(8, 4, 5, 0) 52%, rgba(8, 4, 5, 0.62) 100%);
}
#m-hangar .m-card { width: 200px; }
.m-card {
  width: 180px; min-height: 116px; display: flex !important; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  background: var(--glass) !important; padding: 14px 16px !important; border: 2px solid rgba(255, 255, 255, 0.08) !important;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.m-card:hover { background: rgba(255, 255, 255, 0.14) !important; transform: translateY(-2px); }
.m-card.on { border-color: var(--red) !important; background: rgba(230, 57, 70, 0.22) !important; box-shadow: inset 0 -4px 0 var(--red); }
.m-card b { font-size: 20px; font-weight: 800; line-height: 1.1; margin-top: 4px; }
.m-card small { font-size: 13.5px; font-weight: 700; color: rgba(255, 255, 255, 0.7); }
.m-card em { font-style: normal; font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, 0.45); margin-top: auto; }
.m-card .m-stats-bars { width: 100%; margin-top: 6px; gap: 4px; }
.m-card .m-stat { grid-template-columns: 64px 1fr; font-size: 12.5px; }
.m-card .m-stat b { height: 7px; }
.m-card.add { border-style: dashed !important; }
.m-card.add .m-chip { background: var(--white); color: var(--red-deep); }
/* field cards: a picture of the field on top, the chip on the picture, text below */
.m-card.pic { padding: 0 0 12px !important; gap: 3px; overflow: hidden; }
#m-fields .m-card { width: auto; flex: 1 1 128px; max-width: 180px; } /* shrink a little before wrapping to a second row */
.m-card.pic > b, .m-card.pic > small, .m-card.pic > em { margin-left: 14px; margin-right: 14px; }
.m-card.pic > b { margin-top: 8px; }
.m-pic { position: relative; display: block; width: 100%; aspect-ratio: 2 / 1; overflow: hidden; background: rgba(255, 255, 255, 0.06); }
.m-pic img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s; }
.m-card:hover .m-pic img { transform: scale(1.06); }
.m-pic .m-chip { position: absolute; left: 10px; top: 9px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.m-card.add .m-pic { border-bottom: 2px dashed rgba(255, 255, 255, 0.18); }
/* a field loading in the background: dimmed picture, sliding bar along its bottom edge */
.m-card.loading .m-pic img { filter: brightness(0.6); }
.m-card.loading .m-pic::after {
  content: ""; position: absolute; bottom: 0; height: 3px; width: 35%; background: var(--red);
  animation: slide 1.1s ease-in-out infinite;
}
.m-card.loading .m-pic::before {
  content: "Loading…"; position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; padding-top: 12px;
  font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--white);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}
.m-card.add.loading .m-pic i { display: none; }
#m-fly.busy { opacity: 0.6; cursor: progress !important; }
.m-pic i { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 10px; font-style: normal; font-size: 46px; font-weight: 500; color: rgba(255, 255, 255, 0.55); }

/* footer corners */
.m-foot-left { position: absolute; left: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 6px; }
.m-foot-left > b { font-size: 18px; font-weight: 800; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.m-author {
  display: flex; align-items: center; gap: 10px; background: var(--white); color: var(--red-deep);
  font-size: 19px; font-weight: 800; text-transform: uppercase; padding: 10px 18px 12px; box-shadow: inset 0 -4px 0 #d9cdce;
}
.m-author .logo-plane { width: 26px; height: 26px; fill: var(--red); transform: rotate(32deg); }
.m-foot-right { position: absolute; right: 22px; bottom: 26px; display: flex; }
.m-foot-right button { font-size: 17px !important; font-weight: 800; color: rgba(255, 255, 255, 0.72) !important; padding: 0 12px !important; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.m-foot-right button + button { border-left: 2px solid rgba(255, 255, 255, 0.3) !important; }
.m-foot-right button:hover { color: var(--white) !important; }

/* modal (how to fly / credits) */
.m-modal { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); z-index: 3; }
.m-modal-box {
  position: relative; width: min(520px, 92vw); max-height: 86vh; overflow-y: auto;
  background: var(--bg-solid); border-top: 4px solid var(--red); padding: 22px 26px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.m-modal-box h2 { margin: 0 0 14px; font-size: 26px; font-weight: 800; text-transform: uppercase; }
.m-modal-box p, .m-modal-box li { font-size: 15px; font-weight: 600; color: rgba(255, 255, 255, 0.78); }
.m-modal-box ul { padding-left: 18px; }
.m-x { position: absolute; right: 14px; top: 12px; font-size: 20px !important; color: rgba(255, 255, 255, 0.6) !important; }
.m-x:hover { color: var(--white) !important; }
.m-keys { border-collapse: collapse; width: 100%; font-size: 15px; font-weight: 700; }
.m-keys td { padding: 5px 0; border-bottom: 1px solid var(--line); }
.m-keys td:first-child { width: 130px; }

/* smaller screens */
@media (max-width: 1180px) {
  #m-fields .m-card b { font-size: 17px; }
  .m-left, .m-right { width: 250px; }
  .m-slot { display: none; }
}
@media (max-width: 900px) {
  .m-left, .m-right, .m-foot-right { display: none !important; }
  .m-tx { right: 14px; top: 14px; }
  .logo.m-logo { font-size: 44px; }
  .m-play { left: calc(50% - 80px); }
}
@media (max-height: 760px) {
  .m-top { height: 124px; }
  .m-logo { top: 14px; font-size: 52px; }
  .m-tabs button { font-size: 17px; padding: 8px 18px 11px !important; }
  .m-stage { top: 124px; }
  .m-left, .m-right { top: 150px; }
  .m-fly { height: 70px; font-size: 54px !important; }
  .m-mode { height: 70px; }
  .m-mode b { font-size: 22px; }
  .m-btn { height: 48px; font-size: 20px !important; }
}
