:root {
      --bg: #04070b;
      --panel: rgba(4, 7, 11, 0.82);
      --panel-strong: rgba(6, 11, 18, 0.94);
      --line: rgba(0, 255, 213, 0.22);
      --text: #d8f8ff;
      --muted: rgba(216, 248, 255, 0.62);
      --cyan: #00ffd5;
      --cyan2: #7df9ff;
      --gold: #f5c76b;
      --red: #e74c3c;
    }

    * { box-sizing: border-box; }

    html,
    body {
      margin: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      background: var(--bg);
      color: var(--text);
      font-family: Inter, "Segoe UI", system-ui, sans-serif;
    }

    #map-card {
      position: fixed;
      inset: 0;
      overflow: hidden;
      background:
        radial-gradient(circle at 50% 46%, rgba(0, 255, 213, 0.24), transparent 24%),
        radial-gradient(circle at 25% 20%, rgba(0, 255, 213, 0.14), transparent 32%),
        radial-gradient(circle at 75% 80%, rgba(245, 199, 107, 0.12), transparent 28%),
        linear-gradient(135deg, #020409, #08111a);
    }

    #mapContainer {
      position: relative;
      z-index: 1;
      width: 100%;
      height: 100%;
      background: transparent;
    }

    #map-card::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: 0;
      opacity: 0;
      background-image:
        linear-gradient(rgba(125, 249, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(125, 249, 255, 0.04) 1px, transparent 1px);
      background-size: 42px 42px;
      pointer-events: none;
      transition: opacity 240ms ease;
    }

    #map-card::after {
      content: "";
      position: absolute;
      inset: 0;
      z-index: 0;
      opacity: 0;
      background:
        radial-gradient(circle at 50% 46%, rgba(0, 255, 213, 0.16), transparent 28%),
        radial-gradient(circle at 58% 54%, rgba(245, 199, 107, 0.08), transparent 34%),
        linear-gradient(180deg, rgba(4, 7, 11, 0.08), rgba(4, 7, 11, 0.32));
      pointer-events: none;
      transition: opacity 240ms ease;
    }

    #map-card.globe-mode::before,
    #map-card.globe-mode::after {
      opacity: 1;
    }

    #marineTrafficView {
      position: absolute;
      inset: 0;
      z-index: 35;
      display: none;
      background: #020406;
    }

    #marineTrafficView.active {
      display: block;
    }

    #marineTrafficView iframe {
      width: 100%;
      height: 100%;
      border: 0;
      display: block;
    }

    .maplibregl-ctrl-bottom-left,
    .maplibregl-ctrl-bottom-right {
      display: none;
    }

    .maplibregl-canvas {
      outline: none;
      filter: saturate(1.08) contrast(1.04) brightness(1.06);
    }

    .hud {
      position: fixed;
      inset: 0;
      z-index: 20;
      pointer-events: none;
      background:
        radial-gradient(circle at 50% 42%, rgba(0, 255, 213, 0.09), transparent 35%),
        radial-gradient(circle at 50% 46%, rgba(245, 199, 107, 0.045), transparent 30%),
        linear-gradient(180deg, rgba(4, 7, 11, 0.08), rgba(4, 7, 11, 0.26));
    }

    .hud::before {
      content: "";
      position: absolute;
      inset: 0;
      opacity: 0.13;
      background-image:
        linear-gradient(rgba(0, 255, 213, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 213, 0.055) 1px, transparent 1px);
      background-size: 48px 48px;
      mask-image: radial-gradient(circle at center, black 20%, transparent 82%);
    }

    .hud::after {
      content: "";
      position: absolute;
      inset: 0;
      opacity: 0.28;
      background:
        repeating-linear-gradient(
          to bottom,
          rgba(125, 249, 255, 0.055),
          rgba(125, 249, 255, 0.055) 1px,
          transparent 1px,
          transparent 7px
        );
    }

    .holo-artifact {
      position: absolute;
      left: -8%;
      right: -8%;
      z-index: 22;
      height: 18px;
      pointer-events: none;
      opacity: 0.24;
      background:
        linear-gradient(
          90deg,
          transparent,
          rgba(0, 255, 213, 0.12),
          rgba(217, 255, 248, 0.22),
          rgba(245, 199, 107, 0.1),
          transparent
        );
      filter: blur(2px);
      animation: holoDrift 12s ease-in-out infinite;
    }

    .holo-artifact.one {
      top: 31%;
    }

    @keyframes holoDrift {
      0%, 100% {
        transform: translate3d(-2%, 0, 0) skewX(-10deg);
        opacity: 0.1;
      }

      42% {
        transform: translate3d(4%, 0, 0) skewX(-10deg);
        opacity: 0.24;
      }

      48% {
        transform: translate3d(8%, 0, 0) skewX(-10deg);
        opacity: 0.08;
      }

      52% {
        transform: translate3d(2%, 0, 0) skewX(-10deg);
        opacity: 0.28;
      }
    }

    .top-command {
      position: absolute;
      top: 14px;
      left: 14px;
      right: 14px;
      z-index: 80;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      border: 1px solid var(--line);
      border-radius: 14px;
      background:
        linear-gradient(180deg, rgba(0, 255, 213, 0.07), transparent 42%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
      backdrop-filter: blur(16px);
      padding: 12px 14px;
      box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
    }

    .eyebrow {
      color: var(--gold);
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.2em;
      text-transform: uppercase;
    }

    h1 {
      margin: 2px 0 0;
      font-size: clamp(22px, 2.5vw, 38px);
      letter-spacing: 0.1em;
      text-transform: uppercase;
      line-height: 1;
    }

    .subline {
      margin-top: 4px;
      color: var(--muted);
      font-size: 11px;
      letter-spacing: 0.13em;
      text-transform: uppercase;
    }

    .navlink {
      color: var(--cyan);
      text-decoration: none;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px 12px;
      background: rgba(0, 255, 213, 0.04);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .navlink:hover {
      border-color: var(--cyan);
      background: rgba(0, 255, 213, 0.12);
      box-shadow: 0 0 24px rgba(0, 255, 213, 0.16);
    }

    #tabbar {
      position: absolute;
      top: 104px;
      left: 50%;
      z-index: 90;
      display: flex;
      gap: 6px;
      max-width: calc(100vw - 28px);
      overflow-x: auto;
      transform: translateX(-50%);
      border: 1px solid rgba(255, 255, 255, 0.12);
      background:
        linear-gradient(90deg, rgba(0, 255, 213, 0.055), rgba(245, 199, 107, 0.035)),
        rgba(4, 7, 11, 0.72);
      border-radius: 999px;
      padding: 5px 7px;
      backdrop-filter: blur(10px);
    }

    #mapStateBtn {
      position: absolute;
      left: 14px;
      bottom: 14px;
      z-index: 92;
      min-height: 42px;
      border: 1px solid rgba(0, 255, 213, 0.3);
      border-radius: 10px;
      background:
        linear-gradient(135deg, rgba(0, 255, 213, 0.1), rgba(245, 199, 107, 0.045)),
        rgba(4, 7, 11, 0.76);
      color: var(--text);
      padding: 0 14px;
      cursor: pointer;
      backdrop-filter: blur(12px);
      box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.12em;
      text-transform: uppercase;
    }

    #mapStateBtn:hover {
      border-color: rgba(245, 199, 107, 0.66);
      background:
        linear-gradient(135deg, rgba(245, 199, 107, 0.12), rgba(0, 255, 213, 0.06)),
        rgba(4, 7, 11, 0.82);
    }

    .tab {
      flex: 0 0 auto;
      min-height: 30px;
      border: 0;
      border-radius: 999px;
      background: transparent;
      color: rgba(216, 248, 255, 0.68);
      padding: 6px 12px;
      cursor: pointer;
      font-size: 12px;
      font-weight: 800;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      transition: 0.2s ease;
    }

    .tab:hover {
      color: white;
      background: rgba(255, 255, 255, 0.1);
    }

    .tab.active {
      color: var(--text);
      background: rgba(245, 199, 107, 0.16);
      box-shadow: 0 0 22px rgba(245, 199, 107, 0.2);
    }

    #sidepanel {
      position: absolute;
      top: 154px;
      left: 14px;
      z-index: 85;
      width: min(240px, calc(100vw - 28px));
      border: 1px solid var(--line);
      border-radius: 12px;
      background:
        linear-gradient(180deg, rgba(0, 255, 213, 0.06), transparent 34%),
        var(--panel);
      padding: 14px;
      backdrop-filter: blur(14px);
      box-shadow: 0 0 30px rgba(0, 0, 0, 0.34);
      font-size: 13px;
    }

    .panel-title {
      margin-bottom: 10px;
      color: var(--gold);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.14em;
      text-transform: uppercase;
    }

    .panel-note {
      margin-top: 10px;
      color: rgba(216, 248, 255, 0.62);
      font-size: 11px;
      line-height: 1.55;
    }

    .panel-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 30px;
      margin-top: 10px;
      border: 1px solid rgba(0, 255, 213, 0.28);
      border-radius: 8px;
      background: rgba(0, 255, 213, 0.05);
      color: var(--cyan2);
      padding: 0 10px;
      text-decoration: none;
      font-size: 10px;
      font-weight: 900;
      letter-spacing: 0.12em;
      text-transform: uppercase;
    }

    .panel-link:hover {
      border-color: var(--cyan);
      background: rgba(0, 255, 213, 0.12);
    }

    .toggle-row {
      display: flex;
      align-items: center;
      gap: 8px;
      min-height: 28px;
      color: rgba(216, 248, 255, 0.82);
      cursor: pointer;
    }

    .toggle-row:hover { color: white; }
    .toggle-row input { accent-color: var(--gold); cursor: pointer; }

    .option-row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 6px;
    }

    .mini-btn {
      border: 1px solid rgba(0, 255, 213, 0.22);
      border-radius: 8px;
      background: rgba(4, 7, 11, 0.86);
      color: rgba(216, 248, 255, 0.78);
      padding: 6px 8px;
      cursor: pointer;
      font-size: 10px;
      font-weight: 900;
      letter-spacing: 0.1em;
      text-transform: uppercase;
    }

    .mini-btn:hover,
    .mini-btn.active {
      border-color: rgba(245, 199, 107, 0.64);
      background: rgba(245, 199, 107, 0.14);
      color: var(--text);
    }

    #cellular-radio,
    #cellular-country {
      flex: 1 1 112px;
      width: auto;
      min-width: 112px;
    }

    .field-label {
      margin-top: 10px;
      color: rgba(216, 248, 255, 0.56);
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.12em;
      text-transform: uppercase;
    }

    select,
    input[type="password"],
    input[type="number"],
    input[type="text"],
    input[type="range"] {
      width: 100%;
      margin-top: 5px;
    }

    select,
    input[type="password"],
    input[type="number"],
    input[type="text"] {
      border: 1px solid rgba(0, 255, 213, 0.22);
      border-radius: 8px;
      background: rgba(4, 7, 11, 0.88);
      color: var(--text);
      padding: 6px 8px;
      font-size: 11px;
      outline: none;
    }

    select:hover,
    select:focus,
    input[type="password"]:hover,
    input[type="password"]:focus,
    input[type="number"]:hover,
    input[type="number"]:focus,
    input[type="text"]:hover,
    input[type="text"]:focus {
      border-color: var(--cyan);
    }

    input[type="range"] {
      accent-color: var(--gold);
    }

    #event-count,
    #fire-count,
    #fire-status,
    #hazard-count,
    #hazard-status,
    #humanitarian-count,
    #humanitarian-status,
    #cellular-count,
    #cellular-status,
    #weather-count,
    #weather-status,
    #fire-days-label {
      margin-top: 5px;
      color: var(--cyan2);
      font-size: 11px;
    }

    .tetra-weather-attribution {
      display: none;
      position: absolute;
      right: 14px;
      bottom: 14px;
      z-index: 91;
      border: 1px solid rgba(0, 255, 213, 0.22);
      border-radius: 8px;
      background: rgba(4, 7, 11, 0.76);
      color: rgba(216, 248, 255, 0.72);
      padding: 7px 9px;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      pointer-events: none;
      backdrop-filter: blur(10px);
    }

    #popup {
      display: none;
      position: absolute;
      top: 154px;
      right: 14px;
      z-index: 100;
      width: min(340px, calc(100vw - 28px));
      border: 1px solid rgba(0, 255, 213, 0.24);
      border-radius: 12px;
      background: var(--panel-strong);
      color: var(--text);
      padding: 14px;
      box-shadow: 0 8px 34px rgba(0, 0, 0, 0.62);
      backdrop-filter: blur(14px);
      font-size: 12px;
    }

    .popup-head {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 12px;
      margin-bottom: 9px;
    }

    #pop-cat {
      margin-bottom: 4px;
      font-size: 9px;
      font-weight: 800;
      letter-spacing: 0.15em;
      text-transform: uppercase;
    }

    #pop-title {
      display: block;
      max-width: 275px;
      font-size: 13px;
      line-height: 1.4;
    }

    #pop-close {
      color: rgba(216, 248, 255, 0.62);
      cursor: pointer;
      font-size: 18px;
      line-height: 1;
    }

    #pop-close:hover { color: white; }

    #pop-meta {
      margin-bottom: 8px;
      color: rgba(216, 248, 255, 0.62);
      font-size: 10px;
      line-height: 1.8;
    }

    #pv,
    #pop-img {
      display: none;
      width: 100%;
      margin-bottom: 8px;
      border: 1px solid rgba(255, 255, 255, 0.08);
    }

    #pop-link {
      color: var(--cyan2);
      text-decoration: none;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.1em;
      text-transform: uppercase;
    }

    @media (max-width: 820px) {
      .top-command {
        align-items: flex-start;
        flex-direction: column;
      }

      .navlink {
        align-self: flex-start;
      }

      #tabbar {
        top: 142px;
        left: 14px;
        transform: none;
      }

      #sidepanel,
      #popup {
        top: 206px;
      }
    }

    @media (max-width: 560px) {
      #sidepanel {
        right: 14px;
        width: auto;
      }

      #popup {
        top: auto;
        bottom: 70px;
      }
    }
