/* ===========================================================
   Pokémon GO Raid-Radar – Design
   Mobile zuerst, ab 861px Breite: Liste links, Karte rechts
   =========================================================== */
:root {
  --bg: #0e1120;
  --panel: #171b30;
  --panel2: #1f2440;
  --line: #2c3358;
  --text: #eef0ff;
  --muted: #9ba5cc;
  --accent: #ffcb05;
  --blue: #3b6bff;
  --good: #3ddc84;
  --warn: #ffa63d;
  --bad: #ff5468;
  --radius: 14px;
  --header-h: 58px;
  --s5: #ff4d5e; --s4: #ff8a3d; --s3: #ffc83d; --s2: #6fd58a; --s1: #5aa9ff;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: 1.35rem; margin-top: 2.2rem; }
h3 { font-size: 1.05rem; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Kopfzeile ---------- */
.top {
  position: sticky; top: 0; z-index: 1100;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 16px; min-height: var(--header-h);
  background: rgba(14, 17, 32, .96); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.brand-ball {
  width: 24px; height: 24px; border-radius: 50%; display: inline-block;
  background: linear-gradient(#ff4d5e 0 46%, #111 46% 54%, #fff 54%);
  border: 2px solid #111; box-shadow: inset 0 0 0 2px rgba(255,255,255,.15);
}
.tabs { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  padding: 7px 14px; white-space: nowrap; color: var(--muted); font-weight: 600;
}
.tab-btn:hover { color: var(--text); background: var(--panel); }
.tab-btn.active { background: var(--accent); color: #1b1b1b; }
.home-link { font-size: .9rem; color: var(--muted); text-decoration: none; white-space: nowrap; }
.home-link:hover { color: var(--text); }

.tab { display: none; }
.tab.active { display: block; }

/* ---------- Karten-Seite ---------- */
.layout { display: grid; grid-template-columns: 410px 1fr; height: calc(100dvh - var(--header-h)); }
.side { overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 14px; }
.mapwrap { position: relative; min-height: 300px; }
#map { position: absolute; inset: 0; background: #1a1d2e; }
#map.crosshair, #map.crosshair .leaflet-grab { cursor: crosshair !important; }

/* dunkle Kartenfarben (nur die Kacheln werden gefiltert) */
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.8); }
.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel2); color: var(--text); }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-control-attribution { background: rgba(14,17,32,.8) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--accent) !important; }

.notice {
  display: flex; gap: 10px; align-items: flex-start; font-size: .9rem;
  background: rgba(59,107,255,.14); border: 1px solid rgba(59,107,255,.45);
  padding: 10px 12px; border-radius: var(--radius); margin-bottom: 12px;
}
.icon-btn { background: none; border: 0; color: var(--muted); padding: 2px 6px; font-size: 1rem; }

/* ---------- Filter ---------- */
.filters { display: grid; gap: 12px; }
#q {
  width: 100%; padding: 11px 14px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
}
#q::placeholder { color: var(--muted); }
.filter-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; font-size: .88rem; color: var(--text);
}
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); color: #17171f; font-weight: 700; }
.row { display: flex; gap: 10px; align-items: end; justify-content: space-between; flex-wrap: wrap; }
label { display: grid; gap: 4px; font-size: .88rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
select, input[type=number], input[type=text] {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; color: var(--text);
}
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }
.link-btn { background: none; border: 0; color: var(--accent); text-decoration: underline; padding: 4px; }

.list-head { margin: 16px 2px 8px; color: var(--muted); font-size: .88rem; }
.list { display: grid; gap: 10px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------- Ort-Karten ---------- */
.spot {
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; cursor: pointer; transition: border-color .15s, transform .15s;
}
.spot:hover { border-color: var(--muted); }
.spot.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,203,5,.25); }
.spot-top { display: flex; align-items: center; gap: 10px; }
.spot-title { flex: 1; min-width: 0; }
.spot h3 { font-size: 1rem; }
.sub { color: var(--muted); font-size: .85rem; }
.score, .pin {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 50%; font-weight: 800; color: #17171f; border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.score { width: 36px; height: 36px; border-width: 2px; }
.s5 { background: var(--s5); } .s4 { background: var(--s4); } .s3 { background: var(--s3); }
.s2 { background: var(--s2); } .s1 { background: var(--s1); }
.pin-wrap { background: none; border: 0; }
.fav { background: none; border: 0; font-size: 1.5rem; color: var(--muted); padding: 0 4px; line-height: 1; }
.fav.on { color: var(--accent); }
.badges, .habs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hab { font-size: .8rem; background: var(--bg); border-radius: 999px; padding: 2px 9px; color: var(--muted); }
.tip { margin: 8px 0 0; font-size: .88rem; color: var(--muted); }

.tier {
  display: inline-block; padding: 2px 9px; border-radius: 8px; font-weight: 800; font-size: .8rem;
  background: var(--c); color: #17171f;
}
.tier.big { font-size: 1rem; padding: 4px 12px; }

.my-reports { background: var(--panel2); border: 1px dashed var(--accent); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.my-reports h3 { margin-bottom: 6px; }
.rep { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; font-size: .9rem; }
.rep-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-min { color: var(--accent); font-weight: 700; }

/* ---------- Karten-Knöpfe, Legende ---------- */
.map-actions { position: absolute; z-index: 500; top: 12px; right: 12px; display: grid; gap: 8px; justify-items: end; }
.fab {
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
.fab.primary, .fab.on { background: var(--accent); color: #1b1b1b; border-color: var(--accent); }
.banner {
  position: absolute; z-index: 500; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center;
  width: max-content; max-width: calc(100% - 24px);
  background: var(--panel); border: 2px solid var(--accent); border-radius: var(--radius); padding: 10px 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.legend {
  position: absolute; z-index: 500; left: 12px; bottom: 28px; background: rgba(23,27,48,.92);
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: .78rem;
}
.legend-title { color: var(--muted); }
.legend-row { display: flex; align-items: center; gap: 5px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-left: 4px; }

.rpin {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; font-size: 1.3rem;
  background: var(--c); border: 3px solid #fff; box-shadow: 0 2px 10px rgba(0,0,0,.55);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .rpin { animation: none; } }

/* ---------- Popups ---------- */
.pop { display: grid; gap: 6px; min-width: 190px; }
.pop strong { font-size: 1rem; }
.pop-sub { color: var(--muted); font-size: .85rem; }
.pop-row { font-size: .88rem; display: flex; gap: 6px; flex-wrap: wrap; }
.pop-tip { font-size: .85rem; color: var(--muted); }
.pop-link { font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  background: var(--accent); color: #1b1b1b; border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 700;
}
.btn:hover { filter: brightness(1.08); }
.btn.small { padding: 6px 12px; font-size: .88rem; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); color: #fff; }

/* ---------- Normale Seiten ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.page.narrow { max-width: 640px; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 62ch; }
.hint { color: var(--muted); font-size: .9rem; margin: 6px 0 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tier-grid, .boss-grid, .hab-grid, .weather-grid { display: grid; gap: 14px; margin-top: 16px; }
.tier-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.boss-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.hab-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.weather-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tier-card { border-top: 5px solid var(--c); display: grid; gap: 8px; align-content: start; }
.tier-head { display: flex; align-items: center; gap: 10px; }
.tier-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; font-size: .92rem; }
.diff { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
.meter { display: inline-flex; gap: 3px; }
.meter i { width: 16px; height: 8px; border-radius: 3px; background: var(--line); }
.meter i.on { background: linear-gradient(90deg, var(--s2), var(--s3), var(--s4), var(--s5)); background-size: 80px 100%; }
.meter i.on:nth-child(1) { background-position: 0 0; } .meter i.on:nth-child(2) { background-position: -16px 0; }
.meter i.on:nth-child(3) { background-position: -32px 0; } .meter i.on:nth-child(4) { background-position: -48px 0; }
.meter i.on:nth-child(5) { background-position: -64px 0; }

.boss { border-top: 5px solid var(--c); display: grid; gap: 8px; align-content: start; }
.boss-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.types { display: flex; flex-wrap: wrap; gap: 5px; }
.type { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.weak-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 4px; }
.weak { display: flex; flex-wrap: wrap; gap: 8px; }
.weak-item { display: inline-flex; align-items: center; gap: 4px; }
.weak-item small { color: var(--muted); font-size: .72rem; }
.page .chips { margin-top: 10px; }

.hab-card { display: grid; gap: 10px; align-content: start; }
.hab-icon { font-size: 2.2rem; }
.hab-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.mons { font-size: .88rem; }
.rank { list-style: none; counter-reset: r; padding: 0; margin: 0; display: grid; gap: 8px; }
.rank li { counter-increment: r; }
.rank-item {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px;
}
.rank-item::before {
  content: counter(r); display: grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: var(--accent); color: #1b1b1b; font-weight: 800;
}
.rank-item:hover { border-color: var(--accent); }
.rank-name { flex: 1; display: grid; }
.rank-name small { color: var(--muted); }
.weather { display: grid; gap: 8px; justify-items: start; }
.w-icon { font-size: 1.8rem; }
.note-box {
  margin-top: 2rem; padding: 14px 16px; border-radius: var(--radius);
  background: rgba(255,203,5,.1); border: 1px solid rgba(255,203,5,.4);
}

/* ---------- Raid-Check ---------- */
.form-card { display: grid; gap: 16px; margin-top: 18px; }
.result { margin-top: 16px; display: grid; gap: 8px; border-width: 2px; }
.result h2 { margin: 0; }
.result p { margin: 0; }
.res-icon { font-size: 2.4rem; }
.result.good { border-color: var(--good); } .result.ok { border-color: var(--s3); }
.result.warn { border-color: var(--warn); } .result.bad { border-color: var(--bad); }

/* ---------- Dialog & Toast ---------- */
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 18px; padding: 20px; width: min(420px, calc(100% - 24px));
}
dialog::backdrop { background: rgba(0,0,0,.65); }
dialog form { display: grid; gap: 14px; }
dialog h2 { margin: 0; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; }
.toast {
  position: fixed; z-index: 3000; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--accent); border-radius: 999px;
  padding: 10px 18px; max-width: calc(100% - 24px); box-shadow: 0 6px 20px rgba(0,0,0,.5);
}

/* ---------- Handy / Tablet ---------- */
@media (max-width: 860px) {
  :root { --header-h: 0px; }
  .top { gap: 6px 12px; }
  .tabs { order: 3; flex-basis: 100%; }
  .home-link { margin-left: auto; }
  .layout { display: flex; flex-direction: column; height: auto; }
  .mapwrap { order: -1; height: 58vh; min-height: 340px; flex: none; }
  .side { overflow: visible; border-right: 0; }
  .map-actions { top: 8px; right: 8px; }
  .legend { display: none; }
}
