/* Native hidden attribute must always win, even when a later component rule sets display:block. */
[hidden]{display:none!important}

/* ============================= 0.4.0 DEV — FLOATING TOOLS + PLAYER DISPLAY HARDENING =============================
   Atlas Web no longer spends permanent map width on Fog/Ruler/Spells/Events.
   The four lozenges stay available at the map edge and open one viewport-bounded palette at a time.
   The old side-collapse slivers are intentionally retired. */

/* Workspace: map + compact Initiative only. Left tools float over the map. */
.workspace-grid,
.workspace-grid.drawer-open,
.workspace-grid.left-panel-collapsed,
.workspace-grid.right-panel-collapsed,
.workspace-grid.left-panel-collapsed.right-panel-collapsed{
  --left-panel-width:0px!important;
  --right-panel-width:292px!important;
  grid-template-columns:minmax(0,1fr) var(--right-panel-width)!important;
  position:relative!important;
  min-width:0!important;
}
.map-shell{
  grid-column:1!important;
  min-width:0!important;
}
.personal-tools{
  grid-column:2!important;
  min-width:0!important;
  padding:6px!important;
  gap:6px!important;
}
#left-panel-toggle,
#right-panel-toggle{
  display:none!important;
}

/* A stale collapse class from an older DEV build must never hide the new tool rail. */
.workspace-grid.left-panel-collapsed .atlas-sidebar{
  width:0!important;
  min-width:0!important;
  padding:0!important;
  margin:0!important;
  border:0!important;
  opacity:1!important;
  visibility:visible!important;
  pointer-events:none!important;
  overflow:visible!important;
}

/* Left map tool rail: small lozenges, always reachable, no permanent column. */
.atlas-sidebar.tools-only-sidebar{
  position:absolute!important;
  left:0!important;
  top:0!important;
  bottom:0!important;
  width:0!important;
  min-width:0!important;
  height:auto!important;
  z-index:90!important;
  display:block!important;
  overflow:visible!important;
  pointer-events:none!important;
  background:transparent!important;
  border:0!important;
}
.tools-only-sidebar>.location-tree,
.tools-only-sidebar .side-help{
  display:none!important;
}
.tools-only-sidebar .map-tools-card{
  position:static!important;
  width:0!important;
  height:100%!important;
  min-width:0!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
  overflow:visible!important;
  pointer-events:none!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
}
.tools-only-sidebar .map-tool-tabs{
  position:absolute!important;
  left:7px!important;
  top:50%!important;
  transform:translateY(-50%)!important;
  z-index:96!important;
  width:58px!important;
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:7px!important;
  margin:0!important;
  padding:6px 4px!important;
  border:1px solid #4d402c!important;
  border-radius:18px!important;
  background:rgba(10,13,11,.94)!important;
  box-shadow:0 10px 28px rgba(0,0,0,.48),inset 0 0 0 1px rgba(255,255,255,.02)!important;
  pointer-events:auto!important;
  backdrop-filter:blur(8px);
}
.tools-only-sidebar .map-tool-tab{
  width:48px!important;
  min-width:48px!important;
  min-height:42px!important;
  padding:0 3px!important;
  border-radius:15px!important;
  font-size:8px!important;
  line-height:1!important;
  letter-spacing:.035em!important;
  background:#10130f!important;
  border-color:#4a4032!important;
  color:#a89b84!important;
  box-shadow:none!important;
}
.tools-only-sidebar .map-tool-tab:hover,
.tools-only-sidebar .map-tool-tab:focus-visible{
  border-color:#9f7e4c!important;
  color:#efd5a1!important;
  background:#221c14!important;
  outline:none!important;
}
.tools-only-sidebar .map-tool-tab.active{
  background:linear-gradient(180deg,#3a2b18,#211a12)!important;
  border-color:#d0aa65!important;
  color:#f0d69d!important;
  box-shadow:inset 0 0 0 1px rgba(255,228,169,.09),0 0 12px rgba(174,128,65,.12)!important;
}

/* Selected tool opens as a single compact floating palette. */
.tools-only-sidebar .map-tool-panel{
  position:absolute!important;
  left:74px!important;
  top:8px!important;
  z-index:95!important;
  width:clamp(270px,22vw,326px)!important;
  max-width:calc(100vw - var(--right-panel-width) - 96px)!important;
  max-height:calc(100% - 16px)!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior:contain!important;
  scrollbar-gutter:stable!important;
  padding:8px!important;
  border:1px solid #655136!important;
  border-radius:8px!important;
  background:linear-gradient(180deg,rgba(20,24,20,.985),rgba(10,14,11,.985))!important;
  box-shadow:0 16px 42px rgba(0,0,0,.62),inset 0 0 0 1px rgba(255,255,255,.025)!important;
  pointer-events:auto!important;
  backdrop-filter:blur(10px);
}
.tools-only-sidebar .map-tool-panel.hidden{
  display:none!important;
}
.tools-only-sidebar .map-tool-panel .tool-card-heading{
  margin:0 0 6px!important;
  padding:0 0 5px!important;
}
.tools-only-sidebar .map-tool-panel .tool-card-heading h3{
  font-size:19px!important;
  line-height:1!important;
}
.tools-only-sidebar .map-tool-panel .eyebrow{
  font-size:8px!important;
}
.tools-only-sidebar .map-tool-panel .fog-status,
.tools-only-sidebar .map-tool-panel .asset-library-status{
  font-size:8px!important;
  line-height:1.25!important;
}
.tools-only-sidebar .map-tool-panel .btn{
  min-height:28px!important;
  padding:4px 6px!important;
}
.tools-only-sidebar .map-tool-panel .recalibrate-map-btn{
  min-height:34px!important;
  margin-bottom:6px!important;
}
.tools-only-sidebar .map-tool-panel .fog-toggle-row{
  padding:5px 6px!important;
  margin-bottom:4px!important;
}
.tools-only-sidebar .map-tool-panel .fog-brush-control{
  padding:3px 1px!important;
}
.tools-only-sidebar .map-tool-panel .element-library-grid{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:4px!important;
}
.tools-only-sidebar .map-tool-panel .element-library-btn{
  min-height:38px!important;
  padding:3px 25px 3px 4px!important;
}
.tools-only-sidebar .map-tool-panel .event-library-card>.event-fire-btn{
  min-height:44px!important;
}
.tools-only-sidebar .map-tool-panel .asset-library-toolbar{
  gap:4px!important;
}
.tools-only-sidebar .map-tool-panel .asset-library-toolbar .btn{
  font-size:7px!important;
}

/* Keep Initiative useful without giving it a third of the screen. */
.personal-tools .personal-tool-tabs{
  min-height:34px!important;
}
.personal-tools .personal-tool-tab{
  min-height:32px!important;
  font-size:9px!important;
}
.personal-tools .initiative-card{
  padding:7px!important;
}
.personal-tools .initiative-topline{
  gap:4px!important;
  margin-bottom:6px!important;
  padding-bottom:6px!important;
}
.personal-tools .combat-toggle{
  min-height:34px!important;
}
.personal-tools .encounter-reset{
  min-height:34px!important;
}
.personal-tools .next-turn{
  min-height:37px!important;
  margin-top:5px!important;
}
.personal-tools .initiative-add-actions{
  gap:4px!important;
  margin-bottom:5px!important;
}
.personal-tools .combatant-list{
  gap:3px!important;
}

/* Map interaction cursor: only the actual map canvas uses grab/crosshair.
   Floating UI and recovery controls never inherit the map's hand cursor. */
.viewer .empty-map,
.viewer .empty-map *,
.viewer button,
.viewer input,
.viewer label,
.viewer select,
.viewer summary{
  cursor:default!important;
}
.viewer .empty-map button,
.viewer .empty-map label,
.viewer .empty-map input[type="file"],
.viewer .empty-map summary,
.viewer button:not(:disabled),
.viewer label[for],
.viewer .pin,
.viewer .map-element{
  cursor:pointer!important;
}
.viewer:not(.fog-editing):not(.measure-editing) .scene,
.viewer:not(.fog-editing):not(.measure-editing) .scene img,
.viewer:not(.fog-editing):not(.measure-editing) .scene video{
  cursor:grab!important;
}
.viewer:not(.fog-editing):not(.measure-editing) .scene:active{
  cursor:grabbing!important;
}

/* Player Display: always show a normal mouse arrow over the map and a clear pointer over controls/pins. */
#player-view,
#player-view .player-viewer,
#player-view .player-viewer *,
#player-view img,
#player-view video,
#player-view canvas{
  cursor:default!important;
}
#player-view #player-fullscreen,
#player-view #player-pin-layer .player-pin{
  cursor:pointer!important;
}
.player-fullscreen{
  z-index:1000!important;
  opacity:1!important;
  min-height:42px!important;
  padding:9px 14px!important;
  border:1px solid #d2ad66!important;
  background:linear-gradient(180deg,rgba(48,38,24,.96),rgba(22,19,14,.96))!important;
  color:#f6dfad!important;
  font-weight:800!important;
  letter-spacing:.035em!important;
  box-shadow:0 5px 18px rgba(0,0,0,.48),inset 0 0 0 1px rgba(255,239,199,.06)!important;
  backdrop-filter:blur(8px)!important;
}
.player-fullscreen:hover,
.player-fullscreen:focus-visible{
  opacity:1!important;
  border-color:#f0cd84!important;
  background:linear-gradient(180deg,rgba(66,49,27,.98),rgba(29,23,15,.98))!important;
  outline:none!important;
}

/* Animated maps are pure visual layers; they should never consume mouse input. */
#map-video,
#player-video,
#map-image,
#player-image{
  display:block;
  pointer-events:none!important;
  user-select:none!important;
  object-fit:contain;
}

/* Recovery: the global pass stays available, but the manual fallback is clearly a one-time permanent repair. */
.empty-map-actions{
  max-width:min(760px,calc(100% - 28px))!important;
}
.empty-add-map{
  min-height:40px!important;
  border-color:#7c633e!important;
  background:#17150f!important;
  color:#e2c68f!important;
}
.legacy-recover-note{
  max-width:500px;
}

/* Compact-height laptops: keep every selected tool reachable without losing map controls. */
@media(max-height:820px){
  .tools-only-sidebar .map-tool-tabs{
    gap:4px!important;
    padding:4px 3px!important;
  }
  .tools-only-sidebar .map-tool-tab{
    min-height:34px!important;
  }
  .tools-only-sidebar .map-tool-panel{
    top:5px!important;
    max-height:calc(100% - 10px)!important;
    width:clamp(258px,21vw,306px)!important;
    padding:6px!important;
  }
  .tools-only-sidebar .map-tool-panel .tool-card-heading h3{
    font-size:17px!important;
  }
  .tools-only-sidebar .map-tool-panel .element-library-btn{
    min-height:34px!important;
  }
}
@media(max-width:1400px){
  .workspace-grid,
  .workspace-grid.drawer-open,
  .workspace-grid.left-panel-collapsed,
  .workspace-grid.right-panel-collapsed{
    --right-panel-width:272px!important;
  }
}
@media(max-width:1100px){
  .workspace-grid,
  .workspace-grid.drawer-open,
  .workspace-grid.left-panel-collapsed,
  .workspace-grid.right-panel-collapsed{
    --right-panel-width:248px!important;
  }
  .tools-only-sidebar .map-tool-panel{
    max-width:calc(100vw - var(--right-panel-width) - 88px)!important;
  }
}
