:root {
  --red: #dc2626;
  --red-dark: #991b1b;
  --orange: #ea580c;
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --green: #16a34a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

.screen {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 90px;
}

h1 { font-size: 1.4rem; margin: 8px 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
p.muted, span.muted { color: var(--muted); font-size: 0.85rem; }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

input, textarea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0b1220;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 10px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  padding: 12px 16px;
  font-weight: 600;
}

.btn-primary { background: var(--red); color: white; width: 100%; }
.btn-secondary { background: #334155; color: var(--text); width: 100%; }
.btn-link { background: none; color: var(--muted); text-decoration: underline; width: 100%; }

.error-text { color: #fca5a5; font-size: 0.85rem; min-height: 1.2em; margin-bottom: 8px; }

/* Notruf-Leiste */
.emergency-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.emergency-btn {
  background: var(--red-dark);
  color: white;
  border-radius: 12px;
  padding: 10px 4px;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform .08s, background .2s;
}
.emergency-btn .num { font-size: 1.3rem; font-weight: 800; }
.emergency-btn.armed { background: var(--red); transform: scale(1.05); box-shadow: 0 0 0 3px #fecaca; }
.emergency-hint { text-align: center; font-size: 0.75rem; color: var(--muted); margin-top: 6px; }

/* Haupt-Buttons */
.action-row { display: flex; flex-direction: column; gap: 14px; margin: 18px 0; }

.help-btn {
  background: var(--orange);
  color: white;
  border-radius: 16px;
  padding: 20px;
  font-size: 1.15rem;
  text-align: center;
}

.sos-btn {
  position: relative;
  background: var(--red);
  color: white;
  border-radius: 16px;
  padding: 26px;
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
.sos-btn small { display: block; font-size: 0.75rem; font-weight: 400; margin-top: 4px; opacity: .85; }
.sos-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: rgba(255,255,255,0.3);
  transition: width linear;
}

.member-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #334155;
}
.member-row:last-child { border-bottom: none; }

.alert-item {
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: #0b1220;
  border-left: 4px solid var(--muted);
}
.alert-item.active.sos { border-left-color: var(--red); }
.alert-item.active.help { border-left-color: var(--orange); }
.alert-item.cancelled, .alert-item.resolved { opacity: .6; }
.alert-item .row { display: flex; justify-content: space-between; align-items: center; }
.alert-item button { padding: 6px 10px; font-size: 0.8rem; margin-left: 8px; }

#map { width: 100%; height: 220px; border-radius: 12px; margin-bottom: 14px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.toggle-row { display: flex; justify-content: space-between; align-items: center; }
.switch {
  position: relative; width: 46px; height: 26px;
  background: #334155; border-radius: 999px; cursor: pointer;
}
.switch.on { background: var(--green); }
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
  background: white; border-radius: 50%; transition: left .15s;
}
.switch.on .knob { left: 22px; }

.banner {
  background: var(--red);
  color: white;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-weight: 700;
}

code.invite { background: #0b1220; padding: 4px 8px; border-radius: 8px; letter-spacing: 1px; }
