/* RouterBaba Simulator. v2 stylesheet (visual reset).
 *
 * Premium NOC-style layout. Map-first. Clean typography. No retro
 * clutter. Subtle old-internet flavor only in micro details (visit
 * counter, terminal, pixel ASN labels on the map).
 */

:root {
  --c-bg:        #0C1E2F;          /* matches the mascot illustration bg, seamless */
  --c-bg-soft:   #142A40;
  --c-bg-card:   #1A3550;
  --c-paper:     #F5EFE6;
  --c-text:      #E8E2D6;
  --c-text-dim:  #8A9099;
  --c-saffron:   #E87A2A;
  --c-saffron-2: #FF9544;
  --c-emerald:   #7DD4A0;
  --c-emerald-2: #4FB6B0;
  --c-lavender:  #9B8EC4;
  --c-amber:     #FFB347;
  --c-red:       #E85A6A;
  --c-line:      rgba(255, 255, 255, 0.06);
  --c-line-warm: rgba(232, 122, 42, 0.22);

  --f-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --f-sans:    'Inter', system-ui, sans-serif;
  --f-mono:    'JetBrains Mono', 'Cascadia Code', monospace;
  --f-pixel:   'Press Start 2P', 'Courier New', monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-sans);
  font-feature-settings: "ss01", "cv01";
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
}

a { color: var(--c-saffron); text-decoration: none; }
a:hover { color: var(--c-saffron-2); }

/* ============ Sim nav ============ */

.sim-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  background: rgba(6, 18, 30, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.sim-nav .brand {
  display: flex; gap: 0.5rem; align-items: center;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--c-text);
}

.sim-nav .brand-mark {
  display: inline-flex;
  align-items: center;
}
.sim-nav .brand-mark img,
.sim-nav .brand-mark svg {
  width: 30px;
  height: 30px;
  display: block;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(232, 122, 42, 0.18);
}

.hub-mascot {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  margin: 0 0 1.4rem 0;
}

/* Sim hub footer brand: small mark + RouterBaba wordmark, no tagline
   image (full lockup is illegible at footer size). */
.sim-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.sim-footer-mark {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}
.sim-footer-wordmark {
  font-family: var(--f-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--c-saffron);
  letter-spacing: -0.01em;
}

.sim-nav-right {
  display: flex; gap: 1.4rem;
  font-family: var(--f-mono);
  font-size: 0.82rem;
  color: var(--c-text-dim);
}

.sim-nav-right a:hover { color: var(--c-saffron); }

/* ============ Hub page ============ */

.hub {
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.2rem, 4vw, 3rem);
  flex: 1;
}

.hub-kicker {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-saffron);
  margin: 0 0 1rem 0;
}

.hub h1 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 1.4rem 0;
  color: #FFF7EE;
}

.hub-lede {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  color: var(--c-text-dim);
  max-width: 56ch;
  margin: 0 0 2.6rem 0;
  line-height: 1.6;
}

.lab-list { display: grid; gap: 1rem; }

.lab-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.2rem;
  align-items: center;
  padding: 1.4rem 1.5rem;
  background: var(--c-bg-card);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--c-text);
  transition: all 0.22s var(--ease);
}

.lab-row.ready:hover {
  border-color: var(--c-saffron);
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}

.lab-row.locked { opacity: 0.45; cursor: not-allowed; }

.lab-num {
  font-family: var(--f-mono);
  font-size: 1.05rem;
  color: var(--c-saffron);
  letter-spacing: -0.02em;
  min-width: 2.5em;
}

.lab-info h3 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0 0 0.3rem 0;
  letter-spacing: -0.015em;
  color: #FFF7EE;
}

.lab-info p { margin: 0; color: var(--c-text-dim); font-size: 0.94rem; }

.lab-status {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
}

.lab-status.ready {
  color: var(--c-emerald);
  background: rgba(125, 212, 160, 0.1);
}

.lab-status.locked {
  color: var(--c-text-dim);
  background: rgba(255, 255, 255, 0.04);
}

/* ============ Lab page (NOC layout) ============ */

.lab-page {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  overflow: hidden;
  background: var(--c-bg);
}

.mission-bar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.55rem clamp(1rem, 3vw, 2rem);
  background: rgba(6, 18, 30, 0.95);
  border-bottom: 1px solid var(--c-line);
  z-index: 20;
}
.mission-bar > .mission-title-block {
  flex: 1;
  min-width: 0;
}

/* Back-to-hub navigation. Sits on the far left of every lab's mission
   bar so the player always has a clear escape from the lab. The mark
   matches the nav avatar elsewhere on the site for brand continuity. */
.lab-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem 0.35rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--r-sm);
  background: rgba(15, 33, 56, 0.55);
  color: var(--c-text-dim);
  text-decoration: none;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  flex-shrink: 0;
}
.lab-back:hover,
.lab-back:focus-visible {
  color: var(--c-saffron);
  border-color: rgba(232, 122, 42, 0.55);
  background: rgba(232, 122, 42, 0.12);
  outline: none;
}
.lab-back-arrow {
  font-size: 0.95rem;
  transform: translateY(-1px);
  transition: transform 0.18s ease;
}
.lab-back:hover .lab-back-arrow { transform: translate(-2px, -1px); }
.lab-back-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(232, 122, 42, 0.30);
  display: block;
}
.lab-back-text {
  font-weight: 600;
}

@media (max-width: 760px) {
  .lab-back {
    padding: 0.35rem 0.5rem 0.35rem 0.45rem;
    gap: 0.35rem;
  }
  .lab-back-text { display: none; }      /* keep arrow + mark only on phones */
}

@media (max-width: 760px) {
  .mission-bar { gap: 0.4rem; padding: 0.55rem 0.7rem; }
  .mission-objective { display: none; }
  .mission-step { display: none; }
  .alarm-badge span:not(.badge-count):not(.badge-icon) { display: none; }
  .alarm-badge { padding: 0.4rem 0.55rem; }
  .ssh-toggle { padding: 0.4rem 0.6rem; font-size: 0.65rem; }
  .mission-hint { padding: 0.4rem 0.65rem; font-size: 0.7rem; }
}

@media (max-width: 480px) {
  .ssh-toggle { display: none; }       /* split-pane is the only sane mode at phone width */
}

.mission-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  color: #FFF7EE;
}

/* Hidden on desktop too. The floating coach card carries the
   narrative now, and the bar stays focused on title + controls. */
.mission-objective { display: none; }

.mission-step {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-saffron);
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--c-line-warm);
  border-radius: 4px;
}

.mission-hint {
  background: transparent;
  border: 1px solid var(--c-line);
  color: var(--c-text-dim);
  padding: 0.45rem 0.85rem;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.mission-hint:hover { color: var(--c-saffron); border-color: var(--c-saffron); }

.mission-hint.glow {
  animation: hintGlow 2s ease-in-out infinite;
  color: var(--c-saffron);
  border-color: var(--c-saffron);
}

@keyframes hintGlow {
  0%,100% { box-shadow: 0 0 0 rgba(232, 122, 42, 0); }
  50%     { box-shadow: 0 0 14px rgba(232, 122, 42, 0.6); }
}

/* ============ Lab main: map + terminal ============ */

.lab-main {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 460px;
  grid-template-rows: 1fr;
  overflow: hidden;
  min-height: 0;
}

.map-pane {
  position: relative;
  background: var(--c-bg);
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

.term-pane {
  background: linear-gradient(180deg, #051320 0%, #030a13 100%);
  border-left: 1px solid var(--c-line);
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  min-width: 0;
}

@media (max-width: 900px) {
  .lab-main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 260px;
  }
  .term-pane {
    border-left: none;
    border-top: 1px solid var(--c-line);
  }
}

@media (max-width: 700px) {
  .lab-main { grid-template-rows: 1fr 220px; }
}

/* ============ SVG map ============ */

.map-svg {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
}

.map-province { transition: stroke 0.3s var(--ease), fill 0.3s var(--ease); }

.map-link-base { transition: stroke 0.4s var(--ease); }
.map-link-active { transition: opacity 0.5s var(--ease); }

.map-link-traffic {
  animation: linkTraffic 2.4s linear infinite;
}

@keyframes linkTraffic {
  to { stroke-dashoffset: -26; }
}

/* Hover used to apply a CSS transform that fought the JS-set positioning,
   teleporting sites to the SVG origin. Removed. The pin stroke change
   below is enough hover affordance. */
.map-site:hover .site-pin { stroke: var(--c-saffron); stroke-width: 2; }
.map-site:hover .site-ring { stroke-width: 2; }

.map-site.selected .site-ring {
  stroke-width: 2.4;
  animation: ringPulse 2s ease-in-out infinite;
}

@keyframes ringPulse {
  0%,100% { stroke-opacity: 1; }
  50%     { stroke-opacity: 0.5; }
}

.site-ring.pulse-up {
  animation: ringFlare 1.4s ease-out;
}

@keyframes ringFlare {
  0%   { stroke-width: 1.4; stroke-opacity: 1; }
  40%  { stroke-width: 4;   stroke-opacity: 1; }
  100% { stroke-width: 1.4; stroke-opacity: 0.85; }
}

.map-link-celebrate {
  transition: opacity 0.2s var(--ease), stroke-width 0.6s var(--ease);
}
.map-link-celebrate.celebrate-fire {
  opacity: 1;
  stroke-width: 8;
}

/* ============ Onboarding panel (floating) ============ */

.onboarding {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 12;
  background: rgba(20, 42, 64, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(232, 122, 42, 0.3);
  border-radius: var(--r-md);
  padding: 0.95rem 1.1rem;
  max-width: 340px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: onboardingIn 0.45s var(--ease-bounce);
}

@keyframes onboardingIn {
  0%   { opacity: 0; transform: translateY(-8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.onboarding.dismissed {
  animation: onboardingOut 0.25s var(--ease) forwards;
  pointer-events: none;
}

@keyframes onboardingOut {
  to { opacity: 0; transform: translateY(-8px); }
}

.onboarding-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.onboarding-kicker {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-saffron);
}

.onboarding-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--c-text-dim);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.3rem;
}

.onboarding-close:hover { color: var(--c-text); }

.onboarding-body {
  font-family: var(--f-sans);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--c-text);
}

.onboarding-body p {
  margin: 0 0 0.6rem 0;
}
.onboarding-body p:last-child {
  margin-bottom: 0;
}

.onboarding-body code {
  font-family: var(--f-mono);
  font-size: 0.85em;
  background: rgba(232, 122, 42, 0.12);
  color: var(--c-saffron);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* Re-open animation when the coach card pops back on a step change */
.onboarding.coach-pop {
  animation: onboardingIn 0.4s var(--ease-bounce), coachFlare 1.0s ease-out;
}
@keyframes coachFlare {
  0%   { box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5),
                     0 0 0 0 rgba(232, 122, 42, 0); }
  35%  { box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5),
                     0 0 0 14px rgba(232, 122, 42, 0.30); }
  100% { box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5),
                     0 0 0 24px rgba(232, 122, 42, 0); }
}

/* ============ Inspector (slides in from right) ============ */

.inspector-pane {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: rgba(15, 33, 56, 0.96);
  backdrop-filter: blur(10px);
  border-left: 1px solid var(--c-line);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transform: translateX(100%);
  transition: transform 0.3s var(--ease);
}

.inspector-pane.open { transform: translateX(0); }

.inspector-tabs {
  display: flex;
  border-bottom: 1px solid var(--c-line);
}

.inspector-tab {
  flex: 1;
  padding: 0.7rem 0.5rem;
  background: transparent;
  border: none;
  color: var(--c-text-dim);
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.18s var(--ease);
}

.inspector-tab:hover { color: var(--c-text); }
.inspector-tab.active {
  color: var(--c-saffron);
  border-bottom-color: var(--c-saffron);
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem 1rem;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  line-height: 1.65;
}

.inspector-body .row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--c-line);
}

.inspector-body .row .key { color: var(--c-text-dim); }
.inspector-body .row .val { color: var(--c-text); text-align: right; }

.state-pill {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--c-text-dim);
}

.state-pill.established { color: var(--c-emerald); background: rgba(125, 212, 160, 0.1); }
.state-pill.idle        { color: var(--c-red);     background: rgba(232, 90, 106, 0.1); }
.state-pill.connect,
.state-pill.active,
.state-pill.opensent,
.state-pill.openconfirm { color: var(--c-amber);   background: rgba(255, 179, 71, 0.1); }

.inspector-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background: var(--c-bg-card);
  border: 1px solid var(--c-line);
  border-right: none;
  border-radius: var(--r-md) 0 0 var(--r-md);
  color: var(--c-text-dim);
  cursor: pointer;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  padding: 1rem 0.4rem;
  z-index: 8;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}

.inspector-toggle:hover {
  color: var(--c-saffron);
  background: var(--c-bg-soft);
}

.inspector-toggle.hidden { display: none; }

/* ============ Terminal ============ */

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid var(--c-line);
}

.term-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.term-dot.red { background: #FF5F57; }
.term-dot.yel { background: #FEBC2E; }
.term-dot.grn { background: #28C840; }

.term-title {
  margin-left: 0.5rem;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--c-text-dim);
}

.term-output {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem 1rem 0.5rem;
  font-family: var(--f-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--c-text);
  white-space: pre-wrap;
  word-break: break-word;
  /* Subtle CRT scanlines on terminal only (era flavor that works here) */
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.16) 2px,
    rgba(0, 0, 0, 0.16) 3px
  );
}

.term-output .t-prompt { color: var(--c-emerald); }
.term-output .t-cmd    { color: #FFF7EE; }
.term-output .t-err    { color: var(--c-red); }
.term-output .t-warn   { color: var(--c-amber); }
.term-output .t-dim    { color: var(--c-text-dim); }
.term-output .t-ok     { color: var(--c-emerald); }
.term-output .t-celebrate {
  color: var(--c-emerald);
  font-weight: 600;
  border-left: 3px solid var(--c-emerald);
  padding-left: 0.6rem;
  margin: 0.5rem 0;
  background: rgba(125, 212, 160, 0.06);
  display: block;
}

.term-input-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--c-line);
  background: rgba(0, 0, 0, 0.55);
  transition: background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

/* ----- Mirror + ghost text ----- */
.term-input-cluster {
  position: relative;
  flex: 1;
  min-width: 0;
  display: block;
}
.term-input-mirror {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: var(--f-mono);
  font-size: 16px;
  line-height: 1;
  white-space: pre;
  overflow: hidden;
  display: flex;
  align-items: center;
  z-index: 1;
}
.term-typed { visibility: hidden; }
.term-ghost {
  color: rgba(232, 215, 168, 0.38);
  font-style: italic;
}
.term-input-cluster .term-input {
  position: relative;
  width: 100%;
  z-index: 2;
}

/* ----- Suggestions dropdown (live tab-complete + hints) ----- */
.term-suggest {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: rgba(10, 24, 38, 0.97);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(232, 122, 42, 0.45);
  border-radius: 8px;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.55);
  padding: 4px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 60;
  font-family: var(--f-mono);
  font-size: 13px;
}
.term-suggest[hidden] { display: none; }

.term-suggest-item {
  display: flex;
  gap: 1.2rem;
  align-items: baseline;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.term-suggest-item.active {
  background: rgba(232, 122, 42, 0.20);
}
.term-suggest-item:hover {
  background: rgba(232, 122, 42, 0.12);
}
.term-suggest-item.placeholder {
  font-style: italic;
  opacity: 0.75;
  cursor: default;
}
.term-suggest-token {
  color: #FFB347;
  flex: 0 0 auto;
  min-width: 9em;
  font-weight: 600;
}
.term-suggest-item.placeholder .term-suggest-token {
  color: #9B8EC4;
  font-weight: 500;
}
.term-suggest-hint {
  color: var(--c-text-dim);
  font-style: italic;
  font-size: 12px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.term-input-row:focus-within {
  background: rgba(0, 0, 0, 0.75);
  box-shadow: inset 0 1px 0 rgba(232, 122, 42, 0.5);
}

.term-input-prompt {
  font-family: var(--f-mono);
  /* 16px to match input. Keeps the prompt and caret on the same baseline
     and prevents iOS from autozooming on input focus. */
  font-size: 16px;
  color: var(--c-emerald);
  white-space: nowrap;
}

.term-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--c-text);
  font-family: var(--f-mono);
  /* iOS Safari auto-zooms the page when an input has font-size < 16px on
     focus, which breaks the lab layout. Pin to 16px. */
  font-size: 16px;
  caret-color: var(--c-saffron);
}

.term-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.term-input::placeholder {
  color: var(--c-text-dim);
  opacity: 0.7;
}

/* ============ Footer ============ */

.sim-footer {
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  background: rgba(15, 33, 56, 0.6);
  border-top: 1px solid var(--c-line);
  font-family: var(--f-mono);
  font-size: 0.76rem;
  color: var(--c-text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.visit-counter {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--c-text-dim);
}
.visit-counter::first-letter {
  /* the leading "//" picks up the saffron accent the rest of the
     site uses for mono kickers */
  color: var(--c-saffron);
}

/* ============ NOC dashboard ============ */

.alarm-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(232, 90, 106, 0.12);
  color: var(--c-red);
  border: 1px solid rgba(232, 90, 106, 0.4);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.18s var(--ease);
  user-select: none;
}

.alarm-badge:hover {
  background: rgba(232, 90, 106, 0.18);
  transform: translateY(-1px);
}

.alarm-badge.healthy {
  background: rgba(125, 212, 160, 0.08);
  color: var(--c-emerald);
  border-color: rgba(125, 212, 160, 0.3);
}

.alarm-badge .badge-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.alarm-badge .badge-count {
  font-weight: 600;
  font-size: 0.84rem;
}

.alarm-badge.pulse {
  animation: alarmPulse 1.4s ease-in-out infinite;
}

@keyframes alarmPulse {
  0%,100% { box-shadow: 0 0 0 rgba(232, 90, 106, 0); }
  50%     { box-shadow: 0 0 18px rgba(232, 90, 106, 0.6); }
}

.dash-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  /* Must beat Leaflet's marker (600) and popup (700) panes, plus the
     SSH popup terminal (1500). Tour overlay is 5000 so the dashboard
     stays below it. */
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}

.dash-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.dash-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2001;
  background: linear-gradient(180deg, #0F2138 0%, #0A1A2A 100%);
  border-bottom: 1px solid var(--c-line-warm);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(-100%);
  transition: transform 0.32s var(--ease);
  max-height: 75vh;
  overflow-y: auto;
}

.dash-panel.open { transform: translateY(0); }

.dash-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1.4rem clamp(1.2rem, 4vw, 3rem) 1rem;
  border-bottom: 1px solid var(--c-line);
}

.dash-kicker {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-saffron);
  margin-bottom: 0.4rem;
}

.dash-headline {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.8vw, 1.9rem);
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem 0;
  color: #FFF7EE;
}

.dash-sub {
  font-family: var(--f-sans);
  font-size: 0.92rem;
  color: var(--c-text-dim);
}

.dash-close {
  background: transparent;
  border: 1px solid var(--c-line);
  color: var(--c-text-dim);
  font-family: var(--f-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  padding: 0.5rem 0.85rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.dash-close:hover { color: var(--c-text); border-color: var(--c-saffron); }

.dash-alarms {
  padding: 1rem clamp(1.2rem, 4vw, 3rem);
  display: grid;
  gap: 0.8rem;
}

.dash-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--c-text-dim);
}

.dash-empty-icon {
  font-size: 3rem;
  color: var(--c-emerald);
  margin-bottom: 0.6rem;
}

.dash-empty-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.4rem;
  color: #FFF7EE;
  margin-bottom: 0.4rem;
}

.dash-empty-sub {
  font-size: 0.92rem;
}

.dash-alarm {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: var(--c-bg-card);
  border: 1px solid var(--c-line);
  border-left: 4px solid;
  border-radius: var(--r-md);
  align-items: start;
}

.dash-alarm.sev-critical { border-left-color: var(--c-red); }
.dash-alarm.sev-warning  { border-left-color: var(--c-amber); }
.dash-alarm.sev-info     { border-left-color: var(--c-emerald-2); }

.alarm-icon {
  font-family: var(--f-display);
  font-size: 1.4rem;
  font-weight: 700;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-alarm.sev-critical .alarm-icon { background: rgba(232, 90, 106, 0.16); color: var(--c-red); }
.dash-alarm.sev-warning  .alarm-icon { background: rgba(255, 179, 71, 0.16); color: var(--c-amber); }
.dash-alarm.sev-info     .alarm-icon { background: rgba(79, 182, 176, 0.16); color: var(--c-emerald-2); }

.alarm-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.35rem;
}

.alarm-sev {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
}

.dash-alarm.sev-critical .alarm-sev { background: rgba(232, 90, 106, 0.16); color: var(--c-red); }
.dash-alarm.sev-warning  .alarm-sev { background: rgba(255, 179, 71, 0.16); color: var(--c-amber); }
.dash-alarm.sev-info     .alarm-sev { background: rgba(79, 182, 176, 0.16); color: var(--c-emerald-2); }

.alarm-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1rem;
  color: #FFF7EE;
}

.alarm-short {
  font-family: var(--f-sans);
  font-size: 0.94rem;
  color: var(--c-text);
  line-height: 1.5;
}

.alarm-details {
  margin-top: 0.7rem;
}

.alarm-details summary {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-text-dim);
  cursor: pointer;
  user-select: none;
}

.alarm-details summary:hover { color: var(--c-saffron); }

.alarm-details p {
  margin: 0.5rem 0;
  font-family: var(--f-sans);
  font-size: 0.9rem;
  color: var(--c-text);
  line-height: 1.55;
}

.alarm-hint .hint-label {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  color: var(--c-saffron);
  background: rgba(232, 122, 42, 0.1);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-right: 0.4rem;
}

.alarm-investigate {
  background: var(--c-saffron);
  color: #0A1A2A;
  border: none;
  padding: 0.6rem 0.95rem;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s var(--ease);
}

.alarm-investigate:hover {
  background: var(--c-saffron-2);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(232, 122, 42, 0.4);
}

.dash-health {
  display: flex;
  gap: 2rem;
  padding: 1rem clamp(1.2rem, 4vw, 3rem);
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--c-line);
  font-family: var(--f-mono);
  font-size: 0.86rem;
}

.health-stat { display: flex; gap: 0.6rem; align-items: baseline; }

.health-label {
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-text-dim);
}

.health-value { color: var(--c-text); }
.health-value .up    { color: var(--c-emerald); }
.health-value .amber { color: var(--c-amber); }
.health-value .down  { color: var(--c-red); }
.health-value .total { color: var(--c-text-dim); }

.health-value.pct { font-size: 1.05rem; font-weight: 600; }

.dash-health.health-up    .health-value.pct { color: var(--c-emerald); }
.dash-health.health-amber .health-value.pct { color: var(--c-amber); }
.dash-health.health-down  .health-value.pct { color: var(--c-red); }

/* ============ Protocol Microscope (v1.1) ============ */

/* Inline `?` glyph: dim until hovered. Lives next to whyable values. */
.why-glyph {
  display: inline-block;
  margin-left: 0.35rem;
  width: 1.05rem;
  height: 1.05rem;
  line-height: 1;
  padding: 0;
  font-family: var(--f-mono);
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--c-text-dim);
  background: rgba(232, 122, 42, 0.08);
  border: 1px solid var(--c-line);
  border-radius: 50%;
  cursor: pointer;
  vertical-align: middle;
  transition: all 0.15s var(--ease);
}
.why-glyph:hover,
.why-glyph:focus-visible {
  color: var(--c-saffron);
  border-color: var(--c-saffron);
  background: rgba(232, 122, 42, 0.18);
  outline: none;
}

/* Best-path reason chip in the inspector Routes tab */
.reason-chip {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-saffron);
  background: rgba(232, 122, 42, 0.1);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

/* Map message pulses (engine-driven). Selected pulse stays visible
   while the decode pane is open. */
.msg-pulse {
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.25));
  transition: r 0.15s var(--ease), filter 0.15s var(--ease);
}
.msg-pulse:hover {
  filter: drop-shadow(0 0 8px rgba(255, 215, 168, 0.85));
}
.msg-pulse.selected {
  filter: drop-shadow(0 0 12px rgba(232, 122, 42, 0.95));
  stroke: var(--c-saffron);
  stroke-width: 2.4;
}

/* Decode pane: centered modal-style overlay over the map */
.decode-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.decode-overlay.open { display: flex; }

.decode-card {
  width: min(680px, 92vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0F2138 0%, #08182A 100%);
  border: 1px solid var(--c-line-warm);
  border-radius: var(--r-md);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.decode-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  padding: 1.1rem 1.3rem 0.9rem;
  border-bottom: 1px solid var(--c-line);
  background: rgba(0, 0, 0, 0.35);
}

.decode-kicker {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-saffron);
  margin-bottom: 0.3rem;
}

.decode-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: #FFF7EE;
}

.decode-sub {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--c-text-dim);
  margin-left: 0.5rem;
  letter-spacing: 0.04em;
}

.decode-close {
  background: transparent;
  border: 1px solid var(--c-line);
  color: var(--c-text-dim);
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.45rem 0.7rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.decode-close:hover { color: var(--c-text); border-color: var(--c-saffron); }

.decode-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.7rem 1.1rem 1rem;
}

.decode-foot {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--c-text-dim);
  padding: 0.7rem 1.3rem;
  border-top: 1px solid var(--c-line);
  background: rgba(0, 0, 0, 0.3);
  line-height: 1.5;
}

.decode-layer {
  margin: 0.5rem 0;
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.decode-layer > summary {
  cursor: pointer;
  padding: 0.55rem 0.85rem;
  list-style: none;
  background: rgba(232, 122, 42, 0.05);
  border-bottom: 1px solid var(--c-line);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
}
.decode-layer > summary::-webkit-details-marker { display: none; }
.decode-layer > summary::marker { content: ''; }

.decode-layer-name {
  font-family: var(--f-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-saffron);
  letter-spacing: 0.04em;
}

.decode-layer-ref {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--c-text-dim);
  letter-spacing: 0.08em;
}

.decode-field {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) 1fr;
  gap: 0.7rem;
  padding: 0.4rem 0.85rem;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.04);
}
.decode-field:first-of-type { border-top: none; }

.decode-k {
  color: var(--c-text-dim);
}
.decode-v {
  color: var(--c-text);
  word-break: break-word;
}
.decode-len {
  color: var(--c-text-muted, #5e5475);
  font-size: 0.7rem;
  margin-left: 0.4rem;
  opacity: 0.7;
}

/* Why panel: smaller, sits ABOVE the decode pane in z order */
.why-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.why-overlay.open { display: flex; }

.why-card {
  width: min(480px, 92vw);
  background: linear-gradient(180deg, #14223A 0%, #0A1A2A 100%);
  border: 1px solid rgba(155, 142, 196, 0.4);
  border-radius: var(--r-md);
  padding: 1.4rem 1.6rem 1.3rem;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  position: relative;
}

.why-kicker {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-lavender);
  margin-bottom: 0.6rem;
}

.why-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.3rem;
  margin: 0 0 0.7rem 0;
  color: #FFF7EE;
  letter-spacing: -0.015em;
}

.why-body {
  font-family: var(--f-sans);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--c-text);
  margin: 0 0 1rem 0;
}

.why-close {
  background: transparent;
  border: 1px solid var(--c-line);
  color: var(--c-text-dim);
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.45rem 0.85rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.why-close:hover { color: var(--c-text); border-color: var(--c-lavender); }

@media (max-width: 700px) {
  .decode-card { width: 96vw; max-height: 92vh; }
  .decode-field { grid-template-columns: 1fr; gap: 0.15rem; }
  .why-card { width: 96vw; padding: 1.1rem 1.2rem; }
}

/* ============ Leaflet map (v3) ============ */

.leaflet-canvas {
  position: absolute;
  inset: 0;
  background: var(--c-bg);
}

/* Dark NOC look. Filter targets the tile pane only so site pins and
   overlays render on top in their natural saffron / emerald palette. */
.leaflet-tile-pane .rb-tile-layer {
  filter: invert(0.92) hue-rotate(180deg) brightness(0.85)
          saturate(0.55) contrast(0.95);
}

/* Recolor Leaflet's chrome for the dark theme */
.leaflet-control-zoom a,
.leaflet-control-attribution {
  background: rgba(15, 33, 56, 0.92) !important;
  color: var(--c-text, #E8E2D6) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}
.leaflet-control-zoom a {
  width: 32px;
  height: 32px;
  line-height: 32px;
  font-weight: 700;
}
.leaflet-control-zoom a:hover {
  background: rgba(232, 122, 42, 0.22) !important;
  color: #FFB347 !important;
}
.leaflet-control-attribution {
  font-size: 10px !important;
  padding: 2px 6px !important;
}
.leaflet-control-attribution a {
  color: #FFB347 !important;
}

/* ============ Site pins (divIcon HTML) ============ */
.leaflet-div-icon.rb-site-icon,
.rb-site-icon {
  background: transparent;
  border: none;
  overflow: visible;
}
.rb-pin {
  position: relative;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
}
.rb-pin-ring {
  position: absolute;
  inset: -3px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.6px solid #7DD4A0;
  opacity: 0.85;
  transition: border-color 0.4s var(--ease), opacity 0.3s ease;
  pointer-events: none;
}
.rb-pin-core {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.8px solid #0A1A2A;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: border-color 0.2s ease;
}
.rb-pin-sat {
  position: absolute;
  top: -10px;
  left: 14px;
  pointer-events: none;
}
.rb-pin-label {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  white-space: nowrap;
  pointer-events: none;
  font-family: 'Inter Tight', system-ui, sans-serif;
  text-shadow:
    0 1px 4px rgba(6, 18, 30, 0.95),
    0 0 8px rgba(6, 18, 30, 0.85);
}
.rb-pin-iata {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  color: #FFB347;
  font-family: 'JetBrains Mono', monospace;
}
.rb-pin-city {
  font-size: 11px;
  font-weight: 600;
  color: #E8E2D6;
  margin-top: 1px;
}
.rb-pin-asn {
  font-size: 8px;
  font-weight: 500;
  color: rgba(232, 122, 42, 0.85);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 1px;
  letter-spacing: 0.06em;
}
.rb-pin:hover .rb-pin-core {
  border-color: #FFB347;
}
.rb-pin:hover .rb-pin-ring {
  opacity: 1;
}

/* Keyboard focus on a city pin: prominent saffron ring so the user
   knows which router they're about to select with Enter/Space. */
.leaflet-marker-icon.rb-site-icon:focus,
.leaflet-marker-icon.rb-site-icon:focus-visible {
  outline: none;
}
.leaflet-marker-icon.rb-site-icon:focus .rb-pin-ring,
.leaflet-marker-icon.rb-site-icon:focus-visible .rb-pin-ring {
  border-color: #FFB347;
  border-width: 2.4px;
  box-shadow: 0 0 0 4px rgba(255, 179, 71, 0.35);
  opacity: 1;
}
.leaflet-marker-icon.rb-site-icon:focus .rb-pin-core,
.leaflet-marker-icon.rb-site-icon:focus-visible .rb-pin-core {
  border-color: #FFB347;
}
.rb-pin-selected .rb-pin-ring,
.leaflet-marker-icon.rb-site-icon.rb-pin-selected .rb-pin-ring {
  animation: rbPinRingPulse 2s ease-in-out infinite;
}
.rb-pin-selected .rb-pin-core {
  border-color: #FFB347;
  box-shadow: 0 0 18px rgba(255, 179, 71, 0.65);
}
@keyframes rbPinRingPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
.rb-pin-flare {
  animation: rbPinRingFlare 1.4s ease-out;
}
@keyframes rbPinRingFlare {
  0%   { box-shadow: 0 0 0 0 rgba(125, 212, 160, 0); }
  40%  { box-shadow: 0 0 0 12px rgba(125, 212, 160, 0.45); }
  100% { box-shadow: 0 0 0 24px rgba(125, 212, 160, 0); }
}

/* ============ BGP message pulses on the map ============ */
.rb-pulse {
  cursor: pointer;
  filter: drop-shadow(0 0 4px currentColor);
}
.rb-pulse.selected {
  filter: drop-shadow(0 0 10px currentColor);
}

/* Link layer transitions */
.rb-link-base { transition: stroke 0.4s var(--ease), stroke-opacity 0.4s var(--ease); }
.rb-link-overlay { transition: stroke-opacity 0.5s var(--ease); }

/* Link celebrate animation (BGP up moment) */
.rb-link-celebrate {
  opacity: 0;
  transition: opacity 0.2s var(--ease), stroke-width 0.6s var(--ease);
}
.rb-link-celebrate.celebrate-fire {
  opacity: 1;
  stroke-width: 8;
}

/* ============ Map legend (medium key) ============ */
.map-legend {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.7rem 0.85rem;
  background: rgba(15, 33, 56, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--c-text-dim);
  pointer-events: none;
  user-select: none;
}
.map-legend .legend-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.map-legend .legend-swatch {
  width: 18px;
  height: 2px;
  border-radius: 1px;
  display: inline-block;
}
.map-legend .legend-swatch.fiber     { background: #E87A2A; }
.map-legend .legend-swatch.microwave { background: #9B8EC4; }
.map-legend .legend-swatch.satellite {
  background: transparent;
  border-top: 2px dashed #4FB6E0;
  height: 0;
}

@media (max-width: 700px) {
  .map-legend {
    top: 0.6rem;
    right: 0.6rem;
    padding: 0.5rem 0.6rem;
    font-size: 0.6rem;
  }
}

/* Satellite icons + orbit drawn by Leaflet picks up these classes */
.rb-satellite {
  filter: drop-shadow(0 0 6px rgba(79, 182, 224, 0.55));
}

/* Map error fallback */
.rb-map-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #E85A6A;
  font-family: 'JetBrains Mono', monospace;
  padding: 2rem;
  text-align: center;
}

/* ============ Learn banner (hub CTA to the BGP primer) ============ */

.learn-banner {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "kicker arrow"
    "title  arrow"
    "body   arrow";
  gap: 0.4rem 1rem;
  align-items: center;
  margin: 0 auto 2rem;
  max-width: 720px;
  padding: 1.4rem 1.6rem;
  background: linear-gradient(135deg,
    rgba(232, 122, 42, 0.08) 0%,
    rgba(155, 142, 196, 0.08) 100%);
  border: 1px solid rgba(232, 122, 42, 0.28);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--c-text);
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease),
              box-shadow 0.18s var(--ease);
}
.learn-banner:hover {
  transform: translateY(-1px);
  border-color: rgba(232, 122, 42, 0.55);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35),
              0 0 0 1px rgba(232, 122, 42, 0.20);
}
.learn-banner-kicker {
  grid-area: kicker;
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #FFB347;
  font-weight: 600;
}
.learn-banner-title {
  grid-area: title;
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #FFF7EE;
  letter-spacing: -0.01em;
}
.learn-banner-body {
  grid-area: body;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--c-text-dim);
}
.learn-banner-arrow {
  grid-area: arrow;
  font-size: 1.5rem;
  color: #FFB347;
  font-family: var(--f-mono);
  align-self: center;
  transition: transform 0.18s var(--ease);
}
.learn-banner:hover .learn-banner-arrow {
  transform: translateX(4px);
}

@media (max-width: 600px) {
  .learn-banner {
    grid-template-columns: 1fr;
    grid-template-areas:
      "kicker"
      "title"
      "body"
      "arrow";
  }
  .learn-banner-arrow { justify-self: end; }
}

/* ============ SSH popup mode ============

   Click the SSH button in the lab header. The terminal pane jumps out
   of the right rail and becomes a draggable, resizable floating window
   sitting on top of the full-width map. Click again to dock back.    */

.ssh-toggle {
  background: rgba(15, 33, 56, 0.85);
  border: 1px solid rgba(232, 122, 42, 0.4);
  color: #FFB347;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.ssh-toggle:hover {
  background: rgba(232, 122, 42, 0.18);
  color: #FFF7EE;
  border-color: rgba(232, 122, 42, 0.6);
}
.ssh-toggle.active {
  background: rgba(232, 122, 42, 0.32);
  color: #FFF7EE;
  border-color: #FFB347;
}

body.ssh-mode .lab-main {
  grid-template-columns: 1fr;
}
body.ssh-mode .term-pane {
  position: fixed;
  top:    var(--ssh-top, 90px);
  left:   var(--ssh-left, 30vw);
  width:  var(--ssh-w, min(760px, 88vw));
  height: var(--ssh-h, min(500px, 70vh));
  z-index: 1500;
  border: 1px solid rgba(232, 122, 42, 0.5);
  border-radius: var(--r-md);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(232, 122, 42, 0.18),
    0 0 60px rgba(232, 122, 42, 0.12);
  overflow: hidden;
  resize: both;
  min-width: 360px;
  min-height: 260px;
}
body.ssh-mode .term-pane .term-bar {
  cursor: grab;
  user-select: none;
  background: rgba(20, 35, 52, 0.98);
}
body.ssh-mode .term-pane .term-bar:active {
  cursor: grabbing;
}
body.ssh-mode .term-pane .term-bar .term-title {
  margin-right: auto;
}

/* SSH close button: hidden by default, visible only when popped out */
.ssh-close {
  display: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--c-text-dim);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  margin-left: 0.4rem;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.ssh-close:hover {
  background: rgba(232, 90, 106, 0.18);
  color: #FFF7EE;
  border-color: rgba(232, 90, 106, 0.55);
}
body.ssh-mode .ssh-close { display: inline-flex; align-items: center; justify-content: center; }

@media (max-width: 700px) {
  body.ssh-mode .term-pane {
    top: 60px !important;
    left: 4vw !important;
    width: 92vw !important;
    height: 60vh !important;
  }
}

/* ============ Intro tour (first-run coachmarks) ============ */

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  pointer-events: auto;
}
.tour-overlay[hidden] { display: none; }

.tour-spotlight {
  position: absolute;
  border-radius: 12px;
  pointer-events: none;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.62),
    0 0 0 4px rgba(232, 122, 42, 0.85),
    0 0 24px rgba(232, 122, 42, 0.45);
  transition: top 0.35s var(--ease), left 0.35s var(--ease),
              width 0.35s var(--ease), height 0.35s var(--ease);
}

.tour-tooltip {
  position: absolute;
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 1.1rem 1.3rem 1rem;
  background: rgba(15, 33, 56, 0.98);
  border: 1px solid rgba(232, 122, 42, 0.5);
  border-radius: 10px;
  color: var(--c-text);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55);
  font-family: var(--f-sans);
  transition: top 0.35s var(--ease), left 0.35s var(--ease);
  animation: tourPop 0.35s var(--ease-bounce);
}
@keyframes tourPop {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
.tour-step-pill {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: #FFB347;
  background: rgba(232, 122, 42, 0.12);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.6rem;
}
.tour-title {
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #FFF7EE;
  margin: 0 0 0.45rem;
}
.tour-body {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--c-text);
  margin: 0 0 1rem;
}
.tour-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}
.tour-skip,
.tour-next {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 0.55rem 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.tour-skip {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--c-text-dim);
}
.tour-skip:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--c-text);
}
.tour-next {
  background: #E87A2A;
  border: 1px solid #E87A2A;
  color: #FFF7EE;
  font-weight: 600;
}
.tour-next:hover {
  background: #FFB347;
  border-color: #FFB347;
}

/* While the tour is active, dim interactivity below the overlay so
   stray clicks don't fall through to the lab. */
body.tour-active { overflow: hidden; }

/* ============ Mobile lab layout polish ============ */

@media (max-width: 900px) {
  /* Map + console split on tablet: bigger console for typing room */
  .lab-main { grid-template-rows: 1fr 320px; }
}
@media (max-width: 700px) {
  /* Phone: tab between Map and Console, full screen for whichever is
     active. The tab bar at the bottom switches them. Much more usable
     than a tiny split-pane. */
  .lab-main { grid-template-rows: 1fr; grid-template-columns: 1fr; }
  body:not(.lab-tab-console) .term-pane { display: none; }
  body.lab-tab-console        .map-pane  { display: none; }

  .term-output { font-size: 0.78rem; }
  .term-input,
  .term-input-mirror { font-size: 16px; }   /* anti-iOS-zoom is 16px */
  .term-suggest { font-size: 12px; max-height: 38vh; }
  .term-suggest-token { min-width: 7em; }

  /* Coach card spans the top of the active pane */
  .onboarding {
    max-width: calc(100vw - 24px);
    left: 12px;
    right: 12px;
    transform: none;
    top: 12px;
    padding: 0.85rem 1rem;
    animation: none;
  }
  .onboarding.coach-pop { animation: none; }
  .onboarding.dismissed { animation: none; opacity: 0; pointer-events: none; }
  .onboarding-body { font-size: 0.86rem; }
}

/* ============ Mobile lab tab bar (Map | Console) ============ */
.lab-tabs { display: none; }

@media (max-width: 700px) {
  .lab-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    background: rgba(6, 18, 30, 0.97);
    border-top: 1px solid var(--c-line);
    backdrop-filter: blur(10px);
  }
  .lab-tabs button {
    appearance: none;
    background: transparent;
    border: none;
    border-top: 2px solid transparent;
    padding: 0.85rem 0.5rem;
    color: var(--c-text-dim);
    font-family: var(--f-mono);
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
  }
  .lab-tabs button.active {
    color: #FFB347;
    border-top-color: #FFB347;
  }
  .lab-page { padding-bottom: 48px; }
}

/* ============ Reduced motion ============ */

@media (prefers-reduced-motion: reduce) {
  /* Snap rather than animate. Keep transition/animation API working
     for state-carrying CSS class flips (a link turning green still
     happens, just instantly), but kill the lerp/pulse/loop fanfare. */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  /* Explicit hard-offs for looping / glowing decoration */
  .map-link-traffic,
  .mission-hint.glow,
  .alarm-badge.pulse,
  .site-ring.pulse-up,
  .rb-pin-flare,
  .rb-link-celebrate,
  .map-link-celebrate,
  .map-site.selected .site-ring,
  .rb-pin-selected .rb-pin-ring,
  .onboarding,
  .onboarding.coach-pop,
  .tour-tooltip { animation: none !important; }
  /* Spotlight snaps without slide */
  .tour-spotlight { transition: none !important; }
  /* JS-driven map pulses are simplified in map.js by checking the
     same media query at runtime. */
}
