/* ============================================
   THEME: FALLOUT BRIGHT
   Primary: #FFE030 (bright lemon-yellow)
   Secondary: #F08000 (clean orange)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Rajdhani:wght@500;600;700&display=swap');

:root {
  /* ── Core palette ── */
  --primary: #FFE030;
  --primary-dim: rgba(255, 224, 48, 0.11);
  --primary-glow: rgba(255, 224, 48, 0.18);
  --secondary: #F08000;
  --secondary-dim: rgba(240, 128, 0, 0.1);
  --accent: #c084fc;
  --accent-dim: rgba(192, 132, 252, 0.1);
  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, 0.1);
  --danger: #ff6b6b;
  --danger-dim: rgba(255, 107, 107, 0.1);
  --cyan: #67e8f9;
  --cyan-dim: rgba(103, 232, 249, 0.1);

  /* ── Surfaces ── */
  --bg-base: #0b0b0d;
  --bg-surface: #131315;
  --bg-elevated: #1a1a1e;
  --bg-input: #0d0d10;
  --bg-hover: rgba(255, 224, 48, 0.04);

  /* ── Borders ── */
  --border-subtle: rgba(255, 224, 48, 0.09);
  --border-medium: rgba(255, 224, 48, 0.18);
  --border-strong: rgba(255, 224, 48, 0.35);

  /* ── Text ── */
  --text-primary: #ecedf0;
  --text-secondary: rgba(236, 237, 240, 0.68);
  --text-tertiary: rgba(236, 237, 240, 0.38);
  --text-on-primary: #0b0b0d;

  /* ── Radii ── */
  --radius-lg: 10px;
  --radius-md: 7px;
  --radius-sm: 4px;
  --radius-pill: 999px;

  /* ── Shadows ── */
  --shadow-glow: 0 0 20px -6px rgba(255, 224, 48, 0.15);
  --shadow-elevated: 0 6px 28px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border-subtle);

  /* ── Typography ── */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --font-display: 'Rajdhani', 'Inter', sans-serif;

  /* ── Layout ── */
  --header-height: 52px;
  --sidebar-width: 350px;

  /* ── Backward-compatible aliases (old variable names → new values) ── */
  --primary-color: var(--primary);
  --primary-color-rgb: 255, 224, 48;
  --secondary-color: var(--secondary);
  --secondary-color-rgb: 240, 128, 0;
  --accent-color: var(--accent);
  --accent-color-rgb: 192, 132, 252;
  --dark-color: var(--bg-base);
  --dark-color-rgb: 11, 11, 13;
  --light-color: var(--primary);
  --light-color-rgb: 255, 224, 48;
  --text-color: var(--text-secondary);
  --text-medium: var(--text-secondary);
  --text-medium-rgb: 236, 237, 240;
  --grid-color: var(--green);
  --terminal-green: var(--green);
  --terminal-green-rgb: 74, 222, 128;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  height: 100%;
}

body {
  overflow: hidden;
  line-height: 1.5;
  font-size: 14px;
  color: var(--text-primary);
  background-color: var(--bg-base);
  background-image:
    linear-gradient(0deg, transparent 24%,
      rgba(255, 224, 48, 0.012) 25%,
      rgba(255, 224, 48, 0.012) 26%,
      transparent 27%, transparent 74%,
      rgba(255, 224, 48, 0.012) 75%,
      rgba(255, 224, 48, 0.012) 76%, transparent 77%, transparent),
    linear-gradient(90deg, transparent 24%,
      rgba(255, 224, 48, 0.012) 25%,
      rgba(255, 224, 48, 0.012) 26%,
      transparent 27%, transparent 74%,
      rgba(255, 224, 48, 0.012) 75%,
      rgba(255, 224, 48, 0.012) 76%, transparent 77%, transparent);
  background-size: 50px 50px;
}

#upload-log-container {
    color: var(--text-secondary);
}

/* Styles for text-based pages like Privacy Policy */
.text-page {
  padding: 1rem;
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  background-color: var(--bg-base);
  min-height: 100vh;
  overflow-y: auto;
}

.text-page .container {
   max-width: 800px;
   margin: 2em auto;
   padding: 2em;
   background-color: var(--bg-surface);
   border: 1px solid var(--border-medium);
   border-radius: var(--radius-lg);
   box-shadow: var(--shadow-elevated);
}

.text-page h1 { text-align: center; color: var(--primary); margin-bottom: 1em; font-size: 1.8em; font-family: var(--font-display); }
.text-page h2 { color: var(--secondary); margin-top: 1.5em; margin-bottom: 0.5em; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.2em; font-size: 1.4em; font-family: var(--font-display); }
.text-page p, .text-page ul {
  line-height: 1.7;
  margin-bottom: 1em;
  color: var(--text-secondary);
  font-size: 1.05em;
}
.text-page ul { padding-left: 2em; }
.text-page li { margin-bottom: 0.5em; }
.text-page strong { color: var(--primary); font-weight: bold; }
.text-page a { color: var(--accent); text-decoration: none; }
.text-page a:hover { text-decoration: underline; color: var(--primary); }
.text-page .effective-date { text-align: center; color: var(--text-tertiary); font-style: italic; margin-bottom: 2em; }

/* FAQ specific styles */
.faq-item {
  margin-bottom: 2em;
  padding: 1em 1em 1em 1.5em;
  border-left: 3px solid var(--accent);
  background-color: var(--bg-elevated);
  border-radius: var(--radius-sm);
  position: relative;
}

.faq-item h3 {
  color: var(--primary);
  font-size: 1.3em;
  font-family: var(--font-display);
  margin-bottom: 0.6em;
}



/* Ensure strong text in answers is also primary color for emphasis */
.faq-item p strong {
    color: var(--primary-color); 
}

/* Styling for links within FAQ answers for better visibility */
.faq-item p a {
    color: var(--accent-color); /* Magenta for links */
    text-decoration: none; 
    font-weight: bold; /* Make links pop */
    border-bottom: 1px dashed var(--accent-color); /* Thematic underline */
    padding-bottom: 1px; /* Space for the dashed line */
    transition: color 0.2s ease, border-color 0.2s ease;
}

.faq-item p a:hover {
    color: var(--primary-color); /* Yellow on hover */
    border-bottom-color: var(--primary-color);
}

/* 
  Note: The "JOIN RADIAMAPS DISCORD" link in your faq.html currently has inline styles.
  For better maintainability and to ensure these styles apply correctly, 
  consider moving those inline styles to a dedicated class in this CSS file 
  and applying that class to the <a> tag in your HTML.
  For example:
  HTML: <a href="..." class="discord-link-button">...</a>
  CSS:
  .discord-link-button {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    text-decoration: none;
    font-weight: bold;
    background-color: rgba(192, 132, 252, 0.1);
    box-shadow: 0 0 8px var(--accent-color);
    margin-top: 0.5em; // Adjust as needed
  }
  .discord-link-button:hover {
    background-color: rgba(255, 255, 0, 0.2);
    border-color: var(--primary-color);
    color: var(--primary-color);
  }
*/


/* --- App Container Styles --- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  border: none;
  overflow: hidden;
}

/* Hex Color Controls Rail (Left) */
.hex-color-panel.color-rail{
  position: absolute;
  top: calc(var(--header-height) + 6px);
  left: 52px;
  width: 28px;
  bottom: 80px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 4px 24px;
  background: rgba(var(--dark-color-rgb), 0.85);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevated);
  z-index: 3;
}
.hex-color-panel.pre-init{ visibility:hidden; opacity:0; }
.hex-color-panel.color-rail{ transition: opacity 160ms ease; }

/* Dragging visual cue */
.hex-color-panel.color-rail.dragging{ box-shadow: var(--shadow-elevated), var(--shadow-glow); }

/* Snap preview states */
.hex-color-panel.color-rail.snap-preview-left,
.hex-color-panel.color-rail.snap-preview-right,
.hex-color-panel.color-rail.snap-preview-top,
.hex-color-panel.color-rail.snap-preview-bottom{
  outline: 2px dashed var(--border-strong);
  outline-offset: 2px;
  box-shadow: var(--shadow-elevated), var(--shadow-glow);
}

/* Ghost target where the rail will snap */
#hex-rail-snap-ghost{
  position: fixed;
  z-index: 2;
  pointer-events: none;
  border: 1px dashed var(--border-strong);
  background: var(--primary-dim);
  box-shadow: var(--shadow-glow);
  transition: left 80ms ease-out, top 80ms ease-out, width 80ms ease-out, height 80ms ease-out, opacity 80ms ease-out;
}
#hex-rail-snap-ghost.hidden{ opacity: 0; visibility: hidden; }
#hex-rail-snap-ghost:not(.hidden){ opacity: 1; visibility: visible; }

/* Drag handle at top */
.hex-color-panel.color-rail .rail-drag-handle{
  position: absolute;
  top: 4px; left: 6px; right: 6px; height: 18px;
  border-radius: var(--radius-sm);
  background-image:
    radial-gradient(circle, rgba(255, 224, 48, 0.7) 25%, transparent 26%),
    radial-gradient(circle, rgba(255, 224, 48, 0.7) 25%, transparent 26%);
  background-size: 6px 6px, 6px 6px;
  background-repeat: repeat-x, repeat-x;
  background-position: center 4px, center 12px;
  filter: drop-shadow(0 0 4px var(--primary-glow));
  cursor: grab;
  z-index: 5;
}
.hex-color-panel.color-rail .rail-drag-handle:active{ cursor: grabbing; }

/* Make room so controls don't overlap the handle */
.hex-color-panel.color-rail .rail-top{ padding-top: 24px; }

/* Bottom resize grab bar (full width) */
.hex-color-panel.color-rail .rail-resize-br{
  position: absolute; left: 4px; right: 4px; bottom: 3px; height: 8px;
  cursor: ns-resize;
  background: linear-gradient(to right, rgba(255,224,48,0.0), rgba(255,224,48,0.75), rgba(255,224,48,0.0));
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35), inset 0 0 6px rgba(0,0,0,0.6);
}
.hex-color-panel.color-rail .rail-resize-br:hover{ filter: brightness(1.1); }
/* Hide resize grip in auto-compact mode (no slider) */
.hex-color-panel.color-rail.auto-compact .rail-resize-br{ display: none; }

.rail-top{ display:flex; flex-direction: column; align-items:center; justify-content:flex-start; }
/* Vertical rocker: M over A - now the only controls in rail-top */
/* MAP CONTROL COMPLIANCE: Match map control border styling */
.rail-modes{ display:flex; flex-direction: column; align-items:center; border:1px solid var(--secondary-color); box-shadow: 0 0 10px rgba(var(--secondary-color-rgb), 0.12) inset; border-radius:4px; overflow:hidden; } /* MAPBOX COMPLIANCE: 4px radius */
.rail-btn{
  width: 20px; height: 20px; /* MICRO BUTTON: Compact control size */
  display:flex; align-items:center; justify-content:center;
  background: rgba(var(--dark-color-rgb), 0.6); /* Match map control background */
  color: var(--primary-color); /* Yellow icons matching header buttons */
  border: none;
  font-size: 0.70rem; /* M/A text */
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.rail-btn .mdi{ font-size: 13px; line-height: 1; }
.rail-btn + .rail-btn{ border-top:1px solid rgba(var(--secondary-color-rgb), 0.3); }
.rail-btn:first-child{ border-top-left-radius:4px; border-top-right-radius:4px; } /* MAPBOX COMPLIANCE: 4px radius */
.rail-btn:last-child{ border-bottom-left-radius:4px; border-bottom-right-radius:4px; } /* MAPBOX COMPLIANCE: 4px radius */
.rail-btn.active{ background: var(--primary-color); color: var(--dark-color); box-shadow: var(--shadow-glow); }
.rail-btn:hover:not(.active){ background: rgba(var(--dark-color-rgb), 0.8); color: var(--primary-color); }
.rail-btn.gear{ display:none; }
/* Removed Hot Spots/auto controls UI */
.hex-auto-controls{ display:none !important; }

.hex-gradient-slider{ display:flex; flex-direction:column; align-items:stretch; flex:1; }
/* range-labels removed */

.gradient-track{
  position: relative;
  flex:1;
  margin: 0 auto;
  width: 12px; /* thinner rail */
  border-radius: 4px; /* MAPBOX COMPLIANCE: Match Mapbox control radius */
  /* Default fallback gradient (UI): Red (top) → Yellow → Green (bottom) */
  background: linear-gradient(to top, #008000 0%, #ffff00 50%, #ff0000 100%);
  box-shadow: inset 0 0 0 1px rgba(var(--secondary-color-rgb), 0.25), 0 0 8px rgba(var(--secondary-color-rgb), 0.18), 0 0 0 1px rgba(0,0,0,0.35);
  min-height: 280px;
  overflow: visible; /* allow knobs to overflow */
  z-index: 0;
  /* Shrink visually by 10% (5% top + 5% bottom) */
  transform: scaleY(0.90);
  transform-origin: center;
  /* Prevent page scroll/pinch from interfering with handle drag on touch */
  touch-action: none;
  overscroll-behavior: contain;
}

/* Solid caps inside the rail: green from top to upper handle, red from lower handle to bottom */
.gradient-track::before,
.gradient-track::after{
  content:''; position:absolute; left: 0; right: 0; pointer-events:none; z-index: 2;
}
.gradient-track::before{ /* solid red cap at top */
  top: 0; height: var(--upper-pct, 0%);
  background: #FF0000;
  border-top-left-radius: 4px; border-top-right-radius: 4px; /* MAPBOX COMPLIANCE: 4px radius */
}
.gradient-track::after{ /* solid green cap at bottom */
  bottom: 0; height: calc(100% - var(--lower-pct, 100%));
  background: #006400;
  border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; /* MAPBOX COMPLIANCE: 4px radius */
}
/* Core gradient (middle window), stretched between handles */
.gradient-core{
  position: absolute;
  left: 0; right: 0;
  top: var(--range-top, 0%);
  bottom: calc(100% - var(--range-bottom, 100%));
  /* Core shows the full gradient compressed within the middle span */
  background: inherit;
  z-index: 1;
}

/* Sleek arrow indicators (no white box) */
.gradient-track .handle{
  position:absolute; left: 100%; width: 34px; height: 26px; z-index: 3;
  transform: translateY(-50%);
  cursor: grab;
  /* Remove any default background/outline that can look like a square box */
  background: transparent;
  border: 0;
  outline: none;
  /* Improve touch behavior */
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  will-change: top;
}
.gradient-track .handle:active{ cursor: grabbing; }
/* Triangular pointer into the rail */
.gradient-track .handle::before{
  content: '';
  position: absolute; left: -16px; top: 50%; width: 0; height: 0; transform: translateY(-50%);
  border-top: 13px solid transparent; border-bottom: 13px solid transparent;
  border-right: 16px solid var(--tab-color, rgba(255,255,255,0.9));
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.8)) drop-shadow(0 0 4px rgba(0,0,0,0.6));
}
/* Dark outline behind the triangle for contrast */
.gradient-track .handle::after{
  content: '';
  position: absolute; left: -18px; top: 50%; width: 0; height: 0; transform: translateY(-50%);
  border-top: 15px solid transparent; border-bottom: 15px solid transparent;
  border-right: 18px solid rgba(0,0,0,0.55);
  z-index: -1;
}
/* Ensure no focus ring shows a square box around the handle */
.gradient-track .handle:focus{ outline: none; box-shadow: none; }

/* Hint pulse animation for new users */
.gradient-track .handle.hint-pulse {
  animation: hint-pulse 2s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%, 100% { 
    transform: translateY(-50%) scale(1); 
    filter: brightness(1);
  }
  50% { 
    transform: translateY(-50%) scale(1.1); 
    filter: brightness(1.3) drop-shadow(0 0 8px rgba(255,224,48,0.6));
  }
}

/* Horizontal mode hint pulse */
.hex-color-panel.horizontal .gradient-track .handle.hint-pulse {
  animation: hint-pulse-horizontal 2s ease-in-out infinite;
}

@keyframes hint-pulse-horizontal {
  0%, 100% {
    transform: translateX(-50%) scale(1);
    filter: brightness(1);
  }
  50% {
    transform: translateX(-50%) scale(1.1);
    filter: brightness(1.3) drop-shadow(0 0 8px rgba(255,224,48,0.6));
  }
}

/* Flip handles and labels to left when near right edge */
.hex-color-panel.handles-left .gradient-track .handle{ left: auto; right: 100%; }
.hex-color-panel.handles-left .gradient-track .handle::before{
  left: auto; right: -16px;
  border-right: 0; border-left: 16px solid var(--tab-color, rgba(255,255,255,0.9));
}
.hex-color-panel.handles-left .gradient-track .handle::after{
  left: auto; right: -18px;
  border-right: 0; border-left: 18px solid rgba(0,0,0,0.55);
}
.hex-color-panel.handles-left .gradient-track .handle-label{
  left: auto; right: calc(100% + 10px);
}
.hex-color-panel.handles-left .gradient-track .handle-label::before{
  left: auto; right: -6px; border-right: 0; border-left: 6px solid rgba(12,12,16,0.92);
}

/* Floating value badges with blinking underscore (Radiacode style)
   Move badges to the right of the rail when the rail is on the left */
.gradient-track .handle-label{
  position:absolute;
  left: calc(100% + 10px); right: auto;
  transform: translateY(-50%);
  background: rgba(12,12,16,0.92);
  color: var(--primary-color);
  border: 1px solid rgba(var(--secondary-color-rgb), 0.35);
  padding: 2px 8px;
  font-size: 0.86rem;
  white-space: nowrap;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.45), 0 0 12px rgba(var(--secondary-color-rgb), 0.18);
  z-index: 20;
  font-family: var(--font-display); letter-spacing: 0.3px;
  /* Keep clickable for quick set dialogs */
  pointer-events: auto;
}
.rail-btn:hover{ box-shadow: 0 0 6px rgba(var(--secondary-color-rgb), 0.28) inset, 0 0 6px rgba(var(--secondary-color-rgb), 0.22); }
.gradient-track .handle-label::before{
  content: '';
  position: absolute; left: -6px; top: 50%; transform: translateY(-50%);
  width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-right: 6px solid rgba(12,12,16,0.92);
}
.gradient-track .handle-label::after{
  content: '_'; margin-left: 2px; color: var(--primary-color);
  animation: blink-caret 1.1s steps(1, end) infinite;
}
@keyframes blink-caret{ 50% { opacity: 0; } }

/* Removed dim overlay; using solid caps instead */

/* Themed tooltips */
#rm-tooltip.rm-tooltip{
  position: fixed;
  z-index: 10000;
  background: rgba(12,12,16,0.96);
  color: var(--primary-color);
  border: 1px solid rgba(var(--secondary-color-rgb), 0.5);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-size: 0.78rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5), 0 0 10px rgba(var(--secondary-color-rgb), 0.25);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  will-change: transform, opacity;
}
#rm-tooltip.rm-tooltip.hidden{ opacity: 0; visibility: hidden; }
#rm-tooltip.rm-tooltip:not(.hidden){ opacity: 1; visibility: visible; }
#rm-tooltip.rm-tooltip::after{
  content: '';
  position: absolute;
  bottom: -6px; left: 50%; transform: translateX(-50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 6px solid rgba(12,12,16,0.96);
  filter: drop-shadow(0 -1px 0 rgba(var(--secondary-color-rgb), 0.45));
}

/* Map controls remain at the far left; rail sits just to their right */
.mapboxgl-ctrl-top-left{ margin-left: 10px; }

@media (max-width: 900px){
  /* Keep left offset consistent to avoid horizontal jump on resize */
  .hex-color-panel.color-rail{ width: 26px; left: 52px; padding: 6px 4px; bottom: 44px; }
  .gradient-track{ width: 10px; min-height: 240px; }
  .gradient-track .handle-label{ left: calc(100% + 14px); font-size: 0.72rem; }
  /* Keep controls a touch larger on mobile */
  .rail-btn{ width: 24px; height: 24px; font-size: 0.76rem; }
  .rail-btn .mdi{ font-size: 15px; }
  .rail-btn.rail-toggle{ width: 24px; height: 24px; }
  /* Enlarge touch targets on small screens for easier dragging */
  .gradient-track .handle{ height: 40px; width: 40px; }
}

@media (max-width: 799px){
  /* Enlarge .rail-btn tap targets to meet 40×40px minimum for mobile usability */
  .rail-btn{ width: 40px; height: 40px; min-width: 40px; min-height: 40px; font-size: 0.85rem; }
  .rail-btn .mdi{ font-size: 18px; }
  .rail-btn.rail-toggle{ width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
}

/* Auto mode: compact to just the rocker */
.hex-color-panel.auto-compact{
  /* Keep same width as default; only hide slider and shrink height */
  padding: 8px 6px;
  gap: 4px;
  bottom: auto; /* shrink to content height */
}
.hex-color-panel.auto-compact .hex-gradient-slider{ display:none; }

/* Horizontal layout for hex-color-panel */
.hex-color-panel.horizontal {
  /* Transform to horizontal orientation */
  flex-direction: row !important;
  align-items: center !important;
  /* Force horizontal dimensions - but allow resize overrides */
  width: auto; /* Remove !important to allow JavaScript resize */
  height: 28px !important; /* Use the original width as height */
  min-width: 435px !important; /* Use the original height as min-width */
  max-width: 80vw !important;
  /* Adjust padding for horizontal layout - better balanced spacing */
  padding: 4px 16px 4px 16px !important;
  gap: 12px !important;
}

/* Remove forced positioning from CSS - let JavaScript handle positioning */
.hex-color-panel.horizontal.positioned-horizontal {
  bottom: 20px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  top: auto !important;
}

/* Horizontal layout: drag handle moves to left side */
.hex-color-panel.horizontal .rail-drag-handle {
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  right: auto;
  width: 18px;
  height: auto;
  /* Vertical dots pattern for horizontal handle */
  background-image:
    radial-gradient(circle, rgba(255, 224, 48, 0.9) 25%, rgba(255, 224, 48, 0) 26%),
    radial-gradient(circle, rgba(255, 224, 48, 0.9) 25%, rgba(255, 224, 48, 0) 26%);
  background-size: 6px 6px;
  background-repeat: repeat-y, repeat-y;
  background-position: 4px center, 12px center; /* two columns */
}

/* Horizontal layout: rail-top becomes horizontal and takes reduced space */
.hex-color-panel.horizontal .rail-top {
  padding-top: 0;
  padding-left: 24px; /* room for drag handle */
  flex-direction: row;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Horizontal layout: mode buttons become horizontal */
.hex-color-panel.horizontal .rail-modes {
  flex-direction: row;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.hex-color-panel.horizontal .rail-btn + .rail-btn {
  border-top: none;
  border-left: 1px solid rgba(255,255,255,0.18);
}

.hex-color-panel.horizontal .rail-btn:first-child {
  border-top-right-radius: 0;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 0;
}

.hex-color-panel.horizontal .rail-btn:last-child {
  border-top-left-radius: 0;
  border-top-right-radius: 10px;
  border-bottom-left-radius: 0;
}

/* Horizontal layout: gradient slider becomes horizontal */
.hex-color-panel.horizontal .hex-gradient-slider {
  flex-direction: row !important;
  align-items: center !important;
  flex: 1 !important;
  height: auto !important; /* Let it size based on content */
  min-height: 40px !important; /* Ensure enough space for track + handles */
  max-height: 50px !important; /* Prevent it from getting too tall */
  margin-left: 8px !important; /* Shift gradient and indicators to the right */
}

.hex-color-panel.horizontal .gradient-track {
  width: auto !important;
  height: 12px !important;
  min-height: 12px !important; /* Override the base min-height: 280px */
  flex: 1 !important;
  min-width: 200px !important; /* Reduced for better mobile fit */
  max-width: calc(100% - 8px) !important; /* Minimal right margin for tight fit */
  margin: 0 !important;
  /* Horizontal gradient: Green (left) → Yellow → Red (right) */
  background: linear-gradient(to right, #008000 0%, #ffff00 50%, #ff0000 100%) !important;
  border-radius: 9px !important;
  transform: none !important; /* Remove the scaleY(0.90) transform */
}

/* Horizontal gradient caps: green from left to lower handle, red from upper handle to right */
.hex-color-panel.horizontal .gradient-track::before {
  /* green cap at left (low values) */
  left: 0;
  right: auto;
  top: 0;
  bottom: 0;
  width: var(--lower-pct, 0%);
  height: auto;
  background: #008000;
  border-radius: 9px 0 0 9px;
}

.hex-color-panel.horizontal .gradient-track::after {
  /* red cap at right (high values) */
  right: 0;
  left: calc(var(--upper-pct, 100%));
  top: 0;
  bottom: 0;
  width: auto;
  height: auto;
  background: #FF0000;
  border-radius: 0 9px 9px 0;
}

/* Horizontal gradient core */
.hex-color-panel.horizontal .gradient-core {
  left: var(--range-left, 0%) !important;
  right: calc(100% - var(--range-right, 100%)) !important;
  top: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  height: 12px !important; /* Match track height exactly */
  border-radius: 9px !important; /* Match track radius */
}

/* Horizontal handles positioned using left instead of CSS variables */
.hex-color-panel.horizontal .gradient-track .handle {
  position: absolute !important;
  top: 100% !important;
  left: 0px; /* Default position, will be overridden by JavaScript */
  right: auto !important;
  width: 26px !important;
  height: 34px !important;
  transform: translateX(-50%) !important;
  will-change: left !important;
}

/* Horizontal handle triangular pointer points up into the track */
.hex-color-panel.horizontal .gradient-track .handle::before {
  left: 50%;
  top: -16px;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 0;
  border-bottom: 16px solid var(--tab-color, rgba(255,255,255,0.9));
}

.hex-color-panel.horizontal .gradient-track .handle::after {
  left: 50%;
  top: -18px;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 0;
  border-bottom: 18px solid rgba(0,0,0,0.55);
}

/* Horizontal handle labels positioned below the track */
.hex-color-panel.horizontal .gradient-track .handle-label {
  left: 0px; /* Default position, will be overridden by JavaScript */
  top: calc(100% + 10px) !important;
  right: auto !important;
  bottom: auto !important;
  transform: translateX(-50%) !important;
}

.hex-color-panel.horizontal .gradient-track .handle-label::before {
  left: 50%;
  top: -6px;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid rgba(12,12,16,0.92);
  border-top: 0;
}

/* Horizontal layout: no flip needed for handles, they're always below */
.hex-color-panel.horizontal.handles-left .gradient-track .handle {
  /* Override the left positioning in horizontal mode */
  left: var(--handle-pos, 0%);
  right: auto;
  transform: translateX(-50%);
}

.hex-color-panel.horizontal.handles-left .gradient-track .handle::before,
.hex-color-panel.horizontal.handles-left .gradient-track .handle::after {
  /* Reset to same as non-flipped in horizontal mode */
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 0;
}

.hex-color-panel.horizontal.handles-left .gradient-track .handle::before {
  border-bottom: 16px solid var(--tab-color, rgba(255,255,255,0.9));
}

.hex-color-panel.horizontal.handles-left .gradient-track .handle::after {
  border-bottom: 18px solid rgba(0,0,0,0.55);
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
}

.hex-color-panel.horizontal.handles-left .gradient-track .handle-label {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.hex-color-panel.horizontal.handles-left .gradient-track .handle-label::before {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid rgba(12,12,16,0.92);
  border-top: 0;
}

/* Horizontal handles positioned above track when near top of screen */
.hex-color-panel.horizontal.handles-top .gradient-track .handle {
  top: auto !important;
  bottom: 100% !important;
}

.hex-color-panel.horizontal.handles-top .gradient-track .handle::before {
  top: auto;
  bottom: -16px;
  border-bottom: 0;
  border-top: 16px solid var(--tab-color, rgba(255,255,255,0.9));
}

.hex-color-panel.horizontal.handles-top .gradient-track .handle::after {
  top: auto;
  bottom: -18px;
  border-bottom: 0;
  border-top: 18px solid rgba(0,0,0,0.55);
}

.hex-color-panel.horizontal.handles-top .gradient-track .handle-label {
  top: auto !important;
  bottom: calc(100% + 10px) !important;
}

.hex-color-panel.horizontal.handles-top .gradient-track .handle-label::before {
  top: auto;
  bottom: -6px;
  border-bottom: 0;
  border-top: 6px solid rgba(12,12,16,0.92);
}

/* Horizontal layout: resize handle moves to right side */
.hex-color-panel.horizontal .rail-resize-br {
  left: auto;
  right: 3px;
  top: 4px;
  bottom: 4px;
  width: 8px;
  height: auto;
  cursor: ew-resize;
  background: linear-gradient(to bottom, rgba(255,224,48,0.0), rgba(255,224,48,0.75), rgba(255,224,48,0.0));
}

/* Horizontal layout: mobile adjustments */
@media (max-width: 900px) {
  .hex-color-panel.horizontal {
    min-width: 300px !important;
    max-width: 95vw !important;
    height: 26px !important; /* Use the mobile vertical width as height */
    padding: 4px 20px 4px 6px !important;
  }
  
  .hex-color-panel.horizontal .gradient-track {
    min-width: 200px !important; /* Reduced from 280px for mobile */
    max-width: 250px !important;
    height: 10px !important;
  }
  
  .hex-color-panel.horizontal .gradient-track .handle {
    height: 40px !important;
    width: 40px !important;
  }
  
  .hex-color-panel.horizontal .gradient-track .handle-label {
    font-size: 0.72rem !important;
  }
}

/* --- Updated Header Styles --- */

@keyframes flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    text-shadow:
      0 0 4px var(--primary-color),
      0 0 8px var(--primary-color);
  }
  20%, 24%, 55% {
    text-shadow: none;
  }
}

/* --- Menu Toggle Button - Hero/Primary Action --- */
.menu-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(var(--primary-color-rgb), 0.1);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  z-index: 16; /* Above header content, below panel when open */
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0; /* Prevent button from shrinking */
  position: relative; /* For notification badge positioning */
  box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.15);
}

.menu-toggle-btn:hover, .menu-toggle-btn:focus-visible {
  background: rgba(var(--primary-color-rgb), 0.2);
  border-color: var(--primary-color);
  box-shadow: 0 4px 16px rgba(var(--primary-color-rgb), 0.25);
  transform: translateY(-2px) scale(1.05);
}

/* Active/open state for menu button */
.menu-toggle-btn[aria-expanded="true"] {
  background: rgba(var(--primary-color-rgb), 0.25);
  border-color: var(--primary-color);
  box-shadow: 0 6px 20px rgba(var(--primary-color-rgb), 0.3);
  transform: scale(1.02);
}

.menu-toggle-btn[aria-expanded="true"]:hover {
  transform: scale(1.07) translateY(-1px);
}

/* Notification Badge on Menu Toggle Button */
.notification-badge {
  position: absolute;
  top: 1px;
  transform: translateY(-50%);
  max-width: 140px; overflow: hidden; text-overflow: ellipsis;
  background: var(--accent-color); /* Using accent-color for consistency */
  color: var(--dark-color); /* Using dark-color for text */
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  padding: 2px;
  box-sizing: border-box;
  z-index: 17; /* Above menu toggle button */
  box-shadow: 0 0 5px var(--accent-color);
  animation: pulse-accent 1.5s infinite alternate; /* New animation name */
}

.notification-badge.hidden {
  display: none !important;
}

@keyframes pulse-accent {
  0% { box-shadow: 0 0 5px var(--accent-color); transform: scale(1); }
  100% { box-shadow: 0 0 15px var(--accent-color); transform: scale(1.1); }
}

/* Menu Panel + Backdrop removed — replaced by nav-drawer.css */

/* Style items inside the menu */
.menu-item {
  display: flex;
  flex-direction: column; /* Stack label and control vertically */
  gap: 0.5rem;
  border-bottom: 1px dashed var(--secondary-color);
  padding-bottom: 1rem;
}
.menu-item:last-child {
    border-bottom: none; /* No border on last item */
}

.menu-item label {
  color: var(--secondary-color);
  font-size: 0.9em;
  text-transform: uppercase;
  text-align: left; /* Align labels left */
}

.menu-item select,
.menu-item .btn-menu,
.menu-item .user-display,
.menu-item .privacy-link,
.menu-item .auth-controls,
.menu-item .faq-link {
  width: 100%; /* Make controls fill width */
  text-align: center;
}

.menu-item select {
   padding: 0.5rem;
   border-radius: 0;
   border: 1px solid var(--secondary-color);
   background-color: var(--dark-color);
   color: var(--primary-color);
   font-family: var(--font-sans);
   box-shadow: var(--shadow-glow);
}
.menu-item select:focus {
  outline: none;
  box-shadow: var(--shadow-glow);
}

.menu-item .btn-menu {
   padding: 0.6rem 1rem;
}

/* Auth controls within menu item */
.menu-item .auth-controls {
   display: flex; /* Keep using flex */
   flex-direction: row; /* Keep auth buttons side-by-side */
   justify-content: space-around;
   gap: 0.5rem;
   padding-bottom: 0; /* Remove padding */
   border-bottom: none; /* Remove its own border */
}
.menu-item .auth-controls .btn-menu {
    flex-grow: 1; /* Make buttons share space */
}

.menu-item .user-display {
    color: var(--terminal-green);
    padding: 0.5rem;
    border: 1px dashed var(--terminal-green);
    text-align: center;
    word-break: break-all; /* Wrap long usernames */
    min-height: 2.5em; /* Ensure it has some height even when empty */
}

.menu-item .privacy-link, .menu-item .faq-link {
    display: inline-block; /* Allow text-align */
    padding: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    border: 1px dashed var(--primary-color);
}
.menu-item .privacy-link:hover, .menu-item .faq-link:hover {
    background-color: rgba(255, 255, 0, 0.1);
    text-decoration: none;
}

.bmc-themed-btn {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--primary-color, #ffe900);
    border: 1px solid var(--primary-color, #ffe900);
    background: transparent;
    padding: 6px 14px;
    text-decoration: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: box-shadow 0.2s ease, color 0.2s ease;
}

.bmc-themed-btn:hover {
    color: var(--accent-color, #e400ff);
    border-color: var(--accent-color, #e400ff);
    box-shadow: 0 0 8px var(--accent-color, #e400ff);
    text-decoration: none;
}
/* Sidebar Button Hierarchy — 3-tier visual classes */
.menu-btn-primary {
  background-color: var(--secondary-color);
  color: var(--dark-color);
  border: 2px solid var(--secondary-color);
  box-shadow: var(--shadow-glow);
  font-family: var(--font-display);
  font-weight: bold;
  text-transform: uppercase;
  width: 100%;
  padding: 0.6rem 1rem;
  cursor: pointer;
  display: block;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.menu-btn-primary:hover {
  background-color: rgba(133, 255, 249, 0.85);
  box-shadow: 0 0 16px var(--secondary-color), 0 0 32px rgba(133, 255, 249, 0.6);
  color: var(--dark-color);
  text-decoration: none;
}

.menu-btn-secondary {
  background-color: var(--dark-color);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  box-shadow: 0 0 5px var(--primary-color);
  font-family: var(--font-display);
  font-weight: bold;
  text-transform: uppercase;
  width: 100%;
  padding: 0.6rem 1rem;
  cursor: pointer;
  display: block;
  text-align: center;
  text-decoration: none;
  transition: all 0.3s;
}
.menu-btn-secondary:hover {
  background-color: var(--primary-color);
  color: var(--dark-color);
  box-shadow: var(--shadow-glow);
  text-decoration: none;
}

.menu-btn-tertiary {
  background: none;
  border: none;
  box-shadow: none;
  color: var(--secondary-color);
  display: block;
  padding: 0.4rem 0;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font-display);
  text-transform: uppercase;
  width: 100%;
  text-align: center;
  transition: color 0.2s ease;
}
.menu-btn-tertiary:hover {
  text-decoration: underline;
  color: var(--primary-color);
}

/* --- End Menu Styles --- */

/* (Legacy notifications panel styles removed – replaced by Notification Center) */


/* Main Content Styles */
main {
  flex: 1; /* Takes remaining height */
  display: flex;
  position: relative; /* For positioning overlays like scale */
  overflow: hidden; /* Prevent scrolling */
}

#map {
  width: 100%; /* Full width by default */
  height: 100%;
  /* border/shadow removed */
  transition: width 0.3s ease, margin-left 0.3s ease; /* Keep smooth resizing for sidebar */
  touch-action: pan-x pan-y; /* Allow pan, but prevent unintended pinch-zoom */
}

/* Prevent iOS auto-zoom on inputs by ensuring font-size >= 16px */
input, select, textarea, button {
  font-size: 16px;
}

/* Adjust map when sidebar is visible */
#sidebar:not(.hidden) + #map {
  width: calc(100% - var(--sidebar-width));
  margin-left: var(--sidebar-width);
}

/* Sidebar Styles */
#sidebar {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100%; /* Cover full height of main */
  background-color: rgba(var(--dark-color-rgb), 0.85); /* Slightly darker/more opaque */
  box-shadow: 2px 0 10px var(--accent-color);
  overflow-y: auto; /* Allow sidebar content scrolling */
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10; /* Below header/menu, above map */
  border-right: 2px solid var(--accent-color);
  display: flex;
  flex-direction: column; /* Ensure children stack vertically */
}

#sidebar.hidden {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}

/* Ensure the history chart container is styled if it exists */
#history-chart {
    padding: 10px 15px;
    border-top: 1px solid #444; /* Separator if readings are above */
}
#history-chart h3 {
    color: var(--primary-color);
    font-size: 1.1em;
    margin-bottom: 8px;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000; /* Ensure it's on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if content is too big */
    background-color: rgba(var(--dark-color-rgb), 0.85); /* Darker overlay */
    display: flex; /* For centering content */
    align-items: center; /* Vertical centering */
    justify-content: center; /* Horizontal centering */
    backdrop-filter: blur(3px); /* Optional: cyberpunk blur effect */
}

body.modal-open {
    overflow: hidden;
}


.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.modal-content {
  background-color: var(--dark-color);
  width: 500px;
  max-width: 90%;
  border: 2px solid var(--accent-color);
  border-radius: 18px; /* Curved corners (AGENTS.md standard) */
  box-shadow: 0 0 20px var(--accent-color);
  transform: scale(0.9); /* Start slightly smaller */
  transition: transform 0.3s ease;
}
.modal:not(.hidden) .modal-content {
    transform: scale(1); /* Scale up when visible */
}

/* Hex Range Modal - compact and teal-themed */
.hex-range-modal-content{
  width: 340px;
  border-color: rgba(var(--secondary-color-rgb), 0.6);
  box-shadow: 0 0 20px rgba(var(--secondary-color-rgb), 0.45);
}
.hex-range-modal-content .modal-header{
  border-bottom-color: rgba(var(--secondary-color-rgb), 0.6);
  color: var(--secondary-color);
}
.hex-range-modal-content .modal-footer{
  border-top-color: rgba(var(--secondary-color-rgb), 0.6);
}
.hex-range-modal-content #hex-range-label{ color: var(--secondary-color); }
.hex-range-modal-content #hex-range-hint{ color: var(--text-medium); }
.hex-range-modal-content #hex-range-input{
  background: rgba(12,12,16,0.9);
  border: 1px solid rgba(var(--secondary-color-rgb), 0.4);
  color: #b6ffe6; /* improved readability for teal theme */
  padding: 8px 10px;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.6), 0 0 10px rgba(var(--secondary-color-rgb), 0.15);
  font-family: var(--font-display);
}
.hex-range-modal-content #hex-range-input:focus{
  outline: none;
  border-color: rgba(var(--secondary-color-rgb), 0.9);
  box-shadow: inset 0 0 6px rgba(0,0,0,0.6), 0 0 14px rgba(var(--secondary-color-rgb), 0.35);
}


.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: var(--dark-color);
  color: var(--accent-color);
  border-bottom: 2px solid var(--accent-color);
}
.modal-header h2 {
    margin: 0;
    font-size: 1.4em;
}

.modal-body {
  padding: 1.5rem; /* More padding */
}

.modal-footer {
  display: flex;
  justify-content: flex-end; /* Aligns buttons to the right */
  align-items: center; /* Vertically aligns items in the footer */
  padding: 1rem; /* Adds padding within the footer area, consistent with modal-header */
  background-color: var(--dark-color); /* Ensures consistent background */
  border-top: 2px solid var(--accent-color); /* Matches modal-header's border style */
  gap: 0.75rem; /* Creates space between multiple buttons in the footer */
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
}

.form-group input[type="text"],
.form-group input[type="file"],
.form-group textarea { /* Added .form-group textarea here */
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--secondary-color);
  background-color: rgba(var(--dark-color-rgb), 0.7);
  color: var(--terminal-green);
  font-family: var(--font-sans); /* Ensures consistent font */
  box-sizing: border-box; /* Good practice to include */
}

.form-group input[type="text"],
.form-group input[type="file"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--secondary-color);
  background-color: rgba(var(--dark-color-rgb), 0.7);
  color: var(--terminal-green);
  font-family: var(--font-sans);
}
.form-group input[type="file"] {
    padding: 0.3rem; /* Adjust padding for file input */
}

.form-group input:focus {
  outline: none;
  box-shadow: var(--shadow-glow);
}

/* --- Enhanced Upload Modal UI (file picker + inline checkbox) --- */
.file-picker { display:flex; flex-wrap:wrap; align-items:flex-start; gap:.9rem; position:relative; }
.file-input { position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }
.file-trigger { cursor:pointer; background:linear-gradient(135deg, #202026, #182e27); border:1px solid var(--accent-color); padding:.55rem .9rem; font-size:.72rem; letter-spacing:1px; font-weight:600; color:var(--terminal-green); text-shadow:0 0 2px var(--accent-color); border-radius:4px; box-shadow:0 0 6px -2px var(--accent-color); display:flex; align-items:center; justify-content:center; width:150px; min-width:150px; height:48px; min-height:48px; white-space:nowrap; }
.file-trigger:hover { background:linear-gradient(135deg, #272732, #1d3c31); box-shadow:0 0 8px -2px var(--accent-color); }
.file-trigger:active { filter:brightness(1.08); }
.file-trigger:hover { background:linear-gradient(135deg, rgba(192,132,252,0.35), rgba(74,222,128,0.25)); }
.file-trigger:focus-visible { outline:2px solid var(--accent-color); outline-offset:2px; }
.file-chosen { flex:1; min-width:220px; padding:.55rem .7rem .55rem .55rem; font-size:.58rem; letter-spacing:1px; background:linear-gradient(120deg, rgba(74,222,128,0.08), rgba(192,132,252,0.07)); border:1px dashed var(--secondary-color); color:var(--terminal-green); border-radius:3px; white-space:normal; overflow-y:auto; max-height:110px; line-height:1.18; box-shadow:0 0 10px -4px var(--accent-color) inset, 0 0 4px -1px var(--accent-color); }
.file-chosen:empty::before { content:'No files selected'; opacity:.6; }
.file-chosen .file-line { display:flex; align-items:center; gap:4px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding:1px 0; position:relative; }
.file-chosen .file-line::before { counter-increment:filecount; content:counter(filecount) '.'; color:var(--accent-color); font-weight:600; text-shadow:0 0 4px var(--accent-color); }
.file-chosen { counter-reset:filecount; }
.file-clear-btn { position:absolute; right:6px; top:6px; background:rgba(0,0,0,0.45); border:1px solid var(--accent-color); color:var(--accent-color); width:22px; height:22px; padding:0; font-size:.7rem; line-height:1; border-radius:3px; cursor:pointer; display:flex; align-items:center; justify-content:center; box-shadow:0 0 6px -2px var(--accent-color); }
.file-clear-btn:hover { background:rgba(0,0,0,0.7); }
.file-clear-btn:focus-visible { outline:2px solid var(--accent-color); outline-offset:2px; }
.file-chosen::-webkit-scrollbar { width:6px; }
.file-chosen::-webkit-scrollbar-track { background:rgba(0,0,0,0.3); }
.file-chosen::-webkit-scrollbar-thumb { background:var(--accent-color); box-shadow:0 0 6px -1px var(--accent-color); }
.file-chosen .file-line { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.small-inline { display:flex; align-items:center; gap:.55rem; }
.small-inline .auto-start-checkbox { appearance:none; width:16px; height:16px; margin:0; cursor:pointer; border:1px solid var(--secondary-color); background:rgba(var(--dark-color-rgb),0.4); display:inline-grid; place-items:center; position:relative; box-shadow:0 0 4px -1px var(--accent-color); }
.small-inline .auto-start-checkbox:focus-visible { outline:2px solid var(--accent-color); outline-offset:2px; }
.small-inline .auto-start-checkbox::after { content:''; width:10px; height:10px; transform:scale(0); transition:transform .18s ease; background:var(--accent-color); box-shadow:0 0 6px -1px var(--accent-color); }
.small-inline .auto-start-checkbox:checked::after { transform:scale(1); }
.small-inline .auto-start-label { margin:0; font-size:.62rem; letter-spacing:1px; opacity:.85; line-height:1; position:relative; top:1px; cursor:pointer; }

/* High-contrast focus for accessibility */
.auto-start-checkbox:focus-visible + .auto-start-label, .file-trigger:focus-visible { text-decoration:underline; }

@media (max-width: 560px){
  .file-trigger { width:140px; min-width:140px; height:46px; min-height:46px; font-size:.66rem; }
  .file-chosen { max-height:90px; }
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Basic Toggle Switch CSS */
.switch {
  position: relative;
  display: inline-block;
  width: 50px; /* Adjust size */
  height: 24px; /* Adjust size */
  vertical-align: middle;
  margin-left: 10px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

#time-slider-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: calc(100% - 120px);
  background-color: rgba(var(--dark-color-rgb), 0.85); /* Using dark-color-rgb */
  padding: 10px 20px;
  box-sizing: border-box;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

#time-slider-container #date-slider {
  width: 80%;
  max-width: 650px;
  margin-top: 5px;
  margin-bottom: 5px;
}

#time-slider-container > div:nth-of-type(2) { 
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

#time-slider-container .history-nav-btn {
  margin: 0 15px;
}

#time-slider-container #date-range-display,
#time-slider-container #selected-date-display {
  color: var(--light-color);
  font-size: 0.9em;
}

#time-slider-container.hidden {
  display: none;
}
#time-slider-container:not(.hidden) {
  display: flex; 
}

.history-nav-btn {
  padding: 5px 10px;
  margin: 0 10px;
  cursor: pointer;
}
.history-nav-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--secondary-color); /* Using secondary-color */
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--light-color);
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--secondary-color); /* Using secondary-color */
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--secondary-color); /* Using secondary-color */
}

input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

#profile-content {
  width: 85%;
  margin: auto;
}

#profile-page section {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid var(--light-color);
    border-radius: 5px;
}
#profile-page h2 {
    margin-top: 0;
    border-bottom: 1px solid var(--light-color);
    padding-bottom: 5px;
    margin-bottom: 15px;
}
.preference-item {
    margin-bottom: 15px;
}
#file-list {
    list-style: none;
    padding: 0;
}
#file-list li {
    padding: 8px;
    border-bottom: 1px dashed var(--light-color);
}
#file-list li:last-child {
    border-bottom: none;
}





/* General Button Styles (already defined, reuse/confirm) */
.btn {
  background-color: var(--dark-color);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  font-weight: bold;
  box-shadow: 0 0 5px var(--primary-color);
}

.profile-btn {
  color:var(--secondary-color);
  border: 1px solid var(--secondary-color);
}

.btn:hover {
  background-color: var(--primary-color);
  color: var(--dark-color);
  box-shadow: var(--shadow-glow);
}

/* Hexagon Tooltip Style */
.hexagon-tooltip {
  background-color: rgba(var(--dark-color-rgb), 0.85); /* Semi-transparent black */
  border: 1px solid var(--primary-color);
  box-shadow: 0 0 8px var(--primary-color);
  padding: 8px 12px;
  font-size: 14px; /* Adjust size */
  color: var(--primary-color);
  font-family: var(--font-display); /* Use theme font */
  position: fixed; /* Use fixed positioning */
  pointer-events: none; /* Prevent interference */
  z-index: 1000; /* Above map layers */
  white-space: nowrap; /* Prevent wrapping */
  border-radius: 3px; /* Slight rounding */
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 0px;
}

::-webkit-scrollbar-track {
  background: var(--dark-color);
}

::-webkit-scrollbar-thumb {
  background: var(--secondary-color);
  border: 1px solid var(--dark-color);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* Radiation Scale Overlay */
.radiation-scale {
  position: absolute;
  bottom: 20px; /* Position at bottom */
  left: 20px; /* Position at left */
  width: 60px; /* Keep width */
  height: 250px; /* Adjusted height */
  background-color: rgba(var(--dark-color-rgb), 0.8);
  border: 2px solid var(--secondary-color);
  box-shadow: var(--shadow-glow);
  z-index: 5; /* Above map, below sidebar/menu */
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 5px;
}

.scale-header {
  color: var(--secondary-color);
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: 1px;
  text-shadow: 0 0 5px var(--secondary-color);
}

.scale-container {
  display: flex;
  flex-direction: column; /* Stack line above labels */
  height: calc(100% - 30px); /* Adjust height based on header */
  width: 100%;
  align-items: center;
  justify-content: space-between; /* Pushes labels to ends */
}

.scale-line-container {
  width: 8px; /* Slightly thicker line */
  flex-grow: 1; /* Take available vertical space */
  background-color: rgba(255, 255, 255, 0.1);
  position: relative;
  margin: 10px auto; /* Vertical margin */
  border-radius: 4px;
}

.scale-line {
  width: 100%;
  position: absolute;
  bottom: 0;
  left: 0;
  background: linear-gradient(to top,
    #00ff00,  /* Green (low) */
    #88ff00,
    #ffff00,  /* Yellow */
    #ff8800,
    #ff0000   /* Red (high) */
  );
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(255, 224, 48, 0.6);
  height: 0%; /* Set dynamically via JavaScript */
  transition: height 0.5s ease-out; /* Smooth transition */
}

.scale-labels {
  width: 100%;
  display: flex;
  flex-direction: column; /* Stack max/min */
  align-items: center;
  font-size: 0.8rem;
  flex-shrink: 0; /* Prevent labels from shrinking */
}

.scale-max, .scale-min {
  color: var(--primary-color);
  margin: 2px 0;
  text-shadow: 0 0 3px var(--primary-color);
}

#max-cpm, #min-cpm {
  color: var(--terminal-green);
  font-weight: bold;
}


/* General Hidden Class */
.hidden {
    display: none !important; /* Use important if needed to override */
}

#menu-number-of-reports {
    color: var(--terminal-green);
    font-weight: bold;
    text-align: center;
    margin-top: 1rem;
    font-size: 1.5em; /* Larger font for visibility */
}

#menu-global-coverage-display {
  color: var(--terminal-green);
  font-weight: bold;
  text-align: center;
  margin-top: 1rem;
  font-size: 1.5em; /* Larger font for visibility */
}

.menu-item.manu-stats {
  display: none;
}

/* Radiation Spinner Styles */
#loading-container {
  background-color: rgba(var(--dark-color-rgb), 0.42); /* Using dark-color-rgb */
  position: absolute;
  z-index: 999;
  width: 100%;
  height: 100%;
  display: block;
}

#loading-container p {
  position: absolute;
  color: var(--primary-color);
  font-size: 1.2em;
  text-shadow: 0 0 5px var(--primary-color);
  top: calc(50% + 160px);
  left: calc(50% - 40px);
}

/* --- Radiation Spinner Styles --- */

.radiation-spinner {
  top: calc(50% - 40px);
  left: calc(50% - 40px);
  width: 160px; /* Adjust size as needed */
  height: 160px; /* Adjust size as needed */
  border-radius: 50%; /* Makes it circular */
  position: relative; /* Needed for pseudo-elements */
  overflow: hidden; /* Crucial for containing glitch effects */
  z-index: 0; /* Base layer */

  /* The base conic gradient */
  background: conic-gradient(
      var(--primary-color) 0deg 60deg,
      var(--dark-color) 60deg 120deg,
      var(--primary-color) 120deg 180deg,
      var(--dark-color) 180deg 240deg,
      var(--primary-color) 240deg 300deg,
      var(--dark-color) 300deg 360deg
  );

  /* Base spinning animation */
  animation: spin 1.5s linear infinite;

  /* Add the base neon glow */
  filter: drop-shadow(0 0 3px var(--primary-color)) drop-shadow(0 0 5px var(--primary-color));
}


/* Glitch Layer (::before) */
.radiation-spinner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%; /* Match parent shape */
  z-index: 1; /* Layer above base, below center dot */

  /* Use the same gradient so it looks like the image itself is glitching */
   background: conic-gradient(
      var(--primary-color) 0deg 60deg,
      var(--dark-color) 60deg 120deg,
      var(--primary-color) 120deg 180deg,
      var(--dark-color) 180deg 240deg,
      var(--primary-color) 240deg 300deg,
      var(--dark-color) 300deg 360deg
  );

  /* Glitch animation combining clipping and translation */
  /* Runs faster and uses steps() for abrupt changes */
  animation: glitch-effect 0.4s steps(2, end) infinite alternate;
}

.editable-field { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.editable-field input[type="text"] { display: none; /* Initially hidden */ }
.editable-field .edit-btn, .editable-field .save-btn { cursor: pointer; color: #007bff; background: none; border: none; font-size: 1em; padding: 0 5px; }
.editable-field .save-btn { display: none; /* Initially hidden */ color: green; }
.editable-field .field-status { font-style: italic; font-size: 0.9em; color: #666; margin-left: 5px; }

#back-to-map-btn {
    display: block;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1;
    font-size: 20px;
    z-index: 100;
    color: var(--primary-color);
}

#exit-track-view-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 16px;
    cursor: pointer;
    color: var(--primary-color);
    background-color: rgba(var(--dark-color-rgb), 0.9);
    border: 1px solid var(--primary-color);
    border-radius: 6px;
}

#exit-track-view-btn:hover {
    background-color: var(--primary-color);
    color: var(--dark-color);
}

#exit-track-view-btn.hidden {
    display: none;
}

/* Center Dot (::after) - slightly higher z-index */
.radiation-spinner::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 35%;
  height: 35%;
  background-color: var(--dark-color);
  border-radius: 50%;
  z-index: 2; /* Ensure dot is above the glitch layer */
   /* Optional: Add border if desired
     border: 2px solid var(--primary-color);
  */
}

#track-chart-container {
  position: fixed; /* Stick to the viewport */
  bottom: 0;
  right: 0;
  width: calc(100% - 115px); /* Full width minus some space */
  height: 25vh; /* Adjust height as needed (e.g., 200px, 25vh) */
  background-color: rgba(var(--dark-color-rgb), 0.9); /* Dark background, adjust color/opacity */
  border-top: 1px solid var(--secondary-color); /* Cyberpunk-style top border */
  box-shadow: 0 -2px 10px rgba(var(--secondary-color-rgb), 0.3); /* Optional glow effect */
  z-index: 10; /* Above map, below modals (adjust if needed) */
  padding: 10px;
  box-sizing: border-box; /* Include padding in width/height */
  transition: transform 0.3s ease-in-out; /* Smooth transition for showing/hiding */
  transform: translateY(100%); /* Start hidden below the screen */
}

/* Style for when the chart is visible (removes the 'hidden' class) */
#track-chart-container:not(.hidden) {
  transform: translateY(0); /* Slide into view */
}

/* Ensure canvas fits container */
#track-chart-container canvas {
  display: block;
  width: 100% !important;
  height: calc(100% - 33px) !important;
}

.track-view-link {
  color: var(--primary-color);
  padding: 5px 10px;
  border-radius: 5px;
  text-decoration: none;
  font-size: 1.2em;
}

a.track-view-link:hover {
  color: var(--accent-color); /* Using accent-color for hover */
  text-shadow: 0 0 5px var(--accent-color);
}

.track-view-link .track-view-date {
  font-weight: bold;
  color: rgba(var(--primary-color-rgb), 0.5); /* Using primary-color with transparency */
  text-decoration: none;
  text-shadow:none;
  font-size: 0.8em;
}


.share-notification {
    padding: 5px 17px;
    background-color: var(--accent-color);
    color: var(--light-color); /* Using light-color */
    border-radius: 4px;
    font-size: 0.8em;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    white-space: nowrap;
    order: 1;
    float: left;
    margin: 3px;
    position: relative;
    z-index: 10;
}

.custom-popup-close-button {
    position: absolute;
    top: 2px;   /* Adjust as needed */
    right: 2px; /* Adjust as needed */
    border: none;
    border-radius: 0;
    cursor: pointer;
    background-color: transparent;
    font-size: 20px;
    line-height: 1;
    padding: 5px 8px;
    color: var(--text-medium); /* Using text-medium */
    z-index: 10; /* Ensure it's above other popup content */
}

.custom-popup-close-button:hover {
    color: var(--dark-color); /* Black on hover */
    background-color: rgba(var(--dark-color-rgb), 0.05); /* Slight background on hover */
}

#app-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000; /* Ensure it's above most other content */
    display: flex;
    flex-direction: column; /* Stack toasts vertically */
    align-items: flex-end;  /* Align toasts to the right edge of their container space */
    gap: 10px; /* Space between toasts */
    width: auto; /* Let container size with content or max-width */
    max-width: 350px; /* Adjust as needed, prevents toasts from being too wide */
}

.toast-notification {
    /* opacity and transition are set in JS for animation control */
    width: 100%; /* Make toast take full width of the container (up to its max-width) */
    box-sizing: border-box;
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    text-align: left; /* Or 'right'/'center' as preferred */
}

.toast-notification.toast-error {
    background-color: var(--danger);
    color: var(--text-on-primary);
}
.toast-notification.toast-success {
    background-color: var(--green);
    color: var(--text-on-primary);
}
.toast-notification.toast-info {
    background-color: var(--primary);
    color: var(--text-on-primary);
}
.toast-notification.toast-warning {
    background-color: var(--secondary);
    color: var(--text-on-primary);
}

.readingModalButton {
  background-color: var(--dark-color);
  color: var(--light-color);
  border: 1px solid var(--secondary-color);
  padding: 5px 8px;
  cursor: pointer;
  transition: all 0.3s;
}

/* Settings Tab + Content removed — replaced by nav-drawer.css */

.settings-header {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--primary-color);
}

.settings-header h2 {
  color: var(--primary-color);
  font-size: 1.3em;
  text-align: center;
  margin: 0;
}

.setting-item {
  display: flex;
  justify-content: space-between; /* Keep for potential future multi-part items */
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 15px; /* Adjusted padding */
  background-color: rgba(var(--dark-color-rgb), 0.4);
  border: 1px solid var(--secondary-color); /* Default border */
  border-radius: 4px;
  cursor: pointer; /* Make it look clickable */
  transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
  position: relative; /* For pseudo-elements if needed */
}

.setting-item:hover {
  background-color: rgba(var(--secondary-color-rgb), 0.1); /* Cyan highlight on hover */
  border-color: var(--primary-color);
}

.setting-item label {
  color: var(--secondary-color);
  font-size: 0.95em;
  margin-right: 10px;
  pointer-events: none; /* Label clicks should go to the parent div */
}

.setting-item input[type="checkbox"] {
  /* Hide the checkbox but keep it functional */
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.setting-item select {
  background-color: var(--dark-color);
  color: var(--primary-color);
  border: 1px solid var(--secondary-color);
  border-radius: 3px;
  padding: 5px;
  font-family: var(--font-display);
  font-size: 0.9em;
  cursor: pointer;
}

.setting-item select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 5px var(--primary-color);
}

/* Visual indicator for the "on" state */
.setting-item.active {
  /* This class is now primarily for the Relative Gradient toggle, which remains green */
  background-color: rgba(var(--terminal-green-rgb), 0.2); /* Greenish background when active */
  border-color: var(--terminal-green);
}

.setting-item.active label {
  color: var(--terminal-green); /* Brighter label when active */
}

/* Styles for Show Readings toggle when OFF (red) */
.setting-item.readings-off {
  background-color: rgba(var(--accent-color-rgb), 0.2); /* Reddish background when off */
  border-color: var(--accent-color); /* Red border */
}

.setting-item.readings-off label {
  color: var(--accent-color); /* Red label when off */
}

/* Styles for Show Readings toggle when ON (normal/default) */
.setting-item.readings-on {
  background-color: rgba(var(--dark-color-rgb), 0.4); /* Default background */
  border-color: var(--secondary-color); /* Default border */
}

.setting-item.readings-on label {
  color: var(--secondary-color); /* Default label color */
}

/* Hexagons on/off toggle styles — now handled by nav-drawer.css */

/* Optional: Add a visual cue like a toggle switch or icon */
.setting-item-onoff::after {
  content: 'OFF';
  font-size: 0.8em;
  color: var(--secondary-color);
  padding: 3px 6px;
  border: 1px solid var(--secondary-color);
  border-radius: 3px;
}

.setting-item-onoff.active::after {
  content: 'ON';
  color: var(--dark-color);
  background-color: var(--terminal-green);
  border-color: var(--terminal-green);
}

@media (max-width: 945px) {

  #profile-content {
    width:100%;
  }
}

/* Keyframes for the base spinning animation */
@keyframes spin {
  from {
      transform: rotate(0deg);
  }
  to {
      transform: rotate(360deg);
  }
}

/* Inline spinner utility (used for feature area save button) */
.spinner {
  border: 2px solid var(--secondary-color);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  width: 16px;
  height: 16px;
}

/* Keyframes for the Glitch Effect */
@keyframes glitch-effect {
  0% {
      /* Small horizontal shift, slightly clipped top */
      transform: translateX(-5px);
      clip-path: inset(5% 0 0 0);
      opacity: 0.95;
  }
  20% {
      /* No shift, normal clip */
      transform: translateX(0);
      clip-path: inset(0 0 0 0);
      opacity: 1;
  }
  40% {
       /* Larger horizontal shift, clip bottom section */
      transform: translateX(7px);
      clip-path: inset(60% 0 5% 0);
      opacity: 0.9;
  }
  60% {
      /* Small negative shift, clip middle section */
      transform: translateX(-3px);
      clip-path: inset(30% 0 30% 0);
      opacity: 1;
  }
  80% {
      /* Larger negative shift, clip small top section */
      transform: translateX(-9px);
      clip-path: inset(0 0 85% 0);
      opacity: 0.85;
  }
  100% {
      /* Back to a small shift, almost normal clip */
      transform: translateX(2px);
      clip-path: inset(0 0 5% 0);
      opacity: 1;
  }
}


.mapboxgl-popula r-mapboxgl-popup {
  background-color: var(--dark-color);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  box-shadow: var(--shadow-glow);
}

.please-log-in-text {
  color: var(--primary-color);
  font-size: 1.2em;
  text-shadow: 0 0 5px var(--primary-color);
  text-align: center;
}

.time-slider-container {
  position: fixed;
  bottom: 0;
  right: 20px;
  width: calc(100% - 150px);
  background-color: rgba(var(--dark-color-rgb), 0.85); /* Using dark-color-rgb */
  padding: 10px 20px;
  box-sizing: border-box;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  border-top: 1px solid #444;
  color: var(--light-color); /* Using light-color */
  font-family: var(--font-display);
}

.time-slider-container.hidden {
  display: none;
}

.time-slider-container label {
  font-weight: bold;
  margin-right: 5px;
}

.time-slider-container input[type="range"] {
  flex-grow: 1;
  max-width: 600px;
  cursor: pointer;
  height: 8px;
  background: #555;
  border-radius: 4px;
  appearance: none;
  -webkit-appearance: none;
}

.time-slider-container input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--secondary-color);
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(var(--secondary-color-rgb), 0.5); /* Darker cyan border */
}

.time-slider-container input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--secondary-color);
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(var(--secondary-color-rgb), 0.5); /* Darker cyan border */
}

#selected-date-display {
  font-weight: bold;
  min-width: 100px;
  text-align: center;
  background-color: rgba(var(--dark-color-rgb), 0.3);
  padding: 3px 8px;
  border-radius: 3px;
}

.achievement-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--primary-color); /* Using primary-color */
  color: var(--dark-color); /* Using dark-color */
  padding: 15px 20px;
  border-radius: var(--radius-md); /* Slightly more rounded */
  box-shadow: 0 4px 12px rgba(var(--dark-color-rgb), 0.25); /* Enhanced shadow */
  z-index: 1050;
  opacity: 0;
  transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
  transform: translateY(20px);
  display: flex;
  align-items: flex-start; /* Align items to the top */
  gap: 15px; /* Increased gap */
  font-size: 1.2em;
  max-width: 350px; /* Limit width */
  cursor: default; /* Default cursor */
}

.achievement-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.achievement-toast .icon {
   font-size: 2em; /* Larger icon */
   margin-top: 2px; /* Align icon better with text */
   flex-shrink: 0; /* Prevent icon from shrinking */
}

.achievement-toast .details {
  display: flex;
  flex-direction: column;
  flex-grow: 1; /* Allow details to take available space */
}

.achievement-toast .name {
  font-weight: bold;
  font-size: 1.1em; /* Slightly larger name */
  margin-bottom: 4px;
}

/* --- New/Modified Styles --- */
.achievement-toast .description {
  font-size: 0.9em;
  margin-bottom: 8px; /* Space below description */
  line-height: 1.4; /* Improve readability */
  opacity: 0.9;
}

.achievement-toast .footer {
  display: flex;
  justify-content: space-between; /* Space out points and link */
  align-items: center;
  font-size: 0.85em;
  margin-top: auto; /* Push footer to bottom if space allows */
}

.achievement-toast .points {
  opacity: 0.8;
  font-weight: bold;
}

.achievement-toast .more-link {
  color: var(--secondary-color); /* Using secondary-color for link */
  text-decoration: underline;
  cursor: pointer; /* Indicate it's clickable */
  transition: color 0.2s ease;
}

.achievement-toast .more-link:hover {
  color: var(--light-color); /* Brighter on hover */
}


/* --- Feature Area Comments Styles --- */
#feature-area-comments-section {
    padding: 10px 15px;
    border-top: 1px solid #444;
    margin-top: 15px; 
    display: flex;
    flex-direction: column;
}

.comments-header {
    color: var(--primary-color);
    font-size: 1.1em;
    margin-bottom: 10px;
}

.comments-list {
    margin-bottom: 10px;
    padding-right: 5px; /* Space for scrollbar */
}

.comment-item {
    background-color: rgba(var(--dark-color-rgb), 0.5);
    border: 1px solid var(--secondary-color);
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 3px;
    position: relative; /* Needed for absolute positioning of action buttons */
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}
 
.comment-actions-container {
    display: flex;
    gap: 5px; /* Space between edit and delete buttons */
    align-items: center;
}

.comment-edit-btn,
.comment-delete-btn {
    background: none;
    border: none;
    color: var(--accent-color); /* Magenta for icons */
    font-size: 1.5em; /* Adjust for icon size */
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    text-shadow: 0 0 3px rgba(192, 132, 252, 0.5); /* Accent glow */
    transition: color 0.2s, transform 0.2s;
}

.comment-edit-btn:hover {
   color: var(--primary-color); /* Yellow on hover */
   transform: scale(1.1);
}
 
.comment-delete-btn:hover {
   color: #ff4757; /* Brighter red on hover */
   transform: scale(1.1);
}
 
.comment-author {
    display: flex;
    align-items: center;
    /* margin-bottom: 5px; */ /* Moved to comment-header gap */
}
 
.comment-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid var(--secondary-color); /* Cyan border */
    object-fit: cover; /* Ensure avatar images cover the area */
}
 
.comment-username {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 0.9em;
}
 
.comment-text-container {
    color: var(--text-medium); /* Use medium text color for better visibility */
    font-size: 0.95em;
    line-height: 1.5;
    margin-bottom: 5px;
    white-space: pre-wrap; /* Preserve line breaks */
    word-break: break-word; /* Break long words */
}

.comment-text-container a {
    color: var(--secondary-color); /* Cyan for links */
    text-decoration: underline; /* Underline to differentiate */
    text-shadow: 0 0 5px var(--secondary-color); /* Subtle glow */
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.comment-text-container a:hover {
    color: var(--primary-color); /* Yellow on hover */
    text-shadow: 0 0 8px var(--primary-color); /* Enhanced glow on hover */
}

.comment-edit-textarea {
    width: 100%;
    min-height: 60px;
    padding: 0.5rem;
    border: 1px solid var(--secondary-color);
    background-color: rgba(var(--dark-color-rgb), 0.7);
    color: var(--terminal-green);
    font-family: var(--font-sans);
    box-sizing: border-box;
    resize: vertical;
    margin-top: 5px; /* Space from author line */
    margin-bottom: 10px; /* Space before new action buttons */
}
.comment-edit-textarea:focus {
    outline: none;
    box-shadow: 0 0 8px var(--secondary-color);
}

.comment-edit-actions-wrapper {
    display: flex;
    justify-content: flex-end; /* Align to the right */
    gap: 8px;
    margin-top: 5px; /* Space above buttons */
}

.comment-save-btn,
.comment-cancel-btn {
    background-color: var(--dark-color);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2em; /* For MDI icons */
    line-height: 1; /* Ensure icon vertical alignment */
}

.comment-save-btn:hover,
.comment-cancel-btn:hover {
    background-color: var(--primary-color);
    color: var(--dark-color);
}

.comment-save-btn .mdi-check { color: var(--terminal-green); } /* Green check */
.comment-cancel-btn .mdi-close { color: var(--accent-color); } /* Magenta close */

.comment-image { /* For future image display */
    max-width: 100%;
    max-height: 200px; /* Limit image height */
    object-fit: contain; /* Show full image, scaled down */
    margin-top: 5px;
    border-radius: 3px;
    border: 1px solid var(--secondary-color);
    display: block; /* Ensure it takes block space */
}
 
.comment-image:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px var(--cyber-glow-color-secondary, #ff00ff), 0 0 5px var(--cyber-glow-color-secondary, #ff00ff) inset;
}
 
/* --- Image Viewer Modal --- */
.modal-content-image {
    display: block;
    max-width: 90vw; /* Max width relative to viewport width */
    max-height: 80vh; /* Max height relative to viewport height */
    margin: auto; /* Center the image */
    border: 2px solid var(--secondary-color); /* Using secondary-color */
    box-shadow: 0 0 20px var(--secondary-color);
    background-color: rgba(var(--dark-color-rgb), 0.9); /* Dark background for the image itself if transparent */
}
 
.modal-caption {
    margin-top: 15px;
    color: var(--text-medium); /* Using text-medium */
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.1em;
    max-width: 90vw;
    overflow-wrap: break-word;
    box-sizing: border-box;
    position: absolute;
    bottom: 10px;
}
 
/* Ensure the generic modal close button style applies or add specific styles */
#image-viewer-modal .modal-close-btn {
    position: absolute;
    top: 15px;
    right: 25px;
    color: var(--primary-color); /* Using primary-color */
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    text-shadow: 0 0 5px var(--secondary-color); /* Using secondary-color */
}
 
#image-viewer-modal .modal-close-btn:hover,
#image-viewer-modal .modal-close-btn:focus {
    color: var(--accent-color); /* Using accent-color */
    text-decoration: none;
}
 
.modal.hidden {
    display: none;
}
 
.comment-meta {
    font-size: 0.75em;
    color: var(--text-medium);
    text-align: right;
}
 
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(var(--dark-color-rgb), 0.7);
    flex-shrink: 0; /* Prevent form from shrinking */
}
 
#feature-area-comment-text {
    width: 100%;
    min-height: 60px;
    padding: 0.5rem;
    border: 1px solid var(--secondary-color);
    background-color: rgba(var(--dark-color-rgb), 0.7);
    color: var(--terminal-green);
    font-family: var(--font-sans);
    box-sizing: border-box;
    resize: vertical;
}
 
#feature-area-comment-text:focus {
    outline: none;
    box-shadow: 0 0 8px var(--secondary-color);
}
 
.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
 
.btn-comment-action {
    background-color: var(--dark-color);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2em; /* For MDI icons */
    line-height: 1; /* Ensure icon vertical alignment */
}
 
.btn-comment-action:hover {
    background-color: var(--primary-color);
    color: var(--dark-color);
}
 
.btn-comment-action .mdi {
    vertical-align: middle; /* Align icon nicely */
}

.feature-area-hover-tooltip .mapboxgl-popup-content {
  background-color: rgba(var(--dark-color-rgb), 0.85);
  border: 1px solid var(--secondary-color); /* Cyan, to differentiate from yellow hexagon tooltips */
  box-shadow: 0 0 8px var(--secondary-color);
  padding: 6px 10px; /* Slightly smaller padding */
  font-size: 13px; /* Adjust size */
  color: var(--secondary-color); /* Cyan text */
  font-family: var(--font-display);
  white-space: nowrap;
  border-radius: 3px;
}

a.disabled {
    background: var(--dark-color);
    border: var(--text-medium);
    color: var(--text-medium);
    text-decoration: line-through;
    box-shadow: rgba(var(--text-medium-rgb), 0.5) 0px 0px 5.03192px 0px; /* Assuming text-medium-rgb exists or can be added */
}

a.disabled:hover {
    background: var(--dark-color);
    border: var(--text-medium);
    color: var(--text-medium);
    text-decoration: line-through;
    box-shadow: rgba(var(--text-medium-rgb), 0.5) 0px 0px 5.03192px 0px;
}

.setting-item.feature-area-controls {
    padding: 0;
    justify-content: stretch;
    cursor: default; /* The container isn't clickable, the buttons are */
}

.setting-item.feature-area-controls:hover {
    background-color: rgba(var(--dark-color-rgb), 0.4); /* Override parent hover */
    border-color: var(--secondary-color);
}

.feature-area-controls .btn-link {
    flex-grow: 1;
    text-align: left;
    background: none;
    border: none;
    color: var(--secondary-color);
    padding: 12px 15px;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.95em;
    text-transform: uppercase;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.feature-area-controls .btn-link:hover {
    background-color: rgba(var(--secondary-color-rgb), 0.1);
    color: var(--primary-color);
}

.feature-area-controls .btn-icon {
    flex-shrink: 0;
    background: none;
    border: none;
    border-left: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    padding: 12px 15px;
    font-size: 1.5em; /* Make the '+' bigger */
    line-height: 1;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.feature-area-controls .btn-icon:hover {
    background-color: rgba(var(--secondary-color-rgb), 0.1);
    color: var(--primary-color);
}

.sidebar-section-share {
    width: 100%;
    height: 7px;
}

.sidebar-share-container {
    position: absolute;
    right: 10px;
}




 
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
 
@media (max-width: 945px) {

   header h1 {
    font-size: 1.5rem;
    padding-right: 0.5rem;
  }
  .menu-toggle-btn {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    font-size: 1.6rem;
    box-shadow: 0 3px 12px rgba(var(--primary-color-rgb), 0.2);
  }
 
  #sidebar {
    width: 95%;
    height: 90vh;
    top: 5%;
    left: 2.5%;
    border-right: none;
      border: 2px solid var(--accent-color);
      transition: transform 0.3s ease-out, opacity 0.3s ease-out;
      opacity: 0;
  }
  #sidebar.hidden {
    transform: scale(0.9);
    opacity: 0;
  }
    #sidebar:not(.hidden) {
       transform: scale(1);
       opacity: 1;
  }
 
  #map {
    width: 100% !important;
    margin-left: 0 !important;
  }
 
  .radiation-scale-unit {
    width: 50px;
    height: 200px;
    bottom: 10px;
    left: 10px;
  }
  .radiation-scale { /* Ensure this is also responsive */
    width: 50px;
    height: 200px;
    bottom: 10px;
    left: 10px;
  }
 
  .scale-line-container {
    width: 6px;
  }
  .radiation-scale-header-unit, .scale-labels {
       font-size: 0.7rem;
  }
 
  .modal-content {
       width: 95%;
  }
 
  .header-stats {
    display: none !important;
  }
 
  .menu-item.manu-stats {
    display: block;
  }
 
  .time-slider-container {
       flex-direction: column; /* Stack elements vertically */
       padding: 8px;
       gap: 8px;
  }
 
  .time-slider-container input[type="range"] {
       width: 90%; /* Take most of the width */
       max-width: none;
  }
 
  #selected-date-display {
       margin-top: 5px;
  }
 
  #profile-content {
    width:100%;
  }
}
 
/* --- Link Preview Styles --- */
.comment-text-container {
    margin-bottom: 5px; /* Space below the text container */
    word-wrap: break-word; /* Ensure long words break */
    color: var(--text-medium); /* Use medium text color for better visibility */
}
 
.link-preview-placeholder {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid var(--secondary-color); /* Cyan border */
    background-color: rgba(var(--dark-color-rgb), 0.6); /* Semi-transparent dark background */
    border-radius: 5px;
    display: flex; /* Use flexbox for layout */
    align-items: center; /* Vertically align items */
    gap: 10px; /* Space between image and text */
    overflow: hidden; /* Hide overflowing content */
    position: relative; /* For absolute positioning of loading/error */
    min-height: 60px; /* Ensure some height even if content is small */
}
 
.link-preview-content {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
 
.link-preview-image {
    width: 80px; /* Fixed width for the image */
    height: 80px; /* Fixed height for the image */
    object-fit: cover; /* Cover the area, cropping if necessary */
    flex-shrink: 0; /* Prevent image from shrinking */
    border-radius: 3px;
    border: 1px solid var(--primary-color); /* Yellow border for image */
}
 
.link-preview-image-fallback {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    background-color: rgba(var(--light-color-rgb), 0.05); /* Light grey placeholder */
    border-radius: 3px;
    border: 1px dashed var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Optional: Add a generic icon for fallback */
    /* &::before { content: '\F04DC'; font-family: 'Material Design Icons'; font-size: 2em; color: var(--secondary-color); } */
}
 
.link-preview-text {
    flex-grow: 1; /* Allow text content to take remaining space */
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow text to shrink */
}
 
.link-preview-title {
    font-weight: bold;
    color: var(--primary-color); /* Yellow for title */
    font-size: 1em;
    white-space: nowrap; /* Prevent title from wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis for long titles */
}
 
.link-preview-description {
    font-size: 0.85em;
    color: var(--text-color); /* General text color */
    display: -webkit-box;
  line-clamp: 2; /* Standard property for supporting browsers */
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
 
.link-preview-sitename {
    font-size: 0.75em;
    color: var(--accent-color); /* Magenta for site name */
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
 
.preview-loading, .preview-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(var(--dark-color-rgb), 0.8); /* Dark overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color); /* Cyan for loading/error text */
    font-size: 0.9em;
    gap: 5px;
}
 
.preview-error {
    color: var(--accent-color); /* Magenta for error */
}
 
.preview-error .mdi {
    font-size: 1.2em; /* Icon size */
}

/* --- Discord Widget Iframe --- */
#discord-widget-container iframe {
    width: 100%;
    height: 300px; /* A more reasonable height for the menu */
    border-radius: 4px; /* Optional: for aesthetics */
}
 
/* Responsive adjustments for link previews */
@media (max-width: 600px) {
    .link-preview-placeholder {
        flex-direction: column; /* Stack image and text vertically */
        align-items: flex-start; /* Align items to the start */
        padding: 8px;
    }
 
    .link-preview-image {
        width: 100%; /* Full width on small screens */
        height: 120px; /* Adjust height for better display */
        margin-bottom: 8px; /* Space below image */
    }
 
    .link-preview-text {
        width: 100%; /* Full width for text */
    }
}

/* Map Search Bar Styles */
.map-search-container {
  position: fixed;
  top: calc(var(--header-height) + 12px); /* Below header */
  left: 50%;
  transform: translateX(-50%);
  z-index: 15; /* Above map controls */
  width: 90%;
  max-width: 560px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background-color: rgba(var(--dark-color-rgb), 0.9);
    border: 2px solid var(--secondary-color);
  border-radius: 16px;
    padding: 8px 16px;
    box-shadow: 0 0 15px var(--secondary-color);
    transition: all 0.3s ease;
}

/* When discovery quick action is present, create breathing room below for its pill */
.search-input-wrapper.has-discovery-below { margin-bottom: 8px; }

.search-input-wrapper:focus-within {
    border-color: var(--primary-color);
  /* Reduce downward shadow bleed so it doesn't overlap stacked action button */
  box-shadow: 0 0 18px rgba(var(--primary-color-rgb),0.9);
    transform: scale(1.02);
}

.search-icon {
    color: var(--secondary-color);
    font-size: 1.2em;
    margin-right: 10px;
    flex-shrink: 0;
}

.map-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--terminal-green);
    font-family: var(--font-sans);
    font-size: 16px; /* Prevent iOS zoom */
    padding: 0;
    min-width: 0; /* Allow flex shrinking */
}

.map-search-input::placeholder {
    color: var(--text-medium);
    opacity: 0.7;
}

.clear-search-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.clear-search-btn:hover {
    background-color: rgba(var(--secondary-color-rgb), 0.1);
    color: var(--primary-color);
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: rgba(var(--dark-color-rgb), 0.95);
    border: 2px solid var(--secondary-color);
  border-top: none; /* avoid double seam */
  border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 15px rgba(var(--secondary-color-rgb), 0.3);
    max-height: 300px;
    overflow-y: auto;
    z-index: 16;
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: var(--primary-color) rgba(var(--secondary-color-rgb), 0.15);
  position: relative;
}

/* Custom scrollbar (WebKit) */
.search-results-dropdown::-webkit-scrollbar {
  width: 10px;
}
.search-results-dropdown::-webkit-scrollbar-track {
  background: rgba(var(--secondary-color-rgb), 0.1);
  border-radius: 0 0 10px 0;
}
.search-results-dropdown::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--primary-color), var(--accent-color));
  border-radius: var(--radius-md);
  border: 2px solid rgba(var(--dark-color-rgb), 0.95);
}
.search-results-dropdown::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(var(--accent-color), var(--primary-color));
}

/* Seamless connection between input and dropdown when open */
.search-input-wrapper:focus-within + .search-results-dropdown { border-color: var(--primary-color); }

.search-results-dropdown.hidden {
    display: none;
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(var(--secondary-color-rgb), 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    color: var(--terminal-green);
    font-family: var(--font-sans);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: rgba(var(--primary-color-rgb), 0.1);
    border-left: 3px solid var(--primary-color);
    padding-left: 13px;
}

.search-result-item.feature-area {
    border-left: 3px solid var(--accent-color);
}

.search-result-item.feature-area .search-result-icon {
    color: var(--accent-color);
}

.search-result-item.feature-area .search-result-title {
    color: var(--accent-color);
}

/* Show more / less entries */
.search-result-item.show-more {
  justify-content: flex-start;
  background: rgba(var(--secondary-color-rgb), 0.05);
}
.search-result-item.show-more .search-result-title {
  color: var(--primary-color);
}
.search-result-item.show-more:hover {
  background: rgba(var(--primary-color-rgb), 0.15);
  border-left: 3px solid var(--accent-color);
}

/* Limited mode gradient fade to hint scrolling */
.search-results-dropdown.limited:after {
  content: '';
  position: sticky;
  bottom: 0;
  display: block;
  height: 36px;
  margin-top: -36px; /* overlap */
  background: linear-gradient(to bottom, rgba(var(--dark-color-rgb), 0), rgba(var(--dark-color-rgb), 0.95));
  pointer-events: none;
  border-radius: 0 0 12px 12px;
}

/* Option focus outline */
.search-result-item:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: -2px;
}

.search-result-icon {
    margin-right: 10px;
    color: var(--secondary-color);
    font-size: 1.1em;
    flex-shrink: 0;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-subtitle {
    font-size: 0.9em;
    color: var(--text-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-type {
    font-size: 0.8em;
    color: var(--accent-color);
    text-transform: uppercase;
    margin-top: 2px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .map-search-container {
  top: calc(var(--header-height) + 8px);
        width: 95%;
        max-width: none;
    }
    
    .search-input-wrapper {
        padding: 6px 12px;
    }
    
    .search-icon {
        font-size: 1.1em;
        margin-right: 8px;
    }
    
    .map-search-input {
        font-size: 15px;
    }
    
    .search-result-item {
        padding: 10px 12px;
    }
}

/* Mode icons inside rail buttons */
.rail-modes .mdi{ font-size: 16px; line-height: 1; display: inline-block; }

/* ============================================
   RESOLUTION MODE STYLES
   ============================================ */

/* Hide gradient slider in resolution mode */
.hex-color-panel.resolution-mode #hex-gradient-slider {
  display: none;
}

/* Show resolution slider in resolution mode */
.hex-color-panel.resolution-mode #hex-resolution-slider {
  display: flex !important;
}

/* Resolution slider container */
.hex-resolution-slider {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1;
  position: relative;
}

/* Resolution track - blue/cyan gradient */
.resolution-track {
  position: relative;
  flex: 1;
  margin: 0 auto;
  width: 12px;
  border-radius: 4px; /* MAPBOX COMPLIANCE: Match Mapbox control radius */
  background: linear-gradient(to top, 
    #0066ff 0%,    /* Deep blue (high detail/Res 15) */
    #0088ff 20%,
    #00aaff 40%,
    #00ccff 60%,   /* Cyan */
    #00eeff 80%,
    #00ff88 100%   /* Signature green (low detail/Res 3) */
  );
  box-shadow: inset 0 0 0 1px rgba(var(--secondary-color-rgb), 0.25), 0 0 8px rgba(0,136,255, 0.3), 0 0 0 1px rgba(0,0,0,0.35);
  min-height: 280px;
  overflow: visible;
  z-index: 0;
  transform: scaleY(0.90);
  transform-origin: center;
  touch-action: none;
  overscroll-behavior: contain;
}

/* Animated grid overlay for cyberpunk effect */
.resolution-track::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    repeating-linear-gradient(0deg, transparent, transparent 10px, rgba(255,224,48,0.06) 10px, rgba(255,224,48,0.06) 11px),
    repeating-linear-gradient(90deg, transparent, transparent 10px, rgba(255,224,48,0.06) 10px, rgba(255,224,48,0.06) 11px);
  border-radius: 4px; /* MAPBOX COMPLIANCE: Match Mapbox control radius */
  pointer-events: none;
  opacity: 0.6;
  animation: grid-scroll-resolution 8s linear infinite;
}

@keyframes grid-scroll-resolution {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 0 44px, 44px 0; }
}

/* Snap point indicators container */
.snap-indicators {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

/* Individual snap indicators */
.snap-indicator {
  position: absolute;
  left: -4px;
  width: 20px;
  height: 2px;
  background: rgba(255,224,48,0.5);
  box-shadow: 0 0 4px rgba(255,224,48,0.6);
  z-index: 1;
}

/* Position snap indicators (14 levels including AUTO) */
/* 13 manual resolutions evenly distributed from 0% to ~92.85% */
.snap-indicator[data-resolution="3"] { top: 0%; }        /* WORLD - top */
.snap-indicator[data-resolution="4"] { top: 7.14%; }     /* CONTINENT */
.snap-indicator[data-resolution="5"] { top: 14.28%; }    /* COUNTRY */
.snap-indicator[data-resolution="6"] { top: 21.42%; }    /* REGION */
.snap-indicator[data-resolution="7"] { top: 28.56%; }    /* CITY */
.snap-indicator[data-resolution="8"] { top: 35.70%; }    /* DISTRICT */
.snap-indicator[data-resolution="9"] { top: 42.84%; }    /* BLOCK */
.snap-indicator[data-resolution="10"] { top: 50%; }      /* BUILDING */
.snap-indicator[data-resolution="11"] { top: 57.14%; }   /* STREET */
.snap-indicator[data-resolution="12"] { top: 64.28%; }   /* ROOM */
.snap-indicator[data-resolution="13"] { top: 71.42%; }   /* PARCEL */
.snap-indicator[data-resolution="14"] { top: 78.56%; }   /* METER */
.snap-indicator[data-resolution="15"] { top: 85.70%; }   /* DETAIL */
.snap-indicator[data-resolution="auto"] { 
  top: 100%; 
  background: rgba(255,224,48,0.8);
  box-shadow: 0 0 6px rgba(255,224,48,1);
  width: 24px;
  left: -6px;
  height: 3px;
}

/* Resolution handle */
.resolution-track .handle.resolution {
  position: absolute;
  left: 100%;
  width: 40px;
  height: 32px;
  z-index: 3;
  top: 100%; /* Default to AUTO at bottom */
  transform: translateY(-50%);
  cursor: grab;
  background: transparent;
  border: 0;
  outline: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  will-change: top;
  transition: top 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.resolution-track .handle.resolution:active {
  cursor: grabbing;
}

/* Hexagon icon that scales with resolution */
.resolution-track .handle.resolution::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%) scale(var(--hex-scale, 1));
  width: 0;
  height: 0;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  border-right: 16px solid rgba(255,224,48,0.95);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8)) drop-shadow(0 0 6px rgba(255,224,48,0.6));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark outline for contrast */
.resolution-track .handle.resolution::after {
  content: '';
  position: absolute;
  left: -18px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 15px solid transparent;
  border-bottom: 15px solid transparent;
  border-right: 18px solid rgba(0,0,0,0.6);
  z-index: -1;
}

/* Focus state for accessibility */
.resolution-track .handle.resolution:focus {
  outline: none;
}

.resolution-track .handle.resolution:focus::before {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8)) drop-shadow(0 0 10px rgba(255,224,48,1));
}

/* Resolution label */
.resolution-label {
  position: absolute;
  left: 16px;
  top: var(--resolution-label-top, 100%);
  transform: translateY(-50%);
  background: rgba(0,0,0,0.85);
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.70rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 4;
  box-shadow: 0 0 8px rgba(255,224,48,0.4);
  transition: top 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* AUTO mode label styling */
.resolution-label.auto-mode {
  color: var(--green);
  box-shadow: var(--shadow-glow);
}

/* Horizontal mode adaptations */
.hex-color-panel.horizontal.resolution-mode .resolution-track {
  width: auto;
  height: 12px;
  min-height: 0;
  min-width: 280px;
  background: linear-gradient(to right, 
    #00ff88 0%,    /* Signature green (low detail/Res 3) - LEFT */
    #00eeff 20%,
    #00ccff 40%,
    #00aaff 60%,   /* Cyan */
    #0088ff 80%,
    #0066ff 100%   /* Deep blue (high detail/Res 15) - RIGHT */
  );
}

.hex-color-panel.horizontal.resolution-mode .snap-indicator {
  top: -4px;
  left: auto;
  width: 2px;
  height: 20px;
}

/* Horizontal snap positions (14 levels including AUTO) */
.hex-color-panel.horizontal .snap-indicator[data-resolution="3"] { left: 0%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="4"] { left: 7.14%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="5"] { left: 14.28%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="6"] { left: 21.42%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="7"] { left: 28.56%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="8"] { left: 35.70%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="9"] { left: 42.84%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="10"] { left: 50%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="11"] { left: 57.14%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="12"] { left: 64.28%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="13"] { left: 71.42%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="14"] { left: 78.56%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="15"] { left: 85.70%; }
.hex-color-panel.horizontal .snap-indicator[data-resolution="auto"] { 
  left: 100%;
  height: 24px;
  top: -6px;
  width: 3px;
}

.hex-color-panel.horizontal.resolution-mode .resolution-track .handle.resolution {
  left: 100%; /* Default to AUTO at right */
  top: 100%;
  transform: translateX(-50%);
  will-change: left;
  transition: left 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hex-color-panel.horizontal.resolution-mode .resolution-track .handle.resolution::before {
  left: 50%;
  top: -18px;
  transform: translateX(-50%) rotate(-90deg) scale(var(--hex-scale, 1));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hex-color-panel.horizontal.resolution-mode .resolution-track .handle.resolution::after {
  left: 50%;
  top: -20px;
  transform: translateX(-50%) rotate(-90deg);
}

.hex-color-panel.horizontal.resolution-mode .resolution-label {
  left: var(--resolution-label-left, 100%);
  top: 16px;
  transform: translateX(-50%);
  transition: left 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Shimmer animation when resolution is changing */
.resolution-track.animating {
  animation: resolution-shimmer 1.2s ease-out;
}

@keyframes resolution-shimmer {
  0% {
    box-shadow: inset 0 0 0 1px rgba(var(--secondary-color-rgb), 0.25),
                0 0 8px rgba(255,224,48, 0.2),
                0 0 0 1px rgba(0,0,0,0.35);
  }
  15% {
    box-shadow: inset 0 0 0 1px rgba(255,224,48, 0.6),
                0 0 20px rgba(255,224,48, 0.4),
                0 0 40px rgba(255,224,48, 0.2),
                0 0 0 1px rgba(255,224,48,0.4);
  }
  30% {
    box-shadow: inset 0 0 0 1px rgba(240,128,0, 0.5),
                0 0 16px rgba(240,128,0, 0.3),
                0 0 32px rgba(240,128,0, 0.15),
                0 0 0 1px rgba(240,128,0,0.3);
  }
  50% {
    box-shadow: inset 0 0 0 1px rgba(255,224,48, 0.5),
                0 0 24px rgba(255,224,48, 0.35),
                0 0 48px rgba(255,224,48, 0.15),
                0 0 0 1px rgba(255,224,48,0.3);
  }
  70% {
    box-shadow: inset 0 0 0 1px rgba(240,128,0, 0.4),
                0 0 12px rgba(240,128,0, 0.25),
                0 0 24px rgba(240,128,0, 0.12),
                0 0 0 1px rgba(240,128,0,0.2);
  }
  100% {
    box-shadow: inset 0 0 0 1px rgba(var(--secondary-color-rgb), 0.25),
                0 0 8px rgba(255,224,48, 0.2),
                0 0 0 1px rgba(0,0,0,0.35);
  }
}

/* Pulse the snap indicators during animation */
.resolution-track.animating .snap-indicator {
  animation: indicator-pulse 1.2s ease-out;
}

@keyframes indicator-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  20% {
    opacity: 1;
    transform: scale(1.3);
    box-shadow: 0 0 8px rgba(255,224,48,0.8);
  }
  40% {
    opacity: 0.8;
    transform: scale(0.9);
  }
  60% {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 6px rgba(0,136,255,0.8);
  }
  80% {
    opacity: 0.9;
    transform: scale(0.95);
  }
}

/* ============================================
   CONFIDENCE FILTER MODE STYLES
   ============================================ */

/* Hide gradient slider in confidence mode */
.hex-color-panel.confidence-mode #hex-gradient-slider {
  display: none;
}

/* Hide resolution slider in confidence mode */
.hex-color-panel.confidence-mode #hex-resolution-slider {
  display: none !important;
}

/* Show confidence slider in confidence mode */
.hex-color-panel.confidence-mode #hex-confidence-slider {
  display: flex !important;
}

/* Confidence slider container */
.hex-confidence-slider {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1;
  position: relative;
}

/* Confidence track */
.confidence-track {
  position: relative;
  flex: 1;
  border-radius: 9px;
  background: linear-gradient(to top,
    rgba(255,255,255,0.08) 0%,
    rgba(74,222,128,0.25) 50%,
    rgba(74,222,128,0.5) 100%
  );
  box-shadow: inset 0 0 0 1px rgba(var(--secondary-color-rgb), 0.25),
              0 0 0 1px rgba(0,0,0,0.35);
  min-height: 60px;
  touch-action: none;
}

/* Fill area showing selected range */
.confidence-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 0 0 9px 9px;
  background: rgba(255,107,107,0.25);
  pointer-events: none;
  transition: height 0.1s ease;
}

/* Confidence handle */
.confidence-track .handle.confidence {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 8px;
  background: var(--secondary);
  border-radius: 4px;
  cursor: grab;
  z-index: 10;
  box-shadow: var(--shadow-glow), 0 1px 3px rgba(0,0,0,0.5);
  touch-action: none;
}
.confidence-track .handle.confidence:active {
  cursor: grabbing;
}

/* Confidence label */
.confidence-label {
  position: absolute;
  right: -40px;
  font-size: 11px;
  font-weight: 600;
  color: var(--secondary);
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Horizontal orientation overrides */
.hex-color-panel.horizontal .confidence-track {
  background: linear-gradient(to right,
    rgba(255,255,255,0.08) 0%,
    rgba(74,222,128,0.25) 50%,
    rgba(74,222,128,0.5) 100%
  );
  min-height: auto;
  min-width: 60px;
}

.hex-color-panel.horizontal .confidence-fill {
  bottom: 0;
  top: 0;
  left: 0;
  right: auto;
  height: auto !important;
  border-radius: 9px 0 0 9px;
}

.hex-color-panel.horizontal .confidence-track .handle.confidence {
  top: 50%;
  left: auto;
  transform: translateY(-50%);
  width: 8px;
  height: 28px;
}

.hex-color-panel.horizontal .confidence-label {
  right: auto;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
}

/* Premium CTA Menu Item */
.premium-cta-link {
    color: #f6c90e;
    font-weight: bold;
}

.premium-cta-link:hover {
    color: #ffe066;
    text-decoration: underline;
}
