/* ============================================================
   SITE ANALYSIS COPILOT — Styles
   ============================================================ */

:root {
  --bg:       #0A0A0A;
  --bg-card:  #141414;
  --border:   rgba(255,255,255,0.07);
  --border-2: rgba(255,255,255,0.12);
  --accent:   #A8FF00;
  --accent-dim: rgba(168,255,0,0.12);
  --text:     #F0F0F0;
  --text-2:   rgba(240,240,240,0.65);
  --text-3:   rgba(240,240,240,0.60);
  --yellow:   #FFD60A;
  --red:      #FF453A;
  --font:     'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-display: 'Clash Display', 'Helvetica Neue', sans-serif;
  --r:        12px;
  --t:        160ms cubic-bezier(0.25,0.1,0.25,1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; overflow: hidden;
  font-family: var(--font); background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

/* ── Header ──────────────────────────────────── */
#hdr {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: 54px;
  display: flex; align-items: center;
  padding: 0 22px; gap: 14px;
  background: rgba(6,6,8,0.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.hdr-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.80); font-size: 15px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--t); flex-shrink: 0; text-decoration: none;
}
.hdr-btn:hover { color: #fff; background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.3); }
#hdr-title {
  flex: 1;
  font-size: 11px; font-weight: 700; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--text-2);
}
#hdr-title span { color: var(--accent); }
#hdr-address {
  font-size: 12px; letter-spacing: 0.04em; color: rgba(240,240,240,0.60);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px;
}
.hdr-export-btn {
  height: 32px; padding: 0 16px; border-radius: 8px;
  background: rgba(168,255,0,0.12); border: 1px solid rgba(168,255,0,0.3);
  color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; cursor: pointer; display: none; align-items: center;
  transition: all var(--t);
}
.hdr-export-btn:hover { background: rgba(168,255,0,0.2); }
.hdr-export-btn.visible { display: flex; }
.lang-toggle {
  height: 32px; padding: 0 12px; border-radius: 8px; gap: 4px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.16);
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  cursor: pointer; display: flex; align-items: center; flex-shrink: 0; color: rgba(255,255,255,0.65);
  transition: all var(--t);
}
.lang-toggle:hover { background: rgba(255,255,255,0.13); color: rgba(255,255,255,0.8); }
.lang-toggle .lang-active { color: var(--accent); }

/* Narrow-phone header: prevent overflow on <480px */
@media (max-width: 480px) {
  #hdr { padding: 0 12px; gap: 8px; }
  #hdr-title { font-size: 10px; letter-spacing: 0.2em; }
  #hdr-address { max-width: 0; display: none; }
  .hdr-export-btn { padding: 0 10px; font-size: 9px; letter-spacing: 0.1em; }
  .lang-toggle { padding: 0 8px; font-size: 9px; letter-spacing: 0.08em; }
}

/* ── Screens ────────────────────────────────── */
.screen {
  position: fixed; top: 54px; left: 0; right: 0; bottom: 0;
  overflow-y: auto; display: none;
}
#screen-result.active { display: block; }

/* ── Screen 1: Input ─────────────────────────── */
#screen-input {
  display: none; flex-direction: column; align-items: center;
  justify-content: flex-start; padding: 60px 24px 40px;
}
#screen-input.active { display: flex; }
.input-center {
  width: 100%; max-width: 560px;
}
.input-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 24px;
}
.input-h1 {
  font-family: var(--font-display);
  font-size: clamp(44px, 8vw, 80px); font-weight: 700; letter-spacing: -0.03em;
  line-height: 0.95; margin-bottom: 20px; color: var(--accent);
  text-transform: uppercase;
}
.input-sub {
  font-size: 16px; color: rgba(240,240,240,0.88); font-weight: 600; letter-spacing: 0.02em; margin-bottom: 44px;
  line-height: 1.5;
}
.input-quote {
  font-family: var(--font);
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 600;
  font-style: italic;
  color: rgba(240,240,240,0.60);
  letter-spacing: 0.01em;
  margin-bottom: 40px;
  line-height: 1.4;
}
.form-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.geo-input {
  width: 100%; height: 52px; background: var(--bg-card);
  border: 1px solid var(--border-2); border-radius: var(--r);
  color: var(--text); font-family: var(--font); font-size: 16px;
  padding: 0 18px; outline: none; transition: border-color var(--t);
}
.geo-input::placeholder { color: var(--text-3); }
.geo-input:focus { border-color: var(--accent); }
.geo-input.error { border-color: var(--red); }

/* ── Address Autocomplete ────────────────────────────────── */
.addr-wrap { position: relative; }
.geo-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.geo-suggestions[hidden] { display: none; }
.geo-suggestion-item {
  padding: 12px 18px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.4;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--t), color var(--t);
}
.geo-suggestion-item:last-of-type { border-bottom: none; }
.geo-suggestion-item:hover,
.geo-suggestion-item.active {
  background: rgba(168,255,0,0.08);
  color: var(--text);
}
.geo-suggestion-item .sugg-type {
  display: inline-block;
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 6px;
  opacity: 0.6;
}
.geo-suggestions-footer {
  padding: 8px 18px;
  font-size: 10px;
  color: var(--text-2);
  opacity: 0.5;
  text-align: right;
  border-top: 1px solid rgba(255,255,255,0.06);
}
#error-msg {
  font-size: 12px; color: var(--red); letter-spacing: 0.06em; min-height: 16px;
  padding: 0 2px;
}
.analyse-btn {
  width: 100%; height: 54px; background: var(--accent);
  border: none; border-radius: var(--r); color: #0A0A0A;
  font-family: var(--font); font-size: 13px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  cursor: pointer; transition: opacity var(--t); margin-top: 6px;
}
.analyse-btn:hover { opacity: 0.88; }
.analyse-btn:active { opacity: 0.72; }

/* Saved projects */
.saved-section {
  width: 100%; max-width: 560px; margin-top: 48px;
}
.saved-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 14px;
}
.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 16px;
  display: flex; align-items: center; gap: 14px; cursor: pointer;
  transition: border-color var(--t);
}
.saved-card:hover { border-color: rgba(255,255,255,0.16); }
.saved-score-badge {
  width: 42px; height: 42px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; letter-spacing: -0.02em;
}
.saved-info { flex: 1; min-width: 0; }
.saved-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.saved-addr { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-date { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.saved-open {
  font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); flex-shrink: 0;
}
.saved-del {
  width: 22px; height: 22px; border-radius: 6px; background: none;
  border: 1px solid rgba(255,255,255,0.1); color: var(--text-3);
  font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all var(--t); line-height: 1;
}
.saved-del:hover { color: var(--red); border-color: rgba(255,69,58,0.4); background: rgba(255,69,58,0.08); }

/* ── Screen 2: Loading ─────────────────────────── */
#screen-loading {
  display: none; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100%;
}
#screen-loading.active { display: flex; }
.loading-dot {
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent);
  margin-bottom: 36px;
  animation: geo-pulse 1.8s ease-in-out infinite;
}
@keyframes geo-pulse {
  0%,100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(168,255,0,0.6); }
  50% { transform: scale(1.5); opacity: 0.7; box-shadow: 0 0 0 18px rgba(168,255,0,0); }
}
.loading-title {
  font-size: 13px; font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 12px;
}
.loading-quote {
  font-family: var(--font);
  font-size: 13px; font-weight: 600; font-style: italic;
  color: rgba(240,240,240,0.55);
  letter-spacing: 0.02em;
  margin-bottom: 36px;
}
.steps-list { display: flex; flex-direction: column; gap: 12px; }
.step-item {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; color: var(--text-3); letter-spacing: 0.02em;
  transition: color var(--t);
}
.step-item.active { color: var(--text); }
.step-item.done { color: var(--text-2); }
.step-check {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--text-3); display: flex; align-items: center; justify-content: center;
  font-size: 9px; transition: all var(--t);
}
.step-item.active .step-check { border-color: var(--accent); color: var(--accent); }
.step-item.done .step-check {
  background: var(--accent); border-color: var(--accent); color: #0A0A0A;
}
.step-spinner {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid rgba(168,255,0,0.2); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Screen 3: Result ──────────────────────────── */
#screen-result {
  padding: 0 0 60px;
}

/* Map */
#map-container { position: relative; width: 100%; height: 360px; background: #111; }
#map { width: 100%; height: 100%; }
@media (max-width: 600px) { #map-container { height: 260px; } }

/* ── Score + Radar side by side ─────────────────── */
.score-radar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 600px) {
  .score-radar-grid { grid-template-columns: 1fr; }
  .score-section { border-right: none !important; border-bottom: 1px solid var(--border); }
}

/* Score bar */
.score-section {
  padding: 28px 24px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: center; gap: 18px;
}
.score-number {
  font-family: var(--font-display);
  font-size: 76px; font-weight: 700; letter-spacing: -0.04em; line-height: 1;
}
.score-right { flex: 1; }
.score-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(240,240,240,0.72); margin-bottom: 8px;
}
.score-bar-track {
  height: 4px; background: rgba(255,255,255,0.10); border-radius: 2px; overflow: hidden; margin-bottom: 12px;
}
.score-bar-fill { height: 100%; border-radius: 2px; transition: width 0.8s cubic-bezier(0.16,1,0.3,1); }
.score-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px; border-radius: 20px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase;
}
.score-badge .badge-dot { width: 7px; height: 7px; border-radius: 50%; }
.score-quote {
  font-family: var(--font);
  font-size: 11px; font-style: italic;
  color: rgba(240,240,240,0.55);
  margin-top: 14px; letter-spacing: 0.02em;
}
/* Anders als .score-quote bleibt dieser Link auf Mobile sichtbar (siehe
   Media-Query weiter unten): das Zitat ist Dekoration, die Offenlegung
   des Rechenwegs nicht. */
.score-method-link {
  display: inline-block;
  font-family: var(--font);
  font-size: 11px; color: var(--accent, #A8FF00);
  text-decoration: none; margin-top: 10px;
  letter-spacing: 0.02em; opacity: 0.85;
  min-height: 44px; line-height: 44px;
}
.score-method-link:hover { opacity: 1; text-decoration: underline; }

/* ── Radar Chart section ─────────────────────────── */
.radar-section {
  padding: 24px 24px 0;
}
.radar-container {
  position: relative; height: 280px; margin-bottom: 16px;
}
@media (max-width: 560px) { .radar-container { height: 240px; } }

/* Analysis grid */
.analysis-section { padding: 28px 24px 0; }
.section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase;
  color: rgba(240,240,240,0.65); margin-bottom: 16px;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 560px) { .cards-grid { grid-template-columns: 1fr; } }

.analysis-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 22px;
  transition: border-color 0.3s;
}
.analysis-card[data-status="green"] {
  border-color: rgba(168,255,0,0.22);
  box-shadow: 0 0 28px rgba(168,255,0,0.08), inset 0 0 30px rgba(168,255,0,0.05);
}
.analysis-card[data-status="yellow"] {
  border-color: rgba(255,214,10,0.28);
  box-shadow: 0 0 28px rgba(255,214,10,0.08), inset 0 0 30px rgba(255,214,10,0.05);
}
.analysis-card[data-status="red"] {
  border-color: rgba(255,69,58,0.32);
  box-shadow: 0 0 28px rgba(255,69,58,0.10), inset 0 0 30px rgba(255,69,58,0.06);
}
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.api-offline-notice {
  margin: 0 0 12px; padding: 8px 12px;
  background: rgba(255,159,10,0.10); border: 1px solid rgba(255,159,10,0.28);
  border-radius: 6px;
  font-size: 11px; letter-spacing: 0.02em; color: #FFB340;
  line-height: 1.4;
}
.card-icon-title { display: flex; align-items: center; gap: 10px; }
.card-icon { font-size: 22px; line-height: 1; }
.card-title { font-size: 13px; font-weight: 700; letter-spacing: 0.10em; text-transform: uppercase; color: #fff; }
.card-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
.card-facts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.card-fact { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fact-label { font-size: 14.5px; color: rgba(240,240,240,0.78); flex-shrink: 0; }
.fact-value { font-size: 15px; font-weight: 600; color: #fff; text-align: right; }
.card-sub-score { display: flex; flex-direction: column; margin-top: 6px; }
.sub-score-num { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: #fff; }
.sub-score-label { font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase; color: rgba(240,240,240,0.58); margin-top: 4px; }
.sub-bar-track { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.sub-bar-fill { height: 100%; border-radius: 2px; background: var(--accent); }

/* Chancen & Risiken */
.cr-section { padding: 24px 24px 0; }
.cr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .cr-grid { grid-template-columns: 1fr; } }
.cr-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r); padding: 22px; }
.cr-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.cr-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cr-title { font-size: 11px; font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; }
.cr-list { display: flex; flex-direction: column; gap: 10px; }
.cr-item { font-size: 15px; color: rgba(240,240,240,0.88); line-height: 1.5; padding-left: 14px; position: relative; }
.cr-item::before { content: '—'; position: absolute; left: 0; color: rgba(240,240,240,0.60); }

/* Result footer */
.result-footer {
  padding: 28px 24px 0;
  font-size: 11px; color: rgba(240,240,240,0.55); letter-spacing: 0.06em;
}

/* ── Solar bar chart ────────────────────────────── */
.solar-bars {
  display: flex; gap: 2px; align-items: flex-end; height: 38px; margin-bottom: 10px;
}
.solar-bar-col {
  display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1;
}
.solar-bar { width: 100%; border-radius: 1px; }
.solar-bar-lbl { font-size: 8px; color: rgba(255,255,255,0.60); line-height: 1; }

/* ── Full-width card ─────────────────────────────── */
.analysis-card.full-width { grid-column: 1 / -1; }

/* ── Mobile: collapsible cards ───────────────────── */
@media (max-width: 560px) {
  .analysis-card { padding: 16px; }
  .card-top { margin-bottom: 0; cursor: pointer; user-select: none; }
  .card-top::after {
    content: '›'; font-size: 16px; color: rgba(255,255,255,0.55);
    transform: rotate(90deg); display: inline-block;
    transition: transform 0.2s; margin-left: 6px; flex-shrink: 0;
  }
  .analysis-card.expanded .card-top { margin-bottom: 12px; }
  .analysis-card.expanded .card-top::after { transform: rotate(270deg); }
  .card-body { display: none; }
  .analysis-card.expanded .card-body { display: block; }
  .card-facts { gap: 6px; margin-bottom: 10px; }
  .fact-label { font-size: 13.5px; }
  .fact-value { font-size: 14px; }
  .sub-score-num { font-size: 24px; }
}

/* ── Map controls overlay ────────────────────────── */
.map-layer-ctrl {
  position: absolute; top: 10px; right: 10px; z-index: 500;
  display: flex; border-radius: 8px; overflow: hidden;
  background: rgba(10,10,10,0.88); border: 1px solid rgba(255,255,255,0.13);
  backdrop-filter: blur(10px);
}
.layer-btn {
  padding: 8px 14px; font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,255,255,0.65); cursor: pointer; border: none;
  background: transparent; transition: all 140ms; font-family: var(--font);
}
.layer-btn + .layer-btn { border-left: 1px solid rgba(255,255,255,0.1); }
.layer-btn.active  { background: rgba(168,255,0,0.14); color: #A8FF00; }
.layer-btn:hover:not(.active) { color: rgba(255,255,255,0.85); }

.map-left-btns {
  position: absolute; top: 10px; left: 10px; z-index: 500;
  display: flex; flex-direction: column; gap: 5px;
}
.map-draw-btn {
  padding: 8px 14px; font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  background: rgba(10,10,10,0.88); border: 1px solid rgba(255,255,255,0.13);
  color: rgba(255,255,255,0.65); border-radius: 8px; cursor: pointer;
  font-family: var(--font); transition: all 140ms;
  backdrop-filter: blur(10px); white-space: nowrap;
}
/* Mobile: icon-only buttons */
@media (max-width: 560px) {
  .map-draw-btn { padding: 8px 10px; font-size: 16px; letter-spacing: 0; }
  .map-draw-btn .btn-label { display: none; }
  /* Ausnahme: im Fehlerfall MUSS der Text lesbar sein. Sonst bliebe auf dem
     Handy nur ein kurz rot blinkendes Icon — also wieder kein Feedback. */
  .map-draw-btn.btn-error .btn-label { display: inline; font-size: 10px; letter-spacing: 0.1em; }
  .map-draw-btn.btn-error { font-size: 10px; }
}
.map-draw-btn.active { background: rgba(168,255,0,0.14); color: #A8FF00; border-color: rgba(168,255,0,0.3); }
.map-draw-btn:hover:not(.active) { color: #fff; }
/* Fehlzustand eines Layer-Toggles (fremder Dienst nicht erreichbar). Setzt
   sich nach ~2,8 s selbst zurueck, siehe flashBtnMsg() in script.js. */
.map-draw-btn.btn-error {
  background: rgba(255,69,58,0.14); color: #FF453A;
  border-color: rgba(255,69,58,0.35);
}
.iso-mode-ctrl {
  display: flex; gap: 4px; margin-top: 2px;
}
.iso-mode-btn {
  flex: 1; padding: 6px 0; font-size: 13px; cursor: pointer; border-radius: 6px;
  background: rgba(14,14,14,0.82); border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.5); transition: all var(--t);
}
.iso-mode-btn.active { background: rgba(168,255,0,0.14); border-color: rgba(168,255,0,0.3); }
.iso-tooltip.leaflet-tooltip {
  background: rgba(14,14,14,0.88); border: 1px solid rgba(255,255,255,0.12);
  color: #F0F0F0; font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  border-radius: 4px; padding: 5px 10px; white-space: nowrap;
}

/* Draw area popup */
.geo-popup .leaflet-popup-content-wrapper {
  background: rgba(14,14,14,0.96); border: 1px solid rgba(168,255,0,0.3);
  border-radius: 10px; color: #fff; box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.geo-popup .leaflet-popup-tip { background: rgba(14,14,14,0.96); }
.geo-popup .leaflet-popup-close-button { color: rgba(255,255,255,0.4) !important; }

/* ── Map legend ──────────────────────────────────── */
.map-legend {
  position: absolute; bottom: 10px; right: 10px; z-index: 500;
  background: rgba(10,10,10,0.92); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; backdrop-filter: blur(12px);
  min-width: 148px; overflow: hidden;
  transition: all 160ms;
}
.legend-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; cursor: pointer; user-select: none;
}
.legend-title {
  font-size: 9px; font-weight: 700; letter-spacing: 0.22em;
  text-transform: uppercase; color: rgba(255,255,255,0.65);
}
.legend-toggle-icon {
  font-size: 10px; color: rgba(255,255,255,0.55); transition: transform 160ms;
}
.map-legend.open .legend-toggle-icon { transform: rotate(180deg); }
.legend-body {
  display: none; padding: 0 12px 10px; flex-direction: column; gap: 5px;
}
.map-legend.open .legend-body { display: flex; }
.legend-item {
  display: flex; align-items: center; gap: 7px;
  font-size: 10px; color: rgba(255,255,255,0.65); letter-spacing: 0.03em; white-space: nowrap;
}
.legend-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.legend-circle {
  width: 12px; height: 12px; border-radius: 50%; border: 1.5px dashed; flex-shrink: 0;
  background: transparent;
}
.legend-line {
  width: 16px; height: 2px; flex-shrink: 0; border-radius: 1px;
}
.legend-line.dashed {
  background: repeating-linear-gradient(90deg, currentColor 0, currentColor 4px, transparent 4px, transparent 8px);
}
.legend-sep {
  height: 1px; background: rgba(255,255,255,0.07); margin: 3px 0;
}

/* POI marker tooltip */
.leaflet-tooltip-dark {
  background: rgba(14,14,14,0.92); border: 1px solid rgba(255,255,255,0.15);
  color: #F0F0F0; font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  border-radius: 6px; padding: 5px 10px; white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.leaflet-tooltip-dark::before { border-top-color: rgba(14,14,14,0.92); }

/* Leaflet.Draw toolbar dark theme */
.leaflet-draw-toolbar a {
  background-color: rgba(14,14,14,0.92) !important;
  border-color: rgba(255,255,255,0.12) !important;
}
.leaflet-draw-toolbar a:hover { background-color: rgba(40,40,40,0.95) !important; }
.leaflet-draw-actions a {
  background-color: rgba(14,14,14,0.92) !important; color: #A8FF00 !important;
}

/* Leaflet overrides */
.leaflet-container { background: #0A0A0A; }
.leaflet-control-attribution { font-size: 9px !important; opacity: 0.45; background: rgba(0,0,0,0.5) !important; color: #aaa !important; padding: 2px 6px !important; }
.leaflet-control-attribution a { color: #ccc !important; }

/* ── Print — Virgil Abloh PDF ────────────────── */
@media print {
  html, body { overflow: visible; height: auto; background: #fff !important; color: #000 !important; }
  #hdr, .map-layer-ctrl, .map-left-btns, .map-legend,
  .hdr-export-btn, .saved-del { display: none !important; }
  .screen { position: static; overflow: visible; display: none !important; }
  #screen-result { display: block !important; padding: 0; background: #fff !important; }

  /* Map */
  #map-container {
    height: 200px; border: 1px solid #ddd; border-radius: 0;
    overflow: hidden; background: #f0f0f0 !important;
  }

  /* Score + Radar grid */
  .score-radar-grid {
    grid-template-columns: 200px 1fr !important;
    border-bottom: 2px solid #000 !important;
    background: #fff !important;
  }
  .score-section {
    padding: 32px 28px !important;
    border-right: 1px solid #ddd !important;
    border-bottom: none !important;
    background: #fff !important;
  }
  .radar-section { background: #fff !important; padding-bottom: 8px !important; }

  /* Score — Clash Display, bold */
  .score-number {
    font-family: 'Clash Display', 'Helvetica Neue', sans-serif !important;
    font-size: 56px !important;
    font-weight: 700 !important;
    color: #000 !important;
  }
  .score-label {
    font-family: 'Clash Display', 'Helvetica Neue', sans-serif !important;
    color: #222 !important;
    background: transparent !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 0.20em !important;
  }
  .score-bar-track { background: #e0e0e0 !important; }
  .score-bar-fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .score-badge { background: transparent !important; border: 1.5px solid #333 !important; }
  .score-quote { display: none !important; }
  .loading-quote { display: none !important; }
  #badge-label { color: #000 !important; font-weight: 800 !important; }
  #badge-dot { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  /* Section labels — Clash Display */
  .analysis-section, .cr-section { background: #fff !important; }
  .analysis-section { padding: 32px 28px 0 !important; }
  .cr-section { padding: 28px 28px 0 !important; }
  .section-label {
    font-family: 'Clash Display', 'Helvetica Neue', sans-serif !important;
    color: #000 !important;
    background: transparent !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 0.20em !important;
  }

  /* Cards — Status-farbige Borders */
  .analysis-card, .cr-card {
    break-inside: avoid;
    background: #fff !important;
    border: 1px solid #ddd !important;
    color: #000 !important;
    box-shadow: none !important;
  }
  .analysis-card[data-status="green"] {
    border-left: 4px solid #5CB300 !important;
    border-color: #5CB300 !important;
  }
  .analysis-card[data-status="yellow"] {
    border-left: 4px solid #D4A800 !important;
    border-color: #D4A800 !important;
  }
  .analysis-card[data-status="red"] {
    border-left: 4px solid #D43B31 !important;
    border-color: #D43B31 !important;
  }

  /* Card content */
  .card-title {
    color: #000 !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    letter-spacing: 0.12em !important;
  }
  .card-icon    { font-size: 16px !important; }
  .card-status  { color: #333 !important; }
  .status-dot   { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .fact-label   { color: #444 !important; font-size: 12.5px !important; }
  .fact-value   { color: #000 !important; font-size: 13px !important; font-weight: 700 !important; }
  .sub-bar-track { background: #e0e0e0 !important; }
  .sub-bar-fill  { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .sub-score-label { color: #555 !important; }
  .sub-score-num {
    color: #000 !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }

  /* Chancen & Risiken */
  .cr-item   { color: #222 !important; font-size: 13px !important; }
  .cr-card   { background: #fff !important; }
  .cr-title  { color: #000 !important; font-size: 10px !important; font-weight: 800 !important; }
  .cr-dot    { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  /* Solar bars */
  .solar-bar { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  /* Footer */
  .result-footer { display: block; color: #aaa; padding-top: 16px; font-size: 9px; }

  /* Print header — Virgil Bold */
  .print-header {
    display: block !important;
    padding: 24px 0 20px;
    border-bottom: 3px solid #000;
    margin-bottom: 24px;
    background: #fff !important;
  }
  .print-footer-txt {
    display: block !important;
    text-align: center;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
    color: #999 !important;
    border-top: 1px solid #ddd !important;
    padding-top: 12px !important;
    margin-top: 28px !important;
  }

  /* Mobile collapsed cards must expand for print */
  .card-body { display: block !important; }
  .card-top::after { display: none !important; }
  .analysis-card { padding: 18px !important; }
  @page { margin: 16mm 18mm; size: A4; }
}

/* Print header (hidden on screen) */
.print-header { display: none; font-family: var(--font); }
.print-header h2 {
  font-family: 'Clash Display', 'Helvetica Neue', sans-serif;
  font-size: 42px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.0;
  margin: 0 0 8px; text-transform: uppercase;
}
.print-header .print-eyebrow {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.30em; text-transform: uppercase;
  color: #5CB300; margin-bottom: 10px; display: block;
}
.print-header p { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; color: #333; margin: 2px 0; letter-spacing: 0.02em; }
.print-footer-txt { display: none; }

/* ── Accessibility ─────────────────────────── */
.skip-link {
  position: absolute; top: -100px; left: 16px;
  background: var(--accent); color: var(--bg); padding: 8px 16px;
  border-radius: 6px; font-size: 13px; font-weight: 700;
  z-index: 999; text-decoration: none;
}
.skip-link:focus { top: 8px; }

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.geo-input:focus-visible { outline-offset: 0; }
.legend-header { border: none; background: none; width: 100%; text-align: left; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .loading-dot { animation: none; }
  .score-bar-fill { transition: none; }
}

/* Touch-target hit areas on coarse pointers */
@media (pointer: coarse) {
  .hdr-btn, .lang-toggle, .map-draw-btn, .layer-btn, .iso-mode-btn { position: relative; }
  .hdr-btn::after, .lang-toggle::after, .map-draw-btn::after,
  .layer-btn::after, .iso-mode-btn::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    min-width: 44px; min-height: 44px; width: 100%; height: 100%;
  }
}

/* Abdeckungs-Hinweis unter dem Gesamtscore: erscheint nur, wenn Layer fehlen.
   Bewusst neben der Zahl und nicht im Kleingedruckten — eine 0-100-Zahl sieht
   sonst gleich sicher aus, egal aus wie vielen Quellen sie stammt. */
.score-coverage {
  font-family: var(--font);
  font-size: 11px; line-height: 1.5;
  color: #FFD60A;
  margin-top: 10px; max-width: 42ch;
}
.score-coverage[hidden] { display: none; }
