/* ---------- Bühne & Schritte ---------- */

.stage {
  position: relative; z-index: 2;
  display: grid; place-items: center;
  min-height: 100svh;
  padding: 112px 16px calc(min(26vh, 220px) * 0.55 + 24px);
  overflow-x: clip;
}
.stage > .step { grid-area: 1 / 1; width: 100%; animation: step-in 0.45s var(--ease-out) both; }
.stage > .step.leaving { animation: step-out 0.25s ease-in both; pointer-events: none; }
.loading { color: var(--cream); font-size: 1.6rem; }

@keyframes step-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes step-out { to { opacity: 0; transform: translateY(-8px); } }

.panel {
  position: relative;
  max-width: 460px; margin: 0 auto;
  padding: 56px 28px 28px;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text);
  text-align: center;
  box-shadow: var(--shadow);
  display: grid; gap: 14px;
}
.panel > * { position: relative; z-index: 1; }
.panel-wichtel {
  position: absolute !important; top: -74px; left: 50%; width: 84px; transform: translateX(-50%);
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.2));
}
.panel h1 { font-size: clamp(1.9rem, 7vw, 2.35rem); }
.panel h2 { font-size: clamp(1.6rem, 6vw, 1.95rem); }
.panel h1:focus, .panel h2:focus, .draw-head h2:focus { outline: none; }
.panel .eyebrow { margin-bottom: -6px; }
.lead { color: var(--text); font-size: 1.02rem; max-width: 38ch; margin: 0 auto; }
.fine { font-size: 0.86rem; color: var(--muted); display: inline-flex; gap: 0.4em; align-items: center; justify-content: center; line-height: 1.5; }
.fine .icon { width: 1em; height: 1em; }
.panel .btn.block { margin-top: 6px; }
.panel .btn.block + .btn.block { margin-top: 0; }

.back { position: absolute !important; top: 14px; left: 18px; font-size: 0.92rem; }

/* ---------- Eckdaten (Budget, Bescherung) ---------- */

.facts {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  margin: 4px 0; padding: 14px 0;
  border-block: 1px solid var(--line);
}
.facts > div { display: grid; gap: 2px; padding: 0 8px; align-content: start; }
.facts > div + div { border-left: 1px solid var(--line); }
.facts dt { font-size: 0.78rem; color: var(--muted); }
.facts dd { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 1.1rem; color: var(--ink); }
.facts small { font-size: 0.8rem; color: var(--pine-light); }

/* ---------- Namen wählen ---------- */

.houses { display: grid; gap: 10px; text-align: left; margin: 6px 0 2px; }
.house {
  --house: var(--berry);
  padding: 12px 14px 14px; border-radius: 14px;
  background: #fff; border: 1px solid var(--line);
}
.house-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.house-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--house); flex: none; }
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--cream);
  color: var(--ink); font-weight: 500; font-size: 1rem; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.person:hover { border-color: var(--house); background: color-mix(in srgb, var(--house) 8%, white); }
.person:active { transform: scale(0.98); }
.person:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.person.done { background: transparent; color: var(--muted); }
.person.done .icon { color: var(--ok); width: 1em; height: 1em; }

/* ---------- Telefonnummer ---------- */

.phone-form { display: grid; gap: 12px; margin-top: 4px; }
.phone-field {
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; min-height: 56px;
  border: 1px solid var(--sand-dark); border-radius: var(--radius-sm); background: #fff;
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.phone-field:focus-within { border-color: var(--berry); box-shadow: 0 0 0 3px rgba(168, 66, 63, 0.14); color: var(--berry); }
.phone-field .icon { width: 1.3em; height: 1.3em; }
.phone-field input {
  flex: 1; min-width: 0; border: 0; outline: none; background: none;
  font-size: 1.2rem; font-weight: 500; letter-spacing: 0.02em; color: var(--ink);
}
.phone-field input::placeholder { color: #C2B7AB; font-weight: 400; }
.error-slot:empty { display: none; }
.error-slot { display: grid; gap: 8px; justify-items: center; text-align: left; }

/* ---------- Geheimzahl / Code ---------- */

.code-input {
  width: 100%; min-height: 64px; padding: 0 0 0 0.5em;
  border: 1px solid var(--sand-dark); border-radius: var(--radius-sm); background: #fff;
  font-size: 1.9rem; font-weight: 600; letter-spacing: 0.5em; text-align: center; color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.code-input::placeholder { color: #D4C9BC; }
.code-input:focus { outline: none; border-color: var(--berry); box-shadow: 0 0 0 3px rgba(168, 66, 63, 0.14); }
.code-input.shake { animation: nope 0.35s ease-in-out; border-color: var(--berry); }
.test-hint {
  display: flex; gap: 8px; align-items: center; justify-content: center;
  padding: 10px 14px; border-radius: var(--radius-sm); background: #E8EEF3; color: #2D4A62; font-size: 0.9rem;
}
.test-hint b { letter-spacing: 0.2em; }
@keyframes nope { 0%, 100% { transform: translateX(0); } 25%, 75% { transform: translateX(-5px); } 50% { transform: translateX(5px); } }

/* ---------- Ziehen ---------- */

.step.bare { display: grid; justify-items: center; gap: 18px; text-align: center; padding-bottom: calc(min(26vh, 220px) * 0.55); }
.draw-head { display: grid; gap: 6px; }
.draw-head .eyebrow { color: rgba(250, 245, 236, 0.65); }
.draw-head h2 { color: var(--cream); font-size: clamp(1.7rem, 6.5vw, 2.3rem); }
.hint { color: rgba(250, 245, 236, 0.75); min-height: 1.5em; font-size: 1rem; }

.theater {
  --card-w: min(80vw, 330px, calc((100svh - 330px) * 0.75));
  position: relative; width: var(--card-w); aspect-ratio: 3 / 4;
  min-width: 230px;
}
.glow {
  position: absolute; left: 50%; top: 54%; width: 120%; aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(circle, rgba(243, 213, 146, 0.22) 0%, rgba(243, 213, 146, 0.06) 40%, transparent 65%);
  transition: transform 0.8s var(--ease-out), opacity 0.6s;
}

.present {
  position: absolute; left: 50%; top: 54%; width: 82%;
  translate: -50% -50%;
  padding: 0; border: 0; background: none; cursor: pointer;
  animation: present-idle 4s ease-in-out infinite;
  transition: opacity 0.6s, scale 0.25s var(--ease-out);
}
.present:hover { scale: 1.02; }
.present:focus-visible { outline: 2px dashed var(--gold); outline-offset: 6px; border-radius: 24px; }
.present svg { width: 100%; overflow: visible; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.3)); }
.present .p-lid { transform-box: view-box; transform-origin: 120px 100px; transition: transform 0.9s var(--ease-out), opacity 0.45s 0.35s; }
.present:disabled { cursor: default; }

.present.tap1 { animation: tap-wiggle 0.45s ease-in-out; }
.present.tap2 { animation: tap-wiggle-big 0.5s ease-in-out; }
.tap-count { display: flex; gap: 8px; justify-content: center; }
.tap-count i { width: 8px; height: 8px; border-radius: 50%; background: rgba(250, 245, 236, 0.22); transition: background-color 0.2s; }
.tap-count i.on { background: var(--gold-soft); }
.skip { margin-top: -6px; }
.theater.instant *, .theater.instant { transition-duration: 0.12s !important; }

.theater.shaking .present { animation: shake 1.6s ease-in-out forwards, shake-loop 0.6s 1.6s ease-in-out infinite; }
.theater.shaking .glow { transform: translate(-50%, -50%) scale(1.15); }
.theater.opening .present { animation: none; }
.theater.opening .p-lid { transform: translate(50px, -200px) rotate(24deg); opacity: 0; }
.theater.opening .glow { transform: translate(-50%, -50%) scale(1.35); }
.theater.rising .present { opacity: 0; scale: 0.9; translate: -50% -34%; transition: opacity 0.5s, scale 0.6s, translate 0.6s; }

.flip-card {
  position: absolute; inset: 0;
  perspective: 1600px;
  opacity: 0; transform: translateY(20%) scale(0.3);
  transition: transform 0.9s var(--ease-out), opacity 0.3s;
  pointer-events: none;
}
.theater.rising .flip-card { opacity: 1; transform: none; pointer-events: auto; }
.flip-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 1.1s cubic-bezier(0.45, 0, 0.15, 1);
}
.theater.flipped .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; overflow: hidden;
  border-radius: 4.5% / 3.4%;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.65);
}
.face.front { transform: rotateY(180deg); background: var(--berry-deep); }
.face.front svg, .card-view svg { width: 100%; height: 100%; }
.face.back {
  display: grid; place-content: center; justify-items: center; gap: 16px; padding: 12%;
  background: var(--berry-deep);
}
.face.back::before {
  content: ''; position: absolute; inset: 4.5%; border-radius: 3% / 2.2%;
  border: 1.5px solid rgba(235, 210, 160, 0.45);
}
.face.back .label { font-family: var(--serif); font-weight: 500; font-style: italic; color: var(--cream); font-size: clamp(1.3rem, 6vw, 1.7rem); }
.face.back .wichtel { width: 42%; }
.ticker {
  min-width: 78%; padding: 11px 18px; border-radius: 10px;
  background: var(--cream); color: var(--berry-dark);
  font-family: var(--serif); font-weight: 600; font-size: clamp(1.15rem, 5vw, 1.4rem);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ticker span { display: inline-block; }
.ticker.tick span { animation: tick 0.12s ease-out; }
.ticker.landed { background: var(--gold-soft); color: #3E2C14; }

.after { display: grid; gap: 14px; justify-items: center; animation: step-in 0.5s var(--ease-out) both; margin-top: 6px; }
.sms-status {
  display: inline-flex; gap: 10px; align-items: center; text-align: left;
  max-width: 420px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08); color: var(--cream); font-size: 0.95rem;
}
.sms-status .icon { width: 1.3em; height: 1.3em; color: var(--gold-soft); }
.sms-status.warn .icon { color: var(--blush); }
.after-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.fine.light, .link-btn.light { color: rgba(250, 245, 236, 0.8); text-shadow: 0 1px 8px rgba(17, 29, 43, 0.9); }
.link-btn.light:hover { color: var(--cream); }

/* ---------- Kartenseite ---------- */

.card-view {
  width: min(86vw, 380px, calc((100svh - 250px) * 0.75)); min-width: 240px; aspect-ratio: 3 / 4;
  border-radius: 4.5% / 3.4%; overflow: hidden;
  box-shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.7);
  animation: card-arrive 0.8s var(--ease-out) both;
}

/* ---------- Keyframes ---------- */

@keyframes tap-wiggle {
  0%, 100% { transform: rotate(0); }
  30% { transform: rotate(-3deg); }
  65% { transform: rotate(2.5deg); }
}
@keyframes tap-wiggle-big {
  0%, 100% { transform: rotate(0) translateY(0); }
  25% { transform: rotate(-5deg) translateY(-3px); }
  55% { transform: rotate(4deg) translateY(-6px); }
  80% { transform: rotate(-2deg); }
}
@keyframes present-idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes shake {
  0% { transform: rotate(0); }
  15% { transform: rotate(-2deg); }
  30% { transform: rotate(2deg); }
  45% { transform: rotate(-3deg) translateY(-2px); }
  60% { transform: rotate(3deg) translateY(-4px); }
  75% { transform: rotate(-4deg) translateY(-6px); }
  100% { transform: rotate(0) translateY(-6px) scale(1.04); }
}
@keyframes shake-loop {
  0%, 100% { transform: rotate(-2.5deg) translateY(-6px) scale(1.04); }
  50% { transform: rotate(2.5deg) translateY(-8px) scale(1.04); }
}
@keyframes tick { from { transform: translateY(-50%); opacity: 0.3; } to { transform: none; opacity: 1; } }
@keyframes card-arrive { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

@media (max-width: 420px) {
  .panel { padding: 52px 20px 24px; }
  .stage { padding-top: 104px; }
}

/* ---------- Direkt ziehen (hinterlegte Nummer) ---------- */

.change-name { justify-self: center; margin-bottom: 4px; font-size: 0.9rem; }
.sms-hint { margin-top: 4px; font-size: 0.85rem; }
.lead b, .sms-status b { white-space: nowrap; }

/* ---------- Kalender & Kartenseite ---------- */

.cal-options { display: grid; gap: 10px; }
.card-links { display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: center; font-size: 0.9rem; }
.after > .link-btn { font-size: 0.95rem; }
