:root {
  --ink: #3d2466;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Quicksand", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand: "Snell Roundhand", "Bradley Hand", "Segoe Script", "Dancing Script", "Brush Script MT", cursive;
  --top: max(14px, env(safe-area-inset-top));
  --bot: max(18px, env(safe-area-inset-bottom));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #1a0b3d;
  overscroll-behavior: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  font-family: var(--font);
}
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#ui {
  position: fixed; inset: 0; pointer-events: none; color: #fff; text-align: center;
  display: flex; flex-direction: column; align-items: center;
  padding: var(--top) 16px var(--bot);
}
#ui button, #ui .card-wrap { pointer-events: auto; }
#ui.fade { opacity: 0; transition: opacity .4s; }

#mute {
  position: fixed; top: var(--top); right: 10px; z-index: 5;
  width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(255, 255, 255, .18); font-size: 21px; line-height: 44px; cursor: pointer;
}

.title {
  margin-top: 5vh; padding: 0 44px;
  font-size: clamp(30px, 9vw, 52px); font-weight: 900; line-height: 1.1;
  text-shadow: 0 3px 0 #7a3cc2, 0 0 22px rgba(255, 150, 230, .8);
}
.title.small { font-size: clamp(22px, 6.4vw, 36px); margin-top: 3vh; }
.title.big { font-size: clamp(44px, 14vw, 80px); margin-top: 8vh; }
.sub {
  margin-top: 12px; max-width: 420px; font-size: clamp(17px, 4.8vw, 22px); font-weight: 700;
  text-shadow: 0 2px 0 rgba(80, 30, 140, .7);
}
.hint, .ghint {
  position: absolute; left: 0; right: 0; bottom: calc(var(--bot) + 12px);
  font-size: clamp(19px, 5.4vw, 26px); font-weight: 900;
  text-shadow: 0 2px 0 rgba(80, 30, 140, .8), 0 0 14px rgba(255, 160, 230, .7);
}
.hint { animation: fadeIn .5s both, pulse 1.4s ease-in-out infinite; }
.hint.d2 { animation-delay: 1.1s, 1.1s; }
.ghint small { font-size: .7em; font-weight: 700; opacity: .9; }
.soundhint {
  position: absolute; top: calc(var(--top) + 8px); left: 14px;
  font-size: 15px; font-weight: 800; background: rgba(255, 255, 255, .16); padding: 6px 12px; border-radius: 99px;
}
.gone { opacity: 0 !important; transition: opacity .4s; }

.bubble {
  position: absolute; left: 50%; bottom: calc(var(--bot) + 6px); transform: translateX(-50%);
  width: min(92vw, 460px); padding: 18px 20px 16px;
  background: #fff; color: var(--ink); border-radius: 26px;
  font-size: clamp(18px, 4.9vw, 22px); font-weight: 700; line-height: 1.38;
  box-shadow: 0 8px 0 rgba(90, 40, 160, .35), inset 0 0 0 4px #ffd1ec;
  animation: bubbleIn .45s cubic-bezier(.2, 1.6, .4, 1) both;
}
.bubble::after {
  content: ''; position: absolute; top: -15px; left: 50%; transform: translateX(-50%);
  border: 16px solid transparent; border-top: 0; border-bottom-color: #fff;
}
.bubble b { color: #d6338a; }
.bubble .more { display: block; margin-top: 8px; font-size: .72em; color: #b08ad8; animation: pulse 1.2s infinite; }
.howto { margin-top: 12px; font-size: .8em; color: #8a5cc8; }

.btn {
  font: inherit; font-weight: 900; font-size: clamp(19px, 5.4vw, 24px); color: #fff;
  border: 0; border-radius: 999px; padding: 14px 28px; margin-top: 14px; cursor: pointer;
  background: linear-gradient(135deg, #ff5fa2, #a77bff);
  box-shadow: 0 6px 0 #6a2fb0, 0 10px 24px rgba(160, 60, 220, .5);
  animation: wiggle 2.6s ease-in-out infinite;
  touch-action: manipulation;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #6a2fb0; }
.btn.sec {
  display: block; margin: 14px auto 0; font-size: clamp(15px, 4.2vw, 19px); padding: 10px 20px;
  background: rgba(130, 80, 200, .35); box-shadow: 0 4px 0 rgba(60, 20, 110, .5); animation: none;
}

/* Spiel */
.hud { position: absolute; top: var(--top); left: 12px; right: 64px; }
.bar {
  position: relative; height: 34px; border-radius: 99px; overflow: hidden;
  background: rgba(255, 255, 255, .35); border: 3px solid #fff; box-shadow: 0 3px 0 rgba(80, 40, 140, .35);
}
.bar.bump { animation: bump .3s; }
.fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: linear-gradient(90deg, #ff5fa2, #ff9f43, #ffe14d, #5fe0a0, #5ec8ff, #a77bff);
  transition: width .3s cubic-bezier(.2, 1.4, .4, 1);
}
.lbl {
  position: absolute; inset: 0; line-height: 28px; font-weight: 900; font-size: 17px; color: #fff;
  text-shadow: 0 1px 0 #5b2a8f, 0 0 6px rgba(91, 42, 143, .8);
}
.howto2 {
  position: absolute; left: 0; right: 0; bottom: calc(var(--bot) + 20px);
  font-size: clamp(18px, 5vw, 24px); font-weight: 900; color: #fff;
  text-shadow: 0 2px 0 rgba(80, 30, 140, .8); animation: pulse 1.3s infinite; transition: opacity .5s;
}
.count {
  position: absolute; left: 0; right: 0; top: 34%;
  font-size: clamp(80px, 26vw, 150px); font-weight: 900; color: #fff;
  text-shadow: 0 6px 0 #7a3cc2, 0 0 30px rgba(255, 150, 230, .9);
  animation: countPop .9s ease-out both;
}
.panel {
  position: absolute; left: 0; right: 0; margin: 0 auto; bottom: calc(var(--bot) + 6px);
  width: min(92vw, 440px); padding: 18px 18px 20px; border-radius: 28px;
  background: rgba(255, 255, 255, .95); color: var(--ink); box-shadow: 0 10px 0 rgba(90, 40, 160, .35);
}
.panel p { margin: 8px 0; font-size: clamp(17px, 4.6vw, 20px); font-weight: 700; }
.panel .big { font-size: clamp(30px, 9vw, 42px); font-weight: 900; color: #d6338a; }
.panel .stat { font-size: .95em; color: #7a52b3; }
.panel .btn.sec { color: #6a3fb0; background: #f1e8ff; box-shadow: 0 4px 0 #d8c6f5; }

/* Karte */
.card-wrap {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: calc(var(--top) + 30px) 16px var(--bot); perspective: 900px;
}
.card-tilt { transition: transform .25s ease-out; transform-style: preserve-3d; }
.card-border {
  padding: 5px; border-radius: 32px;
  background: linear-gradient(135deg, #ff5fa2, #ff9f43, #ffe14d, #5fe0a0, #5ec8ff, #a77bff, #ff5fa2);
  background-size: 300% 300%;
  animation: cardIn 1s cubic-bezier(.2, 1.3, .3, 1) both, shimmer 4s linear infinite;
  box-shadow: 0 0 40px rgba(255, 160, 230, .6), 0 20px 50px rgba(20, 0, 50, .6);
}
.card {
  width: min(86vw, 420px); max-height: calc(100dvh - 110px); overflow: auto;
  padding: 18px 22px 22px; border-radius: 27px; color: var(--ink);
  background: radial-gradient(circle at 20% 0%, #fff 0%, #fff4fb 50%, #f0e6ff 100%);
}
.card-uni { width: 120px; height: auto; margin: -4px auto 0; display: block; animation: float 2.4s ease-in-out infinite; }
.card h1 { margin: 4px 0 0; font-size: clamp(24px, 7vw, 32px); font-weight: 900; line-height: 1.15; color: #7a3cc2; }
.name { font-size: clamp(36px, 11vw, 52px); font-weight: 900; line-height: 1.15; margin: 4px 0 8px; white-space: nowrap; }
.name span {
  display: inline-block; animation: wave 1.6s ease-in-out infinite;
  text-shadow: 2px 0 0 #4a2f6b, -2px 0 0 #4a2f6b, 0 2px 0 #4a2f6b, 0 -2px 0 #4a2f6b, 1.5px 1.5px 0 #4a2f6b, -1.5px -1.5px 0 #4a2f6b, 1.5px -1.5px 0 #4a2f6b, -1.5px 1.5px 0 #4a2f6b, 0 5px 0 rgba(74, 47, 107, .35);
}
.card p { margin: 10px 0; font-size: clamp(17px, 4.6vw, 19px); font-weight: 700; line-height: 1.42; }
.sig { font-family: var(--hand); font-size: clamp(26px, 7.5vw, 34px) !important; color: #d6338a; margin-top: 14px !important; }
.r { animation: rise .7s cubic-bezier(.2, 1.3, .4, 1) both; }
.r1 { animation-delay: .5s; } .r2 { animation-delay: 1s; } .r3 { animation-delay: 1.8s; }
.r4 { animation-delay: 2.6s; } .r5 { animation-delay: 3.3s; } .r6 { animation-delay: 4s; }

/* Torte */
.tiny { margin-top: 10px; font-size: clamp(14px, 3.9vw, 17px); font-weight: 800; text-shadow: 0 2px 0 rgba(60, 20, 110, .8); }
.final {
  margin-top: calc(var(--top) + 42px); width: min(92vw, 440px); padding: 6px 18px 18px; border-radius: 28px;
  background: rgba(255, 255, 255, .94); color: var(--ink); box-shadow: 0 10px 0 rgba(90, 40, 160, .35), 0 0 40px rgba(255, 160, 230, .5);
  pointer-events: auto;
}
.final .fimg { width: 110px; margin-top: -2px; animation: float 2.4s ease-in-out infinite; }
.final h1 { margin: 0; font-size: clamp(28px, 8.4vw, 40px); font-weight: 900; color: #d6338a; }
.final p { margin: 8px 0; font-size: clamp(17px, 4.6vw, 20px); font-weight: 700; }
.final .tiny { color: #7a52b3; text-shadow: none; }
.final .btn.sec { color: #6a3fb0; background: #f1e8ff; box-shadow: 0 4px 0 #d8c6f5; }

/* Animationen */
.pop { animation: pop .55s cubic-bezier(.2, 1.6, .4, 1) both; }
.d1 { animation-delay: .35s; } .d2 { animation-delay: .9s; } .d3 { animation-delay: 1.4s; }
@keyframes pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pulse { 50% { transform: scale(1.07); opacity: .85; } }
@keyframes bubbleIn { from { opacity: 0; transform: translateX(-50%) translateY(30px) scale(.8); } }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-4deg) scale(1.05); } 90% { transform: rotate(4deg) scale(1.05); } 95% { transform: rotate(-2deg); } }
@keyframes bump { 50% { transform: scale(1.06); } }
@keyframes countPop { 0% { opacity: 0; transform: scale(2.2); } 25% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(.85); } }
@keyframes cardIn { from { opacity: 0; transform: scale(.2) rotate(-12deg) translateY(30vh); } }
@keyframes shimmer { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.9); } }
@keyframes wave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px) rotate(-3deg); } }
@keyframes float { 50% { transform: translateY(-6px) rotate(2deg); } }

@media (prefers-reduced-motion: reduce) {
  .btn, .hint, .name span, .card-uni, .fimg { animation: none !important; }
}
