/* ATLAS 9.19.32 — phone top bar, compact warning badge, Valmynd as a real sheet,
   hide all floating map chrome while any sheet/popover is open. Beats simple-9190
   and pro-phone absolute positions (those made Valmynd a ~300px floating card
   under the top buttons, and stretched the badge with left+right). */

/* Reserved top bar: VÍ-kort | badge | Valmynd. Never overlap at 320–430px. */
html.atlas-phone-shell #atlasPhoneTop{
  position:fixed;
  top:calc(env(safe-area-inset-top,0px) + 8px);
  left:8px;right:8px;
  z-index:130;
  display:flex;align-items:center;gap:6px;
  height:36px;min-height:36px;
  pointer-events:none;
  box-sizing:border-box;
}
html.atlas-phone-shell #atlasPhoneTop > *{
  pointer-events:auto;
  position:relative !important;
  top:auto !important;
  left:auto !important;
  right:auto !important;
  bottom:auto !important;
  transform:none !important;
  margin:0 !important;
  height:36px !important;
  min-height:36px !important;
  flex:0 0 auto;
}
html.atlas-phone-shell.atlas-pro-phone body #atlasPhoneTop #openReferencePlayer#openReferencePlayer,
html.atlas-phone-shell body.v9-map-first #atlasPhoneTop #openReferencePlayer#openReferencePlayer,
html.atlas-phone-shell.atlas-pro-phone body #atlasPhoneTop #phoneMenuButton#phoneMenuButton,
html.atlas-phone-shell body.v9-map-first #atlasPhoneTop #phoneMenuButton#phoneMenuButton{
  position:relative !important;
  top:auto !important;left:auto !important;right:auto !important;
  height:36px !important;min-height:36px !important;
  z-index:1 !important;
}
html.atlas-phone-shell #atlasPhoneTop #openReferencePlayer{flex:0 1 auto;min-width:0;max-width:42%;}
html.atlas-phone-shell #atlasPhoneTop #atlasWarnBadge{
  flex:0 1 auto;min-width:0;max-width:46%;
  width:auto !important;height:36px !important;
  left:auto !important;right:auto !important;top:auto !important;
  transform:none !important;
  position:relative !important;
}
html.atlas-phone-shell #atlasPhoneTop #phoneMenuButton{margin-left:auto !important;flex:0 0 auto;}

/* Short VÍ label when the bar is tight */
html.atlas-phone-shell #atlasPhoneTop .vi-label-short{display:none;}
@media (max-width:360px){
  html.atlas-phone-shell #atlasPhoneTop .vi-label-full{display:none;}
  html.atlas-phone-shell #atlasPhoneTop .vi-label-short{display:inline;}
  html.atlas-phone-shell #atlasPhoneTop #openReferencePlayer{max-width:34%;padding-left:8px !important;padding-right:8px !important;}
  html.atlas-phone-shell #atlasPhoneTop #phoneMenuButton .valmynd-text{display:none;}
}

/* Compact self-explanatory badge — never a stretching bar */
.atlas-warn-badge{
  display:inline-flex;align-items:center;gap:5px;
  width:auto !important;max-width:100%;
  left:auto;right:auto;
  white-space:nowrap;overflow:hidden;
  box-sizing:border-box;
  font:800 12px/1 system-ui,sans-serif;
}
.atlas-warn-badge .warn-ico,
html.atlas-phone-shell .atlas-warn-badge .warn-ico{
  font-style:normal;font-size:14px;line-height:1;font-weight:700;
  font-family:system-ui,"Segoe UI Symbol","Noto Sans Symbols",sans-serif;
  font-variant-emoji:text;
  font-feature-settings:"liga" 0;
  color:inherit;
  position:static !important;width:auto !important;height:auto !important;
  overflow:visible !important;clip:auto !important;clip-path:none !important;
  flex:none;
}
html.atlas-narrow-phone #atlasPhoneTop #atlasWarnBadge{
  flex:0 0 auto !important;
  min-width:auto !important;
  overflow:visible;
  gap:4px;
  padding:0 10px 0 8px;
}
.atlas-warn-badge .warn-label{overflow:hidden;text-overflow:ellipsis;}
html.atlas-narrow-phone .atlas-warn-badge .warn-label{
  position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);
}
/* Beat any leftover ≤400px span-clip so 375–400px still show “⚠ 7 viðvaranir”. */
@media (max-width:400px){
  html:not(.atlas-narrow-phone) .atlas-warn-badge .warn-label{
    position:static !important;width:auto !important;height:auto !important;
    overflow:hidden;clip:auto !important;clip-path:none !important;
  }
}
.atlas-warn-hint{
  position:absolute;top:calc(100% + 6px);left:0;z-index:140;
  padding:6px 8px;border-radius:8px;
  background:#11171c;color:#f4f7f8;
  font:650 12px/1.3 system-ui,sans-serif;
  white-space:nowrap;
  box-shadow:0 4px 14px rgba(0,0,0,.4);
  pointer-events:none;
}
.atlas-warn-hint::before{
  content:"";position:absolute;top:-5px;left:12px;
  border:5px solid transparent;border-bottom-color:#11171c;
}

/* Valmynd (and sibling menus) = full-width bottom sheet. Trump simple-9190's 300px card at z-index 80. */
html.atlas-phone-shell body #toolsMenu#toolsMenu#toolsMenu:not([hidden]),
html.atlas-phone-shell.atlas-pro-phone body.v9-map-first #toolsMenu#toolsMenu#toolsMenu:not([hidden]),
html.atlas-phone-shell.atlas-pro-phone body #toolsMenu#toolsMenu#toolsMenu:not([hidden]),
html.atlas-phone-shell body #appearancePanel#appearancePanel#appearancePanel:not([hidden]),
html.atlas-phone-shell.atlas-pro-phone body #appearancePanel#appearancePanel#appearancePanel:not([hidden]),
html.atlas-phone-shell body #informationLayers#informationLayers#informationLayers:not([hidden]),
html.atlas-phone-shell.atlas-pro-phone body #informationLayers#informationLayers#informationLayers:not([hidden]),
html.atlas-phone-shell body #layoutMenu#layoutMenu#layoutMenu:not([hidden]),
html.atlas-phone-shell body #mSheet#mSheet#mSheet:not([hidden]),
html.atlas-phone-shell body #atlasBriefSheet#atlasBriefSheet:not([hidden]){
  position:fixed !important;
  left:0 !important;right:0 !important;
  width:100% !important;max-width:none !important;min-width:0 !important;
  top:auto !important;
  bottom:0 !important;
  height:auto !important;
  max-height:calc(100dvh - env(safe-area-inset-top,0px) - 52px) !important;
  min-height:min(70dvh, calc(100dvh - env(safe-area-inset-top,0px) - 64px)) !important;
  z-index:220 !important;
  border-radius:18px 18px 0 0 !important;
  transform:none !important;
  margin:0 !important;
  padding-bottom:calc(var(--atlas-tabs-h, 54px) + env(safe-area-inset-bottom, 0px) + 8px) !important;
  overflow:auto !important;
  box-shadow:0 -12px 40px rgba(0,0,0,.45) !important;
}
/* Show the real Valmynd rows (simple-9190 hid everything except #simpleMenu). */
html.atlas-phone-shell body #toolsMenu#toolsMenu#toolsMenu > *{display:block !important;}
html.atlas-phone-shell body #toolsMenu#toolsMenu#toolsMenu > header,
html.atlas-phone-shell.atlas-pro-phone body #toolsMenu#toolsMenu#toolsMenu > header{
  display:flex !important;
  align-items:flex-start;
  justify-content:space-between;
  position:sticky;top:0;z-index:2;
  gap:12px;
  padding:12px 14px 10px;
  background:inherit;
}
html.atlas-phone-shell body #toolsMenu#toolsMenu#toolsMenu > header button,
html.atlas-phone-shell body #atlasBriefSheet .sheet-close,
html.atlas-phone-shell body #toolsMenu #closeTools{
  position:relative !important;
  z-index:3 !important;
  flex:none;
  width:44px !important;height:44px !important;min-width:44px !important;min-height:44px !important;
  margin:0 !important;
}

/* Hide ALL floating map chrome while a sheet or popover is open */
html.atlas-phone-shell.atlas-sheet-open .c9-compass,
html.atlas-phone-shell.atlas-sheet-open .c9-zoom,
html.atlas-phone-shell.atlas-sheet-open .c9-cross,
html.atlas-phone-shell.atlas-sheet-open .slider-bubble,
html.atlas-phone-shell.atlas-sheet-open .time-box,
html.atlas-phone-shell.atlas-sheet-open #timelineBubble,
html.atlas-phone-shell.atlas-sheet-open #surfaceFrameTrust,
html.atlas-phone-shell.atlas-sheet-open #viImageStatus,
html.atlas-phone-shell.atlas-sheet-open #frameTrustHide,
html.atlas-phone-shell.atlas-sheet-open #legendPeek,
html.atlas-phone-shell.atlas-sheet-open #mapLegend,
html.atlas-phone-shell.atlas-sheet-open #isoLegendChip,
html.atlas-phone-shell.atlas-sheet-open #isoLegendPop,
html.atlas-phone-shell.atlas-sheet-open #isoEmptyNote,
html.atlas-phone-shell.atlas-sheet-open #layerChips,
html.atlas-phone-shell.atlas-sheet-open .layer-chips,
html.atlas-phone-shell.atlas-sheet-open .atlas-compass-ctrl,
html.atlas-phone-shell.atlas-sheet-open .maplibregl-ctrl-top-right,
html.atlas-phone-shell.atlas-sheet-open .maplibregl-ctrl-bottom-left,
html.atlas-phone-shell.atlas-sheet-open .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group,
html.atlas-phone-shell.atlas-sheet-open #mLocate,
html.atlas-phone-shell.atlas-sheet-open #atlasWarnBadge,
html.atlas-phone-shell.atlas-sheet-open .atlas-warn-hint,
html.atlas-phone-shell.atlas-sheet-open #pastFrameNote,
html.atlas-phone-shell.atlas-sheet-open #layerStateNote{
  display:none !important;
  visibility:hidden !important;
  pointer-events:none !important;
}
/* Keep the sheet above the top bar; hide VÍ/Valmynd only when the sheet would cover them —
   the sheet starts below the top bar, so the top bar can stay. Badge is hidden as requested. */
html.atlas-phone-shell.atlas-sheet-open #atlasPhoneTop #atlasWarnBadge{display:none !important;}

/* Layer chips must not overflow the viewport */
html.atlas-phone-shell body #layerChips#layerChips,
html.atlas-phone-shell.atlas-pro-phone body .layer-chips.layer-chips,
html.atlas-phone-shell.atlas-pro-phone body[data-frame-trust="hidden"] .layer-chips.layer-chips,
html.atlas-phone-shell.atlas-pro-phone body #layerChips#layerChips{
  top:calc(env(safe-area-inset-top,0px) + 52px) !important;
  left:8px !important;right:8px !important;
  width:auto !important;max-width:none !important;
  overflow-x:auto !important;overflow-y:hidden !important;
  flex-wrap:nowrap !important;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
  overscroll-behavior-x:contain;
}
html.atlas-phone-shell body #layerChips#layerChips::-webkit-scrollbar{display:none;}
html.atlas-phone-shell.atlas-pro-phone body #layerChips#layerChips button{
  flex:0 1 auto !important;
  min-width:0 !important;
}

/* Bottom player: no stray light sliver; clip overflow */
html.atlas-phone-shell.atlas-pro-phone body #weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem{
  left:0 !important;right:0 !important;width:100% !important;
  overflow:hidden !important;
  border-radius:16px 16px 0 0;
  background:rgba(10,14,18,.96) !important;
}
html.atlas-phone-shell #legendPeek{
  z-index:40;
}

/* Tímabil / ⋯ menus stay on top of the dock, not under map chrome */
html.atlas-phone-shell .row-menu:not([hidden]),
html.atlas-phone-shell #loopPanel:not([hidden]){
  z-index:230 !important;
}

html.atlas-phone-shell.atlas-landscape-phone body #toolsMenu#toolsMenu#toolsMenu:not([hidden]),
html.atlas-phone-shell.atlas-landscape-phone body #appearancePanel#appearancePanel#appearancePanel:not([hidden]),
html.atlas-phone-shell.atlas-landscape-phone body #informationLayers#informationLayers#informationLayers:not([hidden]),
html.atlas-phone-shell.atlas-landscape-phone body #atlasBriefSheet#atlasBriefSheet:not([hidden]){
  min-height:calc(100dvh - 44px) !important;
  max-height:calc(100dvh - 8px) !important;
}

.brief-legend{display:flex;flex-wrap:wrap;gap:8px 14px;margin:0 0 12px;padding:0;list-style:none;font:650 12px/1.3 system-ui,sans-serif;color:#c5d0d6;}
.brief-legend li{display:inline-flex;align-items:center;gap:6px;}
.brief-legend i{width:10px;height:10px;border-radius:50%;display:inline-block;}
.brief-legend [data-color="yellow"] i{background:#e0b31a;}
.brief-legend [data-color="orange"] i{background:#e07a16;}
.brief-legend [data-color="red"] i{background:#c23a2c;}

/* CHIP CLIP 932: beat overflow:visible from simple-9190 */
html.atlas-phone-shell.atlas-pro-phone body #layerChips#layerChips.layer-chips,
html.atlas-phone-shell body #layerChips#layerChips.layer-chips{
  overflow:auto hidden !important;
  overflow-x:auto !important;
  overflow-y:hidden !important;
  max-width:calc(100vw - 16px) !important;
  width:auto !important;
  box-sizing:border-box !important;
}

/* First-time compact hint sits under the badge — drop chips/status so it does not cover them. */
html.atlas-phone-shell.atlas-warn-hint-open body #layerChips#layerChips.layer-chips,
html.atlas-phone-shell.atlas-pro-phone.atlas-warn-hint-open body #layerChips#layerChips.layer-chips{
  top:calc(env(safe-area-inset-top,0px) + 88px) !important;
}
html.atlas-phone-shell.atlas-warn-hint-open #viImageStatus,
html.atlas-phone-shell.atlas-warn-hint-open #surfaceFrameTrust{
  transform:translateY(36px);
}
