:root {
  --red: #c8102e;
  --red-dark: #7a0019;
  --bg: #f4f1ee;
  --card: #ffffff;
  --text: #1b1b1b;
  --muted: #6b6b6b;
  --line: #e3ddd7;
  --green: #1f9d55;
  --yellow: #e0a100;
  --bad: #d0312d;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --card: #1f1f1f;
    --text: #f1f1f1;
    --muted: #a3a3a3;
    --line: #333;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.4;
  -webkit-user-select: none;
  user-select: none;
}
input { -webkit-user-select: text; user-select: text; }

.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: block; }
.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
}
.center { text-align: center; }
.muted { color: var(--muted); padding-top: 40vh; }

h1 { font-size: 28px; margin: 8px 0 8px; text-align: center; }
.lead { text-align: center; color: var(--muted); margin: 0 0 24px; }
.logo { display: block; width: 88px; height: 88px; border-radius: 20px; margin: 8px auto 12px; }
.logo-sm { width: 44px; height: 44px; border-radius: 11px; }

.btn {
  appearance: none; border: 0; border-radius: 12px; cursor: pointer;
  font: inherit; font-weight: 600; padding: 12px 18px;
  background: var(--line); color: var(--text);
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--red); color: #fff; }
.btn.big { display: block; width: 100%; padding: 18px; font-size: 20px; margin-top: 12px; }
.btn.small { padding: 8px 12px; font-size: 15px; white-space: nowrap; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); display: block; margin: 16px auto 0; }
.btn[disabled] { opacity: .5; }
.link { background: none; border: 0; color: var(--red); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.link.small { font-size: 14px; }
#btn-skip-install { display: block; margin: 24px auto 0; color: var(--muted); font-size: 14px; text-align: center; }

input {
  width: 100%; font: inherit; font-size: 20px; padding: 14px 16px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text);
}
input:focus { outline: none; border-color: var(--red); }

.steps { list-style: none; padding: 0; margin: 0; }
.steps li {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
}
.steps small { color: var(--muted); }
.num {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--red); color: #fff; font-weight: 700;
  display: grid; place-items: center;
}
.share { width: 22px; height: 22px; vertical-align: -4px; color: #0a84ff; margin-left: 4px; }

.hint { color: var(--muted); font-size: 14px; margin: 10px 4px; }
.hint.warn { color: var(--bad); font-weight: 600; text-align: center; }

.top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.top .title { font-weight: 800; font-size: 22px; }
.top .sub { color: var(--muted); font-size: 15px; }

.card { background: var(--card); border-radius: 16px; padding: 6px 16px; margin-bottom: 12px; }
.checklist .row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.checklist .row:last-child { border-bottom: 0; }
.checklist .txt { flex: 1; min-width: 0; }
.checklist .txt b { display: block; }
.checklist .txt small { color: var(--muted); font-size: 14px; display: block; }
.dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--yellow); }
.dot.ok { background: var(--green); }
.dot.bad { background: var(--bad); }
.tips { padding: 14px 16px; font-size: 15px; }
.tips ul { margin: 6px 0 0; padding-left: 20px; }
.tips li { margin: 4px 0; }

/* Bereitschaft */
.screen.dark { background: #000; color: #ddd; }
.standby {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom)); text-align: center;
}
.sb-status { position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 0; right: 0; font-size: 14px; color: #999; display: flex; gap: 8px; justify-content: center; align-items: center; }
.clock { font-size: 88px; font-weight: 200; font-variant-numeric: tabular-nums; letter-spacing: 2px; }
.sb-date { color: #888; margin-bottom: 36px; }
.sb-label { font-size: 22px; font-weight: 800; letter-spacing: 6px; color: var(--red); }
.sb-sub { color: #777; margin-top: 6px; }
.sb-warn { margin-top: 28px; color: #ffb020; font-size: 15px; max-width: 360px; }
.sb-warn.bad { color: #ff5a4f; font-weight: 700; }
.standby .btn.ghost { margin-top: 48px; border-color: #333; color: #777; }

/* Alarm */
.screen.alarm { background: var(--red); color: #fff; animation: flash 1s steps(1) infinite; }
.screen.alarm.answered { animation: none; background: #5b0a16; }
.screen.alarm.ended { animation: none; background: #333; }
@keyframes flash { 0% { background: var(--red); } 50% { background: var(--red-dark); } }
.alarm-inner {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
  max-width: 520px; margin: 0 auto; text-align: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.alarm-kind { font-size: 20px; font-weight: 800; letter-spacing: 8px; opacity: .9; }
.alarm-stichwort { font-size: 38px; font-weight: 900; line-height: 1.1; margin: 14px 0 18px; word-wrap: break-word; }
.alarm-ort { font-size: 22px; font-weight: 700; }
.alarm-text { font-size: 19px; margin-top: 10px; white-space: pre-wrap; }
.alarm-time { margin-top: 16px; opacity: .85; font-variant-numeric: tabular-nums; }
.tap-sound {
  margin: 20px auto 0; background: #fff; color: var(--red); border: 0; border-radius: 30px;
  font: inherit; font-weight: 800; padding: 12px 22px; animation: pulse 1s infinite;
}
@keyframes pulse { 50% { transform: scale(1.06); } }
.alarm-actions { display: grid; gap: 12px; margin-top: 32px; }
.btn.huge { font-size: 24px; padding: 22px; border-radius: 16px; font-weight: 900; }
.btn.yes { background: #fff; color: #0b7a3b; }
.btn.no { background: rgba(0,0,0,.35); color: #fff; }
.alarm-done { margin-top: 32px; font-size: 22px; font-weight: 800; }
.screen.alarm .btn.ghost { color: #fff; border-color: rgba(255,255,255,.5); margin-top: 24px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #222; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 15px;
  max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.3); z-index: 10;
}
