:root {
  --bg1: #1a0b2e;
  --bg2: #3b0f2f;
  --card: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.18);
  --text: #fff5f7;
  --muted: #f3c4d0;
  --accent: #ff4d7d;
  --button: #c2185b; /* weiße Schrift darauf: 5.9:1 (WCAG AA) */
  --focus: #ffffff;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 10%, #5a1a4a 0, transparent 40%),
              linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
}

.wrap { max-width: 900px; margin: 0 auto; padding: 48px 16px; }

h1 { margin: 0 0 8px; font-size: clamp(2rem, 6vw, 3.5rem); text-align: center; letter-spacing: -0.02em; }

/* Kalender */
.grid {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
}

.door {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  color: var(--text);
  text-decoration: none;
  font-size: 2.2rem;
  font-weight: 700;
  transition: transform 0.25s, background 0.25s, box-shadow 0.25s;
}
.door:hover, .door:focus-visible {
  transform: translateY(-4px) rotate(-1deg);
  background: rgba(255, 77, 125, 0.25);
  box-shadow: 0 12px 30px rgba(255, 77, 125, 0.35);
}

.door.locked { opacity: 0.5; cursor: not-allowed; }
.door.locked:hover { transform: none; background: var(--card); box-shadow: none; }

.door.opened {
  position: relative;
  background: rgba(255, 77, 125, 0.18);
  border-color: rgba(255, 77, 125, 0.5);
  color: var(--muted);
}
.door.opened::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  background: var(--accent);
  /* gleiches Herz wie im Popup, als Maske */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Türchen-Seite */
.day { display: flex; flex-direction: column; min-height: 100vh; }
.day h1 { text-align: left; }
.back { color: var(--muted); text-decoration: none; margin-bottom: 24px; }
.back:hover { color: var(--text); }

.content {
  flex: 1;
  padding: 24px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  line-height: 1.6;
}
.content img { max-width: 100%; border-radius: 8px; }
.poem { text-align: center; }
.math { font-family: "STIX Two Math", "Cambria Math", "Times New Roman", serif; font-size: 1.5rem; }
.int { font-size: 1.6em; vertical-align: -0.2em; line-height: 1; }
.rebus { display: flex; align-items: center; gap: 16px; font-size: 2rem; margin-bottom: 32px; }
/* FE0E im HTML erzwingt Textdarstellung statt Emoji, damit die Farbe greift */
.glyph { color: #ffd166; font-size: 48px; line-height: 1; text-shadow: 0 0 8px rgba(255, 209, 102, 0.5); }
.rps { font-size: 2rem; letter-spacing: 8px; }
.content a { color: #ffb3c6; text-underline-offset: 4px; } /* Standard-Blau hätte auf dunklem Grund zu wenig Kontrast */
.content a:hover { color: var(--text); }

.answer { margin-top: 40px; }
.answer label { display: block; margin-bottom: 8px; color: var(--muted); }
.row { display: flex; gap: 8px; }

input, button {
  font: inherit;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.55); /* Feldrand ≥ 3:1 zum Hintergrund */
}
input::placeholder { color: #c9a9bb; opacity: 1; }
/* gleicher Rand wie das Input, damit beide exakt gleich hoch sind */
button { background: var(--button); border-color: var(--button); color: #fff; font-weight: 600; cursor: pointer; }
button:hover { background: #a3134b; border-color: #a3134b; }

.msg { min-height: 1.5em; color: #ffb3c6; }

.shake { animation: shake 0.4s; }
@keyframes shake {
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
}

/* Herz-Popup */
.overlay {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--text);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(26, 11, 46, 0.85);
  backdrop-filter: blur(6px);
  overflow: hidden;
}
.overlay[open] { display: flex; animation: fade 0.4s; }
.overlay::backdrop { background: transparent; }

.big-heart {
  width: min(50vw, 300px);
  height: auto;
  filter: drop-shadow(0 0 40px rgba(255, 77, 125, 0.6));
  animation: pop 0.6s ease-out, beat 1.2s 0.6s infinite;
}
.love { margin: 0 0 32px; padding: 0 16px; font-size: 2rem; font-weight: 700; text-align: center; }
.overlay button { position: relative; z-index: 1; }

.fall {
  position: absolute;
  top: -64px;
  pointer-events: none;
  animation: fall linear infinite;
}
.fall svg { display: block; width: 100%; fill: currentColor; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0); } 70% { transform: scale(1.15); } }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.12); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .big-heart, .fall, .door, .shake { animation: none; transition: none; }
  .fall { display: none; }
}
