/* Eclipse Spot Finder — dark, twilight-toned UI.
   The subject is a sunset eclipse; a bright white chrome fights both the
   mood and the map. Palette is a deep indigo night with a warm corona
   accent, tuned so the blue→red terrain ramp stays legible on top.

   Dark is the default and stays the default: it is the mood of the thing.
   The light theme below exists for daylight and for people who simply
   cannot read pale-on-dark, and it is a *dusk* light — warm paper rather
   than clinical white — so the same map ramp still reads on top of it.
   Every colour is a variable; nothing outside :root hardcodes a hex that
   differs between themes, so the toggle is a one-attribute change. */
:root {
  --bg: #0b0e18;
  --panel: #151a2b;
  --panel-2: #1c2338;
  --panel-3: #232b44;
  --line: #2c3550;
  --line-soft: #212942;
  --ink: #eef1f9;
  --muted: #98a3bd;
  --dim: #6d7893;
  --accent: #6ea8fe;
  --accent-2: #3d7bd9;
  --corona: #ffc46b;
  --danger: #ff8a8a;
  --ok: #7fd6a5;
  /* theme-dependent odds and ends that are not part of the ramp */
  --void: #0b0e18;            /* the moon: always the darkest thing on screen */
  --on-accent: #fff;          /* text on an accent-filled button */
  --cta-ink: #08111f;         /* text on the bright gradient CTA */
  --chip-ink: #07101f;        /* text on a class-coloured chip */
  --scrollbar: #2b3450;
  --swatch-ring: rgba(255, 255, 255, 0.16);
  --map-halo: #000;           /* outline behind labels drawn over the map */
  --band-ink: #ffd9a8;
  --contour-ink: #cfd8f0;
  --attrib-bg: rgba(11, 14, 24, 0.82);
  --scrim: radial-gradient(120% 90% at 50% 0%,
    rgba(24, 20, 48, 0.72), rgba(5, 7, 14, 0.9));
  --scrim-flat: rgba(5, 7, 14, 0.74);
  --welcome-wash: linear-gradient(180deg, #1a2035, #12162400 60%);
  --warn-ink: #ffd4d4;
  --warn-bg: rgba(178, 24, 43, 0.28);
  --warn-line: rgba(255, 138, 138, 0.4);
  --warn-soft-ink: #ffe6bd;
  --warn-soft-bg: rgba(255, 196, 107, 0.14);
  --warn-soft-line: rgba(255, 196, 107, 0.35);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="light"] {
  --bg: #eceef5;
  --panel: #ffffff;
  --panel-2: #f4f6fb;
  --panel-3: #e8ecf6;
  --line: #ccd3e4;
  --line-soft: #dfe4f0;
  --ink: #141a2b;
  --muted: #4d5773;
  --dim: #6b7591;
  --accent: #2f6fd0;
  --accent-2: #2258ad;
  --corona: #b45309;          /* the warm accent has to survive white */
  --danger: #b91c1c;
  --ok: #15803d;
  --on-accent: #fff;
  --cta-ink: #fff;
  --chip-ink: #07101f;
  --scrollbar: #c2cadd;
  --swatch-ring: rgba(0, 0, 0, 0.22);
  --map-halo: #fff;
  --band-ink: #8a4b12;
  --contour-ink: #33406a;
  --attrib-bg: rgba(255, 255, 255, 0.86);
  --scrim: radial-gradient(120% 90% at 50% 0%,
    rgba(70, 78, 110, 0.42), rgba(20, 26, 43, 0.62));
  --scrim-flat: rgba(20, 26, 43, 0.5);
  --welcome-wash: linear-gradient(180deg, #fdf3e6, #ffffff00 60%);
  --warn-ink: #7f1d1d;
  --warn-bg: rgba(185, 28, 28, 0.1);
  --warn-line: rgba(185, 28, 28, 0.35);
  --warn-soft-ink: #7c4a03;
  --warn-soft-bg: rgba(180, 83, 9, 0.1);
  --warn-soft-line: rgba(180, 83, 9, 0.32);
  --shadow: 0 10px 30px rgba(31, 41, 69, 0.18);
  --shadow-sm: 0 4px 14px rgba(31, 41, 69, 0.13);
  color-scheme: light;
}
/* The land tint exists because dark basemaps put land and sea at the same
   value. A light basemap already separates them, and screening white over
   white just erases the coast — so it comes off with the lights on. */
:root[data-theme="light"] .land-overlay { display: none; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { color: var(--ink); background: var(--bg); overflow: hidden; }

#map { position: fixed; inset: 0; z-index: 0; background: var(--bg); }
.class-overlay { image-rendering: auto; }
/* the umbra layer is shadow, so it must not brighten the basemap */
.umbra-overlay { image-rendering: pixelated; mix-blend-mode: multiply; }
/* land tint sits under everything: dark basemaps make land and sea nearly
   the same value, and which side of the coast you are on is not optional */
.land-overlay { image-rendering: pixelated; mix-blend-mode: screen; }
/* place labels ride in shadowPane so they stay above every data overlay */
.leaflet-shadow-pane { pointer-events: none; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; border-radius: var(--radius-sm); }
button:focus-visible, input:focus-visible, select:focus-visible,
[tabindex]:focus-visible, li[role="option"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

.panel {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ---------- top bar ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1002;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; padding-top: max(9px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
#topbar h1 {
  font-size: 0.98rem; margin: 0; flex: 1; min-width: 0; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
#topbar h1 #s-title { color: var(--ink); }
#topbar h1 #s-sub { font-weight: 400; color: var(--dim); font-size: 0.84em; }
.eclipse-dot {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  background: var(--void); box-shadow: 0 0 0 1.5px var(--corona),
    0 0 10px 1px rgba(255, 196, 107, 0.75);
  margin-right: 7px; vertical-align: baseline;
}
#howworks-toggle, #theme-toggle {
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 7px 13px; white-space: nowrap; font-weight: 600;
  font-size: 0.85rem; color: var(--ink);
}
#howworks-toggle:hover, #theme-toggle:hover { background: var(--panel-3); }
/* One glyph, two states: a filled disc for "go dark", a rayed sun for
   "go light". Drawn in text so it inherits colour and needs no asset. */
#theme-toggle {
  width: 34px; padding: 0; height: 32px; display: grid; place-items: center;
  font-size: 0.95rem; line-height: 1;
}
#lang-switch { display: flex; gap: 3px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
#lang-switch button {
  background: none; padding: 5px 9px; font-size: 0.75rem;
  font-weight: 700; color: var(--dim); border-radius: 6px;
}
#lang-switch button:hover { color: var(--ink); }
#lang-switch button[aria-pressed="true"] {
  background: var(--accent-2); color: var(--on-accent);
}

/* ---------- welcome ---------- */
#welcome-backdrop {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--scrim);
  backdrop-filter: blur(4px);
}
#welcome {
  position: fixed; z-index: 2001;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(600px, calc(100vw - 24px));
  max-height: min(88vh, 800px); overflow-y: auto;
  background: var(--welcome-wash), var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow);
  padding: 30px 28px 24px; text-align: center;
}
#welcome.hidden, #welcome-backdrop.hidden { display: none; }
/* The corona breathes. A total eclipse is not a static icon — the corona
   visibly shifts — and a 6 s pulse says "this is alive, and it is coming"
   without asking for attention. Killed outright by reduced-motion. */
.corona {
  width: 74px; height: 74px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--void);
  box-shadow: 0 0 0 2px rgba(255, 196, 107, 0.95),
    0 0 26px 6px rgba(255, 196, 107, 0.45),
    0 0 60px 18px rgba(255, 150, 80, 0.18);
  animation: corona-breathe 6s ease-in-out infinite;
}
@keyframes corona-breathe {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(255, 196, 107, 0.95),
      0 0 26px 6px rgba(255, 196, 107, 0.45),
      0 0 60px 18px rgba(255, 150, 80, 0.18);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(255, 210, 140, 1),
      0 0 34px 9px rgba(255, 196, 107, 0.6),
      0 0 82px 26px rgba(255, 150, 80, 0.26);
  }
}
#s-welcome-title {
  margin: 0; font-size: 0.9rem; font-weight: 600; color: var(--muted);
  letter-spacing: 0.06em; text-transform: uppercase;
}
#countdown { display: flex; justify-content: center; gap: 8px; margin: 14px 0 18px; }
.cd-unit {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 0.62rem; color: var(--dim); text-transform: uppercase;
  letter-spacing: 0.12em; min-width: 66px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 6px 7px;
}
.cd-unit b {
  font-size: 2rem; font-weight: 700; line-height: 1; color: var(--corona);
  font-variant-numeric: tabular-nums;
}
/* On the day itself the four boxes are replaced by a single line, so it
   needs to carry the weight they were carrying. */
.cd-msg {
  font-size: 1.15rem; font-weight: 700; color: var(--corona);
  line-height: 1.35; padding: 6px 4px;
}
#s-welcome-lead {
  margin: 0 0 16px; font-size: 0.94rem; line-height: 1.55;
  color: var(--muted); text-align: left;
}
#welcome-steps {
  margin: 0 0 20px; padding: 0; list-style: none;
  display: grid; gap: 8px; text-align: left; counter-reset: step;
}
#welcome-steps li {
  display: grid; grid-template-columns: 28px 1fr; gap: 1px 12px;
  align-items: baseline; padding: 11px 13px;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 11px; counter-increment: step;
}
#welcome-steps li::before {
  content: counter(step); grid-row: span 2;
  display: grid; place-items: center; width: 26px; height: 26px;
  background: var(--accent-2); color: var(--on-accent); border-radius: 50%;
  font-size: 0.78rem; font-weight: 700;
}
#welcome-steps b { font-size: 0.92rem; }
#welcome-steps span { font-size: 0.83rem; color: var(--muted); }
#welcome-cta {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: var(--cta-ink); font-weight: 700; padding: 14px 30px;
  font-size: 1rem; width: 100%; border-radius: 11px;
}
#welcome-cta:hover { filter: brightness(1.08); }

/* ---------- how it works ---------- */
#howworks {
  position: fixed; z-index: 1001; top: 58px; left: 12px; right: 12px;
  max-width: 580px; margin: 0 auto;
  max-height: calc(100vh - 150px); overflow-y: auto;
  padding: 6px 20px 16px; font-size: 0.89rem; line-height: 1.6;
  color: var(--muted);
}
#howworks.hidden { display: none; }
#howworks h2 { font-size: 1.05rem; margin: 14px 0 6px; color: var(--ink); }
#howworks-close {
  background: var(--accent-2); color: var(--on-accent); padding: 9px 18px;
  font-weight: 600;
}

/* ---------- controls ---------- */
#controls {
  position: fixed; z-index: 1000; top: 60px; left: 12px;
  display: flex; flex-direction: column; gap: 10px;
  padding: 13px; width: 270px;
}
#s-where { font-size: 0.72rem; font-weight: 700; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.07em; }
#search-wrap { position: relative; }
#search {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel-2); color: var(--ink);
}
#search::placeholder { color: var(--dim); }
#search:focus { border-color: var(--accent-2); }
#suggest {
  position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0;
  margin: 0; padding: 5px; list-style: none; background: var(--panel-3);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); max-height: 230px; overflow-y: auto;
}
#suggest li {
  padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 0.87rem;
  display: flex; justify-content: space-between; gap: 8px;
}
#suggest li:hover, #suggest li:focus {
  background: var(--accent-2); color: var(--on-accent);
}
#suggest .sug-cc { color: var(--dim); font-size: 0.76rem; }
#suggest li:hover .sug-cc { color: #dbe6ff; }
#locate-btn {
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink); padding: 10px 12px; font-weight: 600; font-size: 0.87rem;
}
#locate-btn:hover { background: var(--panel-3); border-color: var(--accent-2); }
#radius-label, #sort-label, #access-label {
  font-size: 0.72rem; color: var(--dim); display: flex; flex-direction: column;
  gap: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
}
#radius-out {
  font-weight: 700; color: var(--corona); font-size: 0.95rem;
  text-transform: none; letter-spacing: 0;
}
#radius { width: 100%; accent-color: var(--accent); }
#sort, #access {
  padding: 9px 10px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel-2);
  color: var(--ink); font-weight: 500; text-transform: none;
  letter-spacing: 0; font-size: 0.87rem;
}
.check {
  display: flex; align-items: center; gap: 8px; font-size: 0.8rem;
  color: var(--muted); cursor: pointer; font-weight: 500;
}
.check:hover { color: var(--ink); }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.ctrl-sep { height: 1px; background: var(--line-soft); margin: 1px 0; }

/* ---------- legend ---------- */
#legend {
  position: fixed; z-index: 1000; right: 12px; top: 60px;
  padding: 11px 13px; font-size: 0.71rem; line-height: 1.4; max-width: 258px;
}
#legend { overflow-y: auto; }
#legend-toggle {
  background: none; width: 100%; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; padding: 0 0 6px;
}
.legend-title {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--dim);
}
.legend-caret { color: var(--dim); font-size: 0.7rem; transition: transform 0.2s; }
#legend.collapsed .legend-caret { transform: rotate(180deg); }
#legend.collapsed #legend-body { display: none; }
#legend.collapsed { padding-bottom: 6px; }
.legend-note { margin: 0 0 8px; color: var(--muted); }
.legend-note.band { margin: 8px 0 0; padding-top: 8px;
  border-top: 1px solid var(--line-soft); }
.legend-row { display: flex; gap: 8px; align-items: flex-start; margin: 5px 0; }
.legend-swatch {
  width: 13px; height: 13px; border-radius: 3px; flex: none; margin-top: 2px;
  box-shadow: 0 0 0 1px var(--swatch-ring);
}
.legend-name { font-weight: 700; color: var(--ink); }
.legend-desc { color: var(--muted); }

/* ---------- sheet / results ---------- */
#sheet {
  position: fixed; z-index: 1003; left: 0; right: 0; bottom: 0;
  border-radius: 18px 18px 0 0; max-height: 64vh;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-bottom: none;
  box-shadow: var(--shadow);
}
#sheet.collapsed #sheet-body { display: none; }
#sheet-handle {
  background: none; width: 100%; display: flex;
  justify-content: space-between; align-items: center;
  padding: 14px 16px; font-weight: 700; font-size: 0.93rem;
}
#sheet.collapsed #sheet-chevron { transform: rotate(0deg); }
#sheet-chevron { transform: rotate(180deg); transition: transform 0.2s;
  color: var(--dim); }
#sheet-body { overflow-y: auto; padding: 0 11px 14px; }
.sheet-h {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--dim); margin: 14px 6px 7px; font-weight: 700;
}
.muted { color: var(--muted); font-size: 0.86rem; margin: 4px 6px 10px; }

.ys-card {
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2));
  border: 1px solid var(--line); border-left: 4px solid;
  border-radius: 12px; padding: 13px 15px; margin: 0 0 4px;
}
.ys-head {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--dim); font-weight: 700;
}
.ys-place { font-size: 0.86rem; color: var(--muted); margin-top: 3px; }
.ys-verdict { font-weight: 700; margin: 5px 0 7px; font-size: 1.02rem;
  line-height: 1.3; }
.ys-stats { font-size: 0.83rem; color: var(--muted); margin-bottom: 9px; }
.ys-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.btn-sm {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  font-size: 0.78rem; font-weight: 600; padding: 6px 11px; border-radius: 8px;
}
.btn-sm:hover { background: var(--panel-3); border-color: var(--accent-2); }
.btn-sm.primary { background: var(--accent-2); border-color: var(--accent-2);
  color: var(--on-accent); }

#ranking { margin: 0; padding: 0; list-style: none; }
.rank-row {
  width: 100%; text-align: left; display: grid;
  grid-template-columns: 1.6em 1fr auto; gap: 3px 10px; align-items: center;
  padding: 10px 12px; margin: 4px 0; background: var(--panel-2);
  border: 1px solid var(--line-soft); border-radius: 11px;
  transition: background 0.15s, border-color 0.15s;
}
.rank-row:hover { background: var(--panel-3); border-color: var(--accent-2); }
.rank-num { font-weight: 700; color: var(--dim); grid-row: span 2;
  font-variant-numeric: tabular-nums; }
.rank-main { font-weight: 650; font-size: 0.92rem; }
.rank-sub { font-size: 0.76rem; color: var(--muted); grid-column: 2; }
.chip {
  font-size: 0.68rem; font-weight: 700; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; grid-row: span 2;
  color: var(--chip-ink);
}
.acc { font-weight: 700; }
.acc-private, .acc-restricted { color: var(--danger); }
.acc-unknown { color: var(--corona); }
#ranking .empty { padding: 14px; color: var(--muted); font-size: 0.86rem; }

/* ---------- skyline ---------- */
#skyline-wrap { margin: 6px 0 2px; }
.sky-card {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px 9px;
}
.sky-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 7px; gap: 8px;
}
.sky-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--dim); }
.sky-quality { font-size: 0.8rem; font-weight: 700; }
#skyline-svg { width: 100%; height: auto; display: block; border-radius: 8px; }
.sky-legend {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 7px;
  font-size: 0.7rem; color: var(--muted);
}
.sky-legend i { width: 10px; height: 10px; border-radius: 2px;
  display: inline-block; margin-right: 5px; vertical-align: -1px; }
.sky-note { font-size: 0.7rem; color: var(--dim); margin: 6px 0 0;
  line-height: 1.45; }

/* ---------- popup ---------- */
.leaflet-popup-content-wrapper {
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow);
}
.leaflet-popup-tip { background: var(--panel); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--dim); }
.pp-name { font-weight: 700; font-size: 1rem; margin-bottom: 1px; }
.pp-where { font-size: 0.76rem; color: var(--dim); margin-bottom: 6px; }
.popup-verdict { font-weight: 700; margin-bottom: 6px; }
.popup-stats { margin: 0 0 6px; font-size: 0.85rem; color: var(--muted); }
.popup-stats b { color: var(--ink); }
.pp-times { font-size: 0.78rem; color: var(--muted); margin: 0 0 7px;
  border-left: 2px solid var(--line); padding-left: 8px; }
.pp-times b { color: var(--ink); font-weight: 600; }
.warn {
  margin: 5px 0; font-size: 0.78rem; font-weight: 600; color: var(--warn-ink);
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: 8px; padding: 6px 9px;
}
.warn.soft { color: var(--warn-soft-ink); background: var(--warn-soft-bg);
  border-color: var(--warn-soft-line); }
.popup-details summary { cursor: pointer; font-size: 0.78rem;
  color: var(--accent); }
.popup-details table { font-size: 0.76rem; border-collapse: collapse;
  margin-top: 6px; width: 100%; }
.popup-details td { padding: 2px 8px 2px 0; color: var(--muted); }
.popup-details td:last-child { color: var(--ink); text-align: right; }
.pp-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

#status {
  position: fixed; z-index: 1004; left: 50%; bottom: 78px;
  transform: translateX(-50%); background: var(--panel-3); color: var(--ink);
  font-size: 0.84rem; padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
  max-width: 90vw; text-align: center;
}
#status.show { opacity: 1; }

.band-label {
  background: none; border: none; box-shadow: none; font-weight: 700;
  font-size: 0.72rem; color: var(--band-ink); white-space: nowrap;
  text-shadow: 0 0 4px var(--map-halo), 0 0 4px var(--map-halo),
    0 0 8px var(--map-halo);
}
.contour-label {
  background: none; border: none; box-shadow: none; font-weight: 700;
  font-size: 0.66rem; color: var(--contour-ink); white-space: nowrap;
  text-shadow: 0 0 4px var(--map-halo), 0 0 4px var(--map-halo);
}
.leaflet-control-layers, .leaflet-bar a {
  background: var(--panel) !important; color: var(--ink) !important;
  border-color: var(--line) !important;
}
.leaflet-bar a:hover { background: var(--panel-3) !important; }
.leaflet-control-attribution {
  background: var(--attrib-bg) !important; color: var(--dim) !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }

/* ---------- desktop ---------- */
@media (min-width: 760px) {
  #sheet {
    left: auto; right: 12px; bottom: 12px; width: 400px;
    border-radius: var(--radius); max-height: calc(100vh - 84px);
    border-bottom: 1px solid var(--line);
  }
  #legend { top: auto; bottom: 12px; left: 12px; right: auto; }
  #controls { top: 68px; }
  #howworks {
    top: 68px; left: 12px; right: auto; margin: 0;
    width: 360px; max-height: calc(100vh - 250px);
  }
  body.panel-open #controls, body.panel-open #legend { display: none; }
}

@media (max-width: 759px) {
  #controls {
    top: 56px; left: 8px; right: 8px; width: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px;
  }
  #s-where, .ctrl-sep { display: none; }
  #search-wrap { flex: 1 1 150px; }
  #locate-btn { flex: 0 0 auto; padding: 10px 12px; }
  #radius-label, #sort-label, #access-label { flex: 1 1 125px; }
  /* legend lives inside the sheet on phones (see positionLegend) */
  #legend.in-sheet {
    position: static; max-width: none; font-size: 0.7rem;
    margin: 12px 2px 4px; padding: 10px 12px;
    background: var(--panel-2); border: 1px solid var(--line-soft);
    border-radius: 11px; box-shadow: none; backdrop-filter: none;
  }
  #welcome { padding: 24px 18px 18px; }
  .cd-unit { min-width: 0; flex: 1; }
  .cd-unit b { font-size: 1.6rem; }
  /* Four things compete for one bar on a phone. The subtitle repeats what
     the welcome screen just said, and "How it works" is three words where
     a "?" does the job — collapsing both leaves the title readable instead
     of ellipsed to "Ecli…". The label stays in the accessibility tree at
     font-size 0, so the button is still announced by its real name. */
  #topbar h1 #s-sub { display: none; }
  #howworks-toggle {
    font-size: 0; width: 34px; padding: 0; height: 32px;
    display: grid; place-items: center;
  }
  #howworks-toggle::after { content: "?"; font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  #welcome-backdrop, .panel, #topbar, #sheet { backdrop-filter: none; }
}


/* ---------- skyline modal ---------- */
#sky-backdrop {
  position: fixed; inset: 0; z-index: 2100;
  background: var(--scrim-flat); backdrop-filter: blur(3px);
}
#sky-modal {
  position: fixed; z-index: 2101;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(980px, calc(100vw - 24px));
  max-height: min(92vh, 760px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow); padding: 6px;
}
#sky-close {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  background: var(--panel-3); border: 1px solid var(--line); color: var(--ink);
  width: 34px; height: 34px; border-radius: 50%; font-size: 1.2rem;
  line-height: 1; display: grid; place-items: center;
}
#sky-close:hover { background: var(--panel-2); border-color: var(--accent-2); }
#sky-modal .sky-card { background: none; border: none; padding: 18px 20px 16px; }
#sky-modal .sky-head { padding-right: 54px; }
#sky-modal .sky-title { font-size: 0.78rem; }
#sky-modal .sky-quality { font-size: 1.05rem; }
#sky-modal .sky-legend { font-size: 0.78rem; gap: 16px; margin-top: 12px; }
#sky-modal .sky-note { font-size: 0.78rem; max-width: 74ch; }
.sky-where { font-size: 0.82rem; color: var(--muted); margin-top: 3px; }

@media (max-width: 759px) {
  #sky-modal { width: calc(100vw - 12px); max-height: 94vh; }
  #sky-modal .sky-card { padding: 14px 12px 12px; }
  #sky-modal .sky-legend { gap: 10px; font-size: 0.72rem; }
}
