:root{
  --ink: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.70);
  --muted2: rgba(255,255,255,0.55);
  --shadow: rgba(0,0,0,0.35);
  --accent: #ffcf7a;
  --accent2: #ff7bbf;
  --danger: #ff5b5b;
  --stroke: rgba(255,255,255,0.14);
  --glass: rgba(22,18,16,0.60);
  --glass2: rgba(22,18,16,0.78);

  --font-title: "Bevan", serif;     /* title + headings */
  --font-info: "Bitter", serif;    /* panels + sheet + legend + tooltip */
  --font-input: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; /* inputs */
}

*{ box-sizing:border-box; }
html, body {
  height:100%;
  margin:0;
  font-family: var(--font-info);
  background: #0b0d0c;
  color: var(--ink);
}
a{ color: var(--accent); text-decoration: none; }
a:hover{ text-decoration: underline; }
#app{ position:relative; height:100%; width:100%; overflow:hidden; }

#map{ position:absolute; inset:0; z-index:1; }

.hidden{ display:none !important; }

#flour{
  position:absolute;
  inset:0;
  z-index:2;
  pointer-events:none;
  mix-blend-mode: overlay;
  opacity: 0.28; /* a touch stronger to support seeds */
}

#titleBar{
  position:absolute;
  left: env(safe-area-inset-left, 12px);
  top: env(safe-area-inset-top, 12px);
  z-index: 1400;
  pointer-events: auto;
}

.logoBtn{
  all: unset;
  cursor: pointer;
  display: block;
}

/* Responsive masthead sizing */
#titleLogo{
  display:block;
  width: clamp(220px, 54vw, 560px);
  height: auto;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,0.38));
  user-select: none;
  -webkit-user-drag: none;
}

#hamburger{
  position:absolute;
  right: env(safe-area-inset-right, 10px);
  top: env(safe-area-inset-top, 10px);
  z-index: 1100;
  width: 44px;
  height: 44px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: var(--glass);
  box-shadow: 0 10px 22px var(--shadow);
  cursor:pointer;
}
#hamburger span{
  display:block;
  height:2px;
  width:18px;
  background: rgba(255,255,255,0.85);
  margin: 6px auto;
  border-radius: 2px;
}

.glass{
  background: var(--glass);
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 22px var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.panel{
  position:absolute;
  z-index: 1050;
  width: min(92vw, 360px);
  max-height: calc(100vh - 88px);
  overflow:auto;
  border-radius: 18px;
  padding: 12px;
  font-family: var(--font-info);
}

#sidePanel{
  right: env(safe-area-inset-right, 10px);
  left: auto;
  top: calc(env(safe-area-inset-top, 10px) + 64px);
  display:none;
}

.panel.mobile{
  right: env(safe-area-inset-right, 10px);
  top: calc(env(safe-area-inset-top, 10px) + 64px);
}

.panelHeader{ padding: 4px 6px 10px; border-bottom: 1px solid rgba(255,255,255,0.10); margin-bottom: 10px; }
.panelTitle{ font-family: var(--font-title); font-weight: 400; letter-spacing:0.3px; }
.panelSubtitle{ margin-top:4px; color: var(--muted2); font-size: 12px; }

.panelSection{ padding: 10px 6px; border-bottom: 1px dashed rgba(255,255,255,0.10); }
.panelSection:last-child{ border-bottom:none; }

.row{ display:flex; align-items:center; justify-content:space-between; gap: 10px; }
.label{ display:block; font-family: var(--font-title); font-weight: 400; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.25px; }
.labelRow{ display:flex; align-items:center; justify-content:space-between; gap: 8px; }

.input{
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.28);
  color: var(--ink);
  outline:none;
  font-family: var(--font-input);
}
.input:focus{ border-color: rgba(255,207,122,0.55); box-shadow: 0 0 0 3px rgba(255,207,122,0.12); }

.suggestions{
  margin-top: 8px;
  border-radius: 14px;
  overflow:hidden;
}
.suggestion{
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.10);
  border-top: none;
  background: rgba(0,0,0,0.18);
  cursor:pointer;
  font-size: 13px;
  font-family: var(--font-info);
}
.suggestion:first-child{ border-top: 1px solid rgba(255,255,255,0.10); }
.suggestion:hover{ background: rgba(255,207,122,0.10); }

.btn{
  flex:1;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.22);
  color: var(--ink);
  cursor:pointer;
  font-family: var(--font-info);
}
.btn:hover{ background: rgba(255,255,255,0.08); }
.btn.danger{ border-color: rgba(255,91,91,0.5); }
.btn.danger:hover{ background: rgba(255,91,91,0.12); }

.linkBtn{
  width:100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.12);
  color: var(--muted);
  cursor:pointer;
  text-align:left;
  font-family: var(--font-info);
}
.linkBtn:hover{ color: var(--ink); background: rgba(255,255,255,0.06); }

.chip{
  width: 32px;
  height: 32px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
  color: var(--ink);
  cursor:pointer;
}

.closeX{
  width: 44px;
  height: 44px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.22);
  color: var(--ink);
  font-size: 26px;
  line-height: 0;
  cursor:pointer;
}
.closeX:hover{ background: rgba(255,255,255,0.08); }

.backdrop{
  position:absolute;
  inset:0;
  z-index: 1040;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sheet{
  position:absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  border-radius: 18px 18px 0 0;
  background: var(--glass2);
  border-top: 1px solid rgba(255,255,255,0.16);
  padding: 14px 14px 16px;
  max-height: 55vh;
  overflow:auto;
  box-shadow: 0 -18px 40px rgba(0,0,0,0.45);
  font-family: var(--font-info);
}
.sheetTitle{ font-weight: 800; font-size: 16px; margin-bottom: 8px; }
.sheetLine{ color: var(--muted); font-size: 13px; margin-top: 6px; }

.sheetActions{ display:flex; gap: 10px; margin-top: 12px; }
.sheetActions .btn{ flex:1; }

.modal{
  position:absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 520px);
  max-height: min(80vh, 640px);
  z-index: 1300;
  border-radius: 18px;
  padding: 12px;
  overflow:auto;
  font-family: var(--font-info);
}
.modalHeader{ padding: 4px 6px 10px; border-bottom: 1px solid rgba(255,255,255,0.10); margin-bottom: 10px; }
.modalTitle{ font-family: var(--font-title); font-weight: 400; letter-spacing: 0.3px; }
.modalBody{ padding: 6px; color: var(--muted); font-size: 14px; }

.sourcesList{
  margin: 0;
  padding-left: 20px;
  line-height: 1.55;
}

.sourcesList > li{
  margin: 0 0 14px 0; /* “paragraph” spacing between major sections */
}

.sourcesList ul{
  margin: 10px 0 0 0;
  padding-left: 18px;
}

.sourcesList ul li{
  margin: 0 0 10px 0; /* extra breathing room between bullets */
}

.fineprint{ margin-top: 12px; color: rgba(255,255,255,0.55); font-size: 12px; }

.donutWrap{ display:flex; align-items:center; justify-content:center; }
.donutLegend{ margin-top: 8px; display:flex; flex-direction:column; gap: 6px; }
.legendItem{ display:flex; align-items:center; justify-content:space-between; gap: 10px; font-size: 12px; color: var(--muted); }

.legendSwatch{ width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.25); margin-right: 8px; display:inline-block; vertical-align:middle; }
.legendLeft{ display:flex; align-items:center; gap: 8px; min-width: 0; }
.legendName{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width: 190px; }

.toast{
  position:absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 2000;
  background: rgba(0,0,0,0.62);
  border: 1px solid rgba(255,255,255,0.14);
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--ink);
  font-family: var(--font-info);
}

.leaflet-control-attribution{ font-size: 11px !important; background: rgba(0,0,0,0.35) !important; color: rgba(255,255,255,0.75) !important; border-radius: 10px !important; }
.leaflet-control-attribution a{ color: rgba(255,207,122,0.9) !important; }

/* Desktop: persistent side panel */
@media (min-width: 900px){
  #sidePanel{ display:block; }
  #hamburger{ display:none; }
  #mobilePanel{ display:none !important; }
  #mobileModalBackdrop{ display:none !important; }
}
