/* Ruhige Lesefarben: warmes Creme statt Reinweiss, fast schwarze Schrift und
   ein einziges gedecktes Blaugrün als Akzent. Das Blaugrün bleibt auch bei
   Rot-Grün-Schwäche klar von Creme und Schwarz unterscheidbar. */
:root {
  --ground: #FBF5E6;
  --ink: #14110F;
  --ink-soft: #4A4335;
  --paper: #FFFFFF;
  --accent: #1F5F5B;
  --accent-soft: #DCE9E4;
  --red: #8A1C0E;
  --display: 'Bricolage Grotesque', 'Avenir Next', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }

.view {
  width: 100%;
  max-width: 460px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* ---------- Bausteine ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.brand svg { flex-shrink: 0; color: var(--accent); }
.brand-wave { stroke: var(--ground); }

.accent { color: var(--accent); }

.btn {
  width: 100%;
  min-height: 58px;
  padding: 0 20px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 19px;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn.soft { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--ink); }
.btn.ghost {
  min-height: 52px;
  background: transparent;
  color: var(--ink);
  font-family: var(--body);
  font-weight: 700;
  font-size: 16px;
}
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.small {
  width: 50%;
  min-height: 44px;
  align-self: center;
  padding: 0 12px;
  border-radius: 14px;
  font-size: 14px;
  gap: 6px;
}
.btn.danger-solid {
  min-height: 52px;
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
  font-family: var(--body);
  font-weight: 700;
  font-size: 16px;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.msg {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 500;
}

/* ---------- 1 · The door ---------- */

.door-body {
  flex-grow: 1;
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.intro { display: flex; flex-direction: column; gap: 10px; }
.intro h1 {
  font-family: var(--display);
  font-weight: 800;
  /* So bemessen, dass "Lose your phone," auch auf schmalen Telefonen in
     eine Zeile passt. */
  font-size: clamp(30px, 10.4vw, 48px);
  line-height: 0.98;
  letter-spacing: -0.03em;
}
.intro p { max-width: 360px; }

.card {
  padding: 20px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Umschalter: dasselbe Formular öffnet eine Seite oder legt eine neue an. */
.modes {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--accent-soft);
  border-radius: 14px;
}
.modes button {
  flex: 1 1 0;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-family: var(--body);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.modes button[aria-pressed="true"] { background: var(--accent); color: var(--paper); }

.mode-note { font-size: 15px; }

fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend, .pin-row > label {
  padding: 0;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
}
.pin-row { display: flex; flex-direction: column; }

.dob { display: flex; gap: 8px; }
.dob .field { flex: 1 1 0; min-width: 0; }
.dob .field.year { flex-grow: 1.6; }

.textlink {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font-family: var(--body);
  font-weight: 700;
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.after-note { text-align: center; font-size: 15px; color: var(--ink-soft); }

.field {
  width: 100%;
  height: 58px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 500;
  font-size: 24px;
  text-align: center;
}
.field::placeholder { color: #6F6757; font-size: 18px; }
.field.pin { font-size: 30px; letter-spacing: 0.5em; padding-left: 0.5em; }
.field.pin.masked { -webkit-text-security: disc; }

.shake { animation: shake 0.3s; }
@keyframes shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---------- Anleitung für Neue ---------- */

.guide {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--ground);
  color: var(--ink);
  overflow-y: auto;
}
.guide-inner {
  width: 100%;
  max-width: 460px;
  min-height: 100%;
  margin: 0 auto;
  padding: 28px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.guide-top { display: flex; align-items: center; justify-content: space-between; }
.close {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.guide h2 {
  margin-top: 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(22px, 6.4vw, 26px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.num {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--paper);
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.steps h3 {
  margin-bottom: 4px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.steps p { font-size: 17px; }

.guide-note {
  padding: 16px 18px;
  background: var(--accent-soft);
  border-radius: 18px;
}

/* ---------- 2 · Your page ---------- */

.page {
  height: 100dvh;
  padding: 28px 24px 16px;
  gap: 18px;
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  background: var(--accent-soft);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill.hurry { background: var(--ink); color: var(--paper); }

.page h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 32px;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.paper {
  flex: 1 1 0;
  min-height: 200px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.paper label { padding: 16px 20px 0; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.paper textarea {
  flex-grow: 1;
  width: 100%;
  border: 0;
  resize: none;
  background: transparent;
  padding: 10px 20px 16px;
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
}
.paper textarea:focus { outline: none; }
.paper textarea::placeholder { color: #6F6757; }
.paper:focus-within { border-color: var(--accent); }

.paper-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 2px solid var(--accent-soft);
  font-size: 14px;
  font-weight: 500;
}
.paper-foot svg { color: var(--accent); flex-shrink: 0; }
.paper-foot svg.off { visibility: hidden; }
#status { flex-grow: 1; }
.count { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Sicherheitsabfrage ---------- */

.confirm {
  width: calc(100% - 48px);
  max-width: 380px;
  padding: 24px 20px 20px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 24px;
}
.confirm::backdrop { background: rgba(20, 17, 15, 0.6); }
.confirm h2 {
  margin-bottom: 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.confirm .msg { margin-top: 14px; }
.confirm-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }

.noscript { padding: 24px; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .shake { animation: none; }
  .btn { transition: none; }
}
