html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Arial, sans-serif;
}

#map-frame {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  z-index: 0;
}

.dashboard-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* Above the floating panel band (panels start at z-index 301 in dashboard.js)
     so the toolbar stays clickable even if it wraps over an already-open panel. */
  z-index: 10000;
  background-image: url(./dialog/2009-bg_footer.png);
  background-color: #876a38;
  background-position: center;
  padding: 8px 12px;
  border-bottom: 2px solid #5c4a2a;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-btn {
  color: #F2C848;
  text-decoration: none;
  font-weight: bold;
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid #5c4a2a;
  background-color: #2a1a0a;
  display: inline-block;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 1);
  -webkit-text-stroke: 0.5px black;
  cursor: pointer;
  border-radius: 4px;
}

.dashboard-btn:hover {
  background-color: #5c4a2a;
  color: #ffffff;
}

.dashboard-btn.new {
  position: relative;
}

.new-banner {
  position: absolute;
  top: -4px;
  left: -4px;
  background-color: white;
  color: #000;
  font-size: 7px;
  font-weight: bold;
  padding: 1px 2px;
  transform: rotate(-19deg);
  transform-origin: top left;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
  z-index: 10;
}

.dashboard-panel {
  position: fixed;
  display: none;
  flex-direction: column;
  background-image: url(./dialog/2009-bg_scroll.png);
  background-color: #876A38;
  border: 2px solid #5c4a2a;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  z-index: 200;
  overflow: hidden;
  min-width: 300px;
  min-height: 200px;
  /* border-box keeps style.width/style.height equal to the rendered
     rect.width/rect.height that the resize math reads and writes. */
  box-sizing: border-box;
}

.dashboard-panel.active {
  display: flex;
}

.dashboard-panel-header {
  background-color: #6B5028;
  color: #F2C848;
  padding: 8px 12px;
  border-bottom: 1px solid #5c4a2a;
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 1);
  -webkit-text-stroke: 0.5px black;
}

.dashboard-panel-header h3 {
  margin: 0;
  font-size: 15px;
}

.dashboard-panel-header .close-btn {
  background: none;
  border: none;
  color: #1a0f0a;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.dashboard-panel-header .maximize-btn {
  background: none;
  border: none;
  color: #1a0f0a;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.dashboard-panel-header .maximize-btn:hover,
.dashboard-panel-header .close-btn:hover {
  color: #F2C848;
}

.dashboard-panel.maximized {
  border-radius: 0;
}

.dashboard-panel-body {
  flex: 1;
  overflow: auto;
  padding: 0;
  position: relative;
}

.dashboard-panel-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Full-viewport overlay shown only while a panel is being dragged or
   resized. Without it, mousemove events that pass over an iframe (any
   panel body, or the always-on map background) land in the iframe's own
   document and never reach the top-document listeners that drive the
   gesture. z-index sits below the toolbar (10000) so toolbar clicks keep
   working, but above every panel so the gesture stays receiving events. */
.drag-viewport-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: none;
  background: transparent;
}

.drag-viewport-overlay.active {
  display: block;
}

/* Eight resize handles along the panel edges and corners. Edges get thin
   bars; corners get a slightly larger square and stack above edges via a
   higher z-index so the corner cursor wins when they overlap. */
.resize-handle {
  position: absolute;
  z-index: 15;
}

.resize-n  { top: 0;    left: 14px; right: 14px; height: 7px; cursor: ns-resize; }
.resize-s  { bottom: 0; left: 14px; right: 14px; height: 7px; cursor: ns-resize; }
.resize-e  { right: 0;  top: 14px;  bottom: 14px; width: 7px;  cursor: ew-resize; }
.resize-w  { left: 0;   top: 14px;  bottom: 14px; width: 7px;  cursor: ew-resize; }

.resize-ne { top: 0;    right: 0;   width: 14px; height: 14px; cursor: nesw-resize; z-index: 16; }
.resize-nw { top: 0;    left: 0;    width: 14px; height: 14px; cursor: nwse-resize; z-index: 16; }
.resize-se { bottom: 0; right: 0;   width: 14px; height: 14px; cursor: nwse-resize; z-index: 16; }
.resize-sw { bottom: 0; left: 0;    width: 14px; height: 14px; cursor: nesw-resize; z-index: 16; }

/* The header controls must stay clickable above the corner resize handle that
   sits under them on the top-right of the header. */
.dashboard-panel-header .close-btn,
.dashboard-panel-header .maximize-btn {
  position: relative;
  z-index: 20;
}

/* Translucent highlight that previews where a dragged panel will tile when the
   cursor is in an edge/corner snap zone. Sits above panels but below the
   transparent drag overlay (9999) and toolbar (10000). */
.snap-preview {
  position: fixed;
  display: none;
  z-index: 9998;
  background: rgba(242, 200, 72, 0.22);
  border: 2px solid rgba(242, 200, 72, 0.85);
  border-radius: 8px;
  pointer-events: none;
  box-sizing: border-box;
}

.snap-preview.active {
  display: block;
}

body.map-maximized .dashboard-toolbar,
body.map-maximized .dashboard-panel {
  display: none !important;
}

.restore-btn {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 300;
  display: none;
}

body.map-maximized .restore-btn {
  display: inline-block;
}

.maximize-hint {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 50;
  background-color: rgba(42, 26, 10, 0.85);
  color: #F2C848;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
  pointer-events: none;
}
