/* ============================================================
   Familien-Essensplaner – Styles
   Mobile-first, funktioniert auf Handy & PC.
   ============================================================ */

:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --card-2: #f0f2f5;
  --text: #1c2430;
  --muted: #6b7688;
  --line: #e4e8ee;
  --accent: #ff6b6b;
  --accent-dark: #e85555;
  --green: #2bb673;
  --green-dark: #1f9a5f;
  --shadow: 0 6px 20px rgba(28, 36, 48, 0.08);
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1c222b;
    --card-2: #262e39;
    --text: #eef1f5;
    --muted: #9aa5b4;
    --line: #2c3540;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior-y: contain;   /* verhindert versehentliches Neuladen durch Wisch-nach-unten */
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px 96px;
  min-height: 100vh;
}

/* ---------- Kopfzeile ---------- */
header.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding: 18px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
header.top h1 {
  font-size: 1.25rem;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
}
header.top .logo { font-size: 1.6rem; }

/* ---------- Views ---------- */
.view { display: none; animation: fade 0.25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h2.section { font-size: 1.05rem; margin: 18px 0 10px; font-weight: 700; }
.sub { color: var(--muted); font-size: 0.9rem; margin: 2px 0 14px; }

/* ---------- Buttons ---------- */
button { font-family: inherit; cursor: pointer; border: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; font-weight: 700;
  padding: 13px 18px; border-radius: 14px; font-size: 1rem;
  box-shadow: var(--shadow); transition: transform 0.1s, background 0.2s;
  width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn.secondary { background: var(--card); color: var(--text); border: 1.5px solid var(--line); box-shadow: none; }
.btn.small { width: auto; padding: 8px 14px; font-size: 0.85rem; border-radius: 11px; }

/* ---------- Wochenplan ---------- */
.day-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 14px;
}
.day-card .daylabel { width: 42px; font-weight: 800; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; }
.day-card .emoji { font-size: 1.9rem; }
.day-card .meal { flex: 1; min-width: 0; }
.day-card .meal .name { font-weight: 700; }
.day-card .meal .meta { color: var(--muted); font-size: 0.82rem; }
.day-card .reroll { background: var(--card-2); color: var(--text); border-radius: 10px; padding: 8px 10px; font-size: 1rem; }
.day-card.empty .meal .name { color: var(--muted); font-weight: 500; }
.kidtip { margin-top: 5px; font-size: 0.8rem; color: var(--green-dark); background: rgba(43,182,115,0.1);
  padding: 5px 9px; border-radius: 8px; line-height: 1.35; }
.modal-tip { font-size: 0.92rem; margin: 10px 0; padding: 10px 12px; }

.plan-actions { display: flex; gap: 10px; margin: 14px 0 6px; }

/* ---------- Tinder-Spiel ---------- */
.player-pick { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.chip {
  background: var(--card); border: 1.5px solid var(--line); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.swipe-area { position: relative; height: 440px; margin: 8px 0 18px; user-select: none; }
.card {
  position: absolute; inset: 0; background: var(--card); border-radius: 24px;
  box-shadow: var(--shadow); padding: 26px 22px; display: flex; flex-direction: column;
  transition: transform 0.3s ease, opacity 0.3s ease; overflow: hidden;
}
.card .big-emoji { font-size: 5.5rem; text-align: center; margin: 18px 0 8px; }
.card h3 { font-size: 1.5rem; margin: 6px 0; text-align: center; font-weight: 800; }
.card .card-desc { color: var(--muted); text-align: center; }
.card .card-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: auto; }
.card .tag { background: var(--card-2); color: var(--muted); padding: 5px 11px; border-radius: 999px; font-size: 0.78rem; }
.card .stamp {
  position: absolute; top: 26px; font-size: 1.6rem; font-weight: 900; padding: 6px 14px;
  border-radius: 12px; border: 3px solid; opacity: 0; transform: rotate(-12deg);
}
.card .stamp.like { right: 22px; color: var(--green); border-color: var(--green); }
.card .stamp.nope { left: 22px; color: var(--accent); border-color: var(--accent); }

.swipe-buttons { display: flex; justify-content: center; gap: 22px; }
.round {
  width: 68px; height: 68px; border-radius: 50%; font-size: 1.8rem; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; transition: transform 0.1s;
}
.round:active { transform: scale(0.9); }
.round.nope { background: var(--card); color: var(--accent); border: 2px solid var(--line); }
.round.like { background: var(--green); color: #fff; }
.round.skip { width: 54px; height: 54px; font-size: 1.2rem; background: var(--card); color: var(--muted); border: 2px solid var(--line); align-self: center; }

.game-done { text-align: center; padding: 40px 10px; }
.game-done .big-emoji { font-size: 4rem; }

/* ---------- Rezeptliste ---------- */
.search { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--text); font-size: 1rem; margin-bottom: 12px; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 6px; }
.filter-row .chip { flex: 0 0 auto; font-size: 0.85rem; padding: 7px 13px; }

.recipe-item {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px;
  margin-bottom: 8px; display: flex; align-items: center; gap: 12px;
}
.recipe-item .emoji { font-size: 1.8rem; }
.recipe-item .info { flex: 1; min-width: 0; }
.recipe-item .info .name { font-weight: 700; }
.recipe-item .info .meta { color: var(--muted); font-size: 0.82rem; }
.recipe-item .score { font-size: 0.9rem; }

/* ---------- Einkaufsliste ---------- */
.shop-group { font-weight: 800; margin: 16px 0 6px; font-size: 0.95rem; color: var(--muted); }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--card);
  border-radius: 12px; margin-bottom: 7px; box-shadow: var(--shadow); }
.shop-item input { width: 22px; height: 22px; accent-color: var(--green); }
.shop-item.checked .txt { text-decoration: line-through; color: var(--muted); }
.shop-item .qty { color: var(--muted); font-size: 0.85rem; margin-left: auto; }

/* ---------- Modal (Rezeptdetail) ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50; display: none;
  align-items: flex-end; justify-content: center; }
.modal-bg.open { display: flex; }
.modal {
  background: var(--card); width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  border-radius: 24px 24px 0 0; padding: 22px 20px 30px; animation: slideup 0.28s ease;
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.modal .close { float: right; background: var(--card-2); width: 36px; height: 36px; border-radius: 50%;
  font-size: 1.1rem; color: var(--text); }
.modal .big-emoji { font-size: 3.5rem; }
.modal h2 { margin: 6px 0; }
.modal ul { padding-left: 20px; }
.modal ol { padding-left: 20px; }
.modal li { margin-bottom: 5px; }

/* ---------- Untere Navigation ---------- */
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto;
}
nav.tabs button {
  background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center;
  gap: 2px; font-size: 0.7rem; font-weight: 600; padding: 4px 10px; border-radius: 10px;
}
nav.tabs button .ico { font-size: 1.35rem; }
nav.tabs button.active { color: var(--accent); }

/* ---------- Login / Konto ---------- */
.who-chip { margin-left: auto; background: var(--card); border: 1.5px solid var(--line); color: var(--text);
  padding: 6px 12px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.login-members { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.member-btn { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 18px 20px;
  font-size: 1.15rem; font-weight: 700; color: var(--text); box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; }
.member-btn .em { font-size: 1.8rem; }
.member-btn:active { transform: scale(0.99); border-color: var(--accent); }
.login-pin { margin-top: 6px; display: flex; flex-direction: column; gap: 10px; }
.login-pin .search { text-align: center; letter-spacing: 0.3em; font-size: 1.3rem; }

/* ---------- Board-Status ---------- */
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 11px 14px; margin-bottom: 8px; }
.status-row .who { font-weight: 700; }
.status-row .badge { font-size: 0.85rem; color: var(--muted); text-align: right; }
.status-row.ok .badge { color: var(--green-dark); font-weight: 600; }
.status-row.open { opacity: 0.85; }

#board-myaction { margin-top: 14px; display: flex; flex-direction: column; gap: 9px; }
.mychoice { background: var(--card-2); border-radius: 12px; padding: 12px 14px; font-size: 0.95rem; }

.drag-handle { padding: 8px 10px; color: var(--muted); font-size: 1.25rem; cursor: grab; touch-action: none;
  user-select: none; -webkit-user-select: none; align-self: center; }
.drag-handle:active { cursor: grabbing; }
.week-card.dragging { opacity: 0.6; box-shadow: 0 10px 26px rgba(0,0,0,0.25); }
.week-card .reorder { display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.week-card .reorder button { background: var(--card-2); color: var(--text); width: 30px; height: 26px; border-radius: 7px; font-size: 0.8rem; }
.week-card .reorder button:disabled { opacity: 0.3; }
.adopt { color: var(--accent-dark); font-weight: 600; }
.owner-note { color: var(--muted); }
.block-sep { text-align: center; font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; margin: 16px 0 8px; position: relative; }
.block-sep::before, .block-sep::after { content: ""; position: absolute; top: 50%; width: 22%; height: 1px; background: var(--line); }
.block-sep::before { left: 0; } .block-sep::after { right: 0; }

/* ---------- Tage-Auswahl ---------- */
.day-choice { display: flex; gap: 10px; margin: 6px 0 20px; }
.day-opt { flex: 1; background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 16px 0;
  font-size: 1.6rem; font-weight: 800; color: var(--text); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; }
.day-opt span { font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; margin-top: 2px; }
.day-opt.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.day-opt.active span { color: rgba(255,255,255,0.85); }
.hint-mini { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 12px; }

/* ---------- Wisch-Kopf ---------- */
.swipe-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 6px; min-height: 40px; }
.swipe-progress { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

/* ---------- Favoriten-Auswahl ---------- */
.result.pick { position: relative; display: flex; align-items: center; gap: 12px; padding-right: 12px; cursor: pointer;
  border: 2px solid transparent; }
.result.pick img, .result.pick .noimg { width: 90px; height: 90px; object-fit: cover; flex: 0 0 auto; border-radius: 0;
  background: var(--card-2); display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.result.pick .body { padding: 8px 0; }
.result.pick.chosen { border-color: var(--green); }
.corner-fav { position: absolute; top: 8px; left: 8px; background: var(--accent); color: #fff; font-size: 0.72rem;
  font-weight: 700; padding: 3px 8px; border-radius: 999px; z-index: 2; }
.pick-check { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 900;
  font-size: 0.9rem; opacity: 0; transition: opacity 0.15s; }
.result.pick.chosen .pick-check { opacity: 1; }

.pick-bar { position: fixed; bottom: 66px; left: 0; right: 0; max-width: 520px; margin: 0 auto; z-index: 25;
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; }
.pick-bar #pick-count { font-weight: 700; }
.pick-bar .btn { width: auto; }

.daylabel-sm { font-size: 0.72rem; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------- Umschalter Einkaufsliste ---------- */
.seg { display: flex; gap: 6px; background: var(--card-2); border-radius: 12px; padding: 4px; margin-bottom: 8px; }
.seg-btn { flex: 1; background: none; color: var(--muted); font-weight: 700; padding: 9px 0; border-radius: 9px; font-size: 0.9rem; }
.seg-btn.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Tochter-Tipp ---------- */
.kidtip { margin-top: 5px; font-size: 0.8rem; color: var(--green-dark); background: rgba(43,182,115,0.1);
  padding: 5px 9px; border-radius: 8px; line-height: 1.35; }
.modal-tip { font-size: 0.92rem; margin: 12px 0; padding: 11px 13px; }

/* ---------- Finden: Auswahl-Chips ---------- */
.pickgroup { margin-bottom: 14px; }
.pg-label { font-size: 0.82rem; font-weight: 700; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.03em; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-wrap .chip { font-size: 0.9rem; padding: 8px 14px; }

/* ---------- Suchergebnisse ---------- */
.res-count { font-weight: 700; margin: 18px 0 10px; }
.result { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px; }
.result img { width: 100%; height: 180px; object-fit: cover; display: block; background: var(--card-2); }
.result .body { padding: 12px 14px; }
.result .body .name { font-weight: 700; line-height: 1.3; }
.result .body .meta { color: var(--muted); font-size: 0.82rem; margin-top: 3px; }
.result .actions { display: flex; gap: 8px; margin-top: 11px; }
.result .actions .btn { flex: 1; }
.btn.added { background: var(--green); }

.loading { text-align: center; color: var(--muted); padding: 40px 20px; }
.spinner { width: 34px; height: 34px; margin: 0 auto 14px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Woche ---------- */
.week-card { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px; padding-right: 10px; }
.week-card img, .week-card .noimg { width: 74px; height: 74px; object-fit: cover; flex: 0 0 auto; background: var(--card-2);
  display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.week-card .info { flex: 1; min-width: 0; padding: 8px 0; }
.week-card .info .name { font-weight: 700; line-height: 1.25; }
.week-card .info .meta { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }

/* ---------- Modal-Bild & Aktionen ---------- */
.modal-img { width: 100%; height: 200px; object-fit: cover; border-radius: 14px; margin-bottom: 6px; }
.modal-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 18px; }
.modal-actions .btn { text-decoration: none; }

.empty-hint { text-align: center; color: var(--muted); padding: 40px 20px; }
.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; opacity: 0; transition: opacity 0.3s; z-index: 60; pointer-events: none;
}
.toast.show { opacity: 0.95; }
