/* =========================================================
   Geburtstagsquiz – Design
   Dunkler Hintergrund, Blau/Violett, dezentes Gold.
   Mobile First: alles ist zuerst fürs Handy gebaut.
   ========================================================= */

:root {
  --bg: #070912;
  --bg-glow-1: #1b2350;
  --bg-glow-2: #2a1a4d;
  --surface: rgba(255, 255, 255, 0.058);
  --surface-strong: rgba(255, 255, 255, 0.085);
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #edf0ff;
  --muted: #a8afd0;
  --blue: #6f8dff;
  --violet: #a678ff;
  --gold: #e7c46a;
  --good: #4ad7b0;
  --bad: #ff8193;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --tap: 56px;
}

* {
  box-sizing: border-box;
}

/* Versteckt heißt versteckt – auch bei Elementen mit eigenem display-Wert
   (Bilder, Chips, Listen). Ohne diese Zeile würde "hidden" dort wirkungslos sein. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "SF Pro Text", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* --- Hintergrund-Ebenen ------------------------------------------------ */

/* Der weiche Farbverlauf liegt in einer eigenen, fest stehenden Ebene.
   So bleibt er auch auf sehr langen Seiten sauber – ohne das auf Handys
   oft fehlerhafte "background-attachment: fixed". */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 12% -10%, var(--bg-glow-1) 0%, transparent 55%),
    radial-gradient(110% 75% at 92% 4%, var(--bg-glow-2) 0%, transparent 52%),
    linear-gradient(180deg, #070912 0%, #05060d 100%);
}


.bg-canvas,
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.bg-canvas {
  z-index: 0;
}

.confetti-canvas {
  z-index: 40;
}

/* --- Grundgerüst ------------------------------------------------------- */

.page {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  padding: 22px 18px 26px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.screen {
  animation: screen-in 0.45s ease both;
}

.screen[hidden] {
  display: none;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  box-shadow: var(--shadow);
  /* Bewusst ohne backdrop-filter: das kostet auf Handys spürbar Leistung
     und führt beim Scrollen langer Seiten zu Darstellungsfehlern. */
}

/* --- Typografie -------------------------------------------------------- */

h1,
h2,
h3 {
  margin: 0 0 10px;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

h1 {
  font-size: clamp(1.6rem, 7vw, 2.15rem);
}

h2 {
  font-size: clamp(1.3rem, 5.6vw, 1.6rem);
}

p {
  margin: 0 0 14px;
}

.lead {
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.tiny {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.gradient-text {
  background: linear-gradient(100deg, var(--blue), var(--violet) 55%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.gold {
  color: var(--gold);
}

/* --- Intro ------------------------------------------------------------- */

.intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  min-height: 60dvh;
}

.intro-badge {
  font-size: clamp(1.5rem, 8vw, 2.4rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 16px 20px;
  border: 1px solid rgba(231, 196, 106, 0.4);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(111, 141, 255, 0.14), rgba(166, 120, 255, 0.14));
  box-shadow: 0 0 42px rgba(111, 141, 255, 0.22);
  animation: badge-in 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.intro-sub {
  color: var(--muted);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.72rem;
  animation: fade-in 0.8s 0.5s both;
}

@keyframes badge-in {
  0% {
    opacity: 0;
    transform: scale(0.86);
    filter: blur(8px);
  }
  60% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* --- Formulare --------------------------------------------------------- */

label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 7px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  background: rgba(9, 12, 26, 0.72);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(111, 141, 255, 0.25);
}

input::placeholder,
textarea::placeholder {
  color: #6f78a0;
}

/* --- Buttons ----------------------------------------------------------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  padding: 15px 20px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  text-align: center;
  text-decoration: none;
  background: linear-gradient(100deg, var(--blue), var(--violet));
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 10px 26px rgba(90, 100, 255, 0.28);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.995);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: none;
  color: var(--text);
  font-weight: 500;
}

.btn-quiet {
  background: none;
  border: 1px solid var(--border);
  box-shadow: none;
  color: var(--muted);
  font-weight: 500;
  min-height: 48px;
  padding: 11px 16px;
  font-size: 0.92rem;
}

.btn-danger {
  background: rgba(255, 129, 147, 0.14);
  border: 1px solid rgba(255, 129, 147, 0.45);
  color: var(--bad);
  box-shadow: none;
}

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

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

/* --- Quiz -------------------------------------------------------------- */

.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

.chip {
  display: inline-block;
  padding: 5px 11px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(231, 196, 106, 0.1);
  border: 1px solid rgba(231, 196, 106, 0.3);
  border-radius: 999px;
  white-space: nowrap;
}

.progress {
  height: 7px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--violet));
  transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.question-text {
  font-size: clamp(1.15rem, 5vw, 1.4rem);
  font-weight: 650;
  margin-bottom: 16px;
}

.question-image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 18px;
}

.answer {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 62px;
  padding: 14px 16px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.14s ease;
}

.answer:active {
  transform: scale(0.99);
}

.answer .marker {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  transition: all 0.18s ease;
}

.answer.selected {
  border-color: var(--blue);
  background: linear-gradient(100deg, rgba(111, 141, 255, 0.18), rgba(166, 120, 255, 0.16));
  box-shadow: 0 0 0 1px rgba(111, 141, 255, 0.4), 0 0 26px rgba(111, 141, 255, 0.18);
}

.answer.selected .marker {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(100deg, var(--blue), var(--violet));
}

.answer.locked {
  cursor: default;
  opacity: 0.55;
}

.answer.locked.selected {
  opacity: 1;
  animation: pulse-lock 0.5s ease;
}

@keyframes pulse-lock {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.025);
  }
  100% {
    transform: scale(1);
  }
}

/* --- Auswertung -------------------------------------------------------- */

.calc {
  text-align: center;
  padding: 40px 0;
}

.spinner {
  width: 46px;
  height: 46px;
  margin: 0 auto 18px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.score-ring {
  position: relative;
  width: 186px;
  height: 186px;
  margin: 4px auto 18px;
}

.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring .track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 11;
}

.score-ring .value {
  fill: none;
  stroke: url(#ringGradient);
  stroke-width: 11;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.score-ring .ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-ring .percent {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.score-ring .points {
  font-size: 0.85rem;
  color: var(--muted);
}

.result-title {
  text-align: center;
  font-size: clamp(1.25rem, 5.4vw, 1.55rem);
  font-weight: 750;
  margin-bottom: 8px;
}

.result-text,
.result-sentence {
  text-align: center;
  color: var(--muted);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 22px 0;
}

/* --- Antworten ansehen ------------------------------------------------- */

.review-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.review-item {
  padding: 14px 15px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-left: 3px solid var(--bad);
  border-radius: 14px;
}

.review-item.correct {
  border-left-color: var(--good);
}

.review-item .review-q {
  font-weight: 600;
  margin-bottom: 8px;
}

.review-item .row {
  display: flex;
  gap: 8px;
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.review-item .row .key {
  flex: 0 0 auto;
  color: var(--muted);
}

.result-good {
  color: var(--good);
}

.result-bad {
  color: var(--bad);
}

.review-item .explanation {
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}

/* --- Gästebuch --------------------------------------------------------- */

.counter {
  display: block;
  margin-top: 6px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--muted);
}

.counter.limit {
  color: var(--gold);
}

.notice {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 14px;
}

.notice.error {
  border-color: rgba(255, 129, 147, 0.45);
  background: rgba(255, 129, 147, 0.1);
  color: #ffd3da;
}

.notice.success {
  border-color: rgba(74, 215, 176, 0.4);
  background: rgba(74, 215, 176, 0.1);
  color: #c6f6e8;
}

.notice.info {
  border-color: rgba(111, 141, 255, 0.4);
  background: rgba(111, 141, 255, 0.1);
}

.field-error {
  margin: 8px 0 0;
  color: var(--bad);
  font-size: 0.88rem;
  min-height: 1.2em;
}

/* --- Test-Banner ------------------------------------------------------- */

.test-banner {
  position: relative;
  z-index: 3;
  margin-bottom: 14px;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #0a0c17;
  background: linear-gradient(100deg, var(--gold), #f3dfa5);
  text-align: center;
}

/* --- Fußzeile ---------------------------------------------------------- */

.site-footer {
  margin-top: 26px;
  text-align: center;
  font-size: 0.74rem;
  color: rgba(168, 175, 208, 0.62);
}

.site-footer a {
  color: inherit;
}

/* --- Sehr kleine Handys ------------------------------------------------ */

@media (max-width: 360px) {
  body {
    font-size: 16px;
  }

  .page {
    padding: 16px 13px 20px;
  }

  .card {
    padding: 18px 14px;
    border-radius: 20px;
  }

  .answer {
    min-height: 56px;
    padding: 12px 13px;
  }

  .score-ring {
    width: 158px;
    height: 158px;
  }

  .score-ring .percent {
    font-size: 2.1rem;
  }
}

/* --- Bewegung reduzieren ----------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
