:root {
  --green: #1f4d3a;
  --green-2: #2f7a55;
  --red: #c8102e;
  --gold: #e0a526;
  --cream: #fbf7ef;
  --ink: #1e2a25;
  --muted: #5d6b64;
  --line: #e4ddd0;
  --card: #fff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(30, 42, 37, 0.06), 0 8px 24px rgba(30, 42, 37, 0.08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.55 Nunito, system-ui, sans-serif;
}
h1, h2, h3 { font-family: Fraunces, Georgia, serif; line-height: 1.15; margin: 0 0 0.5em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
a { color: var(--green); }
.hint { color: var(--muted); margin-top: -0.3em; }

/* ---------- Buttons & Felder ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.4em;
  border: 2px solid var(--red); background: var(--red); color: #fff;
  padding: 0.7em 1.3em; border-radius: 999px; font: 800 1rem Nunito, sans-serif;
  cursor: pointer; text-decoration: none; transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(200, 16, 46, 0.25); }
.btn:disabled { opacity: 0.5; cursor: wait; transform: none; }
.btn-ghost { background: transparent; color: var(--green); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--green); box-shadow: none; }
.btn-small { padding: 0.4em 0.9em; font-size: 0.9rem; }
.btn-big { font-size: 1.15rem; padding: 0.9em 1.8em; }
.btn.danger { color: var(--red); }
.btn.active { background: var(--green); border-color: var(--green); color: #fff; }
.field { display: flex; flex-direction: column; gap: 0.3em; margin: 0 0 1em; font-weight: 600; }
.field > span { font-size: 0.92rem; }
.field small { color: var(--muted); font-weight: 400; }
input, select, textarea {
  font: inherit; font-weight: 400; color: inherit; background: #fff;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 0.6em 0.8em; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(47, 122, 85, 0.15); }
.check { display: flex; gap: 0.6em; align-items: flex-start; margin: 0.4em 0 1em; cursor: pointer; }
.check input { width: auto; margin-top: 0.3em; accent-color: var(--green); }
.check.small { font-size: 0.9rem; margin: 0; align-items: center; }
.check.small input { margin: 0; }
.grid2 > *, .grid3 > *, .kid-row > * { min-width: 0; }
.grid2, .grid3 { display: grid; gap: 0 1.2em; grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 700px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; }

/* ---------- Kopf & Hero ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 1em;
  padding: 0.8em clamp(1em, 4vw, 3em);
  background: rgba(251, 247, 239, 0.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.logo { font: 700 1.7rem "Mountains of Christmas", serif; color: var(--green); text-decoration: none; }
.topbar nav { display: flex; gap: 1.2em; align-items: center; }
.topbar nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 600; }
@media (max-width: 700px) { .topbar nav a:not(.btn) { display: none; } }

.hero {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 3em; align-items: center;
  max-width: 1150px; margin: 0 auto; padding: clamp(2em, 6vw, 5em) clamp(1em, 4vw, 3em);
}
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.3rem); }
.hero h1 em { font-style: normal; color: var(--red); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; color: var(--green-2); font-size: 0.85rem; }
.lead { font-size: 1.15rem; color: var(--muted); }
.hero-cta { display: flex; gap: 0.8em; flex-wrap: wrap; margin: 1.5em 0 1em; }
.hero-facts { color: var(--muted); font-weight: 600; }
.hero-art svg { width: 100%; filter: drop-shadow(0 20px 40px rgba(31, 77, 58, 0.25)); }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } .hero-art { max-width: 360px; } }

.how { max-width: 1150px; margin: 0 auto; padding: 1em clamp(1em, 4vw, 3em) 3em; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2em; }
@media (max-width: 760px) { .how-grid { grid-template-columns: 1fr; } }
.how-card { background: var(--card); border-radius: var(--radius); padding: 1.5em; box-shadow: var(--shadow); }
.how-card span {
  display: inline-grid; place-items: center; width: 2.2em; height: 2.2em; border-radius: 50%;
  background: var(--green); color: #fff; font-weight: 800; margin-bottom: 0.6em;
}
.how-card p { color: var(--muted); margin: 0; }

/* ---------- Planer ---------- */
.planner {
  max-width: 1150px; margin: 0 auto 4em; background: var(--card); border-radius: 24px; box-shadow: var(--shadow);
  padding: clamp(1.2em, 3vw, 2.5em); scroll-margin-top: 80px;
}
.stepper { display: flex; list-style: none; padding: 0; margin: 0 0 2em; gap: 0.4em; counter-reset: s; overflow-x: auto; }
.stepper li { flex: 1; counter-increment: s; }
.stepper button {
  width: 100%; border: 0; background: var(--cream); padding: 0.8em 0.6em; border-radius: 12px;
  font: 700 0.95rem Nunito, sans-serif; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.stepper button::before { content: counter(s) ". "; }
.stepper button.active { background: var(--green); color: #fff; }
.step { display: none; }
.step.active { display: block; animation: fade 0.25s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.step-nav { display: flex; justify-content: space-between; margin-top: 2em; padding-top: 1.2em; border-top: 1px solid var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 0.5em; margin: -0.3em 0 0.8em; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 0.35em 0.9em;
  font: 600 0.95rem Nunito, sans-serif; cursor: pointer;
}
.chip:hover, .chip.active { border-color: var(--green); background: #eef6f1; }
#more-names { margin-bottom: 1.5em; }

.kid-row { display: grid; grid-template-columns: 2fr 1fr auto; gap: 0.8em; align-items: end; margin-bottom: 0.6em; }
.kid-row .field { margin: 0; }
.icon-btn { border: 0; background: none; font-size: 1.2rem; cursor: pointer; padding: 0.5em; color: var(--muted); }
#add-kid { margin: 0.4em 0 1.5em; }
.big-number { font: 800 1.8rem Fraunces, serif; color: var(--green); }

.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; margin: 0.5em 0 1.5em; }
@media (max-width: 700px) { .mode-switch { grid-template-columns: 1fr; } }
.mode-card { border: 2px solid var(--line); border-radius: var(--radius); padding: 1em 1.2em; cursor: pointer; display: flex; flex-direction: column; gap: 0.2em; }
.mode-card input { position: absolute; opacity: 0; }
.mode-card:has(input:checked) { border-color: var(--green); background: #eef6f1; }
.mode-card small { color: var(--muted); }

.selection { background: var(--cream); border-radius: var(--radius); padding: 1em 1.2em; margin-bottom: 2em; }
.selection-head { display: flex; align-items: center; gap: 0.8em; flex-wrap: wrap; }
.selection-head span { color: var(--muted); flex: 1; }
.sel-list { display: flex; flex-wrap: wrap; gap: 0.5em; padding: 0; margin: 0.8em 0 0; list-style: none; }
.sel-list li { background: #fff; border-radius: 999px; padding: 0.3em 0.4em 0.3em 0.9em; font-size: 0.92rem; display: flex; align-items: center; gap: 0.3em; }
.sel-list li button { border: 0; background: none; cursor: pointer; color: var(--muted); }
.sel-list:empty::after { content: "Noch nichts ausgewählt – die Automatik plant alles. Klickt im Katalog auf „+ Einplanen“."; color: var(--muted); font-size: 0.92rem; }

.catalog-title { margin-top: 0.5em; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 0.8em; align-items: center; margin-bottom: 1.2em; }
@media (max-width: 860px) { .filters { grid-template-columns: 1fr 1fr; } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1em; }
.card {
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 1em; display: flex; flex-direction: column; gap: 0.5em;
  background: #fff; transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover { box-shadow: var(--shadow); }
.card.selected { border-color: var(--green); background: #f4faf6; }
.card.done { opacity: 0.55; }
.card-top { display: flex; gap: 0.6em; align-items: flex-start; }
.card-emoji { font-size: 1.8rem; line-height: 1; }
.card h4 { margin: 0; font: 800 1.02rem Nunito, sans-serif; }
.card p { margin: 0; color: var(--muted); font-size: 0.92rem; flex: 1; }
.meta { display: flex; gap: 0.4em; flex-wrap: wrap; font-size: 0.8rem; }
.tag { background: var(--cream); border-radius: 6px; padding: 0.1em 0.5em; font-weight: 700; color: var(--muted); }
.tag.mit { background: #fff4dc; color: #8a6100; }
.tag.com { background: #e7f0fb; color: #2b5b93; }
.card-actions { display: flex; gap: 0.4em; flex-wrap: wrap; }
.card-actions .btn { padding: 0.3em 0.8em; font-size: 0.85rem; }
.empty { color: var(--muted); grid-column: 1 / -1; }

/* ---------- Geschichte ---------- */
.generate-box { background: linear-gradient(135deg, #1f4d3a, #2f7a55); color: #fff; border-radius: var(--radius); padding: 1.5em; margin-bottom: 1.5em; }
.generate-box p { margin-top: 0; opacity: 0.9; }
.generate-box .btn { background: #fff; color: var(--green); border-color: #fff; }
.progress { margin-top: 1em; display: flex; gap: 1em; align-items: center; }
.progress .bar { flex: 1; height: 10px; background: rgba(255, 255, 255, 0.25); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.4s; }
.error { background: #fdecee; color: #8f0b20; border-radius: 10px; padding: 0.8em 1em; }
.story-title { font: 700 2rem "Mountains of Christmas", serif; color: var(--green); margin: 0.2em 0; }
.story-summary { color: var(--muted); max-width: 70ch; }
.day {
  display: grid; grid-template-columns: 110px 1fr; gap: 1.2em; border-top: 1px solid var(--line); padding: 1.4em 0;
}
@media (max-width: 760px) { .day { grid-template-columns: 1fr; } }
.day-date b { display: block; font: 800 1.6rem Fraunces, serif; color: var(--red); line-height: 1; }
.day-date small { color: var(--muted); font-weight: 700; }
.badge { display: inline-block; margin-top: 0.4em; font-size: 0.75rem; font-weight: 800; padding: 0.1em 0.6em; border-radius: 99px; background: #eef6f1; color: var(--green); }
.day-prank { display: flex; gap: 0.5em; flex-wrap: wrap; align-items: center; margin-bottom: 0.7em; }
.day-prank select { flex: 1; min-width: 220px; }
.day input.title { font-weight: 800; font-size: 1.1rem; margin-bottom: 0.5em; }
.day textarea.body { font-family: Andika, sans-serif; line-height: 1.5; min-height: 10em; resize: vertical; field-sizing: content; }
.day details { margin-top: 0.6em; font-size: 0.92rem; color: var(--muted); }
.day details summary { cursor: pointer; font-weight: 700; color: var(--green); }
.day details ul, .day details ol { margin: 0.3em 0; padding-left: 1.3em; }
.stale { color: #8a6100; font-size: 0.85rem; font-weight: 700; }
.writing textarea.body { background: repeating-linear-gradient(90deg, #f6f2ea, #fff 40%, #f6f2ea 80%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Design & Druck ---------- */
.designs { display: flex; gap: 0.8em; flex-wrap: wrap; margin-bottom: 1.5em; }
.design-btn { border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 0.5em; cursor: pointer; width: 130px; font: 700 0.9rem Nunito, sans-serif; }
.design-btn.active { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 122, 85, 0.2); }
.design-btn .swatch { height: 60px; border-radius: 8px; margin-bottom: 0.4em; }
.print-layout { display: grid; grid-template-columns: auto 1fr; gap: 2em; align-items: start; }
@media (max-width: 860px) { .print-layout { grid-template-columns: 1fr; } }
.preview-wrap { width: calc(136.5mm * 0.62); height: calc(198mm * 0.62); }
.preview { transform: scale(0.62); transform-origin: 0 0; filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15)); }
.print-options { display: flex; flex-direction: column; gap: 0.7em; align-items: flex-start; }
.print-options hr { width: 100%; border: 0; border-top: 1px solid var(--line); }
.file-btn { cursor: pointer; }

/* ---------- Community ---------- */
.community {
  max-width: 1150px; margin: 0 auto 4em; padding: 0 clamp(1em, 4vw, 3em);
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 3em; scroll-margin-top: 80px;
}
@media (max-width: 860px) { .community { grid-template-columns: 1fr; } }
.ticks { padding: 0; list-style: none; }
.ticks li::before { content: "✓ "; color: var(--green-2); font-weight: 800; }
.idea-form { background: var(--card); border-radius: var(--radius); padding: 1.5em; box-shadow: var(--shadow); }
.form-msg { font-weight: 700; color: var(--green); }
.footer { text-align: center; color: var(--muted); padding: 2em 1em 3em; font-size: 0.9rem; }

/* ---------- Detail-Dialog ---------- */
dialog { border: 0; border-radius: 20px; padding: 0; max-width: 560px; width: 92vw; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); }
dialog::backdrop { background: rgba(20, 30, 25, 0.5); }
.dlg { padding: 1.6em; }
.dlg h3 { display: flex; gap: 0.4em; align-items: center; }
.dlg .media { background: var(--cream); border-radius: 12px; padding: 1em; color: var(--muted); text-align: center; font-size: 0.9rem; }
.dlg .media img, .dlg .media video { max-width: 100%; border-radius: 8px; }
.dlg .safety { background: #fff4dc; border-radius: 10px; padding: 0.6em 0.9em; font-size: 0.92rem; }
.dlg-actions { display: flex; gap: 0.5em; justify-content: flex-end; margin-top: 1em; }

/* ---------- Druck ---------- */
#print-root { position: absolute; left: -10000px; top: 0; }
@media print {
  body { background: #fff; }
  #app, dialog { display: none !important; }
  #print-root { position: static; }
}
