/* SkyTrack GCS - sensor operator station.
 * Black screens in dark bezels, one stroke-style monospaced face (B612 Mono, designed for
 * Airbus cockpit displays), legends beside bezel keys, and flight-deck colour coding:
 * white data and scales, green engaged modes, cyan own sensor and selected values, magenta
 * the active target line, amber cautions, red warnings. Nothing rounded, no gradients. */

@font-face { font-family: "B612 Mono"; src: url("B612Mono-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url("B612Mono-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --station: #0a0b0c;
  --bezel: #15181a;
  --line: #2c3236;
  --line-2: #464e54;
  --tick: #3a4247;
  --tape: #1d2124;
  --txt: #e8edef;
  --txt-2: #9ea8ae;
  --txt-3: #5b656b;
  --grn: #3fd65a;
  --cyn: #3ccfe6;
  --mag: #e255e2;
  --amb: #ffb000;
  --red: #ff4040;
  --yel: #f2e14a;
  --sky: #2a64a3;
  --gnd: #6a4426;
  --ac: #f5c518;
  --font: "B612 Mono", Consolas, "Cascadia Mono", "DejaVu Sans Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--station); color: var(--txt); }
body { font: 12px/1.35 var(--font); text-transform: uppercase; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-transform: inherit; }
button:disabled { cursor: default; }
:focus-visible { outline: 1px solid var(--cyn); outline-offset: 1px; }
html[data-brt="ngt"] .station { filter: brightness(0.55); }

[data-c="grn"] { color: var(--grn); }
[data-c="cyn"] { color: var(--cyn); }
[data-c="amb"] { color: var(--amb); }
[data-c="red"] { color: var(--red); }
[data-c="dim"] { color: var(--txt-3); }

.station { display: flex; flex-direction: column; height: 100vh; }

/* ------------------------------------------------------------------ status bar */
.sb { display: flex; align-items: stretch; flex: none; height: 30px; background: var(--bezel); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
.sb > * { display: flex; align-items: center; padding: 0 10px; border-right: 1px solid var(--line); }
.sb-name { font-weight: 700; letter-spacing: 0.04em; }
.sb-ann { gap: 6px; padding: 0 8px; }
.sb-ann:empty, .sb-ann:not(:has(.ann:not([hidden]))) { display: none; }
.ann { padding: 1px 6px; border: 1px solid var(--txt); color: var(--txt); }
.ann-sim { border-color: var(--cyn); color: var(--cyn); }
.sb-gap { flex: 1; padding: 0; }
.sb-f i { font-style: normal; color: var(--txt-2); margin-right: 7px; }
.sb-f b { font-weight: 400; }
.sb-brt { border-right: 0; color: var(--txt-2); }
.sb-brt:hover { color: var(--txt); }

/* ------------------------------------------------------------------ deck */
.deck {
  flex: 1; min-height: 0; display: grid; gap: 6px; padding: 6px;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 31%);
  grid-template-rows: minmax(0, 1.08fr) minmax(0, 1fr) 214px;
  grid-template-areas: "a pfd" "a b" "ded ded";
}
#mfd-a { grid-area: a; }
#mfd-pfd { grid-area: pfd; }
#mfd-b { grid-area: b; }
.dedrow { grid-area: ded; display: grid; gap: 6px; min-width: 0; min-height: 0; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.3fr) minmax(0, 1fr); }

/* ------------------------------------------------------------------ MFD */
.mfd { display: flex; min-width: 0; min-height: 0; background: var(--bezel); border: 1px solid var(--line); }
.page {
  flex: 1; min-width: 0; min-height: 0; display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  grid-template-rows: 24px minmax(0, 1fr) 24px;
}
.page-plain { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); padding: 6px; }
.screen { grid-area: 2 / 2; position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #000; border: 1px solid var(--line); }
.page-plain .screen { grid-area: 1 / 1; }
.screen > img, .screen > video, .screen > canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.screen > img, .screen > video { object-fit: contain; }
#scr-sens { cursor: crosshair; }
.ro #scr-sens { cursor: default; }
.no-video { position: absolute; inset: 0; display: grid; place-items: center; color: var(--amb); letter-spacing: 0.12em; pointer-events: none; }

/* bezel keys: five per side, a short mark at the outer edge of each */
.osb { display: grid; place-items: center; min-width: 0; min-height: 0; background-repeat: repeat-x; }
.osb-t, .osb-b { grid-column: 2; grid-template-columns: repeat(5, minmax(0, 1fr)); background-image: linear-gradient(to right, transparent calc(50% - 6px), var(--tick) calc(50% - 6px), var(--tick) calc(50% + 6px), transparent calc(50% + 6px)); background-size: 20% 2px; }
.osb-t { grid-row: 1; background-position: 0 0; }
.osb-b { grid-row: 3; background-position: 0 100%; }
.osb-l, .osb-r { grid-row: 2; grid-template-rows: repeat(5, minmax(0, 1fr)); background-image: linear-gradient(to bottom, transparent calc(50% - 6px), var(--tick) calc(50% - 6px), var(--tick) calc(50% + 6px), transparent calc(50% + 6px)); background-size: 2px 20%; background-repeat: repeat-y; }
.osb-l { grid-column: 1; background-position: 0 0; }
.osb-r { grid-column: 3; background-position: 100% 0; }

.lg { display: flex; flex-direction: column; align-items: center; padding: 1px 4px; font-size: 11px; line-height: 1.15; text-align: center; color: var(--txt); }
.lg small { font-size: 9px; color: var(--txt-2); }
button.lg:hover:not(:disabled) { outline: 1px solid var(--line-2); }
button.lg:disabled { color: var(--txt-3); }
button.lg:disabled small { color: var(--txt-3); }
.lg[aria-pressed="true"] { background: var(--txt); color: #000; }
.lg-box { outline: 1px solid var(--txt); outline-offset: -1px; padding: 1px 5px; }

/* ------------------------------------------------------------------ data panes */
.ded { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; padding: 7px 10px 6px; background: #000; border: 1px solid var(--line); box-shadow: 0 0 0 5px var(--bezel); margin: 5px; }
.ded h2 { display: flex; justify-content: space-between; flex: none; margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 400; color: var(--txt-2); letter-spacing: 0.06em; }
.ded h2 span { color: var(--txt-3); }

.kv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 14px; }
.kv > div { display: flex; gap: 8px; min-width: 0; }
.kv > .w { grid-column: 1 / -1; }
.kv i { flex: none; width: 4.5ch; font-style: normal; color: var(--txt-2); }
.kv b { font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: clip; }

.tf-wrap { flex: 1; min-height: 0; overflow: auto; }
.tf { width: 100%; border-collapse: collapse; }
.tf th { position: sticky; top: 0; background: #000; padding: 0 14px 3px 0; text-align: left; font-weight: 400; color: var(--txt-2); }
.tf td { padding: 1px 14px 1px 0; white-space: nowrap; }
.tf th:first-child, .tf td:first-child { padding-left: 4px; }
.tf .n { text-align: right; }
.tf tbody tr { cursor: pointer; }
.ro .tf tbody tr { cursor: default; }
.tf tbody tr:hover td { background: #161a1c; }
.tf tbody tr.tgt td { background: var(--txt); color: #000; }
.tf tr.empty td { color: var(--txt-3); cursor: default; }

.cas { display: grid; flex: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-bottom: 7px; }
.cas span { padding: 2px 0; text-align: center; color: var(--txt-3); border: 1px solid #262c30; }
.cas .adv { color: var(--txt); border-color: var(--line-2); }
.cas .cau { color: var(--amb); border-color: var(--amb); }
.cas .wrn { color: var(--red); border-color: var(--red); }
.cas .off { color: #3a4247; border-color: #1d2225; }
.msg { flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 0; list-style: none; }
.msg li { display: flex; gap: 10px; white-space: nowrap; }
.msg time { flex: none; color: var(--txt-3); }
.msg span { overflow: hidden; text-overflow: ellipsis; }
.msg .sts { color: var(--txt-2); }
.msg .adv { color: var(--txt); }
.msg .cau { color: var(--amb); }
.msg .wrn { color: var(--red); }
.msg .empty { color: var(--txt-3); }

.toast { position: fixed; top: 40px; left: 50%; transform: translateX(-50%); z-index: 10; max-width: calc(100vw - 32px); padding: 6px 14px; background: #000; color: var(--amb); border: 1px solid var(--amb); }

/* ------------------------------------------------------------------ smaller screens */
@media (max-width: 1100px), (max-height: 660px) {
  .station { height: auto; min-height: 100vh; }
  .deck { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto auto; grid-template-areas: "a a" "pfd b" "ded ded"; }
  #mfd-a { aspect-ratio: 16 / 10; }
  #mfd-pfd, #mfd-b { aspect-ratio: 4 / 3.3; }
  .dedrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dedrow > :last-child { grid-column: 1 / -1; }
  .ded { min-height: 200px; }
  .sb-proc { display: none; }
}
@media (max-width: 700px) {
  .sb { flex-wrap: wrap; height: auto; }
  .sb > * { padding: 5px 8px; }
  .sb-gap { display: none; }
  .deck { grid-template-columns: minmax(0, 1fr); grid-template-areas: "a" "pfd" "b" "ded"; padding: 4px; }
  #mfd-a { aspect-ratio: 4 / 3.4; }
  .page:not(.page-plain) { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .lg { font-size: 10px; padding: 1px 2px; }
  .dedrow { grid-template-columns: minmax(0, 1fr); }
  .tf-wrap { overflow-x: auto; }
}
