@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&display=swap");

:root {
  --bg: #241A14;
  --bg-panel: #33261D;
  --bg-panel-alt: #402F23;
  --accent: #E8A24D;
  --accent-soft: #F0C384;
  --rose: #C97B84;
  --text: #F1E9DD;
  --text-muted: #BCA68C;
  --border: rgba(241, 233, 221, 0.13);
  --radius: 3px;
  --boden-farbe: #4A3323;

  --deko-katze-hell: #D9B98A;
  --deko-katze-dunkel: #8B6B47;
  --deko-katze-schatten: #C2A276;
  --deko-katze-bauch: #EDDCBE;
  --deko-katze-auge: #241C3D;
  --deko-katze-nase: #C97B84;
  --deko-farn-stiel: #4F6F58;
  --deko-farn-blatt: #8FBFA0;
  --deko-farn-blatt-dunkel: #6C9A80;
  --deko-topf: #B0724A;
  --deko-topf-dunkel: #8C5636;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(0deg, var(--boden-farbe) 0%, rgba(74, 51, 35, 0) 16%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.07) 0px, rgba(0, 0, 0, 0.07) 2px, transparent 2px, transparent 30px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.05) 0px, rgba(0, 0, 0, 0.05) 1px, transparent 1px, transparent 5px),
    radial-gradient(ellipse 55% 45% at 12% 4%, rgba(232, 162, 77, 0.14), transparent 62%),
    radial-gradient(ellipse 45% 30% at 100% 18%, rgba(183, 156, 224, 0.05), transparent 65%);
  background-repeat: no-repeat, repeat, repeat, no-repeat, no-repeat;
  background-attachment: fixed, fixed, fixed, fixed, fixed;
  color: var(--text);
  font-family: "Inter", -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, .schrift-fraunces {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Kopfzeile ---------- */
.kopfzeile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  max-width: 920px;
  margin: 0 auto;
}

.logo {
  font-size: 1.05rem;
  font-family: "Fraunces", serif;
  font-weight: 600;
  max-width: 30ch;
  line-height: 1.25;
}

.logo em {
  font-style: italic;
  color: var(--accent-soft);
}

.kopfzeile nav {
  display: flex;
  gap: 24px;
  font-size: 0.95rem;
}

.kopfzeile nav a {
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.kopfzeile nav a:hover,
.kopfzeile nav a.aktiv {
  color: var(--accent-soft);
}

/* ---------- Layout ---------- */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 32px 96px;
}

.hero {
  margin-bottom: 56px;
}

.hero h1 {
  font-size: clamp(2rem, 4.5vw, 2.9rem);
  line-height: 1.15;
  max-width: 15ch;
}

.hero p {
  margin-top: 18px;
  max-width: 52ch;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.hero-aktion {
  margin-top: 28px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.95rem;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #1B1530;
  font-weight: 600;
  border: none;
}

.btn-primary:hover { background: var(--accent-soft); }

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover { border-color: var(--accent-soft); color: var(--accent-soft); }

.btn-klein {
  padding: 6px 12px;
  font-size: 0.82rem;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#btn-bild-generieren {
  display: block;
  margin-bottom: 12px;
}

/* ---------- Avatar ---------- */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.avatar svg { display: block; width: 100%; height: 100%; }

.avatar-gross { width: 88px; height: 88px; }

/* ---------- Eintraege ---------- */
.eintrag {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--kategorie-farbe, var(--accent));
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
}

.eintrag-kopf {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.eintrag-kopf .wer {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.eintrag-kopf .name {
  font-size: 0.92rem;
  font-weight: 600;
}

.eintrag-kopf .name a { text-decoration: none; }
.eintrag-kopf .name a:hover { color: var(--accent-soft); }

.eintrag-kopf .meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.rubrik-label {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--kategorie-farbe, var(--accent)) 18%, transparent);
  color: var(--kategorie-farbe, var(--accent));
  white-space: nowrap;
}

.eintrag h3 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.eintrag p {
  color: var(--text);
  white-space: pre-wrap;
  font-size: 0.98rem;
}

.eintrag-fuss {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

/* ---------- Profilkopf ---------- */
.profilkopf {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.profilkopf .angaben h2 { font-size: 1.6rem; }
.profilkopf .angaben .seit { color: var(--text-muted); font-size: 0.88rem; margin-top: 4px; }

.wuerfel-reihe {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* ---------- Formular ---------- */
.formular-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 40px;
}

.formular-panel h3 { margin-bottom: 4px; }
.formular-panel .hinweis { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 16px; }

.rubrik-wahl {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.rubrik-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.rubrik-btn.aktiv {
  border-color: var(--rubrik-farbe, var(--accent));
  color: var(--rubrik-farbe, var(--accent));
  background: color-mix(in srgb, var(--rubrik-farbe, var(--accent)) 14%, transparent);
}

input[type="text"], textarea {
  width: 100%;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  margin-bottom: 12px;
}

textarea { min-height: 110px; resize: vertical; }

input::placeholder, textarea::placeholder { color: var(--text-muted); }

.abschnitt-titel {
  margin: 40px 0 18px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.leer {
  color: var(--text-muted);
  font-style: italic;
  padding: 20px 0;
}

footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 32px;
}

@media (max-width: 640px) {
  .kopfzeile { padding: 16px 20px; flex-direction: column; gap: 12px; }
  main { padding: 32px 20px 72px; }
  .profilkopf { flex-wrap: wrap; }
}

/* ---------- Deko: Katze, Stern, Farn ---------- */
.deko {
  position: fixed;
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.deko svg { display: block; shape-rendering: crispEdges; }

.deko-katze {
  top: 84px;
  left: 14px;
  width: 68px;
}

.deko-stern {
  top: 96px;
  right: 26px;
  width: 22px;
  animation: stern-funkeln 2.6s ease-in-out infinite;
}

.deko-farn {
  bottom: 18px;
  left: 18px;
  width: 34px;
  transform-origin: 50% 100%;
  animation: farn-schwenken 4.5s ease-in-out infinite;
}

.katze-kopf {
  transform-origin: 20px 14px;
  animation: katze-hochschauen 9s ease-in-out infinite;
}

.katze-ohr {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.katze-ohr-links  { animation: katze-ohr-zucken 9s ease-in-out infinite; }
.katze-ohr-rechts { animation: katze-ohr-zucken 9s ease-in-out infinite reverse; }

/* geschlossene Augen (Schlaf-Striche) verblassen beim Aufwachen */
.katze-auge-geschlossen {
  opacity: 1;
  animation: katze-augen-geschlossen 9s ease-in-out infinite;
}

/* offene Augen: standardmäßig unsichtbar, blenden beim Aufwachen ein */
.katze-auge-offen {
  opacity: 0;
  animation: katze-augen-offen 9s ease-in-out infinite;
}


/* ---------- Keyframes ---------- */
@keyframes stern-funkeln {
  0%, 100% { opacity: 0.45; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.15); }
}

@keyframes farn-schwenken {
  0%, 100% { transform: rotate(-4deg); }
  50%      { transform: rotate(4deg); }
}

@keyframes katze-hochschauen {
  0%, 90%, 100% { transform: translateY(0); }
  93%, 97%      { transform: translateY(-3px); }
}

@keyframes katze-ohr-zucken {
  0%, 89%, 98%, 100% { transform: rotate(0deg); }
  92%                { transform: rotate(-12deg); }
  94%                { transform: rotate(7deg); }
  95%                { transform: rotate(-5deg); }
}

@keyframes katze-augen-offen {
  0%, 92%, 99%, 100% { opacity: 0; }
  93%, 97%           { opacity: 1; }
}

@keyframes katze-augen-geschlossen {
  0%, 91%, 98%, 100% { opacity: 1; }
  93%, 97%           { opacity: 0; }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .deko-katze { width: 48px; top: 70px; left: 8px; }
  .deko-stern { width: 16px; top: 78px; right: 16px; }
  .deko-farn  { width: 24px; left: 10px; bottom: 12px; }
}

/* ---------- Barrierefreiheit: Animationen aus ---------- */
@media (prefers-reduced-motion: reduce) {
  .deko-stern, .deko-farn, .katze-kopf, .katze-auge-geschlossen,
  .katze-auge-offen, .katze-ohr-links, .katze-ohr-rechts {
    animation: none !important;
  }
}