:root {
  --bg: #faf6f0;
  --card: #ffffff;
  --text: #2b2320;
  --muted: #7a6f68;
  --line: #e8e0d6;
  --accent: #c8433d;
  --accent-dark: #a8332e;
  --accent-soft: #fbe9e7;
  --ok: #2f8f5b;
  --ok-soft: #e4f4ea;
  --shadow: 0 1px 2px rgba(40, 20, 10, .06), 0 4px 14px rgba(40, 20, 10, .06);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1715;
    --card: #262120;
    --text: #f1ebe5;
    --muted: #a69a92;
    --line: #3a322e;
    --accent: #e2625c;
    --accent-dark: #c9463f;
    --accent-soft: #3c2523;
    --ok: #57b57f;
    --ok-soft: #21372b;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 0 16px calc(32px + env(safe-area-inset-bottom));
}
main { max-width: 640px; margin: 0 auto; }
a { color: var(--accent); }

header.top {
  padding: 22px 0 10px;
}
header.top h1 { margin: 0; font-size: 1.7rem; line-height: 1.2; letter-spacing: -.01em; }
header.top .sub { color: var(--muted); margin-top: 4px; }
.brand { font-size: .85rem; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 6px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 12px 0;
}
.card h2 { margin: 0 0 10px; font-size: 1.15rem; }

label { display: block; font-size: .9rem; color: var(--muted); margin: 12px 0 4px; }
label:first-child { margin-top: 0; }
input, textarea, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 48px;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

button, .btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  min-height: 48px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
}
button:active, .btn:active { background: var(--accent-dark); }
button:disabled { opacity: .5; cursor: default; }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn-secondary:active { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--muted); padding: 8px 10px; min-height: 40px; }
.btn-ghost:active { background: var(--bg); }
.btn-danger { color: var(--accent); }
.btn-block { width: 100%; }
.btn-small { min-height: 40px; padding: 8px 14px; font-size: .95rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.row .grow { flex: 1 1 200px; }
.row .fixed { flex: 0 0 auto; }

.hint { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }
.error { color: var(--accent); font-size: .95rem; margin-top: 8px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* Wunsch-Karten */
.wish {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: start;
  transition: opacity .2s;
}
.wish .thumb {
  width: 72px; height: 72px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  font-size: 2rem;
}
.wish .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.wish .title { font-weight: 650; font-size: 1.08rem; line-height: 1.3; margin: 2px 0 4px; overflow-wrap: anywhere; }
.wish .price { color: var(--muted); font-size: .95rem; }
.wish .note { color: var(--muted); font-size: .95rem; margin-top: 4px; white-space: pre-line; overflow-wrap: anywhere; }
.wish .actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.wish .actions > * { flex: 1 1 100px; }
.wish .actions .narrow { flex: 0 0 auto; min-width: 48px; }
.wish .shop { font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.wish .shop a { color: var(--accent); text-decoration: none; }

.wish.claimed { opacity: .55; }
.wish.claimed .title { text-decoration: line-through; text-decoration-thickness: 2px; }
.wish.claimed.mine { opacity: 1; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .85rem; font-weight: 600;
  padding: 6px 10px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok);
}
.badge.warn { background: var(--accent-soft); color: var(--accent); }

.count { color: var(--muted); font-size: .9rem; margin: 14px 2px 4px; }

/* Link-Kästen */
.linkbox {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg); border: 1px dashed var(--line);
  border-radius: 10px; padding: 8px 8px 8px 12px;
}
.linkbox code { flex: 1; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Umschalter */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { width: auto; min-height: 0; appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--line); position: relative; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }

/* Dialog */
dialog {
  border: 0; border-radius: var(--radius); padding: 0;
  width: min(92vw, 420px); background: var(--card); color: var(--text);
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog .inner { padding: 20px; }
dialog h3 { margin: 0 0 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 999px; font-size: .95rem;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 10;
  max-width: 90vw;
}
.toast.show { opacity: 1; }

.mylists a { display: block; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--text); }
.mylists a:first-child { border-top: 0; }
.mylists small { display: block; color: var(--muted); }
.drag-handle { cursor: grab; color: var(--muted); font-size: 1.3rem; padding: 0 4px; align-self: center; touch-action: none; }
.claimed-by { font-size: .9rem; color: var(--muted); margin-top: 4px; }

/* Bildauswahl */
.picker-status { color: var(--muted); font-size: .9rem; margin: 0 0 8px; min-height: 1.2em; }
.picker-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.pick {
  flex: 0 0 auto; width: 88px; height: 88px; padding: 0; min-height: 0;
  border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--muted);
  overflow: hidden; scroll-snap-align: start; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 1.6rem; font-weight: 500;
}
.pick small { font-size: .7rem; }
.pick img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.pick.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pick.selected::after {
  content: "✓"; position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: .85rem; display: flex; align-items: center; justify-content: center;
}
.pick:active { background: var(--line); }
