/* =====================================================================
   Wunschkiste — Design-System „Geschenkpapier & Schleife"
   Ziel: mobil zuerst, sehr einfach & hochlesbar (auch für Oma/Opa).
   Warme, taktile Ästhetik statt generischem Lila-auf-Weiß.
   Keine externen Fonts (strikte CSP) → charakterstarker System-Serif + klare Body-Schrift.
   ===================================================================== */

:root {
  /* Farben – Licht */
  --paper: #faf4e9;
  --paper-2: #f3ead9;
  --card: #fffdf8;
  --ink: #2a211a;
  --ink-soft: #6f6153;
  --line: #e7dcc8;

  --primary: #e0562d;       /* warmes Korall – Hauptaktion */
  --primary-dark: #c1431d;
  --on-primary: #fffaf4;
  --berry: #7a2f52;         /* tiefe Beere – sekundär */
  --honey: #eaa13a;         /* Honig – Priorität/Akzent */
  --success: #2e7d55;
  --success-soft: #e3f0e7;
  --danger: #c0392b;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;

  --r: 20px;
  --r-sm: 14px;
  --shadow: 0 2px 8px rgba(60, 40, 20, 0.07);
  --shadow-lg: 0 16px 40px rgba(60, 40, 20, 0.18);
  --maxw: 620px;
  --tap: 56px; /* Mindesthöhe für Tap-Ziele (Fingerfreundlichkeit) */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1613;
    --paper-2: #221a15;
    --card: #26201a;
    --ink: #f5eee1;
    --ink-soft: #bcac98;
    --line: #3a3028;
    --primary: #f4693c;
    --primary-dark: #d6552b;
    --success-soft: #17321f;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 18px;                 /* großzügige Basisgröße für gute Lesbarkeit */
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  /* dezente „Papier"-Textur */
  background-image:
    radial-gradient(circle at 20% 10%, rgba(224, 86, 45, 0.05), transparent 45%),
    radial-gradient(circle at 90% 30%, rgba(122, 47, 82, 0.05), transparent 40%);
  background-attachment: fixed;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}

/* ---------------- Kopf-/Fußzeile ---------------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
/* „Geschenkband" unter der Kopfzeile */
.app-header::after {
  content: ""; display: block; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--honey) 55%, var(--berry));
}
.app-header__inner, .container {
  max-width: var(--maxw); margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
}
.app-header__inner {
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.5rem; letter-spacing: .01em;
  text-decoration: none; color: var(--ink);
  display: inline-flex; gap: 8px; align-items: center;
}
.header-actions { display: flex; gap: 8px; align-items: center; }

.container { padding-top: 22px; padding-bottom: 48px; }

.app-footer {
  max-width: var(--maxw); margin: 0 auto; padding: 28px 16px 40px;
  color: var(--ink-soft); font-size: 0.82rem; text-align: center; line-height: 1.7;
}
.app-footer a { color: var(--ink-soft); }

/* ---------------- Typografie ---------------- */
h1 { font-family: var(--font-display); font-size: 2rem; line-height: 1.15; margin: 0 0 6px; font-weight: 700; }
h2 { font-family: var(--font-display); font-size: 1.4rem; margin: 26px 0 12px; }
h3 { font-size: 1.15rem; margin: 0 0 6px; font-weight: 700; }
.subtitle { color: var(--ink-soft); margin: 0 0 22px; font-size: 1.05rem; }
.muted { color: var(--ink-soft); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 700; color: var(--primary); }

/* ---------------- Karten ---------------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px; box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card--clickable { cursor: pointer; transition: transform .1s ease, box-shadow .15s ease; }
.card--clickable:active { transform: scale(.99); }
@media (hover: hover) { .card--clickable:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); } }

/* ---------------- Buttons (groß & taktil) ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px; justify-content: center;
  min-height: var(--tap);
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
  padding: 12px 20px; border-radius: 999px; font-size: 1.05rem; font-weight: 700;
  font-family: var(--font-body); cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(.97); }
@media (hover: hover) { .btn:hover { background: var(--paper-2); } }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: var(--shadow); }
@media (hover: hover) { .btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); } }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn--block { width: 100%; }
.btn--big { min-height: 62px; font-size: 1.15rem; padding: 16px 24px; }
.btn--sm { min-height: 44px; padding: 8px 16px; font-size: .95rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Große Auswahl-Kacheln (z. B. „Wie möchtest du den Wunsch erfassen?") */
.choice {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-sm);
  padding: 16px; margin-bottom: 12px; cursor: pointer; min-height: var(--tap);
  transition: border-color .15s ease, transform .08s ease;
}
.choice:active { transform: scale(.99); }
@media (hover: hover) { .choice:hover { border-color: var(--primary); } }
.choice__icon {
  flex: 0 0 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.7rem; background: var(--paper-2);
}
.choice__title { font-weight: 700; font-size: 1.1rem; }
.choice__sub { color: var(--ink-soft); font-size: .92rem; }
.choice__chev { margin-left: auto; color: var(--ink-soft); font-size: 1.3rem; }

/* ---------------- Formulare (große Felder) ---------------- */
label { display: block; font-weight: 700; font-size: 1rem; margin: 16px 0 6px; }
input, select, textarea {
  width: 100%; padding: 14px 16px; border: 2px solid var(--line);
  border-radius: var(--r-sm); font-size: 1.05rem; font-family: inherit;
  background: var(--card); color: var(--ink); min-height: var(--tap);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
textarea { min-height: 90px; resize: vertical; }
.field-inline { display: flex; gap: 12px; }
.field-inline > * { flex: 1; }
.check {
  display: flex; align-items: center; gap: 12px; margin-top: 14px;
  padding: 14px 16px; border: 2px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
}
.check input { width: 26px; height: 26px; flex: 0 0 auto; accent-color: var(--primary); }
.check label { margin: 0; }

/* Prioritäts-Auswahl als große Segmente */
.prio { display: flex; gap: 8px; }
.prio button {
  flex: 1; min-height: var(--tap); border: 2px solid var(--line); background: var(--card);
  border-radius: var(--r-sm); font-weight: 700; font-size: .95rem; cursor: pointer; color: var(--ink);
}
.prio button.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--card)); }

/* ---------------- Navigation / Zurück ---------------- */
.crumb { display: inline-flex; align-items: center; gap: 8px; color: var(--primary);
  background: none; border: none; font-size: 1rem; font-weight: 700; cursor: pointer; padding: 6px 0; margin-bottom: 8px; }

/* ---------------- Wunsch-/Produktzeile ---------------- */
.item { display: flex; gap: 16px; align-items: flex-start; }
.item__img {
  width: 84px; height: 84px; border-radius: 14px; object-fit: cover;
  background: var(--paper-2); flex-shrink: 0; display: grid; place-items: center; font-size: 2.1rem;
}
.item--big .item__img { width: 108px; height: 108px; }
.item__body { flex: 1; min-width: 0; }
.item__title { font-weight: 700; font-size: 1.15rem; line-height: 1.25; }
.item__meta { color: var(--ink-soft); font-size: .95rem; margin-top: 2px; }
.item__price { font-weight: 700; color: var(--berry); }
.item__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* ---------------- Badges / Bänder ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .82rem; font-weight: 800; padding: 4px 11px; border-radius: 999px;
}
.badge--heart { background: color-mix(in srgb, var(--berry) 15%, var(--card)); color: var(--berry); }
.badge--prio { background: color-mix(in srgb, var(--honey) 22%, var(--card)); color: #96631a; }
.badge--group { background: color-mix(in srgb, var(--primary) 14%, var(--card)); color: var(--primary-dark); }
.badge--reserved { background: var(--success-soft); color: var(--success); }
.badge--purchased { background: var(--success); color: #fff; }

/* Prioritäts-Akzent an der Karte */
.card--heart { border-left: 6px solid var(--berry); }
.card--high  { border-left: 6px solid var(--honey); }

/* ---------------- Fortschritt (Gruppen-Geschenk) ---------------- */
.progress { background: var(--paper-2); border-radius: 999px; height: 14px; overflow: hidden; margin: 10px 0 6px; }
.progress__bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--honey)); border-radius: 999px; transition: width .4s ease; }

/* ---------------- Statistik-Leiste ---------------- */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 8px; text-align: center; }
.stat__value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat__label { font-size: .72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }

/* ---------------- Hinweise / Empty ---------------- */
.notice { padding: 14px 16px; border-radius: var(--r-sm); font-size: 1rem; }
.notice--info { background: color-mix(in srgb, var(--primary) 10%, var(--card)); color: var(--ink); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); }
.notice--warn { background: color-mix(in srgb, var(--honey) 18%, var(--card)); color: #8a5a12; }
.notice--ok { background: var(--success-soft); color: var(--success); }
.empty { text-align: center; color: var(--ink-soft); padding: 40px 16px; }
.empty__emoji { font-size: 3rem; display: block; margin-bottom: 10px; }

/* Große Hero-Fläche (öffentliche Sicht) */
.hero { text-align: center; padding: 8px 0 20px; }
.hero__badge {
  display: inline-flex; align-items: center; gap: 8px; background: var(--card);
  border: 2px solid var(--line); border-radius: 999px; padding: 8px 18px; font-weight: 700; margin-bottom: 14px;
}
.hero h1 { font-size: 2.3rem; }

/* ---------------- Scanner / Foto ---------------- */
.scanner { position: relative; background: #000; border-radius: var(--r); overflow: hidden; aspect-ratio: 3/4; max-height: 60vh; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner__frame { position: absolute; inset: 22% 14%; border: 3px solid rgba(255,255,255,.9); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
.hint { text-align: center; color: var(--ink-soft); font-size: .95rem; margin: 10px 0; }
.preview-photo { width: 100%; max-height: 240px; object-fit: contain; border-radius: var(--r-sm); background: var(--paper-2); }

/* ---------------- Modal / Bottom-Sheet ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(30, 20, 12, .55); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
@media (min-width: 600px) { .modal-backdrop { align-items: center; padding: 16px; } }
.modal {
  background: var(--card); width: 100%; max-width: 560px;
  border-radius: 26px 26px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg); max-height: 94vh; overflow-y: auto;
  animation: sheet .26s cubic-bezier(.2, .8, .2, 1);
}
@media (min-width: 600px) { .modal { border-radius: 26px; } }
.modal__grip { width: 44px; height: 5px; border-radius: 999px; background: var(--line); margin: 8px auto 6px; }
.modal__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal__head h3 { font-family: var(--font-display); font-size: 1.35rem; }
.modal__close { background: var(--paper-2); border: none; width: 44px; height: 44px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; color: var(--ink); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: var(--paper); padding: 13px 22px; border-radius: 999px;
  font-size: 1rem; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 100; opacity: 0;
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- FAB ---------------- */
.fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 30;
  border: none; background: var(--primary); color: var(--on-primary);
  border-radius: 999px; padding: 17px 30px; font-size: 1.15rem; font-weight: 800;
  box-shadow: var(--shadow-lg); cursor: pointer; display: inline-flex; gap: 10px; align-items: center;
}
.fab:active { transform: translateX(-50%) scale(.96); }
.has-fab { padding-bottom: 104px; }

/* ---------------- Token-Box ---------------- */
.token-box { display: flex; gap: 10px; align-items: center; }
.token-box code {
  background: var(--paper-2); padding: 12px 14px; border-radius: 12px;
  font-size: .95rem; word-break: break-all; flex: 1; border: 1px solid var(--line);
}

/* ---------------- Skeleton ---------------- */
.skeleton { background: linear-gradient(90deg, var(--line) 25%, var(--card) 50%, var(--line) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r-sm); }
.skeleton-card { height: 110px; margin-bottom: 14px; }

/* ---------------- Animationen ---------------- */
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet { from { transform: translateY(100%); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.reveal { animation: rise .45s ease both; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
