* { box-sizing: border-box; }
    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
      margin: 0; padding: 0;
      background: #0d1f2d;
      color: #eee;
    }
    .header {
      background: #0d1f2d;
      padding: 14px 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .header h1 { margin: 0; font-size: 1.3em; color: #f7c948; }
    #status-bar {
      padding: 6px 24px;
      font-size: 12px;
      color: #aaa;
      min-height: 28px;
      background: rgba(255,255,255,0.04);
      border-bottom: 1px solid rgba(255,255,255,0.06);
    }
    #status-bar.error { color: #f87171; }
    #status-bar.ok    { color: #6ee7b7; }
    #map-wrapper { position: relative; }
    #map { height: calc(100vh - 88px); width: 100%; }

    /* Control panel */
    #layer-control {
      position: absolute;
      top: 12px; right: 12px;
      z-index: 6000;
      background: rgba(13,31,45,0.96);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 10px;
      padding: 14px;
      width: 270px;
      box-shadow: 0 4px 20px rgba(0,0,0,0.5);
      font-size: 13px;
      max-height: calc(100vh - 120px);
      overflow-y: auto;
    }
    .section-title {
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: #666;
      margin-bottom: 8px;
    }
    select {
      width: 100%;
      background: rgba(255,255,255,0.07);
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 6px;
      color: #eee;
      font-size: 12px;
      padding: 6px 8px;
      outline: none;
      margin-bottom: 6px;
      appearance: none;
    }
    select:focus { border-color: #f7c948; }
    select option { background: #0d1f2d; }

    .btn {
      width: 100%;
      padding: 7px 12px;
      font-size: 12px;
      font-weight: 700;
      border-radius: 6px;
      border: none;
      cursor: pointer;
      margin-top: 4px;
      display: flex;
      align-items: center;
      gap: 8px;
      justify-content: center;
    }
    .btn:disabled { opacity: 0.5; cursor: not-allowed; }
    .btn-primary   { background: #f7c948; color: #0d1f2d; }
    .btn-primary:hover:not(:disabled) { background: #fad55c; }

    /* Layer toggle buttons */
    .layer-btn {
      width: 100%;
      padding: 8px 12px;
      font-size: 12px;
      font-weight: 600;
      border-radius: 6px;
      border: 1px solid rgba(255,255,255,0.12);
      cursor: pointer;
      margin-top: 6px;
      display: flex;
      align-items: center;
      gap: 8px;
      background: rgba(255,255,255,0.05);
      color: #ccc;
      transition: all 0.15s;
    }
    .layer-btn:hover { background: rgba(255,255,255,0.12); }
    .layer-btn.active { border-color: currentColor; }
    .layer-btn .dot {
      width: 10px; height: 10px;
      border-radius: 50%;
      flex-shrink: 0;
      box-shadow: 0 0 6px currentColor;
    }
    .layer-btn .count {
      margin-left: auto;
      font-size: 10px;
      color: #666;
      font-weight: 400;
    }

    hr.divider { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 12px 0; }

    /* Species checklist */
    .sp-item {
      display: flex;
      align-items: center;
      gap: 7px;
      padding: 5px 6px;
      border-radius: 5px;
      cursor: pointer;
      transition: background 0.1s;
      font-size: 12px;
    }
    .sp-item:hover { background: rgba(255,255,255,0.07); }
    .sp-item input[type="checkbox"] {
      width: 13px; height: 13px;
      accent-color: #f7c948;
      cursor: pointer;
      flex-shrink: 0;
    }
    .sp-dot {
      width: 8px; height: 8px;
      border-radius: 50%;
      flex-shrink: 0;
    }
    .sp-name { flex: 1; }
    .sp-name .sp-common { font-weight: 600; color: #eee; display: block; }
    .sp-name .sp-sci    { font-style: italic; color: #666; font-size: 10px; display: block; }
    .sp-count { font-size: 10px; color: #555; flex-shrink: 0; }
    #obs-count { font-size: 11px; color: #888; margin-top: 6px; }

    /* Popup */
    .leaflet-popup-content-wrapper {
      background: #0d1f2d;
      color: #eee;
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 8px;
    }
    .leaflet-popup-tip { background: #0d1f2d; }
    .leaflet-popup-content { margin: 10px 14px; }
    .popup-photo { width: 100%; border-radius: 6px; margin-bottom: 8px; max-height: 160px; object-fit: cover; }
    .popup-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
    .popup-meta { font-size: 12px; color: #aaa; line-height: 1.7; }
    .popup-meta a { color: #f7c948; text-decoration: none; }


    /* Hover tooltip */
    #hover-tip {
      position: fixed;
      z-index: 9000;
      background: rgba(10,22,35,0.97);
      border: 1px solid rgba(255,255,255,0.18);
      border-radius: 8px;
      padding: 8px 12px;
      pointer-events: none;
      max-width: 260px;
      box-shadow: 0 4px 20px rgba(0,0,0,0.6);
      display: none;
    }
    #hover-tip.visible { display: block; }
    #hover-tip .ht-title {
      font-size: 13px;
      font-weight: 700;
      margin-bottom: 3px;
    }
    #hover-tip .ht-row {
      font-size: 11px;
      color: #aaa;
      line-height: 1.6;
    }
    #hover-tip .ht-hint {
      font-size: 10px;
      color: #555;
      margin-top: 4px;
      border-top: 1px solid rgba(255,255,255,0.06);
      padding-top: 4px;
    }

    /* Diagnostics */
    #diag {
      position: fixed; right: 12px; bottom: 12px;
      max-width: 400px; max-height: 35vh; overflow: auto;
      background: rgba(0,0,0,0.88); color: #ccc;
      font-size: 11px; padding: 8px; border-radius: 8px;
      z-index: 99999; display: none;
    }
    #diag.visible { display: block; }