/* Design angelehnt an wegweiser.kgs.la – gleiche Farben, Schriften und Kopfzeile */

/* Schriften liegen lokal im Binary (kein Google Fonts → keine Daten an Dritte) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/fraunces.woff2") format("woff2");
}

:root {
  --paper: #F5F8F1;
  --brand-top: #0C4A35;
  --brand-bottom: #115740;
  --paper-raised: #FFFFFF;
  --ink: #1E2B21;
  --ink-soft: #5C6B5E;
  --amber: #7CA430;
  --amber-deep: #115740;
  --lantern: #7A3B2E;
  --line: #DCE6D6;
  --shared-tint: #E6EEDD;
  --green-ok: #4C7A52;
  --error-bg: #F7E7E2;
  --error: #7A3B2E;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #13201A; --paper-raised: #1C2A21; --ink: #E9F1E3; --ink-soft: #A9BFA9;
    --amber: #9DC544; --amber-deep: #B7D96A; --lantern: #D98B6E; --line: #2C3B31;
    --shared-tint: #24352A; --green-ok: #7FB489; --error-bg: #3A2620; --error: #E8A88F;
  }
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--paper); color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--amber-deep); }

/* ---------- Kopfzeile wie im Wegweiser ---------- */
header.top {
  padding: env(safe-area-inset-top, 0px) 20px 0;
  background: linear-gradient(180deg, var(--brand-top) 0%, var(--brand-bottom) 100%);
  color: #FFF7EC;
}
.top-inner { max-width: 640px; margin: 0 auto; padding: 22px 0 30px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.top-text { min-width: 0; }
.brand-link { color: inherit; text-decoration: none; }
.app-name {
  display: block;
  font-family: Fraunces, Georgia, serif; font-weight: 600;
  font-size: clamp(28px, 8vw, 38px); letter-spacing: -0.01em; margin: 0 0 6px;
}
.subline { font-size: 15px; opacity: .92; margin: 0; max-width: 46ch; }
.brandmark {
  display: block;
  width: clamp(72px, 24vw, 116px); height: clamp(72px, 24vw, 116px);
  border-radius: 18px; flex: 0 0 auto;
  box-shadow: rgba(0, 0, 0, .22) 0 4px 14px;
}

/* ---------- Inhalt ---------- */
main { max-width: 640px; margin: 0 auto; padding: 26px 16px 60px; }
h1 {
  font-family: Fraunces, Georgia, serif; font-weight: 600;
  font-size: clamp(24px, 6.5vw, 30px); letter-spacing: -0.01em; margin: 0 0 8px;
}
.lead { color: var(--ink-soft); margin: 0 0 20px; }
.legend { font-size: 13px; color: var(--ink-soft); margin: 18px 2px 0; }
.hint { color: var(--ink-soft); font-size: 13.5px; margin: 2px 0 8px; }
.description { white-space: pre-line; color: var(--ink-soft); margin: 0 0 20px; }
.muted { color: var(--ink-soft); }
code { background: var(--shared-tint); color: var(--amber-deep); padding: 1px 6px; border-radius: 6px; font-size: .92em; }

.card {
  display: block; background: var(--paper-raised);
  border: 1px solid var(--line); border-radius: 14px; padding: 16px;
}

/* ---------- Formulare ---------- */
label { display: block; font-weight: 600; margin-top: 18px; }
label:first-child { margin-top: 0; }
.optional {
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; margin-left: 4px; border-radius: 999px;
  background: var(--shared-tint); color: var(--ink-soft); vertical-align: 1px;
}
input, textarea {
  width: 100%; font: inherit; font-size: 16px; /* 16px verhindert Auto-Zoom auf dem iPhone */
  padding: 10px 12px; margin-top: 6px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink);
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--amber); outline-offset: 1px; border-color: transparent; }

button, .button {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  padding: 10px 18px; margin-top: 18px; border: 0; border-radius: 999px;
  background: var(--brand-bottom); color: #FFF7EC; text-decoration: none;
}
button:active, .button:active { transform: scale(.98); }
.button.secondary { background: transparent; color: var(--amber-deep); border: 1.5px solid var(--amber-deep); }
button.danger { background: var(--lantern); }

/* ---------- Hinweise ---------- */
.notice { padding: 12px 16px; border-radius: 14px; margin-bottom: 18px; }
.notice.ok { background: var(--shared-tint); color: var(--ink); }
.notice.error { background: var(--error-bg); color: var(--error); }
.notice .share { margin-top: 8px; }
.notice .button { margin-top: 10px; }

/* ---------- Slots ---------- */
ul.slots { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.slot { background: var(--paper-raised); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.slot-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.slot .label { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 18px; }
.slot .count {
  flex: 0 0 auto; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
  background: var(--shared-tint); color: var(--green-ok);
}
.slot.full .label { color: var(--ink-soft); }
.slot.full .count { color: var(--ink-soft); }
.slot .names { margin: 6px 0 0; font-size: 14px; color: var(--ink-soft); }
.slot p.muted { margin: 8px 0 0; font-size: 14px; }

form.signup { display: flex; gap: 8px; margin-top: 10px; }
form.signup input[name="name"] { flex: 1; margin-top: 0; }
form.signup button { margin-top: 0; }

/* ---------- Zwischenüberschriften auf der Liste ---------- */
ul.slots li.section { padding: 14px 2px 0; }
ul.slots li.section:first-child { padding-top: 0; }
ul.slots li.section h2 {
  font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 21px;
  margin: 0; padding-bottom: 6px; border-bottom: 2px solid var(--line);
}

/* ---------- Breite Seiten (Anlegen/Bearbeiten) ----------
   Desktop: Feldname + weiße Karte links, Erklärung rechts daneben.
   Handy:   Erklärung über der Karte, eingeklappt hinter einem „?“ (ohne JavaScript, per Checkbox). */
body.wide main, body.wide .top-inner { max-width: 940px; }
.fields { margin-top: 8px; }
.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  column-gap: 32px;
  margin-top: 26px;
}
.field-head { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.field-head > label, .field-head > .field-label { margin: 0; font-weight: 600; font-size: 16px; }
.field > .control { grid-column: 1; grid-row: 2; min-width: 0; }
.field > .control.card { padding: 14px; box-shadow: rgba(12, 74, 53, .05) 0 1px 3px; }
.field > .help {
  grid-column: 2; grid-row: 1 / span 2; align-self: start;
  font-size: 13.5px; line-height: 1.5; color: var(--ink-soft);
  border-left: 2px solid var(--line); padding: 2px 0 2px 16px; margin-top: 34px;
}
.help p { margin: 0 0 8px; }
.help p:last-child { margin-bottom: 0; }
.help em { font-style: normal; color: var(--ink); }
.help .example {
  display: flex; justify-content: space-between; gap: 8px;
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 10px; color: var(--ink); font-size: 13px;
}
.kbd {
  display: inline-block; min-width: 1.6em; text-align: center; font-size: 12px; font-weight: 600;
  padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  background: var(--paper-raised); color: var(--ink);
}
/* In der weißen Karte heben sich die Eingabefelder leicht getönt ab */
.field .card input, .field .card textarea { background: var(--paper); margin-top: 0; }
.field .card textarea { display: block; }
.field.submit { margin-top: 28px; }
.field.submit > .control { grid-row: 1; }
.field.submit button { margin-top: 0; }

/* Ein-/Ausklappen der Hilfe (nur auf dem Handy sichtbar) */
.help-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.help-btn {
  display: none; flex: 0 0 auto; cursor: pointer; user-select: none;
  width: 22px; height: 22px; border-radius: 50%; margin-left: auto;
  font-size: 13px; font-weight: 700; line-height: 22px; text-align: center;
  background: var(--shared-tint); color: var(--amber-deep);
}
.help-toggle:focus-visible ~ .field-head .help-btn { outline: 2px solid var(--amber); outline-offset: 2px; }
.help-toggle:checked ~ .field-head .help-btn { background: var(--amber-deep); color: var(--paper-raised); }

@media (max-width: 760px) {
  .field { grid-template-columns: minmax(0, 1fr); margin-top: 22px; }
  .help-btn { display: inline-block; }
  .field > .help {
    grid-column: 1; grid-row: 2; display: none; margin: 0 0 10px; padding: 10px 12px;
    border: 0; border-radius: 10px; background: var(--shared-tint); color: var(--ink); font-size: 13.5px;
  }
  .help-toggle:checked ~ .help { display: block; }
  .field > .control { grid-row: 3; }
  .field > .control.card { padding: 10px; }
  .ed-head, .ed-row { grid-template-columns: 28px minmax(0, 1fr) 56px 30px; gap: 4px; }
  .ed-row.heading { grid-template-columns: 28px minmax(0, 1fr) 30px; }
  .ed-handle { width: 28px; } .ed-del { width: 30px; }
  .field .card .ed-row input.ed-label { padding: 8px 6px; }
  .field.submit > .help { display: block; grid-row: 2; background: none; padding: 0; margin: 10px 0 0; color: var(--ink-soft); }
}

/* ---------- Zeilen-Editor ---------- */
.editor { margin: 0; }
.ed-head {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 76px 34px; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--ink-soft); padding: 0 0 4px;
}
.ed-head span:first-child { grid-column: 2; }
.ed-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ed-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 76px 34px; gap: 6px; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 4px;
}
.ed-row.heading { grid-template-columns: 34px minmax(0, 1fr) 34px; background: var(--shared-tint); margin-top: 8px; }
.ed-row.heading:first-child { margin-top: 0; }
.ed-row.dragging { opacity: .85; box-shadow: rgba(0, 0, 0, .18) 0 6px 18px; border-color: var(--amber); position: relative; z-index: 1; }
.field .card .ed-row input.ed-label { margin: 0; padding: 8px 10px; border-color: transparent; background: transparent; }
.field .card .ed-row input.ed-label:hover { border-color: var(--line); }
.field .card .ed-row input.ed-label:focus { background: var(--paper-raised); }
.ed-row input { margin: 0; padding: 8px 10px; }
.ed-row.heading .ed-label { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 17px; }
.ed-cap { text-align: center; font-variant-numeric: tabular-nums; border-color: var(--line) !important; background: var(--paper-raised) !important; }
.ed-handle, .ed-del {
  margin: 0; padding: 0; width: 34px; height: 38px; border-radius: 8px;
  background: transparent; color: var(--ink-soft); font-size: 18px; line-height: 1; font-weight: 400;
}
.ed-handle { cursor: grab; touch-action: none; user-select: none; }
.ed-row.dragging .ed-handle { cursor: grabbing; }
.ed-handle:hover, .ed-del:hover { background: var(--shared-tint); color: var(--ink); }
.ed-del:hover { color: var(--lantern); }
.ed-names { grid-column: 2 / -1; font-size: 12.5px; color: var(--green-ok); padding: 0 10px 4px; }
.ed-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.button.small { margin-top: 0; padding: 7px 14px; font-size: 14px; }
button.secondary { background: transparent; color: var(--amber-deep); border: 1.5px solid var(--amber-deep); }

/* ---------- Fertig-Seite + WhatsApp ---------- */
.done-step { margin-bottom: 16px; }
.done-step h2 { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 19px; margin: 0 0 4px; }
.done-step > p { margin: 0 0 12px; }
.done-step .hint { margin: 10px 0 0; }
.copy-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.copy-row input { flex: 1; min-width: 0; margin: 0; font-size: 14px; background: var(--paper); }
.copy-row .button { flex: 0 0 auto; }
.button.whatsapp { background: #1F7A4A; color: #fff; margin-top: 4px; }
.button.whatsapp::before { content: ""; display: inline-block; width: 1em; height: 1em; margin-right: 8px; vertical-align: -2px;
  background: currentColor; -webkit-mask: var(--wa-icon) center / contain no-repeat; mask: var(--wa-icon) center / contain no-repeat; }
:root { --wa-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 0 0-8.6 15.1L2 22l5-1.3A10 10 0 1 0 12 2zm0 18.2c-1.5 0-3-.4-4.3-1.2l-.3-.2-3 .8.8-2.9-.2-.3A8.2 8.2 0 1 1 12 20.2zm4.5-6.1c-.2-.1-1.5-.7-1.7-.8s-.4-.1-.6.1-.6.8-.8.9-.3.2-.5.1a6.7 6.7 0 0 1-3.3-2.9c-.3-.4.3-.4.7-1.4.1-.2 0-.3 0-.4l-.8-1.8c-.2-.5-.4-.4-.6-.4h-.5a1 1 0 0 0-.7.3 3 3 0 0 0-.9 2.2 5.2 5.2 0 0 0 1.1 2.7 11.8 11.8 0 0 0 4.5 4c1.7.7 2.3.8 3.2.6a2.7 2.7 0 0 0 1.8-1.3 2.2 2.2 0 0 0 .2-1.3c-.1-.1-.2-.2-.4-.3z'/%3E%3C/svg%3E"); }
.manage-links { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.manage-links .button { margin-top: 0; }
.manage-links .hint { margin: 0; }

.danger-zone { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }
.danger-zone a { color: var(--lantern); }

/* Honeypot: für Menschen unsichtbar, aber nicht display:none (das erkennen manche Bots) */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

footer {
  max-width: 640px; margin: 8px auto 0; padding: 0 20px 28px;
  font-size: 12.5px; color: var(--ink-soft); text-align: center;
}
footer a { color: inherit; }
