@font-face { font-family: Renner; src: url(assets/ui/Renner-Book.otf); font-weight: 400; }
@font-face { font-family: Renner; src: url(assets/ui/Renner-Bold.otf); font-weight: 700; }

:root {
  --ink: #e1e1e1;
  --dim: #a9a9a2;
  --accent: #e77c48;
  --warn: #ff4b2b;
  --on: #9ad06a;
  --panel: rgba(18, 20, 17, 0.82);
  --edge: rgba(255, 255, 255, 0.14);
  --shadow: 0 1px 2px #000, 0 0 3px rgba(0, 0, 0, 0.8);
  --hud-text: max(11px, 1.35vh);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; font-family: Renner, "Segoe UI", system-ui, sans-serif; color: var(--ink); }
canvas#view { display: block; position: fixed; left: 0; top: 0; cursor: none; }
#h-marks { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; }

#h-bottom { position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; gap: 2vh; pointer-events: none; }
#h-bottom > #h-dials { margin-bottom: 1.2vh; }
#h-left { flex: none; width: max(30vh, 180px); display: flex; flex-direction: column; align-items: flex-start; }
#h-left #h-hints { white-space: nowrap; }
#h-left #h-hints { margin-left: 1.2vh; }
#h-minimap { position: relative; flex: none; width: 30vh; height: 30vh; min-width: 180px; min-height: 180px; overflow: hidden; }
#h-minimap .mm-map { position: absolute; left: 0; top: 0; max-width: none; opacity: 0.72; transform-origin: 0 0; will-change: transform; }
#h-minimap .mm-me { position: absolute; left: 50%; top: 50%; width: 2.6vh; height: 2.6vh; min-width: 16px; min-height: 16px; will-change: transform; }
#h-hints { background: rgba(38, 40, 38, 0.55); padding: 0.8vh 1.2vh 0.9vh; font-size: max(11px, 1.35vh); line-height: 1.32; color: var(--ink); margin-bottom: 1vh; }
#h-hints .hint-title { text-align: center; letter-spacing: 0.02em; margin-bottom: 0.3vh; }
#h-hints .hint-grid { display: grid; grid-template-columns: auto auto; column-gap: 0.4vh; }
#h-hints .hint-grid span:nth-child(odd) { text-align: right; }
#free-aim { position: fixed; left: 50%; top: 50%; pointer-events: none; }
#free-aim[hidden] { display: none; }
#free-aim .fa-dot { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px #000; }
#h-dials { display: flex; gap: 0.6vh; }
.dial-wrap { display: flex; flex-direction: column; align-items: center; }
.dial-wrap[hidden] { display: none; }
.hud-text, .dial-label, .dial .rim, .dial-value, .dial-value2, #h-vsi, #h-fuel, #h-fps {
  color: #fff; -webkit-text-stroke: 0.22em #000; paint-order: stroke fill; text-shadow: none; font-variant-numeric: tabular-nums; }
.dial-label { font-size: var(--hud-text); margin-bottom: 0.2vh; }
.dial { position: relative; width: 10.7vh; height: 10.7vh; min-width: 96px; min-height: 96px; background: url(assets/ui/AircraftInstrumentBackground.webp) center / 100% no-repeat; }
.dial .rim { position: absolute; transform: translate(-50%, -50%); font-size: max(8px, 0.95vh); -webkit-text-stroke-width: 0.25em; }
.dial-needle, .dial-needle2 { position: absolute; left: 3.1%; top: 3.1%; width: 93.8%; height: 93.8%; }
.dial-needle { background: url(assets/ui/AircraftInstrumentNeedle.webp) center / 100% no-repeat; }
.dial-needle2 { background: var(--accent); -webkit-mask: url(assets/ui/AircraftInstrumentSecondaryNeedle.webp) center / 100% no-repeat; mask: url(assets/ui/AircraftInstrumentSecondaryNeedle.webp) center / 100% no-repeat; }
.dial-value, .dial-value2 { position: absolute; left: 0; right: 0; text-align: center; font-size: var(--hud-text); }
.dial-value { top: 30%; }
.dial-value2 { top: 57%; }

#h-topright { position: fixed; right: 1.5vh; top: 1.5vh; display: flex; align-items: flex-start; gap: 0.8vh; pointer-events: none; }
#h-gear { display: flex; align-items: center; gap: 0.6vh; margin-top: 2vh; }
#h-storm { width: 2.6vh; height: 2.6vh; min-width: 20px; min-height: 20px; background: url(assets/ui/IconStatusStorm.webp) center / contain no-repeat; }
#h-gear-icon { width: 2.6vh; height: 3.9vh; background: url(assets/ui/AircraftGearsIconSmall.webp) center / contain no-repeat; opacity: 0.85; }
#h-gear .arrows { display: flex; flex-direction: column; gap: 0.3vh; }
#h-gear-up, #h-gear-down { width: 1.25vh; height: 2.5vh; min-width: 10px; min-height: 20px; background: url(assets/ui/AircraftLandingGearOffIcon.webp) center / contain no-repeat; }
#h-gear-down { transform: rotate(180deg); }
#h-gear-up.on, #h-gear-down.on { background-image: url(assets/ui/AircraftLandingGearOnIcon.webp); }
.compass-col { position: relative; display: flex; flex-direction: column; align-items: center; }
#h-compass { width: 15vh; height: 15vh; min-width: 120px; min-height: 120px; }
#h-fps { font-size: var(--hud-text); white-space: nowrap; }
#h-fps[hidden] { display: none; }
#h-fps[data-level="ok"] { color: #f0c04a; }
#h-fps[data-level="bad"] { color: #f06a6a; }
#h-fps .fps-device { color: #6ad46a; }
#h-fps .fps-device[data-dev="CPU"] { color: #f06a6a; }

#h-weapon { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
#h-weapon[hidden] { display: none; }
#h-weapon .w-icon { position: relative; width: 7.2vh; height: 7.2vh; min-width: 56px; min-height: 56px; background: rgba(38, 40, 38, 0.55); }
#h-weapon .w-img { position: absolute; inset: 4%; background: center / contain no-repeat; }
#h-weapon .w-badge { position: absolute; left: 4%; top: 4%; width: 32%; height: 32%; background: center / contain no-repeat; }
#h-weapon.reloading .w-img { opacity: 0.35; }
#h-weapon .w-text { text-align: center; padding: 4px 14px 5px; background: rgba(38, 40, 38, 0.55); font-size: 15px; text-shadow: var(--shadow); white-space: pre; }
#h-fuelbar { position: relative; width: 176px; height: 17px; box-sizing: border-box; border: 2px solid rgba(0, 0, 0, 0.5); background: rgba(10, 11, 11, 0.2); }
#h-fuelbar .fb-fill { position: absolute; left: 0; top: 0; height: 13px; width: 0; background: #fff; }
#h-fuelbar .fb-mark { position: absolute; top: 0; bottom: 0; width: 2px; transform: translateX(-50%); background: rgba(0, 0, 0, 0.5); }
#h-vsi { white-space: pre; text-align: center; font-size: var(--hud-text); line-height: 1.2; }
#h-fuel { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: repeat(4, minmax(2ch, max-content) max-content); white-space: pre; font-size: var(--hud-text); line-height: 1.2; }
#h-fuel > span:nth-child(odd) { text-align: right; }
#h-fuel > span:nth-child(4n+2) { text-align: center; }
#h-fuel > span:nth-child(8n+3), #h-fuel > span:nth-child(8n+7), #h-fuel > span:nth-child(8n) { text-align: left; }

#h-corner { position: fixed; right: 1.5vh; bottom: 1vh; display: flex; flex-direction: column; align-items: flex-end; gap: 0.3vh; pointer-events: none; }
#h-status { font-size: 12px; letter-spacing: 0.08em; color: var(--dim); text-shadow: var(--shadow); pointer-events: none; }

#h-warn .crash { color: var(--warn); font-size: 1.2em; }
#h-warn { position: fixed; top: 30%; left: 50%; transform: translate(-50%, -50%); text-align: center; font-size: max(11px, 1.4vh); line-height: 2.5vh; color: #fff; text-shadow: var(--shadow); pointer-events: none; white-space: nowrap; }
#h-warn .off { visibility: hidden; }
#h-zone { position: fixed; left: 0; right: 0; top: 0; height: 10.5vh; display: none; flex-direction: column; justify-content: center; align-items: center;
  background: rgba(0, 0, 0, 0.32); color: #f5874f; font-size: max(14px, 2.45vh); line-height: 1.2; letter-spacing: 0.02em; text-shadow: 0 0 3px rgba(0, 0, 0, 0.35); pointer-events: none; }
#h-zone div:nth-child(3) { font-size: 1.25em; line-height: 1.1; }

#cursor { position: fixed; left: 0; top: 0; pointer-events: none; will-change: transform; transform: translate(50vw, 50vh) translate(-50%, -50%); width: var(--cursor-size, 25.6px); height: var(--cursor-size, 25.6px); }
#cursor .c-img { width: 100%; height: 100%; background: url(assets/ui/crosshair_dot.webp) center / contain no-repeat; }
#cursor.empty .c-img, #cursor.reloading .c-img { background-image: url(assets/ui/CursorNotReady.webp); }
#cursor.reloading .c-img { animation: cursor-spin 1.8s linear infinite; }
@keyframes cursor-spin { to { transform: rotate(360deg); } }

#corner-notes { position: fixed; left: 16px; top: 16px; display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
#corner-notes > div:not(#h-weapon):not(#h-fuelbar) { text-align: center; padding: 4px 14px 5px; background: rgba(38, 40, 38, 0.55); font-size: 15px; text-shadow: var(--shadow); white-space: nowrap; }
#corner-notes > div[hidden] { display: none; }
#corner-notes #free-hint { padding-top: 6px; padding-bottom: 7px; line-height: 1.3; }

#flash { position: fixed; bottom: 22%; left: 50%; width: 0; height: 0; pointer-events: none; }
#flash .note { position: absolute; left: 0; bottom: 0; transform: translate(-50%, 0); padding: 4px 14px 5px; background: rgba(38, 40, 38, 0.55); font-size: 15px; text-align: center; white-space: pre-line; width: max-content; max-width: 80vw; text-shadow: var(--shadow); transition: transform 0.3s ease-out, opacity 0.3s; }
#flash .note.in { transform: translate(-50%, 14px) !important; opacity: 0; }
#flash .note.old { opacity: 0.75; }
#flash .note.out { opacity: 0; transition: opacity 0.4s; }
#flash .note.out-up { opacity: 0; transition: transform 0.25s ease-in, opacity 0.25s ease-in; }
#flash .note.warn { color: #f0c04a; }


#menu, #pc-only {
  --warden: hsl(200, 65%, 30%); --colonial: hsl(110, 30%, 28%);
  --warden-tint: hsl(200, 100%, 80%); --colonial-tint: hsl(110, 80%, 85%);
  --card-shadow: 0 2px 5px var(--color-bounds);
  --menu-bg: #f0f0f0; --card-bg: #fff; --heading-text: #222; --strong-text: #000;
  --bind-empty-bg: #f1f1f1; --bind-empty-text: #9a9a9a;
  --conflict-bg: #fdeaea; --conflict-border: #d9463b; --conflict-text: #b3261e; --bad-text: #c0271a;
  --track: #aaa; --track-mark: #777; --scale-text: #777; }
:root[data-theme="dark"] #menu, :root[data-theme="dark"] #pc-only {
  --warden: hsl(200, 65%, 62%); --colonial: hsl(110, 40%, 55%);
  --warden-tint: hsl(200, 45%, 24%); --colonial-tint: hsl(110, 30%, 22%);
  --menu-bg: #232427; --card-bg: #2e3035; --heading-text: #e6e6e6; --strong-text: #f2f2f2;
  --bind-empty-bg: #26282c; --bind-empty-text: #7d8088;
  --conflict-bg: #4a2323; --conflict-border: #e0625a; --conflict-text: #ff9a92; --bad-text: #ff7a6e;
  --track: #5b5e66; --track-mark: #8a8d94; --scale-text: #9a9da4; }
#menu {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: var(--color-shade); font-family: sans-serif; color: var(--color-text); }
#menu[hidden] { display: none; }
.menu-panel { position: relative; width: min(940px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--menu-bg); overflow: hidden; }
.menu-head { flex: none; display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--color-border); }
.menu-head .tabs { grid-column: 1; }
.menu-head .spawn-points { grid-column: 1; }
#menu-fullscreen, #menu-theme { grid-column: 2; }
#menu-freecam, #menu-apps { grid-column: 3; }
#menu-resume, .menu-head .kofi-btn { grid-column: 4; }
.menu-panel:has(#tab-spawn:not([hidden])) .menu-head { border-bottom: none; }
.tabs { display: flex; gap: 8px; }
.tabs .top-bar-button, .spawn-points .top-bar-button, #menu-freecam, #menu-apps { min-width: 104px; white-space: nowrap; }
#menu .plane, #menu .bind-row button { font: inherit; color: var(--color-text); cursor: pointer; }
.menu-scroll { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; padding: 0 12px 16px; }

.menu-foot { flex: none; padding: 8px 12px; border-top: 1px solid var(--color-border); }
.legal { margin: 0; padding: 8px 12px; background: var(--card-bg); border: 1px solid var(--color-border); border-left: 4px solid hsl(0, 60%, 65%); border-radius: 4px; box-shadow: var(--card-shadow); font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--heading-text); }
.legal a { color: var(--color-link); }

.spawn-points { display: flex; gap: 8px; }
.spawn-points[hidden] { display: none; }
.apps-btn { gap: 6px; padding: 0 12px 0 8px; }
.apps-icon { flex: none; width: 22px; height: 22px; transition: transform 0.15s; }
.apps-btn:hover .apps-icon { transform: translateY(-1px) scale(1.08); }
#spawn-map { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; gap: 8px; padding: 8px 12px; background: var(--menu-bg); }
#spawn-map[hidden] { display: none; }
#spawn-map .sm-canvas { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#spawn-map canvas { display: block; cursor: none; touch-action: none; }
#spawn-map .sm-cursor { position: absolute; left: 0; top: 0; width: 17px; height: 17px; box-sizing: border-box; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1.5px #000, inset 0 0 0 1.5px #000; pointer-events: none; will-change: transform; }
#spawn-map .sm-cursor[hidden] { display: none; }
#spawn-map .sm-head { flex: none; display: flex; align-items: center; gap: 8px; }
#spawn-map .sm-title { flex: 1; font-weight: bold; font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--heading-text); padding-bottom: 6px; border-bottom: 2px solid; }
#spawn-map .sm-card { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; background: var(--card-bg); border: 1px solid var(--color-border); border-left: 4px solid var(--color-proposition); border-radius: 4px; box-shadow: var(--card-shadow); line-height: 1.4; }
#spawn-map .sm-status { flex: 1; }
#spawn-map .sm-card.bad { border-left-color: var(--bad-text); color: var(--bad-text); }
.faction-heads, .plane-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.faction-heads { padding: 12px 0 4px; }
.menu-scroll.spawn { display: flex; flex-direction: column; overflow: hidden; padding: 0; scrollbar-gutter: auto; }
#tab-spawn:not([hidden]) { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.spawn-top { flex: none; padding: 0 20px 0 12px; }
#plane-list { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; padding: 0 12px 16px; }
.faction-head { font-weight: bold; font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase; padding-bottom: 6px; border-bottom: 2px solid; }
.faction-head.warden { color: var(--warden); }
.faction-head.colonial { color: var(--colonial); }
.plane-cat { margin: 10px 0 6px; }
.plane-pair + .plane-pair { margin-top: 8px; }
#plane-list .plane { --fc: var(--warden); --ft: var(--warden-tint); position: relative; display: flex; align-items: center; gap: 12px; min-width: 0; text-align: left; padding: 6px 12px 6px 8px; background: var(--card-bg); border: 1px solid var(--color-border); border-left: 4px solid var(--fc); border-radius: 4px; box-shadow: var(--card-shadow); transition: background 0.12s, border-color 0.12s; }
#plane-list .plane.colonial { --fc: var(--colonial); --ft: var(--colonial-tint); }
#plane-list .plane:hover { background: color-mix(in srgb, var(--ft) 45%, var(--card-bg)); }
#plane-list .plane.current { background: var(--ft); border-color: var(--fc); }
.plane-icon { flex: none; width: 96px; height: 60px; margin: -4px 0; background: var(--fc); -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; opacity: 0.75; }
.plane:hover .plane-icon, .plane.current .plane-icon { opacity: 1; }
.plane-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.plane-name { font-size: 17px; font-weight: bold; color: var(--strong-text); }
.plane-desig { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bind-group { margin: 16px 0 6px; }
.bind-row { display: grid; grid-template-columns: 1fr 150px 150px; gap: 6px; align-items: center; padding: 2px 0; }
.bind-row button { height: 26px; padding: 0 8px; background: var(--card-bg); border: 1px solid var(--color-border); border-radius: 3px; font-size: 13px; }
.bind-row button:hover { background: color-mix(in srgb, var(--color-proposition) 15%, var(--card-bg)); }
#menu .bind-row button.capturing { background: var(--color-proposition); color: #fff; }
#menu .bind-row button.empty { background: var(--bind-empty-bg); color: var(--bind-empty-text); }
#bind-tip { position: fixed; z-index: 50; max-width: 320px; padding: 5px 10px; background: rgba(38, 40, 38, 0.92); color: #fff; font-size: 13px; line-height: 1.3; border-radius: 3px; pointer-events: none; }
#bind-tip[hidden] { display: none; }
#menu .bind-row button.conflict { background: var(--conflict-bg); border-color: var(--conflict-border); color: var(--conflict-text); }
#bind-reset { margin-top: 16px; }

#settings, #settings-env { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; margin: 0 0 4px; }
#settings-env { margin: 8px 0 0; }
.set-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; min-height: 32px; padding: 2px 0; cursor: pointer; }
.set-row .toggle-switch { justify-self: start; }
.set-range { display: flex; align-items: center; gap: 10px; width: 240px; }
.set-num { flex: none; width: 50px; }
.set-val { flex: none; width: 76px; font-variant-numeric: tabular-nums; }
.set-row input.set-weather[type="range"]::-webkit-slider-runnable-track { background: linear-gradient(to right, transparent var(--from), var(--wx) var(--from), var(--wx) var(--to), transparent var(--to)), linear-gradient(var(--track-mark), var(--track-mark)) 50% 50% / 2px 10px no-repeat, var(--track); }
.set-row input.set-weather[type="range"]::-moz-range-progress { background: transparent; }
.set-slider { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.set-row .set-slider input[type="range"] { flex: none; width: 100%; }
.set-scale { display: flex; justify-content: space-between; margin-top: -2px; font-size: 11px; line-height: 1; color: var(--scale-text); }
.set-row input[type="range"] { -webkit-appearance: none; appearance: none; flex: 1; height: 20px; margin: 0; background: transparent; cursor: pointer; }
.set-row input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(var(--color-proposition), var(--color-proposition)) 0 / var(--fill, 50%) 100% no-repeat, var(--track); }
.set-row input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
.set-row input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--color-proposition); }
.set-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; box-sizing: border-box; width: 18px; height: 18px; margin-top: -7px; border: 2px solid #fff; border-radius: 50%; background: var(--color-proposition); }
.set-row input[type="range"]::-moz-range-thumb { box-sizing: border-box; width: 18px; height: 18px; border: 2px solid #fff; border-radius: 50%; background: var(--color-proposition); }
.set-row input[name="time"]::-webkit-slider-thumb, .set-row input[name="weather"]::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -10px; background: var(--knob) center / 20px no-repeat, var(--knob-bg, var(--color-proposition)); }
.set-row input[name="time"]::-moz-range-thumb, .set-row input[name="weather"]::-moz-range-thumb { width: 24px; height: 24px; background: var(--knob) center / 20px no-repeat, var(--knob-bg, var(--color-proposition)); }

.env-col { display: flex; flex-direction: column; }
.wind-col { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; }
.wind-note { margin: 10px 0 0; }


@media (max-width: 700px) {
  .bind-row { grid-template-columns: 1fr 100px 100px; }
  #settings, #settings-env { grid-template-columns: 1fr; }
  #h-hints { display: none; }
  .plane-icon { width: 60px; height: 40px; }
  .plane-name { font-size: 15px; }
}

body.freecam #h-weapon, body.freecam #h-fuelbar, body.freecam #h-doors, body.freecam #h-refuel, body.freecam #h-gear, body.freecam #h-compass, body.freecam #h-vsi, body.freecam #h-fuel, body.freecam #h-dials,
body.freecam #h-zone, body.freecam #h-warn, body.freecam #cursor { display: none !important; }
body.nopilot #h-weapon, body.nopilot #h-fuelbar, body.nopilot #h-doors, body.nopilot #h-refuel, body.nopilot #h-gear, body.nopilot #h-compass, body.nopilot #h-vsi, body.nopilot #h-fuel, body.nopilot #h-dials,
body.nopilot #cursor { display: none !important; }

#pc-only { position: fixed; inset: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--color-surface); font-family: sans-serif; color: var(--color-text); z-index: 100; }
#pc-only[hidden] { display: none; }
.pc-body { width: min(520px, 100%); margin: auto; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.pc-body .modal-title { margin: 0; padding: 0; }
.pc-shots { display: flex; gap: 8px; margin: 0 -16px; padding: 0 16px 2px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px; scrollbar-width: none; }
.pc-shots::-webkit-scrollbar { display: none; }
.pc-shots img { flex: 0 0 88%; min-width: 0; height: auto; aspect-ratio: 2; object-fit: cover; scroll-snap-align: start; border: 1px solid var(--color-border); border-radius: 4px; box-shadow: var(--card-shadow); }
.pc-apps { align-self: flex-end; }
.pc-card { margin: 0; padding: 8px 12px; background: var(--card-bg); border: 1px solid var(--color-border); border-left: 4px solid var(--color-proposition); border-radius: 4px; box-shadow: var(--card-shadow); line-height: 1.4; }
