/* Microwave backhaul plan (js/xray/microwave-puzzle.js): work order, terrain map with the
   surveyed paths, and a hop inspector with the path profile and link budget.
   Sky blue is this lesson's accent; green, amber and coral keep the meanings they have elsewhere. */
.xr-microwave {
  --mw-sky: #38bdf8; --mw-pass: #87e8a0; --mw-warn: #f2b56b; --mw-fail: #ff7b6b;
  --mw-line: #35505d; --mw-panel: #0a1d27; --mw-ink: #e6f7fb; --mw-muted: #9bb5c3;
}

/* Work order: five checks that tick as the plan comes together. */
.xr-mw-order { margin: 0 0 20px; padding: 12px 16px 14px; border: 1px solid var(--mw-line); border-left: 3px solid var(--mw-sky); border-radius: 0 8px 8px 0; background: #0d2631; }
.xr-mw-order .xr-label { margin: 0 0 8px; color: var(--mw-ink); font-weight: 600; }
.xr-mw-order .xr-label span { color: var(--mw-sky); font: 500 11px/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.xr-mw-order ol { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 6px 18px; margin: 0; padding: 0; list-style: none; }
.xr-mw-order li { display: flex; align-items: flex-start; gap: 9px; color: #b9ced8; font: 400 13px/1.45 var(--sans); }
.xr-mw-order li[data-ok=true] { color: var(--mw-ink); }
.xr-mw-check-mark {
  display: grid; place-items: center; flex: none; width: 18px; height: 18px; margin-top: 1px;
  border: 1px solid #4a6977; border-radius: 4px; color: #07151d; font: 700 11px/1 var(--sans);
}
.xr-mw-order li[data-ok=true] .xr-mw-check-mark { border-color: var(--mw-pass); background: var(--mw-pass); }

.xr-mw-board { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 6fr); gap: clamp(16px, 3vw, 28px); align-items: start; }

/* The map: a low-resolution relief canvas under crisp vector contours and paths. */
.xr-mw-map { position: relative; overflow: hidden; border: 1px solid var(--mw-line); border-radius: 8px; background: #0a1e27; aspect-ratio: 40 / 28; }
.xr-mw-map canvas, .xr-mw-map svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.xr-mw-map canvas { opacity: .9; }
.xr-mw-contours path { fill: none; stroke: #9fd6df; stroke-width: .7; opacity: .22; }
.xr-mw-contours path.is-index { stroke-width: 1.2; opacity: .42; }
.xr-mw-landmarks text { fill: #cfe6ee; font: italic 500 13px var(--sans); letter-spacing: .03em; opacity: .7; paint-order: stroke; stroke: #0a1e27; stroke-width: 3px; pointer-events: none; }
.xr-mw-scale path { fill: none; stroke: #b9ced8; stroke-width: 1.5; }
.xr-mw-scale .is-arrow { fill: #b9ced8; stroke: none; }
.xr-mw-scale text { fill: #b9ced8; font: 500 11px var(--mono); }

.xr-mw-path { cursor: pointer; }
.xr-mw-path-hit { stroke: transparent; stroke-width: 26; stroke-linecap: round; }
.xr-mw-path-line { stroke: #cfe6ee; stroke-width: 2; stroke-dasharray: 3 7; stroke-linecap: round; opacity: .55; transition: stroke .2s, opacity .2s, stroke-width .2s; }
.xr-mw-path:hover .xr-mw-path-line { opacity: .9; }
.xr-mw-path.is-selected .xr-mw-path-line { stroke: var(--mw-sky); stroke-width: 3; opacity: 1; filter: drop-shadow(0 0 5px #38bdf8aa); }
.xr-mw-path[data-state=pass] .xr-mw-path-line { stroke: var(--mw-pass); stroke-width: 4; stroke-dasharray: none; opacity: 1; }
.xr-mw-path[data-state=fail] .xr-mw-path-line { stroke: var(--mw-fail); stroke-width: 4; stroke-dasharray: 10 6; opacity: 1; }
.xr-mw-path[data-state=cut] .xr-mw-path-line { stroke: var(--mw-warn); stroke-width: 3; stroke-dasharray: 2 9; opacity: .9; }
.xr-mw-path.is-selected[data-state=pass] .xr-mw-path-line,
.xr-mw-path.is-selected[data-state=fail] .xr-mw-path-line { stroke-width: 6; filter: drop-shadow(0 0 6px currentColor); }
/* Traffic on a working hop: bright dashes running along the beam. */
.xr-mw-path-signal { stroke: #effffb; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 2 22; opacity: 0; pointer-events: none; }
.xr-mw-path[data-state=pass] .xr-mw-path-signal { opacity: .9; }

.xr-mw-site { pointer-events: none; }
.xr-mw-site-halo { fill: #38bdf800; stroke: none; }
.xr-mw-site-base { fill: #0b202a; stroke: #8fa9b6; stroke-width: 2; }
.xr-mw-site-mast { fill: none; stroke: #e6f7fb; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.xr-mw-site.is-hub .xr-mw-site-base { fill: #2a2415; stroke: #f0c674; }
.xr-mw-site.is-online .xr-mw-site-base { stroke: var(--mw-pass); }
.xr-mw-site.is-hub.is-online .xr-mw-site-base { stroke: #f0c674; }
.xr-mw-site.is-online .xr-mw-site-halo { fill: #87e8a024; }
.xr-mw-site.is-dropped .xr-mw-site-base { stroke: var(--mw-fail); }
.xr-mw-site.is-dropped .xr-mw-site-halo { fill: #ff7b6b33; }
.xr-mw-site.is-end .xr-mw-site-halo { fill: #38bdf833; stroke: var(--mw-sky); stroke-width: 1.5; }
.xr-mw-site-label rect { fill: #07151de6; stroke: #35505d; }
.xr-mw-site.is-end .xr-mw-site-label rect { stroke: var(--mw-sky); }
.xr-mw-site-label text { fill: var(--mw-ink); font: 600 11px var(--mono); letter-spacing: .06em; }

/* The path list is the keyboard and screen-reader way in; the map mirrors it. */
.xr-mw-map-col, .xr-mw-inspector { min-width: 0; }
.xr-mw-map-col > .xr-label { margin-top: 14px; }
.xr-mw-hops { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.xr-mw-hop {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center;
  width: 100%; min-height: 48px; padding: 7px 10px; border: 1px solid var(--mw-line); border-radius: 7px;
  background: #0b202a; color: #d2e7ef; text-align: left; font: inherit; cursor: pointer;
}
.xr-mw-hop:hover { border-color: #72e5ef; background: #12303a; }
.xr-mw-hop:focus-visible { outline: 2px solid #72e5ef; outline-offset: 2px; }
.xr-mw-hop[aria-pressed=true] { border-color: var(--mw-sky); background: #0f2d3c; box-shadow: inset 3px 0 0 var(--mw-sky); }
.xr-mw-hop-name { min-width: 0; overflow: hidden; color: var(--mw-ink); font: 600 12px/1.3 var(--sans); text-overflow: ellipsis; white-space: nowrap; }
.xr-mw-hop-km { grid-row: 2; color: #8fa9b6; font: 400 11px/1.3 var(--mono); }
.xr-mw-hop-state { grid-row: 1 / 3; grid-column: 2; color: #7f9dab; font: 500 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.xr-mw-hop[data-state=pass] .xr-mw-hop-state { color: var(--mw-pass); }
.xr-mw-hop[data-state=fail] .xr-mw-hop-state { color: var(--mw-fail); }
.xr-mw-hop[data-state=cut] .xr-mw-hop-state { color: var(--mw-warn); }

/* Hop inspector. */
.xr-mw-inspector { padding: 14px 16px 16px; border: 1px solid var(--mw-line); border-radius: 10px; background: var(--mw-panel); }
.xr-mw-insp-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 14px; }
.xr-mw-insp-title { margin: 4px 0 2px; color: var(--mw-ink); font: 600 17px/1.3 var(--sans); }
.xr-mw-insp-meta { margin: 0; color: var(--mw-muted); font: 400 12px/1.5 var(--mono); }
.xr-button.xr-mw-build { border-color: var(--mw-sky); color: #dff4ff; background: #0f2d3c; }
.xr-button.xr-mw-build[aria-pressed=true] { border-color: #4a6977; color: #d2e7ef; background: #102630; }
.xr-mw-bands { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.xr-mw-bands .xr-button { min-width: 0; padding-inline: 4px; font: 500 12px/1.2 var(--mono); }
.xr-mw-height-label { display: flex !important; justify-content: space-between; gap: 8px; }
.xr-mw-height-label output { color: var(--mw-ink); font: 500 12px var(--mono); }
.xr-microwave input[type=range] { display: block; width: 100%; accent-color: var(--mw-sky); }

.xr-mw-profile { margin-top: 8px; padding: 6px 4px 0; border: 1px solid #1d3742; border-radius: 8px; background: #06121a; }
.xr-mw-profile svg { display: block; width: 100%; height: auto; }
.xr-mw-pf-grid { stroke: #1d3742; stroke-width: 1; }
.xr-mw-pf-axis { fill: #8fa9b6; font: 400 11px var(--mono); }
.xr-mw-pf-ground { fill: #2a3f33; stroke: #9cc79a; stroke-width: 1.5; stroke-linejoin: round; }
.xr-mw-pf-cold { fill: none; stroke: #c8b7ff; stroke-width: 1.2; stroke-dasharray: 4 3; opacity: .85; }
.xr-mw-pf-zone { fill: #38bdf81f; stroke: #38bdf866; stroke-width: 1; }
.xr-mw-pf-zone60 { fill: none; stroke: var(--mw-sky); stroke-width: 1; stroke-dasharray: 5 3; opacity: .8; }
.xr-mw-pf-hit { stroke: var(--mw-fail); stroke-width: 5; stroke-linecap: round; fill: none; }
.xr-mw-pf-ray { stroke-width: 2; }
.xr-mw-pf-ray.is-clear { stroke: var(--mw-pass); }
.xr-mw-pf-ray.is-blocked { stroke: var(--mw-fail); stroke-dasharray: 6 4; }
.xr-mw-pf-pulse { stroke: #effffb; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 3 40; opacity: .9; }
.xr-mw-pf-tower path { fill: none; stroke: #e6f7fb; stroke-width: 1.4; stroke-linejoin: round; }
.xr-mw-pf-tower .xr-mw-pf-dish { stroke: var(--mw-sky); stroke-width: 2.4; stroke-linecap: round; }
.xr-mw-pf-worst { stroke: #f0c674; stroke-width: 1; stroke-dasharray: 2 2; }
.xr-mw-pf-mark { fill: #f0c674; stroke: #06121a; stroke-width: 1.5; }
.xr-mw-pf-mark.is-bad { fill: var(--mw-fail); }
.xr-mw-pf-label { fill: #f3e2b8; font: 500 11px var(--mono); paint-order: stroke; stroke: #06121a; stroke-width: 3px; }

.xr-mw-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; padding: 0; list-style: none; color: var(--mw-muted); font: 400 11px/1.4 var(--sans); }
.xr-mw-key li { display: flex; align-items: center; gap: 6px; }
.xr-mw-key i { display: inline-block; width: 16px; height: 8px; border-radius: 2px; }
.xr-mw-key-zone { background: #38bdf833; border: 1px solid #38bdf866; }
.xr-mw-key-60 { border-top: 1px dashed var(--mw-sky); height: 0 !important; }
.xr-mw-key-cold { border-top: 1.5px dashed #c8b7ff; height: 0 !important; }

.xr-mw-checks { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.xr-mw-checks li { display: flex; gap: 10px; color: #c4d8e0; font: 400 13px/1.5 var(--sans); }
.xr-mw-checks strong { color: var(--mw-ink); font-weight: 600; }
.xr-mw-checks li[data-ok=true] .xr-mw-check-mark { border-color: var(--mw-pass); background: var(--mw-pass); }
.xr-mw-checks li[data-ok=false] .xr-mw-check-mark { border-color: var(--mw-fail); background: var(--mw-fail); }

.xr-mw-budget { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; margin: 14px 0 0; font: 400 12px/1.5 var(--mono); }
.xr-mw-budget > div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 2px; border-bottom: 1px solid #1d3742; }
.xr-mw-budget dt { color: var(--mw-muted); }
.xr-mw-budget dd { margin: 0; color: var(--mw-ink); text-align: right; white-space: nowrap; }
.xr-mw-budget .is-good dd { color: var(--mw-pass); font-weight: 600; }
.xr-mw-budget .is-bad dd { color: var(--mw-fail); font-weight: 600; }
.xr-mw-budget .is-row { grid-column: 1; }
.xr-button.xr-mw-cut { width: 100%; margin-top: 14px; border-style: dashed; }
.xr-button.xr-mw-cut[aria-pressed=true] { border-color: var(--mw-warn); color: #ffe2bd; background: #2a2215; }
.xr-mw-cut[hidden] { display: none; }

.xr-mw-verdict { margin-top: 20px; padding: 14px 18px; border-left: 3px solid #72e5ef; border-radius: 0 8px 8px 0; background: #0d2631; }
.xr-mw-verdict[data-tone=pass] { border-color: var(--mw-pass); background: #10291f; }
.xr-mw-verdict[data-tone=warn] { border-color: var(--mw-warn); background: #2a22152e; }
.xr-mw-verdict[data-tone=fail] { border-color: var(--mw-fail); background: #2e161430; }
.xr-mw-verdict p { max-width: 72ch; margin: 0; color: #cfe3ea; font: 400 14px/1.6 var(--sans); }
.xr-mw-verdict .xr-mw-verdict-label { margin-bottom: 4px; color: var(--mw-ink); font: 600 16px/1.35 var(--sans); }
.xr-microwave .xr-mw-math p { max-width: 70ch; }
.xr-microwave .xr-note a { color: #8de4ed; text-underline-offset: 4px; }


@media (prefers-reduced-motion: no-preference) {
  .xr-mw-path[data-state=pass] .xr-mw-path-signal { animation: xr-mw-flow 1.1s linear infinite; }
  .xr-mw-pf-pulse { animation: xr-mw-pulse 1.4s linear infinite; }
  .xr-microwave[data-mw-solved=true] .xr-mw-site.is-online .xr-mw-site-halo { animation: xr-mw-glow 2.4s ease-in-out infinite; }
}
@keyframes xr-mw-flow { to { stroke-dashoffset: -24; } }
@keyframes xr-mw-pulse { to { stroke-dashoffset: -43; } }
@keyframes xr-mw-glow { 50% { fill: #87e8a055; } }

@media (max-width: 900px) {
  .xr-mw-board { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .xr-mw-site-body { transform: scale(1.75); }
  .xr-mw-landmarks text { font-size: 22px; }
  .xr-mw-scale text { font-size: 20px; }
  .xr-mw-scale path { stroke-width: 3; }
  .xr-mw-path-line { stroke-width: 3.5; }
  .xr-mw-path:not([data-state=survey]) .xr-mw-path-line { stroke-width: 6; }
  .xr-mw-path.is-selected .xr-mw-path-line { stroke-width: 6; }
  .xr-mw-path-signal { stroke-width: 3; }
  .xr-mw-path-hit { stroke-width: 48; }
  .xr-mw-pf-axis, .xr-mw-pf-label { font-size: 19px; }
  .xr-mw-pf-ray { stroke-width: 3; }
  .xr-mw-order { padding-inline: 12px; }
  /* A sideways strip keeps the inspector right under the map on a phone. */
  .xr-mw-hops { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
  .xr-mw-hops li { flex: 0 0 min(72%, 230px); scroll-snap-align: start; }
  .xr-mw-inspector { padding: 12px; }
  .xr-mw-insp-head .xr-mw-build { width: 100%; }
  .xr-mw-budget { grid-template-columns: 1fr; }
  .xr-mw-bands .xr-button { font-size: 11px; }
}
