/* One stable top rail: geographic lenses, then the network milestone. */
.app-shell #map-navigation {position:fixed;z-index:92;top:16px;left:50%;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;gap:8px;width:max-content;max-width:calc(100vw - 24px);pointer-events:none;}
.app-shell #map-navigation #map-views {position:relative;inset:auto;transform:none;width:max-content;max-width:100%;pointer-events:auto;}
.app-shell #map-navigation #network-goal-disclosure {order:initial;flex:none;margin:0;width:max-content;max-width:100%;}
.app-shell #map-navigation #network-goal-disclosure[open] {width:min(440px,calc(100vw - 24px));}
.app-shell #map-navigation #network-goal-disclosure:not([open]) .disclosure-chevron {display:none;}
.app-shell #network-goal-disclosure > summary {min-height:34px;padding:5px 12px;}
.app-shell #network-goal-disclosure .network-milestones {grid-template-columns:repeat(4,minmax(0,1fr));}
.h101-pixel.is-owned.is-off {background:#101612;}
#signal-entry .entry-flight-pixel > .h101-pixel {pointer-events:none;transition:none!important;}
@media(max-width:760px){
 .app-shell #map-navigation {
   top:var(--map-rail-top);width:calc(100% - 36px);max-width:none;gap:6px;
 }
 .app-shell #map-navigation #map-views {width:100%;}
}
@media(max-width:640px){
 .app-shell #signal-key {top:126px;}
 .app-shell #live-presence {top:190px;}
 .app-shell #network-goal-disclosure > summary {font-size:12px;gap:8px;min-height:32px;padding:4px 10px;}
}

.app-shell #map-views .view-button:not(.view-button--meta) {
  border-radius: var(--map-control-radius) !important;
}

/* Shared geometry for the white frame, windshield, and outside blur. */
.app-shell {
  --map-control-radius: 12px;
  /* Monochrome grain lives on the glass, above the filtered map. */
  --map-glass-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='grain' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)' opacity='.19'/%3E%3C/svg%3E");
  --map-frame-top: 18px;
  --map-frame-side: 20px;
  --map-frame-bottom: 36px;
  --map-perimeter-blur: 15px;
  --map-windshield-depth: 166px;
  --map-windshield-light: 247, 249, 246;
  --map-windshield-strength: .21;
  --map-windshield-blur: 23px;
  --map-rail-top: max(22px, calc(env(safe-area-inset-top) + 10px));
}
.app-shell[data-view="local"] {
  --map-windshield-strength: .26;
  --map-windshield-blur: 27px;
}
.app-shell .frame,
.app-shell[data-mode="coincidence"] .frame {
  inset: var(--map-frame-top) var(--map-frame-side) var(--map-frame-bottom);
  z-index: 62;
  border-color: #fff;
}

/* Subtract the rounded interior from a full-viewport backdrop.
   The interior is two overlapping rectangles and four quarter circles. */
.app-shell .map-edge-fade {
  --radius: var(--map-frame-radius);
  --inside-width: calc(100% - 2 * var(--map-frame-side));
  --inside-height: calc(100% - var(--map-frame-top) - var(--map-frame-bottom));
  --corner-edge: #000 calc(var(--radius) - .5px), transparent calc(var(--radius) + .5px);
  position: absolute;
  inset: 0;
  z-index: 61;
  pointer-events: none;
  -webkit-backdrop-filter: blur(var(--map-perimeter-blur));
  backdrop-filter: blur(var(--map-perimeter-blur));
  mask:
    linear-gradient(#000 0 0),
    linear-gradient(#000 0 0) center var(--map-frame-top) / calc(var(--inside-width) - 2 * var(--radius)) var(--inside-height) no-repeat,
    linear-gradient(#000 0 0) center calc(var(--map-frame-top) + var(--radius)) / var(--inside-width) calc(var(--inside-height) - 2 * var(--radius)) no-repeat,
    radial-gradient(circle at bottom right, var(--corner-edge)) left var(--map-frame-side) top var(--map-frame-top) / var(--radius) var(--radius) no-repeat,
    radial-gradient(circle at bottom left, var(--corner-edge)) right var(--map-frame-side) top var(--map-frame-top) / var(--radius) var(--radius) no-repeat,
    radial-gradient(circle at top right, var(--corner-edge)) left var(--map-frame-side) bottom var(--map-frame-bottom) / var(--radius) var(--radius) no-repeat,
    radial-gradient(circle at top left, var(--corner-edge)) right var(--map-frame-side) bottom var(--map-frame-bottom) / var(--radius) var(--radius) no-repeat;
  mask-composite: exclude, add, add, add, add, add, add;
}

.app-shell .leaflet-control-container .leaflet-bottom.leaflet-right,
.app-shell .mapboxgl-ctrl-bottom-right { right: var(--map-frame-side); }

.app-shell[data-mode="coincidence"] {
  --map-windshield-light: 176, 235, 211;
}
.app-shell .map-windshield {
  position: absolute;
  inset: 0 0 auto;
  z-index: 62;
  height: var(--map-windshield-depth);
  pointer-events: none;
  background: var(--map-glass-grain) repeat,
    linear-gradient(180deg, rgba(var(--map-windshield-light), var(--map-windshield-strength)), transparent);
  -webkit-backdrop-filter: blur(var(--map-windshield-blur)) saturate(1.09);
  backdrop-filter: blur(var(--map-windshield-blur)) saturate(1.09);
  mask-image: radial-gradient(ellipse 77% 116% at 50% 0%, #000 38%, #000e 57%, #0007 76%, transparent 96%);
  opacity: 0;
  transition: opacity .8s ease;
}
.app-shell.is-reveal-controls .map-windshield { opacity: 1; }
@media (max-width: 760px) {
  .app-shell {
    --map-frame-top: 12px;
    --map-frame-side: 8px;
    --map-frame-bottom: 24px;
    --map-perimeter-blur: 11px;
    --map-windshield-depth: 160px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .app-shell .map-windshield { transition: none; }
}

/* The first milestone is filled. Future milestones show their colors as rings. */
.app-shell #network-goal-disclosure :is(.network-mini-track > i, .network-milestones > li) { --milestone-color: #ff6a12; }
.app-shell #network-goal-disclosure :is(.network-mini-track > i, .network-milestones > li):nth-child(2) { --milestone-color: #e6a915; }
.app-shell #network-goal-disclosure :is(.network-mini-track > i, .network-milestones > li):nth-child(3) { --milestone-color: #94bb24; }
.app-shell #network-goal-disclosure :is(.network-mini-track > i, .network-milestones > li):nth-child(4) { --milestone-color: #299348; }
.app-shell #network-goal-disclosure :is(.network-mini-track > i, .network-milestones > li > i) {
  border-color: var(--milestone-color);
}
.app-shell #network-goal-disclosure :is(.network-mini-track > i.is-reached, .network-milestones > li.is-reached > i) {
  background: var(--milestone-color);
  box-shadow: 0 0 0 2px #fff, 0 0 9px #ff6a1259;
}
.app-shell #network-goal-disclosure .network-milestones > li.is-reached > b { color: #a8450d; }

/* The maker credit sits outside the frame, below the map attribution. */
.app-shell .map-maker-credit {
  position:fixed;z-index:89;
  inset:auto max(calc(var(--map-frame-side) + 4px),env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left));
  min-height:var(--map-frame-bottom);
  display:flex;align-items:center;justify-content:flex-end;
  color:#53625a;text-align:right;font:500 clamp(9px,.8vw,11px)/1.25 var(--sans);
  letter-spacing:.025em;pointer-events:none;
}
.app-shell[data-mode=coincidence] .map-maker-credit {color:#e1efe6}
.app-shell.is-intro-sequenced:not(.is-main-loaded) .map-maker-credit {visibility:hidden}
