/* ==================================================================
   typneun Willkommens-Quiz – Styling
   ================================================================== */

/* ------------------------------------------------ Hausschrift */

@font-face {
  font-family: "Uni Neue";
  src: url("fonts/UniNeueBook.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Uni Neue";
  src: url("fonts/UniNeueRegular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Uni Neue";
  src: url("fonts/UniNeueBold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------ Variablen */

:root {
  --blau: #002244;
  --blau-hell: #06305c;
  --weiss: #ffffff;
  --gruen: #aceb15;
  --rot: #ff8d8d;        /* Textfarbe auf dunklem Grund */
  --rot-voll: #ff0000;   /* Flaeche der falsch gewaehlten Antwort */

  --font: "Uni Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 14px;
  --radius-gross: 20px;
  --rand: clamp(16px, 5vw, 32px);
  --tempo: 320ms;
  --kurve: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ------------------------------------------------ Grundlagen */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* hidden muss das display der Knöpfe schlagen */
[hidden] {
  display: none !important;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--blau);
  color: var(--weiss);
  font-family: var(--font);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

/* ------------------------------------------------ Kopf mit Logo */

.kopf {
  padding: var(--rand) var(--rand) 0;
  flex: 0 0 auto;
}

.logo {
  display: block;
  width: 132px;
  max-width: 45vw;
  height: auto;
}

/* ------------------------------------------------ Bühne / Screens */

.buehne {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--rand);
}

.screen {
  display: none;
  width: 100%;
  max-width: 640px;
}

.screen--aktiv {
  display: block;
  animation: screen-rein var(--tempo) var(--kurve) both;
}

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

/* ------------------------------------------------ Karten */

.karte {
  background: var(--blau-hell);
  border-radius: var(--radius-gross);
  padding: clamp(20px, 6vw, 36px);
}

.karte--start,
.karte--ergebnis {
  text-align: center;
}

.karte--frage {
  animation: karte-rein var(--tempo) var(--kurve) both;
}

@keyframes karte-rein {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: none; }
}

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

.titel {
  margin: 0 0 12px;
  color: var(--gruen);
  font-weight: 700;
  font-size: clamp(1.7rem, 7vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.intro {
  margin: 0 0 24px;
  color: var(--weiss);
  font-weight: 300;
  font-size: 1.0625rem;
}

.hinweis {
  margin: 20px 0 0;
  color: var(--weiss);
  opacity: 0.6;
  font-size: 0.8125rem;
  font-weight: 300;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95em;
}

.frage {
  margin: 0 0 22px;
  color: var(--gruen);
  font-weight: 700;
  font-size: clamp(1.25rem, 5vw, 1.6rem);
  line-height: 1.25;
  text-wrap: balance;
}

/* ------------------------------------------------ Fortschritt */

.fortschritt {
  margin-bottom: 16px;
}

.fortschritt__zeile {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 400;
}

.fortschritt__text {
  color: var(--weiss);
  opacity: 0.75;
}

.fortschritt__punkte {
  color: var(--gruen);
}

.fortschritt__bahn {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

.fortschritt__balken {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--gruen);
  transition: width 420ms var(--kurve);
}

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

.antworten {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.antwort {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px 14px 52px;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  background: transparent;
  color: var(--weiss);
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms, background-color 180ms, transform 180ms;
  animation: antwort-rein 300ms var(--kurve) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

@keyframes antwort-rein {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Buchstabe A–D vor der Antwort */
.antwort__kuerzel {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: var(--weiss);
  font-size: 0.8125rem;
  font-weight: 700;
}

@media (hover: hover) {
  .antwort:not([disabled]):hover {
    border-color: var(--gruen);
    background: rgba(172, 235, 21, 0.08);
  }
}

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

.antwort[disabled] {
  cursor: default;
}

/* Zustände nach dem Antworten */

.antwort--richtig {
  border-color: var(--gruen);
  background: var(--gruen);
  color: var(--blau);
  animation:
    antwort-pop 420ms var(--kurve) both,
    antwort-puls 1700ms var(--kurve) 420ms infinite;
}

.antwort--richtig .antwort__kuerzel {
  background: rgba(0, 34, 68, 0.18);
  color: var(--blau);
}

@keyframes antwort-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.035); }
  100% { transform: scale(1); }
}

/* Laeuft nach dem Pop weiter, solange die Antwort steht */
@keyframes antwort-puls {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(172, 235, 21, 0.5);
  }
  55% {
    transform: scale(1.02);
    box-shadow: 0 0 0 10px rgba(172, 235, 21, 0);
  }
}

.antwort--falsch {
  border-color: var(--rot-voll);
  background: var(--rot-voll);
  color: var(--weiss);
  animation: antwort-shake 420ms var(--kurve) both;
}

.antwort--falsch .antwort__kuerzel {
  background: rgba(255, 255, 255, 0.28);
  color: var(--weiss);
}

@keyframes antwort-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-7px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(2px); }
}

/* animation: none ist noetig, sonst haelt die Einblend-Animation
   per fill "both" die Deckkraft auf 1 und opacity greift nicht. */
.antwort--blass {
  animation: none;
  opacity: 0.4;
}

/* ------------------------------------------------ Feedback */

.feedback {
  margin-top: 18px;
}

/* Vor der Antwort steht nichts da – dann auch kein Abstand */
.feedback--leer {
  margin-top: 0;
}

.feedback__kopf {
  margin: 0;
  font-weight: 700;
  font-size: 1.0625rem;
}

.feedback__kopf:empty {
  display: none;
}

.feedback--richtig .feedback__kopf {
  color: var(--gruen);
}

.feedback--falsch .feedback__kopf {
  color: var(--rot);
}

.feedback__text {
  margin: 4px 0 0;
  color: var(--weiss);
  font-weight: 300;
}

.feedback__text:empty {
  display: none;
}

.feedback:not(.feedback--leer) {
  animation: feedback-rein 280ms var(--kurve) both;
}

@keyframes feedback-rein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------ Knöpfe */

.knopf {
  display: inline-block;
  min-height: 56px;
  padding: 15px 30px;
  border: 0;
  border-radius: var(--radius);
  background: var(--gruen);
  color: var(--blau);
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms var(--kurve), filter 160ms;
}

@media (hover: hover) {
  .knopf:hover {
    filter: brightness(1.08);
  }
}

.knopf:active {
  transform: scale(0.98);
}

.knopf:focus-visible {
  outline: 3px solid var(--weiss);
  outline-offset: 3px;
}

.knopf--gross {
  width: 100%;
}

.knopf--weiter {
  width: 100%;
  margin-top: 18px;
  animation: feedback-rein 280ms var(--kurve) 60ms both;
}

/* ------------------------------------------------ Ergebnis-Ring */

.ring {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 20px;
}

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

.ring__bahn,
.ring__wert {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
}

.ring__bahn {
  stroke: rgba(255, 255, 255, 0.15);
}

.ring__wert {
  stroke: var(--gruen);
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 1100ms var(--kurve);
}

.ring__zahl {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gruen);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
}

.ergebnis-zeile {
  margin: 0 0 14px;
  color: var(--weiss);
  opacity: 0.8;
  font-size: 0.9375rem;
}

/* ------------------------------------------------ Emoji-Overlay

   Ein grosses Emoji, das mittig ueber allem aufploppt, kurz steht
   und wieder verschwindet. 0,4 s Vorlauf, dann 2,5 s Ablauf.       */

.emoji-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 3vw, 20px);
  pointer-events: none;
  z-index: 20;
}

.emoji-overlay__zeichen {
  font-size: clamp(5rem, 26vw, 9rem);
  line-height: 1;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.5));
  animation: emoji-auftritt 2500ms var(--kurve) both;
  animation-delay: calc(400ms + var(--i, 0) * 80ms);
}

@keyframes emoji-auftritt {
  0%   { opacity: 0; transform: scale(0.3) translateY(26px) rotate(-14deg); }
  18%  { opacity: 1; transform: scale(1.2) translateY(-8px) rotate(6deg); }
  32%  { opacity: 1; transform: scale(1) translateY(0) rotate(0deg); }
  68%  { opacity: 1; transform: scale(1) translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: scale(1.45) translateY(-22px) rotate(0deg); }
}

/* Bei reduzierter Bewegung einfach stehen lassen, die Logik in
   app.js raeumt sie nach kurzer Zeit wieder weg. */
.emoji-overlay--ruhig .emoji-overlay__zeichen {
  animation: none;
  opacity: 1;
}

/* ------------------------------------------------ Konfetti */

#konfetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* ------------------------------------------------ Schmale Geräte */

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

  .antwort {
    padding-left: 48px;
    font-size: 1rem;
  }

  .ring {
    width: 128px;
    height: 128px;
  }

  .ring__zahl {
    font-size: 2.2rem;
  }
}

/* ------------------------------------------------ Reduzierte Bewegung */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }

  /* Das Pulsieren liefe sonst als Endlosschleife mit 0 ms weiter */
  .antwort--richtig {
    animation: none !important;
  }
}
