:root {
  --bg: #0f172a;
  --accent: #e11d48;
  --card: rgba(255, 255, 255, 0.96);
  --text: #0f172a;
  --muted: #64748b;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  overscroll-behavior: none;
}

.hidden { display: none !important; }

/* ---------- Login ---------- */
.login {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 800px at 30% 20%, #1e293b, #0f172a);
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: 20px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
}
.login-logo { font-size: 44px; }
.login-card h1 { margin: 4px 0 0; font-size: 24px; }
.login-sub { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.login-card input {
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button {
  margin-top: 4px;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.login-card button:disabled { opacity: 0.6; }
.login-error { color: var(--accent); font-size: 14px; min-height: 18px; }

/* ---------- App ---------- */
.app { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; }

.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0));
  color: #fff;
  z-index: 10;
  pointer-events: none;
}
.topbar .brand { font-weight: 700; font-size: 16px; }
.topbar .stats {
  margin-left: auto;
  display: flex;
  gap: 10px;
  font-size: 12px;
  opacity: 0.9;
}
.topbar .stats span {
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.icon-btn {
  pointer-events: auto;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 999px;
  font-size: 16px;
  cursor: pointer;
}

/* ---------- Bottom-Sheet ---------- */
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
  z-index: 11;
  max-height: 70vh;
  transform: translateY(calc(100% - 56px));
  transition: transform 0.25s ease;
  padding-bottom: var(--safe-bottom);
}
.sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 44px; height: 5px;
  background: #cbd5e1;
  border-radius: 999px;
  margin: 10px auto;
  cursor: grab;
}
.sheet-body { padding: 4px 18px 20px; overflow-y: auto; max-height: calc(70vh - 40px); }
.sheet-empty { color: var(--muted); text-align: center; font-size: 14px; }

/* ---------- Trip-UI im Sheet ---------- */
.trip-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.trip-head h2 { margin: 0; font-size: 18px; }
.btn-primary {
  border: 0; background: var(--accent); color: #fff;
  padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.trip-mode {
  font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px;
}
.trip-mode.on { background: #ecfdf5; color: #065f46; }
.trip-mode.off { background: #f1f5f9; color: var(--muted); }
.trip-list { list-style: none; margin: 0; padding: 0; }
.trip-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #eef2f7;
}
.trip-dot { width: 12px; height: 12px; border-radius: 999px; flex: 0 0 auto; }
.trip-name { flex: 1; font-weight: 500; }
.btn-ghost {
  border: 1px solid #e2e8f0; background: #fff; color: var(--text);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; cursor: pointer;
}

/* "Zuletzt hier"-Marker */
.here-marker {
  width: 18px; height: 18px; border-radius: 999px;
  background: var(--accent); border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(0,0,0,0.4);
}

/* MapLibre-Attribution etwas dezenter */
.maplibregl-ctrl-attrib { font-size: 10px; }
