/* =========================================================================
   Pixelfriends Dashboard · "Lapis Nights 2"
   Mobile first. Dunkles Lapis-Blau, Gold-Akzent, Glas nur für Leisten/Panels.
   ========================================================================= */

@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('/fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('/fonts/inter-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('/fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('/fonts/inter-700.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 500; font-display: swap; src: url('/fonts/space-grotesk-500.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 700; font-display: swap; src: url('/fonts/space-grotesk-700.woff2') format('woff2'); }

:root {
  color-scheme: dark;
  --bg: #060a14;
  --bg-2: #0a1122;
  --surface: rgba(18, 29, 56, 0.72);
  --surface-solid: #0e172c;
  --surface-2: #142140;
  --surface-3: #1b2a50;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #eef1fb;
  --text-2: #a9b2cf;
  --text-3: #707a99;
  --gold: #f0c14b;
  --gold-2: #e8a33d;
  --gold-soft: rgba(240, 193, 75, 0.14);
  --lapis: #3f6bc4;
  --lapis-2: #5b8def;
  --online: #4fd1c5;
  --online-glow: rgba(79, 209, 197, 0.35);
  --good: #2fbf71;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #e5484d;
  --grad-gold: linear-gradient(135deg, #f7d27e 0%, #e8a33d 100%);
  --grad-lapis: linear-gradient(160deg, #1c2d58 0%, #0d1631 100%);
  /* Datenfarben (validiert gegen #0e172c: Farbenblindheit, Kontrast) */
  --p1: #c28419;
  --p2: #22a094;
  --p3: #8a7ee6;
  --p4: #e0605f;
  --p5: #4a8fe8;
  --p-other: #5d6785;
  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --appbar-h: 58px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  background:
    radial-gradient(900px 600px at 10% -10%, rgba(63, 107, 196, 0.22), transparent 60%),
    radial-gradient(700px 500px at 110% 0%, rgba(240, 193, 75, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 400 15px/1.45 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
.tab:focus-visible, .side-tab:focus-visible { outline-offset: -2px; }
.log:focus-visible { outline-offset: 0; }
a { color: var(--gold); text-decoration: none; }
h1, h2, h3, .display { font-family: 'Space Grotesk', 'Inter', sans-serif; letter-spacing: -0.01em; }
.num { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; }
.tab-num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.xs { width: 13px; height: 13px; }

/* ---------- App-Rahmen ---------- */
.app { position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; }
.sidebar { display: none; }
.main { position: relative; flex: 1; min-width: 0; height: 100%; overflow: hidden; }

.appbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--appbar-h) + var(--safe-top));
  padding: var(--safe-top) 14px 0;
  display: flex; align-items: center; gap: 10px;
  background: rgba(6, 10, 20, 0.62);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.appbar.scrolled { border-bottom-color: var(--line); }
.appbar .brand { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.appbar .brand h1 { font-size: 17px; font-weight: 700; margin: 0; white-space: nowrap; }
.appbar .view-title { font-size: 17px; font-weight: 700; margin: 0; }
.logo { width: 28px; height: 29px; flex-shrink: 0; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px 0 9px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.dot.on { background: var(--online); box-shadow: 0 0 0 0 var(--online-glow); animation: ping 2.4s infinite; }
.dot.off { background: var(--critical); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 var(--online-glow); } 70% { box-shadow: 0 0 0 8px rgba(79, 209, 197, 0); } 100% { box-shadow: 0 0 0 0 rgba(79, 209, 197, 0); } }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); cursor: pointer; color: var(--text-2);
  transition: transform 0.15s var(--ease), background 0.15s;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.09); }

/* ---------- Views (mobil: horizontaler Pager) ---------- */
.pager { position: absolute; inset: 0; display: flex; will-change: transform; transition: transform 0.42s var(--ease); }
.pager.dragging { transition: none; }
.view {
  flex: 0 0 100%; width: 100%; height: 100%;
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: calc(var(--appbar-h) + var(--safe-top) + 10px) 14px calc(var(--tabbar-h) + var(--safe-bottom) + 26px);
  scrollbar-width: none;
}
.view::-webkit-scrollbar { display: none; }
.view-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 7px 10px calc(7px + var(--safe-bottom));
  display: flex; justify-content: space-around;
  background: rgba(10, 16, 32, 0.78);
  backdrop-filter: saturate(170%) blur(22px);
  -webkit-backdrop-filter: saturate(170%) blur(22px);
  border-top: 1px solid var(--line);
}
.tab {
  position: relative; flex: 1; max-width: 90px; height: 50px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; cursor: pointer; color: var(--text-3);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em;
  transition: color 0.2s;
}
.tab svg.i { width: 23px; height: 23px; transition: transform 0.3s var(--ease); }
.tab.active { color: var(--gold); }
.tab.active svg.i { transform: translateY(-1px) scale(1.06); }
.tab::before {
  content: ''; position: absolute; top: 3px; left: 50%; width: 44px; height: 30px; margin-left: -22px;
  border-radius: 12px; background: var(--gold-soft); opacity: 0; transform: scale(0.6);
  transition: opacity 0.25s, transform 0.35s var(--ease); z-index: -1;
}
.tab.active::before { opacity: 1; transform: scale(1); }
.tab .badge-dot { position: absolute; top: 7px; right: calc(50% - 17px); width: 8px; height: 8px; border-radius: 50%; background: var(--online); border: 2px solid #0a1020; }

/* ---------- Karten / Sektionen ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h2 { font-size: 15.5px; font-weight: 700; margin: 0; flex: 1; display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-family: 'Inter'; font-weight: 500; font-size: 12.5px; color: var(--text-3); }
.card-head .link { font-size: 13px; font-weight: 600; color: var(--gold); background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; padding: 4px 0; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 2px -4px; }
.section-title h2 { font-size: 19px; margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }

/* ---------- Stat-Kacheln ---------- */
.stat { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat .label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.stat .label svg.i { width: 15px; height: 15px; color: var(--gold); }
.stat .value { font-family: 'Space Grotesk'; font-weight: 700; font-size: 26px; line-height: 1.05; letter-spacing: -0.02em; }
.stat .value small { font-size: 14px; font-weight: 500; color: var(--text-2); margin-left: 3px; letter-spacing: 0; }
.stat .foot { font-size: 12px; color: var(--text-3); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); color: var(--text-2); }
.delta.up { color: #7ee2a8; background: rgba(47, 191, 113, 0.14); }
.delta.down { color: #ffb4a3; background: rgba(229, 72, 77, 0.14); }

/* ---------- Hero (Himmel) ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl);
  min-height: 430px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: var(--shadow);
  isolation: isolate;
  display: flex; flex-direction: column;
}
.hero canvas.sky { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; image-rendering: pixelated; }
.hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(4, 7, 16, 0.38) 0%, rgba(4, 7, 16, 0) 42%, rgba(4, 7, 16, 0) 70%, rgba(4, 7, 16, 0.55) 100%); pointer-events: none; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 14px 14px 0; }
.glass-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; color: #fff;
  background: rgba(8, 12, 26, 0.42); border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
}
.hero-body { padding: 14px 18px 0; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45); }
.hero-spacer { flex: 1; min-height: 150px; }
.hero-world { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.82); display: flex; align-items: center; gap: 6px; }
.hero-day { font-family: 'Space Grotesk'; font-weight: 700; font-size: 56px; line-height: 1; letter-spacing: -0.035em; margin: 6px 0 4px; }
.hero-day span { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; opacity: 0.8; margin-right: 6px; }
.hero-time { font-size: 14.5px; color: rgba(255, 255, 255, 0.9); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.hero-time b { font-family: 'Space Grotesk'; font-size: 17px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 12px 12px; }
.hero-stats .hero-stat:first-child { animation-delay: 0.1s; }
.hero-stat { padding: 10px 11px; border-radius: 16px; background: rgba(8, 12, 26, 0.5); border: 1px solid rgba(255, 255, 255, 0.12); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); min-width: 0; }
.hero-stat .k { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255, 255, 255, 0.62); }
.hero-stat .v { font-family: 'Space Grotesk'; font-weight: 700; font-size: 17px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Online-Leiste ---------- */
.online-row { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.online-row::-webkit-scrollbar { display: none; }
.online-person { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 70px; flex-shrink: 0; background: none; border: 0; cursor: pointer; padding: 0; animation: pop-in 0.5s var(--ease) both; }
.online-person .nm { font-size: 12px; font-weight: 600; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-person .tm { font-size: 11px; color: var(--online); font-weight: 600; }
@keyframes pop-in { from { opacity: 0; transform: scale(0.6) translateY(8px); } to { opacity: 1; transform: none; } }
.empty-state { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 14px; }
.empty-state .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.05); color: var(--text-3); flex-shrink: 0; }

/* ---------- Avatar ---------- */
.avatar { position: relative; display: inline-block; vertical-align: middle; flex-shrink: 0; border-radius: 30%; overflow: visible; }
.avatar svg { display: block; width: 100%; height: 100%; border-radius: 30%; shape-rendering: crispEdges; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); }
.avatar.ring svg { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--online), 0 0 22px var(--online-glow); }
.avatar .live { position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; border-radius: 50%; background: var(--online); border: 3px solid var(--surface-solid); }

/* ---------- Ring / Meter ---------- */
.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring circle { transition: stroke-dashoffset 1.2s var(--ease); }
.meter { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--grad-gold); transition: width 1s var(--ease); }

/* ---------- Listen / Ereignisse ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); min-height: 58px; }
.list-item:last-child { border-bottom: 0; }
.list-item .main-t { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.list-item .sub-t { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.list-item .end { margin-left: auto; text-align: right; flex-shrink: 0; font-size: 12.5px; color: var(--text-3); }
button.list-item { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
button.list-item:last-child { border-bottom: 0; }
.ev-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: rgba(255, 255, 255, 0.06); color: var(--text-2); }
.ev-icon.gold { background: rgba(240, 193, 75, 0.14); color: var(--gold); }
.ev-icon.teal { background: rgba(79, 209, 197, 0.13); color: var(--online); }
.ev-icon.blue { background: rgba(91, 141, 239, 0.15); color: #8fb3ff; }
.ev-icon.red { background: rgba(229, 72, 77, 0.15); color: #ff8e8a; }
.ev-icon.violet { background: rgba(138, 126, 230, 0.16); color: #b3a9ff; }
.ev-icon.green { background: rgba(47, 191, 113, 0.14); color: #6fdda0; }

/* ---------- Chips / Segmente ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 34px; padding: 0 14px; border-radius: 999px; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.chip.active { background: var(--gold); color: #1a1405; border-color: var(--gold); }
.chip.static { cursor: default; height: 30px; font-size: 12.5px; }
.chip.on { color: #b9f1d2; border-color: rgba(47, 191, 113, 0.35); background: rgba(47, 191, 113, 0.10); }
.chip.off { color: var(--text-3); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 9px; background: none; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset; }

/* ---------- Buttons ---------- */
.btn {
  height: 46px; padding: 0 18px; border-radius: 14px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 14.5px; background: var(--grad-gold); color: #1a1405;
  box-shadow: 0 10px 26px rgba(232, 163, 61, 0.28);
  transition: transform 0.15s var(--ease), filter 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn.ghost { background: rgba(255, 255, 255, 0.06); color: var(--text); border: 1px solid var(--line-2); box-shadow: none; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* ---------- Diagramme ---------- */
.chart-wrap { position: relative; height: 180px; }
.chart-wrap.tall { height: 220px; }
.chart-wrap.short { height: 120px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.spark { width: 100%; height: 38px; display: block; }

/* ---------- Heatmap ---------- */
.heatmap { overflow-x: auto; scrollbar-width: none; }
.heatmap::-webkit-scrollbar { display: none; }
.heatmap svg { display: block; }
.heat-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: 11px; color: var(--text-3); margin-top: 8px; }
.heat-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ---------- Kalender (Verfügbarkeit) ---------- */
.cal { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.cal .d { aspect-ratio: 1; border-radius: 7px; background: rgba(255, 255, 255, 0.05); position: relative; }
.cal .d.good { background: rgba(47, 191, 113, 0.75); }
.cal .d.warn { background: rgba(250, 178, 25, 0.8); }
.cal .d.bad { background: rgba(229, 72, 77, 0.85); }
.cal .d.today::after { content: ''; position: absolute; inset: -3px; border-radius: 9px; border: 2px solid var(--text); }

/* ---------- Karte (Leaflet) ---------- */
.map-card { position: relative; border-radius: var(--r-xl); overflow: hidden; border: 1px solid var(--line-2); background: #05080f; box-shadow: var(--shadow); }
.map-el { height: 62vh; min-height: 360px; max-height: 640px; background: #05080f; }
.map-card.full { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 60; border-radius: 0; border: 0; }
.map-card.full .map-el { height: 100%; max-height: none; }
.map-ui { position: absolute; z-index: 500; pointer-events: none; }
.map-ui > * { pointer-events: auto; }
.map-ui.top { top: 10px; left: 10px; right: 10px; display: flex; gap: 8px; align-items: flex-start; }
.map-card.full .map-ui.top { top: calc(10px + var(--safe-top)); }
.map-ui.bottom { bottom: 10px; left: 10px; right: 10px; display: flex; gap: 8px; align-items: flex-end; }
.map-card.full .map-ui.bottom { bottom: calc(10px + var(--safe-bottom)); }
.map-ui .glass-chip { cursor: pointer; }
.map-ui .seg { background: rgba(8, 12, 26, 0.66); border-color: rgba(255, 255, 255, 0.16); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.map-ui .seg button { color: rgba(255, 255, 255, 0.78); padding: 0 11px; }
.map-ui .seg button.active { background: var(--gold); color: #1a1405; }
.map-btn { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: rgba(8, 12, 26, 0.6); border: 1px solid rgba(255, 255, 255, 0.16); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); color: #fff; cursor: pointer; }
.map-coords { font-family: 'Space Grotesk'; font-size: 12.5px; font-weight: 600; }
.leaflet-container { background: #05080f; font: inherit; }
.leaflet-image-layer { image-rendering: pixelated; }
.leaflet-control-attribution { background: rgba(6, 10, 20, 0.6) !important; color: var(--text-3) !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: var(--text-2) !important; }
.mk { display: grid; place-items: center; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(255, 255, 255, 0.85); }
.mk svg.i { width: 14px; height: 14px; stroke-width: 2.2; }
.mk.spawn { background: var(--gold); color: #1a1405; box-shadow: 0 0 0 3px rgba(240, 193, 75, 0.35), 0 0 0 2px #fff, 0 6px 16px rgba(0, 0, 0, 0.5); }
.mk.village { background: #b7773a; }
.mk.pet { background: #d86b8c; }
.mk.portal { background: #7b4fd6; }
.mk.spawner { background: #4b556e; }
.mk.golem { background: #8d97a8; }
.mk.trader { background: #2e7cc9; }
.mk.player { background: var(--online); color: #062521; }
.leaflet-tooltip.pf-tip { background: rgba(8, 12, 26, 0.92); color: var(--text); border: 1px solid var(--line-2); border-radius: 10px; font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow); padding: 6px 9px; }
.leaflet-tooltip.pf-tip::before { display: none; }

/* ---------- Volkszählung ---------- */
.census { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.census .c { padding: 12px 10px; border-radius: 16px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.census .c .ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); }
.census .c .n { font-family: 'Space Grotesk'; font-weight: 700; font-size: 22px; line-height: 1; }
.census .c .l { font-size: 11.5px; color: var(--text-2); font-weight: 600; line-height: 1.25; }
.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dim { border-radius: 16px; padding: 12px; min-height: 92px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); position: relative; overflow: hidden; }
.dim.ow { background: linear-gradient(160deg, rgba(47, 191, 113, 0.20), rgba(34, 160, 148, 0.05)); }
.dim.ne { background: linear-gradient(160deg, rgba(229, 72, 77, 0.24), rgba(236, 131, 90, 0.05)); }
.dim.en { background: linear-gradient(160deg, rgba(138, 126, 230, 0.26), rgba(40, 20, 80, 0.05)); }
.dim .t { font-weight: 700; font-size: 13.5px; }
.dim .s { font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.seed { font-family: 'Space Grotesk'; font-size: 14px; font-weight: 600; letter-spacing: 0.02em; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------- Spieler ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.18fr 1fr; align-items: end; gap: 8px; padding-top: 6px; }
.podium .pl { display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; padding: 0; min-width: 0; }
.podium .pl .nm { font-weight: 700; font-size: 13.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .pl .sc { font-family: 'Space Grotesk'; font-weight: 700; font-size: 13px; color: var(--gold); }
.podium .step { width: 100%; border-radius: 14px 14px 6px 6px; display: grid; place-items: center; font-family: 'Space Grotesk'; font-weight: 700; font-size: 24px; color: rgba(255, 255, 255, 0.9); border: 1px solid var(--line-2); border-bottom: 0; }
.podium .p1 .step { height: 92px; background: linear-gradient(180deg, rgba(240, 193, 75, 0.35), rgba(240, 193, 75, 0.06)); }
.podium .p2 .step { height: 66px; background: linear-gradient(180deg, rgba(190, 200, 225, 0.25), rgba(190, 200, 225, 0.04)); }
.podium .p3 .step { height: 50px; background: linear-gradient(180deg, rgba(205, 127, 50, 0.3), rgba(205, 127, 50, 0.05)); }
.crown { color: var(--gold); filter: drop-shadow(0 2px 8px rgba(240, 193, 75, 0.6)); margin-bottom: -4px; }
.records { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px 2px; scroll-snap-type: x mandatory; }
.records::-webkit-scrollbar { display: none; }
.record { flex: 0 0 150px; scroll-snap-align: start; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.record .ic { color: var(--gold); }
.record .v { font-family: 'Space Grotesk'; font-weight: 700; font-size: 21px; line-height: 1.1; }
.record .k { font-size: 12px; color: var(--text-2); font-weight: 600; }
.record .w { font-size: 11.5px; color: var(--text-3); }
.lb-row .rank { width: 22px; font-family: 'Space Grotesk'; font-weight: 700; color: var(--text-3); text-align: center; flex-shrink: 0; }
.lb-row .pts { font-family: 'Space Grotesk'; font-weight: 700; color: var(--gold); font-size: 15px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 9px; }
.bdg { padding: 12px 8px 10px; border-radius: 16px; text-align: center; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); position: relative; }
.bdg .e { font-size: 28px; line-height: 1; filter: grayscale(1) opacity(0.4); }
.bdg.earned { background: linear-gradient(170deg, rgba(240, 193, 75, 0.16), rgba(240, 193, 75, 0.03)); border-color: rgba(240, 193, 75, 0.35); }
.bdg.earned .e { filter: none; }
.bdg .t { font-size: 11.5px; font-weight: 700; margin-top: 7px; line-height: 1.2; }
.bdg .p { font-size: 10.5px; color: var(--text-3); margin-top: 4px; }
.bdg .meter { margin-top: 7px; height: 4px; }
.companion { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.companion .bar { flex: 1; }

/* ---------- Chronik ---------- */
.day-head { position: sticky; top: calc(var(--appbar-h) + var(--safe-top) - 10px); z-index: 5; padding: 8px 4px; margin: 6px -4px 0; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); background: linear-gradient(180deg, #111b33 65%, rgba(17, 27, 51, 0)); }
.tl { position: relative; }
.tl-item { display: flex; gap: 12px; padding: 10px 2px; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 20px; top: 50px; bottom: -10px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-item .body { flex: 1; min-width: 0; padding-top: 2px; }
.tl-item .t1 { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.tl-item .t2 { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.tl-item.fresh { animation: slide-in 0.6s var(--ease) both; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.recap-cta {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 20px; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.12);
  background: radial-gradient(120% 140% at 100% 0%, rgba(240, 193, 75, 0.35), transparent 55%), radial-gradient(120% 120% at 0% 100%, rgba(138, 126, 230, 0.35), transparent 60%), var(--grad-lapis);
  text-align: left; width: 100%; color: var(--text);
}
.recap-cta h3 { margin: 4px 0 6px; font-size: 22px; }
.recap-cta p { margin: 0; padding-right: 58px; color: rgba(255, 255, 255, 0.8); font-size: 13.5px; }
.recap-cta .go { position: absolute; right: 16px; bottom: 16px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #10172b; }

/* ---------- System ---------- */
.health-hero { display: flex; align-items: center; gap: 16px; }
.checks .list-item { min-height: 50px; }
.status-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.status-ic.good { background: rgba(47, 191, 113, 0.16); color: #6fdda0; }
.status-ic.warning { background: rgba(250, 178, 25, 0.16); color: var(--warning); }
.status-ic.critical { background: rgba(229, 72, 77, 0.18); color: #ff8e8a; }
.log-tools { display: flex; gap: 8px; margin-bottom: 10px; }
.search { flex: 1; height: 38px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); color: var(--text); padding: 0 12px; font-size: 14px; min-width: 0; }
.search:focus { outline: none; border-color: var(--gold); }
.log {
  height: 360px; overflow: auto; border-radius: 14px; padding: 10px 12px;
  background: #04070e; border: 1px solid var(--line);
  font: 500 11.5px/1.6 ui-monospace, 'SF Mono', Menlo, monospace; color: #b9c1d9; white-space: pre-wrap; word-break: break-word;
}
.log .l-err { color: #ff9b95; }
.log .l-warn { color: #ffd479; }
.log .l-join { color: #7ce8dc; }
.log .l-start { color: #a6b8ff; font-weight: 700; }
.log mark { background: rgba(240, 193, 75, 0.35); color: #fff; border-radius: 3px; }

/* ---------- Bottom Sheet ---------- */
.sheet-backdrop { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 70; background: rgba(2, 4, 10, 0.55); opacity: 0; transition: opacity 0.3s; backdrop-filter: blur(2px); }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 71;
  max-height: calc(100% - var(--safe-top) - 24px);
  display: flex; flex-direction: column;
  background: #0c1428; border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: 28px 28px 0 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(105%); transition: transform 0.45s var(--ease);
}
.sheet.open { transform: translateY(0); }
.sheet.dragging { transition: none; }
.sheet .grab { padding: 10px 0 6px; display: grid; place-items: center; cursor: grab; touch-action: none; flex-shrink: 0; }
.sheet .grab span { width: 42px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); }
.sheet .sheet-body { overflow-y: auto; padding: 4px 16px calc(24px + var(--safe-bottom)); overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; }
.sheet .sheet-body::-webkit-scrollbar { display: none; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-top) + 8px); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 420px; width: 100%;
  padding: 10px 14px 10px 10px; border-radius: 20px;
  background: rgba(16, 24, 46, 0.92); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  animation: toast-in 0.5s var(--ease) both;
}
.toast.out { animation: toast-out 0.35s ease-in both; }
.toast .t1 { font-weight: 700; font-size: 14px; }
.toast .t2 { font-size: 12.5px; color: var(--text-2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-24px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-16px) scale(0.97); } }

/* ---------- Pull to refresh ---------- */
.ptr { position: absolute; top: calc(var(--appbar-h) + var(--safe-top) + 6px); left: 50%; z-index: 15; width: 36px; height: 36px; margin-left: -18px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--gold); opacity: 0; transform: translateY(-40px); pointer-events: none; }
.ptr.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Skeleton ---------- */
.sk { border-radius: 10px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.09) 50%, rgba(255, 255, 255, 0.04) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.sk.line { height: 14px; }
.sk.block { height: 120px; border-radius: var(--r-lg); }
.sk.hero { height: 430px; border-radius: var(--r-xl); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.stale { opacity: 0.55; transition: opacity 0.3s; }

/* ---------- Offline / Banner ---------- */
.banner { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 16px; font-size: 13.5px; font-weight: 600; }
.banner.warn { background: rgba(250, 178, 25, 0.12); border: 1px solid rgba(250, 178, 25, 0.3); color: #ffd98a; }
.banner.crit { background: rgba(229, 72, 77, 0.12); border: 1px solid rgba(229, 72, 77, 0.35); color: #ffb3ae; }
.banner.info { background: rgba(91, 141, 239, 0.12); border: 1px solid rgba(91, 141, 239, 0.3); color: #bcd0ff; }

/* ---------- Einstellungen ---------- */
.setting { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .txt { flex: 1; min-width: 0; }
.setting .txt b { display: block; font-size: 14.5px; }
.setting .txt span { font-size: 12.5px; color: var(--text-3); }
.switch { position: relative; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.14); transition: background 0.25s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.3s var(--ease); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.field { width: 100%; height: 42px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-2); color: var(--text); padding: 0 12px; font-size: 14.5px; }

/* ---------- Story (Rückblick) ---------- */
.story { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 100; background: #03050b; display: flex; flex-direction: column; animation: fade-in 0.3s ease both; touch-action: none; user-select: none; -webkit-user-select: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.story-bars { position: absolute; top: calc(var(--safe-top) + 10px); left: 10px; right: 10px; display: flex; gap: 4px; z-index: 3; }
.story-bars span { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.28); overflow: hidden; }
.story-bars span i { display: block; height: 100%; width: 0; background: #fff; }
.story-close { position: absolute; top: calc(var(--safe-top) + 22px); right: 10px; z-index: 4; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.story-head { position: absolute; top: calc(var(--safe-top) + 26px); left: 16px; z-index: 3; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.85); }
.slide { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--safe-top) + 80px) 26px calc(var(--safe-bottom) + 60px); overflow: hidden; }
.slide .kicker { font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); }
.slide h2 { font-size: 34px; line-height: 1.08; margin: 10px 0 14px; letter-spacing: -0.02em; }
.slide .big { font-family: 'Space Grotesk'; font-weight: 700; font-size: 92px; line-height: 0.95; letter-spacing: -0.05em; }
.slide p { font-size: 17px; line-height: 1.45; color: rgba(255, 255, 255, 0.86); margin: 0; }
.slide .anim > * { animation: rise 0.7s var(--ease) both; }
.slide .anim > *:nth-child(2) { animation-delay: 0.12s; }
.slide .anim > *:nth-child(3) { animation-delay: 0.24s; }
.slide .anim > *:nth-child(4) { animation-delay: 0.36s; }
.slide .anim > *:nth-child(5) { animation-delay: 0.48s; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.story-bars-row { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.story-bar { display: flex; align-items: center; gap: 12px; }
.story-bar .track { flex: 1; height: 14px; border-radius: 7px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.story-bar .track i { display: block; height: 100%; border-radius: 7px; width: 0; transition: width 1.2s var(--ease) 0.3s; }
.confetti { position: absolute; inset: 0; pointer-events: none; }

@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.view.entering .view-inner > * { animation: fade-up 0.5s var(--ease) both; }
.view.entering .view-inner > *:nth-child(2) { animation-delay: 0.04s; }
.view.entering .view-inner > *:nth-child(3) { animation-delay: 0.08s; }
.view.entering .view-inner > *:nth-child(4) { animation-delay: 0.12s; }
.view.entering .view-inner > *:nth-child(5) { animation-delay: 0.16s; }
.view.entering .view-inner > *:nth-child(n+6) { animation-delay: 0.2s; }

/* =========================================================================
   Desktop: Seitenleiste, mehrspaltige Raster
   ========================================================================= */
@media (min-width: 960px) {
  body { overflow: hidden; }
  .sidebar {
    display: flex; flex-direction: column; width: 250px; flex-shrink: 0; padding: 26px 16px 20px;
    border-right: 1px solid var(--line); background: rgba(255, 255, 255, 0.015);
  }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 26px; }
  .sidebar .brand h1 { font-size: 19px; margin: 0; }
  .sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
  .side-tab { display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 14px; border-radius: 14px; border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: 14.5px; cursor: pointer; text-align: left; transition: background 0.2s, color 0.2s; }
  .side-tab:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
  .side-tab.active { background: linear-gradient(135deg, rgba(240, 193, 75, 0.16), rgba(63, 107, 196, 0.14)); color: var(--gold); }
  .sidebar .foot { font-size: 12px; color: var(--text-3); padding: 12px 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
  .tabbar { display: none; }
  .appbar { left: 0; padding: 0 28px; height: 64px; }
  .appbar .brand .logo { display: none; }
  .appbar .brand h1 { font-size: 22px; }
  .pager { transform: none !important; transition: none; }
  .view { display: none; flex: 1 1 100%; padding: 84px 28px 40px; }
  .view.active { display: block; }
  .view-inner { max-width: 1320px; }
  .desk-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
  .desk-2e { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .desk-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
  .desk-2 > .stack, .desk-2e > .stack { gap: 16px; }
  .hero { min-height: 470px; }
  .hero-day { font-size: 72px; }
  .census { grid-template-columns: repeat(4, 1fr); }
  .map-el { height: 70vh; max-height: 760px; }
  .sheet { left: auto; right: 24px; bottom: 24px; top: 24px; width: 480px; max-height: none; border-radius: 28px; border-bottom: 1px solid var(--line-2); transform: translateX(calc(100% + 40px)); }
  .sheet.open { transform: none; }
  .sheet .grab { display: none; }
  .sheet .sheet-body { padding-top: 20px; }
  .ptr { display: none; }
  .records { margin: 0; padding: 0; flex-wrap: wrap; }
  .record { flex: 1 1 170px; }
  .toasts { top: auto; bottom: 24px; align-items: flex-end; right: 24px; left: auto; }
}

@media (min-width: 1400px) {
  .desk-2 { grid-template-columns: 1.5fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
