/* ============================================================================
 * 1. Configuration & Design Tokens
 * ============================================================================ */
:root {
  /* Frame & Header Layout Knobs (easy to adjust) */
  --page-bg: #ffffff;
  --frame-border: 48px;         /* Thumb-width white border around map pane */
  --frame-top: 14px;            /* White breathing room above site header */
  --frame-bottom: 14px;         /* White breathing room below site footer */
  --frame-gap: 10px;            /* Space between header bar and map pane */
  --map-pane-radius: 24px;      /* Rounded corner radius of the map pane */
  --map-pane-border: 1px solid rgba(15, 23, 42, 0.1);
  --map-pane-shadow: 0 12px 32px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);

  --brand-buoy-height: 124px;   /* Left buoy icon height */
  --brand-banner-height: 148px; /* Right wordmark banner height */
  --brand-banner-width: 390px;  /* Stretched wordmark banner width */
  --brand-gap: 14px;            /* Extra horizontal gap between buoy and banner */
  --brand-offset-x: 125px;      /* Horizontal right offset for header brand group */
  --ad-slot-max-width: 728px;   /* Standard Google AdSense leaderboard width */
  --ad-slot-min-height: 50px;   /* Reserves clean vertical alignment for ad bar */

  /* Map Overlay Dimensions (keep in sync with SimpleMapAdapter._renderScaleBar) */
  --panel-width: 340px;
  --panel-inset: 16px;

  /* Colors & Surfaces (aligned with packages/shared/src/tokens.js) */
  --map-bg: #eef2f6;
  --surface-solid: #ffffff;
  --surface-subtle: rgba(248, 250, 252, 0.92);
  --surface-muted: #f1f5f9;
  --surface-segment: rgba(226, 232, 240, 0.65);
  --bg-glass: rgba(255, 255, 255, 0.92);
  --border-glass: rgba(148, 163, 184, 0.34);
  --border-control: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent-blue: #2563eb;
  --accent-blue-dark: #1d4ed8;
  --accent-cyan: #06b6d4;
  --accent-cyan-dark: #0891b2;
  --accent-rose: #e11d48;
  --accent-rose-dark: #be123c;
  --accent-green: #16a34a;

  /* Radii, Shadows & Motion */
  --radius-lg: 16px;
  --radius-md: 11px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --shadow-lg: 0 14px 36px rgba(15, 23, 42, 0.14), 0 3px 10px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.12);
  --ease-fast: 0.14s ease;
  --ease-panel: 0.22s ease;
}

/* ============================================================================
 * 2. Base & Page Shell Layout
 * ============================================================================ */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

#app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: var(--frame-top) var(--frame-border) var(--frame-bottom);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--frame-gap);
  background: var(--page-bg);
  overflow: hidden;
}

.site-header {
  width: 100%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-brand {
  margin: 0 0 0 var(--brand-offset-x);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--brand-gap);
  line-height: 0;
}

.brand-buoy,
.brand-banner {
  display: block;
  max-width: 100%;
  mix-blend-mode: multiply;
  user-select: none;
}

.brand-buoy {
  height: var(--brand-buoy-height);
  width: auto;
  object-fit: contain;
  margin-block: calc(-0.08 * var(--brand-buoy-height));
}

.brand-banner {
  height: var(--brand-banner-height);
  width: var(--brand-banner-width);
  object-fit: fill;
  margin-block: calc(-0.16 * var(--brand-banner-height));
  margin-left: calc(-0.075 * var(--brand-banner-width));
}

.header-ad-slot {
  flex: 1 1 auto;
  min-width: 0;
  max-width: var(--ad-slot-max-width);
  min-height: var(--ad-slot-min-height);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.map-pane {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border-radius: var(--map-pane-radius);
  overflow: hidden;
  border: var(--map-pane-border);
  box-shadow: var(--map-pane-shadow);
  background: var(--map-bg);
  isolation: isolate;
}

#map-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.site-footer {
  width: 100%;
  flex: 0 0 auto;
  padding-top: 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-muted);
}

.footer-support-btn {
  border: none;
  background: transparent;
  padding: 0;
  font-size: inherit;
  font-weight: 600;
  color: var(--accent-blue);
  cursor: pointer;
}

.footer-support-btn:hover {
  text-decoration: underline;
}

/* ============================================================================
 * 3. Shared Primitives (Surfaces, Buttons, Switches, Badges)
 * ============================================================================ */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.primary-btn,
.secondary-btn,
.danger-outline-btn {
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--ease-fast);
}

.primary-btn {
  border: none;
  background: var(--accent-blue);
  color: var(--surface-solid);
}

.primary-btn:hover {
  background: var(--accent-blue-dark);
}

.primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary-btn:disabled:hover {
  background: var(--accent-blue);
}

.secondary-btn {
  border: 1px solid var(--border-control);
  background: var(--surface-solid);
  color: var(--text-primary);
}

.secondary-btn:hover {
  background: var(--surface-muted);
}

.danger-outline-btn {
  border: 1px solid #fecdd3;
  background: #fff1f2;
  color: var(--accent-rose-dark);
}

.danger-outline-btn:hover {
  background: #ffe4e6;
}

.icon-close-btn {
  border: none;
  background: rgba(226, 232, 240, 0.7);
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-close-btn:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--accent-blue);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
}

.link-btn:hover {
  text-decoration: underline;
}

/* Segmented Switches */
.provider-switch,
.tab-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-segment);
  padding: 3px;
  gap: 3px;
  border-radius: 10px;
}

.tab-bar {
  border-radius: var(--radius-sm);
}

.provider-btn,
.tab-btn {
  border: none;
  background: transparent;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--ease-fast), color var(--ease-fast), box-shadow var(--ease-fast);
}

.tab-btn {
  border-radius: 7px;
}

.provider-btn.active,
.tab-btn.active {
  background: var(--surface-solid);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.provider-btn.active {
  color: var(--accent-blue);
}

.tab-btn.active {
  color: var(--text-primary);
}

/* Badges & Pills */
.ttl-pill,
.sev-badge,
.size-badge,
.radius-active-pill,
.selftest-badge,
.selftest-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.ttl-pill {
  font-variant-numeric: tabular-nums;
  background: #e0f2fe;
  color: #0369a1;
}

.ttl-pill.expiring {
  background: #fef3c7;
  color: #b45309;
}

.ttl-pill.critical {
  background: #ffe4e6;
  color: var(--accent-rose-dark);
}

.sev-badge {
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.sev-badge.minor {
  background: #cffafe;
  color: #0e7490;
}

.sev-badge.moderate {
  background: #dbeafe;
  color: var(--accent-blue-dark);
}

.sev-badge.severe {
  background: #ffe4e6;
  color: var(--accent-rose-dark);
}

.size-badge {
  background: var(--surface-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border-control);
}

.radius-active-pill {
  background: #eff6ff;
  color: var(--accent-blue);
  border: 1px solid #bfdbfe;
  padding: 2px 9px;
  font-size: 11px;
}

.selftest-badge,
.selftest-pill {
  padding: 2px 8px;
  font-size: 10.5px;
}

.selftest-badge.pass,
.selftest-pill.pass {
  background: #dcfce7;
  color: #166534;
}

.selftest-badge.fail,
.selftest-pill.fail {
  background: #ffe4e6;
  color: var(--accent-rose-dark);
}

/* ============================================================================
 * 4. Map-Scoped Floating Controls
 * ============================================================================ */
.floating-pill-btn {
  position: absolute;
  top: 22px;
  left: calc(var(--panel-inset) + var(--panel-width) + 8px);
  z-index: 30;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: left var(--ease-panel), transform var(--ease-panel), background 0.15s ease;
}

.floating-pill-btn:hover {
  background: var(--surface-solid);
}

body.panel-collapsed .floating-pill-btn {
  left: var(--panel-inset);
}

body.panel-collapsed .floating-pill-btn svg {
  transform: rotate(180deg);
}

#control-panel {
  position: absolute;
  top: var(--panel-inset);
  left: var(--panel-inset);
  bottom: var(--panel-inset);
  width: var(--panel-width);
  z-index: 25;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 11px;
  overflow: hidden;
  transition: transform var(--ease-panel), opacity 0.2s ease;
}

body.panel-collapsed #control-panel {
  transform: translateX(calc(-1 * (var(--panel-width) + var(--panel-inset) + 24px)));
  opacity: 0;
  pointer-events: none;
}

body.panel-hidden #control-panel,
body.panel-hidden #panel-toggle-btn {
  display: none !important;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0ea5e9, var(--accent-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.panel-heading {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.control-card {
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid rgba(203, 213, 225, 0.7);
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.control-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.explain-note {
  margin: 1px 0 0;
  font-size: 11px;
  line-height: 1.38;
  color: var(--text-secondary);
}

.checkbox-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 4px;
  border-top: 1px dashed rgba(148, 163, 184, 0.45);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.check-row input[type="checkbox"] {
  accent-color: var(--accent-blue);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.stat-tile {
  background: var(--surface-subtle);
  border: 1px solid rgba(203, 213, 225, 0.7);
  border-radius: 10px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-value {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.list-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.list-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.list-item {
  background: var(--surface-solid);
  border: 1px solid rgba(203, 213, 225, 0.75);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-item:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.list-item.selected {
  border-color: var(--accent-blue);
  background: #eff6ff;
}

.item-top,
.item-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.item-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.item-badges {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.empty-state {
  padding: 18px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(248, 250, 252, 0.7);
  border-radius: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
}

.panel-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.support-btn {
  grid-column: 1 / -1;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: var(--accent-blue-dark);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--ease-fast), border-color var(--ease-fast);
}

.support-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

/* Toast Banner */
.toast-banner {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: rgba(15, 23, 42, 0.92);
  color: var(--surface-solid);
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  max-width: min(520px, calc(100% - 32px));
}

.toast-undo {
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #93c5fd;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.toast-undo:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Pin Detail Card */
.pin-card {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 280px;
  z-index: 32;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.pin-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pin-card-header h2 {
  margin: 5px 0 0;
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.25;
}

.pin-card-meta {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.pin-sev-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.sev-chip {
  border: 1px solid var(--border-control);
  background: var(--surface-solid);
  border-radius: 8px;
  padding: 5px 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.sev-chip.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: var(--surface-solid);
}

.pin-card-actions {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 7px;
}

/* Bottom-Center Map Hint Pill */
.report-bar {
  position: absolute;
  bottom: 18px;
  left: calc(50% + 160px);
  transform: translateX(-50%);
  z-index: 24;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  max-width: calc(100% - 32px);
  transition: left var(--ease-panel);
}

body.panel-collapsed .report-bar,
body.panel-hidden .report-bar {
  left: 50%;
}

.hint-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
  flex-shrink: 0;
}

.bar-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

/* Bottom-Right Zoom & Coordinates */
.map-controls {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.cursor-pill {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
}

.zoom-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.circle-ctrl-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.circle-ctrl-btn:hover {
  background: var(--surface-solid);
}

.circle-ctrl-btn.has-location {
  color: var(--accent-blue);
}

.circle-ctrl-btn.locating {
  color: var(--accent-blue);
  animation: fs-locate-pulse 1.1s ease-in-out infinite;
}

@keyframes fs-locate-pulse {
  0%,
  100% {
    box-shadow: var(--shadow-md), 0 0 0 0 rgba(37, 99, 235, 0.35);
  }
  50% {
    box-shadow: var(--shadow-md), 0 0 0 6px rgba(37, 99, 235, 0);
  }
}

/* Self-Test Card (?selftest=1) */
.selftest-card {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 340px;
  max-height: 75%;
  overflow-y: auto;
  z-index: 45;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.selftest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.selftest-header > div {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}

.selftest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.selftest-item {
  background: var(--surface-subtle);
  border: 1px solid rgba(203, 213, 225, 0.7);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

.selftest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.selftest-name {
  font-size: 11.5px;
  color: var(--text-primary);
  line-height: 1.3;
}

.selftest-err {
  margin-top: 4px;
  font-size: 11px;
  color: var(--accent-rose-dark);
}

/* ============================================================================
 * 5. Modals & Apple Maps Markers
 * ============================================================================ */
.apple-map-canvas {
  cursor: crosshair;
}

.amk-pin-marker {
  width: 36px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--ease-fast);
}

.amk-pin-marker:hover,
.amk-pin-marker.selected {
  transform: scale(1.08);
}

.amk-cluster-marker {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--accent-blue);
  background: var(--bg-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.22);
  cursor: pointer;
}

.amk-cluster-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--surface-solid);
  font-size: 13px;
  font-weight: 800;
}

.amk-pending-marker {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.95);
  border: 2.5px solid var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
  pointer-events: none;
}

.amk-pending-dot {
  width: 11px;
  height: 11px;
  border-radius: var(--radius-pill);
}

.amk-user-location {
  position: relative;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.amk-user-location-ring {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: rgba(37, 99, 235, 0.16);
  border: 1px solid rgba(37, 99, 235, 0.32);
}

.amk-user-location-dot {
  position: relative;
  width: 13px;
  height: 13px;
  border-radius: var(--radius-pill);
  background: var(--accent-blue);
  border: 2.5px solid var(--surface-solid);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.3);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop-light {
  background: rgba(15, 23, 42, 0.26);
  backdrop-filter: blur(2px);
}

.modal-card {
  width: min(440px, 100%);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.road-modal-card {
  width: min(420px, 100%);
  outline: none;
}

.notice-modal-card {
  width: min(400px, 100%);
  outline: none;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.modal-eyebrow {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.modal-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.text-input {
  width: 100%;
  border: 1px solid var(--border-control);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 13px;
  outline: none;
}

.text-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.error-text {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-rose-dark);
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  padding: 7px 10px;
}

.notice-detail-pill {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.road-modal-location {
  background: var(--surface-subtle);
  border: 1px solid rgba(203, 213, 225, 0.75);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.road-modal-street {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.road-modal-coords {
  font-size: 11.5px;
  color: var(--text-muted);
}

.road-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-card {
  border: 1.5px solid var(--border-control);
  background: var(--surface-solid);
  border-radius: 14px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  cursor: pointer;
  transition: transform var(--ease-fast), border-color var(--ease-fast), background var(--ease-fast), box-shadow var(--ease-fast);
}

.choice-card:hover {
  transform: translateY(-1px);
}

.choice-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.choice-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-primary);
}

.choice-sub {
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-muted);
}

.choice-flooded .choice-icon {
  background: #eff6ff;
  color: var(--accent-blue);
}

.choice-flooded:hover,
.choice-flooded.active {
  border-color: var(--accent-blue);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.choice-clear .choice-icon {
  background: #ecfdf5;
  color: #059669;
}

.choice-clear:hover {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

.severity-step {
  border-top: 1px dashed rgba(148, 163, 184, 0.5);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-size-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.severity-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.sev-option {
  border: 1px solid var(--border-control);
  background: var(--surface-solid);
  border-radius: var(--radius-md);
  padding: 9px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: border-color var(--ease-fast), background var(--ease-fast), transform var(--ease-fast), box-shadow var(--ease-fast);
}

.sev-option:hover {
  transform: translateY(-1px);
}

.sev-option .swatch {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
}

.sev-option.minor .swatch {
  background: var(--accent-cyan);
}

.sev-option.minor:hover,
.sev-option.minor.active {
  border-color: var(--accent-cyan-dark);
  background: #ecfeff;
}

.sev-option.minor.active {
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.18);
}

.sev-option.moderate .swatch {
  background: var(--accent-blue);
}

.sev-option.moderate:hover,
.sev-option.moderate.active {
  border-color: var(--accent-blue-dark);
  background: #eff6ff;
}

.sev-option.moderate.active {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.sev-option.severe .swatch {
  background: var(--accent-rose);
}

.sev-option.severe:hover,
.sev-option.severe.active {
  border-color: var(--accent-rose-dark);
  background: #fff1f2;
}

.sev-option.severe.active {
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.18);
}

.sev-option-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.sev-option-desc {
  font-size: 10.5px;
  color: var(--text-muted);
}

.radius-tier-slider {
  width: 100%;
  margin: 2px 0 0;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.radius-tier-labels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  margin-top: -1px;
}

.tier-stop-btn {
  border: none;
  background: transparent;
  padding: 2px 4px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--ease-fast), background var(--ease-fast);
}

.tier-stop-btn:first-child {
  text-align: left;
  justify-self: start;
}

.tier-stop-btn:nth-child(2) {
  text-align: center;
  justify-self: center;
}

.tier-stop-btn:last-child {
  text-align: right;
  justify-self: end;
}

.tier-stop-btn:hover {
  color: var(--text-primary);
  background: rgba(226, 232, 240, 0.55);
}

.tier-stop-btn.active {
  color: var(--accent-blue);
  font-weight: 800;
}

.road-modal-existing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
  background: rgba(241, 245, 249, 0.85);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}

/* ============================================================================
 * 6. Responsive Breakpoint
 * ============================================================================ */
@media (max-width: 760px) {
  :root {
    --frame-border: 14px;
    --frame-top: 12px;
    --frame-bottom: 10px;
    --frame-gap: 10px;
    --map-pane-radius: 18px;
    --brand-buoy-height: 72px;
    --brand-banner-height: 86px;
    --brand-banner-width: 225px;
    --brand-gap: 8px;
    --brand-offset-x: 0px;
    --ad-slot-min-height: 0;
  }

  .site-footer {
    padding-top: 0;
    font-size: 11px;
  }

  #control-panel {
    width: calc(100% - 2 * var(--panel-inset));
    max-height: 55vh;
    bottom: auto;
  }

  .floating-pill-btn {
    left: auto;
    right: var(--panel-inset);
    top: var(--panel-inset);
  }

  body.panel-collapsed .floating-pill-btn {
    left: var(--panel-inset);
    right: auto;
  }

  .report-bar {
    left: 50%;
    max-width: calc(100% - 24px);
    overflow-x: auto;
  }

  .cursor-pill {
    display: none;
  }
}
