/*
 * Weihnachtsquiz – Stilrichtung „alte Weihnachtskarte“:
 * cremefarbenes Papier auf Tannengrün, Beerenrot als Signalfarbe, Gold für Zierrat.
 * Schriften bewusst aus dem System (keine Abrufe bei Dritten): Buch-Antiqua für Überschriften,
 * humanistische Grotesk für Fließtext.
 */

:root {
  --fir-950: #0a1f19;
  --fir-900: #12352b;
  --fir-700: #1f5140;
  --fir-glow: #2c6a53;
  --paper: #fbf4e2;
  --paper-bright: #fffaf0;
  --paper-edge: #d9c9a3;
  --ink: #2a211c;
  --ink-soft: #65574c;
  --berry: #b3261e;
  --berry-deep: #86170f;
  --pine: #2b6a4c;
  --gold: #c9972b;
  --gold-bright: #ecc869;
  --cream: #f6ecd4;

  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --font-body: 'Avenir Next', 'Segoe UI', 'Helvetica Neue', system-ui, sans-serif;

  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-title: clamp(2.3rem, 1.3rem + 5vw, 4.1rem);
  --text-question: clamp(1.4rem, 1.1rem + 1.7vw, 2.05rem);
  --text-score: clamp(5rem, 2rem + 15vw, 9.5rem);

  --space-card: clamp(1.5rem, 0.8rem + 4vw, 3.25rem);
  --radius-card: 6px 26px 6px 26px;
  --radius-control: 4px 14px 4px 14px;
  --sheet-offset: clamp(0.4rem, 1.4vw, 0.7rem);

  --duration-fast: 140ms;
  --duration-normal: 380ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(120% 70% at 50% -10%, var(--fir-glow) 0%, transparent 62%),
    linear-gradient(var(--fir-900), var(--fir-950));
  background-attachment: fixed;
  background-color: var(--fir-950);
}

/* Zackenborte am oberen Rand – wie die Kante eines Norwegerpullis. */
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto;
  z-index: 3;
  height: 14px;
  background:
    linear-gradient(135deg, var(--cream) 25%, transparent 25%) -7px 0 / 14px 14px,
    linear-gradient(225deg, var(--cream) 25%, transparent 25%) -7px 0 / 14px 14px,
    var(--berry);
}

h1,
p,
ul {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

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

/* ---------- Schnee ---------- */

.snow {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.snow__flake {
  position: absolute;
  top: -12px;
  left: var(--x);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: #fff;
  opacity: 0.75;
  animation: snowfall var(--fall) linear var(--delay) infinite;
}

@keyframes snowfall {
  from {
    transform: translate3d(0, -4vh, 0);
  }
  to {
    transform: translate3d(var(--drift), 106vh, 0);
  }
}

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

.stage {
  position: relative;
  z-index: 1;
  flex: 1;
  width: min(100% - 2rem, 45rem);
  margin-inline: auto;
  padding-block: clamp(2.75rem, 7vh, 5rem) 2rem;
}

.colophon {
  position: relative;
  z-index: 1;
  padding: 0 1rem 1.75rem;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.9rem;
  color: rgb(246 236 212 / 0.72);
}

/* ---------- Karte ---------- */

.card {
  position: relative;
  padding: var(--space-card);
  border-radius: var(--radius-card);
  background: linear-gradient(175deg, var(--paper-bright), var(--paper) 55%, #f6ead0);
  box-shadow:
    var(--sheet-offset) var(--sheet-offset) 0 var(--berry),
    0 2.2rem 4rem -1.4rem rgb(0 0 0 / 0.65);
  animation: card-in var(--duration-normal) var(--ease-out) both;
}

/* Gestrichelte Naht wie bei einer geprägten Glückwunschkarte. */
.card::after {
  content: '';
  position: absolute;
  inset: 0.55rem;
  border: 1.5px dashed rgb(201 151 43 / 0.55);
  border-radius: 3px 20px 3px 20px;
  pointer-events: none;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(16px) rotate(-0.6deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--berry);
}

.eyebrow::after {
  content: '';
  flex: 0 1 5rem;
  height: 1.5px;
  background: var(--gold);
}

.card__title {
  margin-top: 0.5rem;
  font-family: var(--font-display);
  font-size: var(--text-title);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lead {
  max-width: 36rem;
  margin-top: 1.1rem;
  font-size: 1.08em;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 0;
  margin-top: 1.9rem;
  padding: 1.1rem 0;
  list-style: none;
  border-block: 1.5px solid var(--paper-edge);
}

.facts li {
  display: flex;
  flex-direction: column;
  padding-inline: 1.4rem;
  border-left: 1.5px solid var(--gold);
}

.facts li:first-child {
  padding-left: 0;
  border-left: 0;
}

.facts strong {
  font-family: var(--font-display);
  font-size: 2.1rem;
  line-height: 1;
  color: var(--berry);
}

.facts span {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1rem;
  margin-top: 2rem;
}

.hint {
  margin-top: 1.4rem;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-soft);
}

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

.button {
  padding: 0.95rem 1.7rem;
  border: 2px solid transparent;
  border-radius: var(--radius-control);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) linear;
}

.button--primary {
  background: var(--berry);
  color: var(--paper-bright);
  box-shadow: 0 5px 0 var(--berry-deep);
}

.button--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 var(--berry-deep);
}

.button--primary:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--berry-deep);
}

.button--ghost {
  background: transparent;
  border-color: var(--ink);
}

.button--ghost:hover {
  background: var(--ink);
  color: var(--paper-bright);
}

/* ---------- Spielstand über der Karte ---------- */

.status {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 0.6rem 1rem;
  margin-bottom: 1.4rem;
  color: var(--cream);
}

.status__count {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.status__count strong {
  font-size: 2.2rem;
  line-height: 1;
  color: var(--gold-bright);
}

.status__meta {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status__clock {
  min-width: 3.2em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--gold-bright);
}

.status__bar {
  grid-column: 1 / -1;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  appearance: none;
  background: rgb(255 255 255 / 0.14);
}

.status__bar::-webkit-progress-bar {
  background: transparent;
}

/* Zuckerstange als Fortschrittsbalken. */
.status__bar::-webkit-progress-value {
  background: repeating-linear-gradient(135deg, var(--berry) 0 9px, var(--cream) 9px 18px);
}

.status__bar::-moz-progress-bar {
  background: repeating-linear-gradient(135deg, var(--berry) 0 9px, var(--cream) 9px 18px);
}

/* ---------- Frage ---------- */

.stamp {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border: 1.5px solid var(--berry);
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--berry);
  transform: rotate(-2deg);
}

.card__question {
  margin: 1rem 0 1.5rem;
  font-family: var(--font-display);
  font-size: var(--text-question);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* Die Überschrift bekommt den Fokus nur per Skript (Vorlesen der neuen Frage), daher ohne Rahmen. */
.card__question:focus {
  outline: none;
}

.options {
  display: grid;
  gap: 0.7rem;
}

.option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 0.75rem;
  border: 1.5px solid var(--paper-edge);
  border-radius: var(--radius-control);
  background: var(--paper-bright);
  text-align: left;
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) linear,
    opacity var(--duration-normal) linear;
}

.option:hover:enabled {
  transform: translateX(5px);
  border-color: var(--gold);
  box-shadow: -5px 0 0 var(--gold);
}

.option:active:enabled {
  transform: translateX(2px);
}

.option:disabled {
  cursor: default;
}

.option__letter {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background: var(--fir-700);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--cream);
}

.option--correct,
.option--wrong {
  color: #fff;
}

.option--correct {
  border-color: var(--pine);
  background: var(--pine);
}

.option--wrong {
  border-color: var(--berry);
  background: var(--berry);
  animation: head-shake var(--duration-normal) var(--ease-out);
}

.option--correct .option__letter,
.option--wrong .option__letter {
  background: #fff;
}

.option--correct .option__letter {
  color: var(--pine);
}

.option--wrong .option__letter {
  color: var(--berry);
}

/* Richtig/falsch nie nur über Farbe: zusätzlich Haken bzw. Kreuz. */
.option--correct .option__text::after {
  content: '  ✓';
  font-weight: 700;
}

.option--wrong .option__text::after {
  content: '  ✗';
  font-weight: 700;
}

.option--dimmed {
  opacity: 0.5;
}

@keyframes head-shake {
  20% {
    transform: translateX(-6px);
  }
  50% {
    transform: translateX(5px);
  }
  80% {
    transform: translateX(-2px);
  }
}

/* ---------- Auflösung ---------- */

.feedback:empty {
  display: none;
}

.feedback {
  margin-top: 1.6rem;
  padding-top: 1.3rem;
  border-top: 1.5px dashed var(--paper-edge);
  animation: reveal var(--duration-normal) var(--ease-out) both;
}

.feedback__verdict {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1.25;
}

.feedback--correct .feedback__verdict {
  color: var(--pine);
}

.feedback--wrong .feedback__verdict {
  color: var(--berry);
}

.feedback__explanation {
  max-width: 62ch;
  margin: 0.45rem 0 1.4rem;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

.card--result {
  text-align: center;
}

.card--result .eyebrow,
.card--result .actions {
  justify-content: center;
}

.card--result .eyebrow::before {
  content: '';
  flex: 0 1 5rem;
  height: 1.5px;
  background: var(--gold);
}

.card--result .lead {
  margin-inline: auto;
}

.score {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.6rem;
  font-family: var(--font-display);
}

.score strong {
  font-size: var(--text-score);
  line-height: 0.95;
  color: var(--berry);
  text-shadow: 0.04em 0.04em 0 var(--gold-bright);
}

.score span {
  font-size: 0.85rem;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.card--result .card__title {
  margin-top: 1.2rem;
  font-size: clamp(1.9rem, 1.2rem + 3.2vw, 3rem);
}

/* ---------- Kleine Bildschirme ---------- */

@media (max-width: 26rem) {
  .facts li {
    padding-inline: 0.9rem;
  }

  .facts strong {
    font-size: 1.7rem;
  }

  .actions .button {
    width: 100%;
  }
}

/* ---------- Weniger Bewegung ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .snow {
    display: none;
  }
}
