:root {
  --bg: #fff4d6;
  --karte: #ffffff;
  --tinte: #3b2f2f;
  --akzent: #ff7a59;
  --akzent2: #4cc9a0;
  --schatten: 0 6px 0 rgba(59, 47, 47, .15);
  --rand: max(16px, env(safe-area-inset-left));
  font-family: "Nunito", "Comic Sans MS", ui-rounded, system-ui, sans-serif;
  color: var(--tinte);
  background: var(--bg);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  background: var(--bg);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }

/* ---------- Regal ---------- */
.ansicht { min-height: 100dvh; padding: env(safe-area-inset-top) var(--rand) env(safe-area-inset-bottom); }
.kopf { display: flex; align-items: center; gap: 12px; padding: 16px 0 8px; }
.logo { width: 48px; height: 48px; }
.kopf h1 { font-size: clamp(1.4rem, 5vw, 2.2rem); margin: 0; flex: 1; letter-spacing: .5px; }
.eltern-knopf {
  border: 0; background: transparent; font-size: 1.4rem; opacity: .35; width: 44px; height: 44px;
  border-radius: 50%;
}
.eltern-knopf.drueckt { animation: laden 1.5s linear forwards; }
@keyframes laden { from { box-shadow: inset 0 0 0 0 var(--akzent); } to { box-shadow: inset 0 0 0 22px var(--akzent); opacity: 1; } }

.liste {
  display: grid; gap: 18px; padding: 12px 0 32px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.cover {
  border: 0; padding: 0; border-radius: 28px; overflow: hidden; background: var(--karte);
  box-shadow: var(--schatten); text-align: left; transition: transform .15s;
  display: flex; flex-direction: column;
}
.cover:active { transform: scale(.96); }
.cover img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.cover span { padding: 12px 16px 16px; font-size: 1.3rem; font-weight: 800; }
.leer { text-align: center; font-size: 1.2rem; opacity: .6; margin-top: 15vh; }

/* ---------- Leser ---------- */
#leser { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: max(10px, env(safe-area-inset-top)); }
.buehne-rahmen { width: 100%; flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.buehne {
  position: relative; width: min(100%, calc((100dvh - 230px) * 4 / 3)); aspect-ratio: 4 / 3;
  border-radius: 28px; overflow: hidden; background: #fff; box-shadow: var(--schatten);
}
.buehne img, .buehne .svg { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.buehne .svg svg { width: 100%; height: 100%; display: block; }
.buehne.blaettern .svg { animation: einblenden .35s ease-out; }

/* Effekte fuer angetippte SVG-Elemente (hotspot.target) */
.lv-fx { transform-box: fill-box; transform-origin: 50% 100%; }
.lv-hop { animation: lv-hop .7s cubic-bezier(.3, 1.6, .5, 1); }
.lv-wiggle { animation: lv-wiggle .7s ease-in-out; transform-origin: 50% 50%; }
.lv-spin { animation: lv-spin .8s ease-in-out; transform-origin: 50% 50%; }
.lv-grow { animation: lv-grow .7s ease-in-out; transform-origin: 50% 50%; }
.lv-shake { animation: lv-shake .6s linear; }
@keyframes lv-hop { 0%, 100% { translate: 0 0; } 40% { translate: 0 -22%; } 70% { translate: 0 0; scale: 1.08 .92; } }
@keyframes lv-wiggle { 0%, 100% { rotate: 0deg; } 25% { rotate: -12deg; } 50% { rotate: 10deg; } 75% { rotate: -6deg; } }
@keyframes lv-spin { to { rotate: 360deg; } }
@keyframes lv-grow { 50% { scale: 1.25; } }
@keyframes lv-shake { 0%, 100% { translate: 0; } 20%, 60% { translate: -6% 0; } 40%, 80% { translate: 6% 0; } }
.buehne.blaettern img { animation: einblenden .35s ease-out; }
@keyframes einblenden { from { opacity: 0; transform: scale(1.03); } to { opacity: 1; transform: none; } }

.hotspots { position: absolute; inset: 0; }
.hotspot {
  position: absolute; transform: translate(-50%, -50%); border: 0; padding: 0;
  border-radius: 50%; background: transparent; aspect-ratio: 1;
}
.hotspot::after {
  content: ""; position: absolute; inset: 18%; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 3px rgba(255, 122, 89, .55);
  opacity: 0; pointer-events: none;
}
.hinweise .hotspot::after { animation: puls 2.2s ease-in-out infinite; }
.hotspot:nth-child(2)::after { animation-delay: .7s; }
.hotspot:nth-child(3)::after { animation-delay: 1.4s; }
@keyframes puls {
  0%, 100% { opacity: 0; transform: scale(.7); }
  40% { opacity: .9; transform: scale(1); }
  70% { opacity: 0; transform: scale(1.25); }
}
.hotspot .welle {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .8) 0 30%, rgba(255, 209, 102, .5) 31% 60%, transparent 61%);
  animation: welle .7s ease-out forwards;
}
@keyframes welle { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.hotspot .note {
  position: absolute; left: 50%; top: 10%; font-size: clamp(1.4rem, 5vw, 2.6rem); pointer-events: none;
  animation: note 1.1s ease-out forwards;
}
@keyframes note { from { transform: translate(-50%, 0) scale(.6); opacity: 1; } to { transform: translate(-50%, -120%) scale(1.3); opacity: 0; } }

.text {
  margin: 0; max-width: 900px; text-align: center; font-weight: 700;
  font-size: clamp(1.15rem, 3.6vw, 1.8rem); line-height: 1.35; min-height: 2.7em;
}
.steuerung { display: flex; gap: 14px; align-items: center; padding-bottom: 4px; }
.rund {
  width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--akzent); color: #fff;
  font-size: 1.8rem; box-shadow: var(--schatten); transition: transform .1s;
}
.rund.klein { width: 56px; height: 56px; font-size: 1.5rem; background: var(--akzent2); }
.rund:active { transform: scale(.9); }
.rund:disabled { opacity: .3; }
.rund.an { background: #f4a261; }
.punkte { display: flex; gap: 8px; padding-bottom: 12px; }
.punkte i { width: 12px; height: 12px; border-radius: 50%; background: rgba(59, 47, 47, .2); }
.punkte i.an { background: var(--akzent); }

/* Querformat auf dem Handy: Text neben das Bild */
@media (orientation: landscape) and (max-height: 520px) {
  #leser { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .buehne { width: calc((100dvh - 30px) * 4 / 3); }
  .buehne-rahmen { width: auto; flex: 0 1 auto; }
  .text { flex: 1 1 200px; font-size: 1.1rem; align-self: center; }
  .steuerung { flex-direction: column; }
  .punkte { display: none; }
}

/* ---------- Eltern ---------- */
dialog {
  border: 0; border-radius: 24px; padding: 20px; width: min(520px, calc(100% - 32px));
  background: var(--karte); color: var(--tinte); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(59, 47, 47, .45); }
.eltern-kopf { display: flex; justify-content: space-between; align-items: center; margin: 0; }
.eltern-kopf h2 { margin: 0; }
.x { border: 0; background: transparent; font-size: 1.4rem; width: 44px; height: 44px; }
.schalter { display: flex; gap: 10px; align-items: center; margin: 12px 0; font-weight: 700; }
.schalter input { width: 22px; height: 22px; }
.zeile { display: flex; gap: 8px; flex-wrap: wrap; }
.zeile input { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border-radius: 12px; border: 2px solid #e4d8c0; }
.knopf { border: 0; border-radius: 12px; background: var(--akzent); color: #fff; padding: 10px 16px; font-weight: 800; }
.knopf.leise { background: #eee3cf; color: var(--tinte); margin-top: 12px; }
.klein-text { font-size: .9rem; opacity: .7; margin: 4px 0 8px; }
.admin-liste { list-style: none; padding: 0; margin: 0; }
.admin-liste li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f0e6d2; }
.admin-liste small { opacity: .6; display: block; }
.admin-liste button { border: 0; background: #ffe1d9; border-radius: 10px; padding: 6px 10px; }
.meldung { min-height: 1.4em; font-weight: 700; margin: 12px 0 0; }
.meldung.fehler { color: #c0392b; }

/* ---------- Anmelden ---------- */
.tor { display: flex; align-items: center; justify-content: center; }
.tor-karte {
  display: flex; flex-direction: column; gap: 12px; width: min(380px, 100%);
  background: var(--karte); border-radius: 28px; padding: 28px 24px; box-shadow: var(--schatten); text-align: center;
}
.tor-karte .logo { width: 72px; height: 72px; align-self: center; }
.tor-karte h1 { margin: 0 0 8px; font-size: 1.6rem; }
.tor-karte input { font: inherit; padding: 12px 14px; border-radius: 12px; border: 2px solid #e4d8c0; }
.tor-karte .knopf { padding: 14px; font-size: 1.1rem; }
.link-box { margin-top: 8px; }
.zeile select { font: inherit; padding: 10px 12px; border-radius: 12px; border: 2px solid #e4d8c0; background: #fff; }
.spalte { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.spalte input { font: inherit; padding: 10px 12px; border-radius: 12px; border: 2px solid #e4d8c0; }
.pw-box { margin: 8px 0; }
.pw-box summary { font-weight: 700; cursor: pointer; }
.admin-liste .knoepfe { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.admin-liste button.gefahr { background: #f8c9bf; }
.kopf-hinweis { position: absolute; right: var(--rand); top: calc(env(safe-area-inset-top) + 64px); background: var(--tinte); color: #fff;
  padding: 6px 12px; border-radius: 10px; font-size: .9rem; font-weight: 700; z-index: 5; }
.format-box { margin: 8px 0 12px; }
.format-box summary { font-weight: 700; cursor: pointer; color: var(--akzent); }
.format-text { white-space: pre-wrap; font-size: .75rem; background: #f6efe0; padding: 10px; border-radius: 10px; max-height: 18rem; overflow: auto; }
