/* =====================================================================
   Ninas Quest – Die Befreiung des Artefakts
   Dunkler Fantasy-Look · Pergamentkarte · goldene Akzente
   ===================================================================== */

:root {
  --bg-0: #0b0a14;
  --bg-1: #161226;
  --bg-2: #0e1b1a;
  --parchment-0: #f3e2bd;
  --parchment-1: #e8d09a;
  --parchment-2: #d8b87a;
  --ink: #3a2a14;
  --ink-soft: #6b5436;
  --gold-0: #ffe9a8;
  --gold-1: #e3b341;
  --gold-2: #a9791f;
  --gold-deep: #7a5512;
  --crimson: #8c2f2a;
  --green: #2f6d42;
  --shadow: rgba(0, 0, 0, 0.55);
  --rune-font: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }

/* hidden-Attribut muss display:block-Buttons sicher verbergen */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--serif);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 50% -10%, #25203f 0%, transparent 60%),
    radial-gradient(900px 600px at 90% 110%, #123028 0%, transparent 55%),
    radial-gradient(900px 600px at 10% 100%, #2a1330 0%, transparent 55%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 55%, var(--bg-2));
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(0.75rem, 3vw, 2.5rem) 1rem 1rem;
  overflow-x: hidden;
}

/* ---------- Schwebende Glut im Hintergrund ---------- */
.embers {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255, 200, 120, 0.5), transparent),
    radial-gradient(2px 2px at 70% 60%, rgba(255, 180, 90, 0.4), transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, rgba(255, 220, 150, 0.45), transparent),
    radial-gradient(1.5px 1.5px at 85% 20%, rgba(255, 200, 120, 0.4), transparent),
    radial-gradient(2px 2px at 55% 15%, rgba(255, 190, 110, 0.35), transparent);
  background-size: 100% 100%;
  animation: emberDrift 18s linear infinite;
  opacity: 0.7;
}
@keyframes emberDrift {
  0%   { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
  100% { background-position: 0 -600px, 0 -800px, 0 -500px, 0 -700px, 0 -650px; }
}

/* ---------- Funkel-/Goldpartikel ---------- */
.sparkle-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}
.spark {
  position: absolute;
  width: 10px; height: 10px;
  color: var(--gold-0);
  font-size: 14px;
  line-height: 1;
  will-change: transform, opacity;
  animation: sparkFly var(--dur, 1100ms) ease-out forwards;
  text-shadow: 0 0 6px rgba(255, 215, 130, 0.9);
}
@keyframes sparkFly {
  0%   { transform: translate(0, 0) scale(0.2) rotate(0deg); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--rot, 180deg)); opacity: 0; }
}

/* ---------- Pergamentkarte ---------- */
.parchment {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: clamp(1.4rem, 4vw, 3rem) clamp(1.2rem, 4vw, 3rem) clamp(1.6rem, 4vw, 2.6rem);
  background:
    radial-gradient(120% 120% at 20% 0%, rgba(255, 255, 240, 0.5), transparent 50%),
    radial-gradient(140% 120% at 90% 100%, rgba(120, 80, 30, 0.22), transparent 55%),
    linear-gradient(160deg, var(--parchment-0), var(--parchment-1) 60%, var(--parchment-2));
  border-radius: 14px;
  border: 1px solid rgba(120, 85, 30, 0.5);
  box-shadow:
    0 0 0 2px rgba(227, 179, 65, 0.25),
    0 0 0 7px rgba(20, 14, 8, 0.35),
    0 26px 60px -10px var(--shadow),
    inset 0 0 60px rgba(120, 80, 30, 0.28),
    inset 0 0 120px rgba(60, 40, 10, 0.18);
  animation: cardIn 900ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.parchment::before {
  /* leichte Faserstruktur / Flecken */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(90, 60, 20, 0.10) 0 6px, transparent 7px),
    radial-gradient(circle at 80% 70%, rgba(90, 60, 20, 0.08) 0 9px, transparent 10px),
    radial-gradient(circle at 60% 25%, rgba(90, 60, 20, 0.06) 0 5px, transparent 6px),
    radial-gradient(circle at 30% 85%, rgba(90, 60, 20, 0.07) 0 7px, transparent 8px);
  opacity: 0.7;
  mix-blend-mode: multiply;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(26px) scale(0.97) rotateX(4deg); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Drachen-Wappen ---------- */
.crest {
  display: flex;
  justify-content: center;
  margin-bottom: 0.4rem;
}
.dragon {
  width: clamp(74px, 16vw, 104px);
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

/* ---------- Fragment-Leiste ---------- */
.fragments {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin: 0.2rem 0 1.2rem;
  flex-wrap: wrap;
}
.frag-slot {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px dashed rgba(120, 85, 30, 0.55);
  background: rgba(255, 240, 200, 0.35);
  color: var(--ink-soft);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  opacity: 0.55;
  transition: all 0.5s ease;
}
.frag-slot .frag-rune { color: var(--gold-2); font-size: 0.7rem; }
.frag-slot.found {
  opacity: 1;
  color: var(--ink);
  border-style: solid;
  border-color: var(--gold-1);
  background: linear-gradient(160deg, var(--gold-0), var(--gold-1));
  box-shadow: 0 0 14px rgba(227, 179, 65, 0.55);
  transform: scale(1.04);
}
.frag-slot.found .frag-rune { color: var(--gold-deep); }

/* ---------- Screens ---------- */
.screen { display: none; animation: screenIn 700ms ease both; }
.screen.is-active { display: block; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Typografie ---------- */
.title {
  text-align: center;
  font-size: clamp(1.9rem, 6vw, 2.9rem);
  line-height: 1.05;
  margin: 0.2rem 0 0.4rem;
  color: var(--gold-deep);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 230, 0.6), 0 2px 6px rgba(120, 80, 20, 0.3);
}
.title .subtitle {
  display: block;
  font-size: clamp(0.95rem, 2.8vw, 1.25rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.5rem;
}
.heading {
  text-align: center;
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
  color: var(--gold-deep);
  margin: 0.2rem 0 1rem;
  text-shadow: 0 1px 0 rgba(255, 255, 230, 0.55);
}
.heading .step {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--crimson);
  margin-bottom: 0.35rem;
}
.rule {
  height: 2px;
  width: 60%;
  margin: 0.6rem auto 1.4rem;
  background: linear-gradient(90deg, transparent, var(--gold-2), transparent);
  position: relative;
}
.rule::after {
  content: "❖";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--gold-2);
  background: var(--parchment-1);
  padding: 0 0.5rem;
  font-size: 0.8rem;
}
.lore {
  font-size: clamp(1rem, 2.6vw, 1.12rem);
  line-height: 1.7;
  margin: 0.7rem 0;
  color: var(--ink);
}
.lore.small { font-size: 0.95rem; }
.lore.center, .center { text-align: center; }
.muted { color: var(--ink-soft); }
.dragon-name { color: var(--crimson); font-style: italic; }
em { color: var(--gold-deep); font-style: italic; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--serif);
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  padding: 0.8rem 1.6rem;
  margin: 1rem auto 0;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--gold-deep);
  text-decoration: none;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.25s ease, filter 0.2s ease;
}
.btn-primary {
  display: block;
  width: fit-content;
  color: #2a1c06;
  background: linear-gradient(160deg, var(--gold-0), var(--gold-1) 55%, var(--gold-2));
  box-shadow: 0 6px 18px -6px rgba(120, 80, 20, 0.7), inset 0 1px 0 rgba(255, 255, 220, 0.7);
  font-weight: 600;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 10px 24px -6px rgba(120, 80, 20, 0.8); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  display: block;
  width: fit-content;
  background: transparent;
  border: 1px solid rgba(120, 85, 30, 0.55);
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-top: 0.8rem;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--gold-2); }

.btn.glow {
  animation: btnGlow 2.4s ease-in-out infinite;
  position: relative;
}
@keyframes btnGlow {
  0%, 100% { box-shadow: 0 6px 18px -6px rgba(120,80,20,0.7), 0 0 0 rgba(255,215,130,0); }
  50%      { box-shadow: 0 6px 22px -4px rgba(120,80,20,0.8), 0 0 26px rgba(255,215,130,0.7); }
}

/* ---------- Rätsel 1: Truhen ---------- */
.chests {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin: 1.4rem 0;
}
.chest {
  margin: 0;
  padding: 0.9rem 0.7rem;
  text-align: center;
  background: rgba(255, 240, 205, 0.45);
  border: 1px solid rgba(120, 85, 30, 0.4);
  border-radius: 10px;
  box-shadow: inset 0 0 18px rgba(120, 80, 30, 0.18), 0 4px 10px -6px var(--shadow);
  transition: transform 0.2s ease;
}
.chest:hover { transform: translateY(-3px); }
.chest-icon {
  position: relative;
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.chest-no {
  position: absolute;
  bottom: -4px; right: 50%;
  transform: translateX(50%);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: var(--crimson);
  border-radius: 999px;
  width: 1.35rem; height: 1.35rem;
  display: grid; place-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}
.chest figcaption { font-size: 0.86rem; line-height: 1.4; color: var(--ink); }

/* ---------- Rätsel 2: Steinreihe ---------- */
.stone-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.55rem;
  margin: 1.6rem 0;
}
.stone {
  font-family: var(--rune-font);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: clamp(0.95rem, 3vw, 1.25rem);
  padding: 0.7rem 0.85rem;
  color: #e9ddc4;
  background: linear-gradient(160deg, #4a4133, #2c2519);
  border: 1px solid #5d4f33;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 10px -5px var(--shadow);
}
.stone-missing {
  color: var(--gold-0);
  background: linear-gradient(160deg, #5a3f1c, #3a2810);
  border-color: var(--gold-2);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255,215,130,0); }
  50%      { box-shadow: 0 0 16px rgba(255,215,130,0.7); }
}

/* ---------- Rätsel 3: Inschrift ---------- */
.inscription {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1.4rem auto;
  width: fit-content;
}
.inscription-line {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
}
.inscription-line span {
  font-family: var(--rune-font);
  font-weight: 700;
  width: clamp(1.7rem, 6vw, 2.3rem);
  height: clamp(1.7rem, 6vw, 2.3rem);
  display: grid;
  place-items: center;
  font-size: clamp(0.9rem, 3vw, 1.2rem);
  color: #e9ddc4;
  background: linear-gradient(160deg, #443a2c, #2a2318);
  border: 1px solid #5d4f33;
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

/* ---------- Antwort-Formulare ---------- */
.answer { margin-top: 1.2rem; }
.answer label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--ink);
  text-align: center;
}
.answer-row {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}
.answer input {
  font-family: var(--serif);
  font-size: 1.05rem;
  padding: 0.7rem 1rem;
  width: min(280px, 70vw);
  border-radius: 10px;
  border: 1px solid rgba(120, 85, 30, 0.55);
  background: rgba(255, 250, 235, 0.85);
  color: var(--ink);
  box-shadow: inset 0 2px 6px rgba(120, 80, 30, 0.18);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.answer input:focus {
  border-color: var(--gold-1);
  box-shadow: inset 0 2px 6px rgba(120, 80, 30, 0.18), 0 0 0 3px rgba(227,179,65,0.3);
}
.answer .btn-primary { margin-top: 0; }
.feedback {
  min-height: 1.4rem;
  text-align: center;
  margin: 0.8rem 0 0;
  font-size: 0.95rem;
  font-style: italic;
}
.feedback.ok { color: var(--green); font-weight: 600; font-style: normal; }
.feedback.bad { color: var(--crimson); }
.answer.solved input { border-color: var(--green); background: rgba(225, 245, 225, 0.7); }

/* Falsch-Schüttler */
.shake { animation: shake 0.5s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* ---------- C 7 K Runen-Rahmen ---------- */
.rune-frame {
  margin-top: 1.6rem;
  padding: 1.2rem;
  text-align: center;
  border-top: 1px dashed rgba(120, 85, 30, 0.5);
  animation: screenIn 600ms ease both;
}
.rune-stones {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  margin: 1rem 0 0.5rem;
}
.rune-stone {
  font-family: var(--rune-font);
  font-weight: 700;
  font-size: clamp(1.4rem, 5vw, 2rem);
  width: clamp(2.6rem, 9vw, 3.4rem);
  height: clamp(2.6rem, 9vw, 3.4rem);
  display: grid; place-items: center;
  color: var(--gold-0);
  background: radial-gradient(circle at 35% 25%, #6a4c1f, #36240d);
  border: 2px solid var(--gold-2);
  border-radius: 10px;
  box-shadow: 0 6px 16px -6px var(--shadow), inset 0 0 12px rgba(255,210,120,0.25);
  animation: runeRise 700ms ease both;
}
.rune-stone:nth-child(2) { animation-delay: 0.18s; }
.rune-stone:nth-child(3) { animation-delay: 0.34s; }
.rune-stone.rune-found {
  border-color: var(--gold-0);
  animation: runeRise 700ms ease both, pulse 1.8s ease-in-out 0.9s infinite;
  transform-origin: center;
}
@keyframes runeRise {
  from { opacity: 0; transform: translateY(14px) scale(0.7) rotate(-8deg); }
  to   { opacity: 1; transform: none; }
}
.rune-result {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold-deep);
  letter-spacing: 0.1em;
  margin: 0.4rem 0 0.8rem;
}

.continue { margin-left: auto; margin-right: auto; }

/* ---------- Finale: Assembly ---------- */
.assembly {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 1.6rem 0;
  min-height: 3.2rem;
}
.piece {
  font-family: var(--rune-font);
  font-weight: 700;
  font-size: clamp(1.3rem, 5vw, 1.9rem);
  letter-spacing: 0.08em;
  padding: 0.55rem 1rem;
  color: var(--gold-0);
  background: radial-gradient(circle at 35% 25%, #6a4c1f, #36240d);
  border: 2px solid var(--gold-2);
  border-radius: 10px;
  box-shadow: 0 8px 20px -8px var(--shadow), inset 0 0 14px rgba(255,210,120,0.25);
  opacity: 0;
  transform: translateY(20px) scale(0.8);
}
.piece.show {
  animation: pieceIn 650ms cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes pieceIn {
  from { opacity: 0; transform: translateY(22px) scale(0.7) rotate(-6deg); }
  to   { opacity: 1; transform: none; }
}
.piece.merge {
  animation: pieceMerge 700ms ease forwards;
}
@keyframes pieceMerge {
  to { opacity: 0; transform: translateY(-14px) scale(0.6); }
}

.artefact-name {
  display: block;
  text-align: center;
  font-family: var(--rune-font);
  font-weight: 800;
  font-size: clamp(2rem, 9vw, 3.6rem);
  letter-spacing: 0.06em;
  text-decoration: none;
  margin: 0.6rem auto 0.4rem;
  padding: 0.4rem 0.6rem;
  color: transparent;
  background: linear-gradient(160deg, #fff4cf, var(--gold-1) 45%, var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 2px 14px rgba(255, 210, 120, 0.35);
  opacity: 0;
  transform: scale(0.9);
  transition: transform 0.2s ease;
}
.artefact-name.reveal { animation: nameReveal 900ms ease both; }
.artefact-name:hover { transform: scale(1.03); }
@keyframes nameReveal {
  0%   { opacity: 0; transform: scale(0.7); filter: blur(8px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---------- Abschlussbrief ---------- */
.letter {
  background: rgba(255, 248, 230, 0.4);
  border: 1px solid rgba(120, 85, 30, 0.35);
  border-radius: 10px;
  padding: 1.4rem 1.4rem 1rem;
  margin: 1rem 0 1.6rem;
  box-shadow: inset 0 0 30px rgba(120, 80, 30, 0.12);
}
.letter p { line-height: 1.7; margin: 0.7rem 0; }
.letter-name {
  text-align: center;
  font-family: var(--rune-font);
  font-weight: 800;
  font-size: clamp(1.5rem, 6vw, 2.2rem);
  letter-spacing: 0.06em;
  color: var(--gold-deep);
  margin: 1rem 0 !important;
}
.letter-sign {
  margin-top: 1.4rem !important;
  font-style: italic;
  text-align: right;
}

/* ---------- Charakterkarten (klickbare Profile) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
  margin: 1.2rem 0;
}
.char-card {
  font-family: var(--serif);
  text-align: center;
  padding: 1.1rem 0.7rem 0.9rem;
  color: inherit;
  cursor: pointer;
  background: linear-gradient(160deg, rgba(255,245,220,0.7), rgba(216,184,122,0.45));
  border: 1px solid var(--gold-2);
  border-radius: 14px;
  box-shadow: 0 6px 16px -8px var(--shadow), inset 0 0 14px rgba(120,80,30,0.15);
  transition: transform 0.22s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.char-card:hover,
.char-card:focus-visible {
  transform: translateY(-6px);
  border-color: var(--gold-0);
  box-shadow: 0 16px 28px -10px var(--shadow), 0 0 22px rgba(227,179,65,0.6);
  outline: none;
}
.char-card:active { transform: translateY(-2px); }

.char-portrait {
  position: relative;
  width: clamp(76px, 22vw, 108px);
  height: clamp(76px, 22vw, 108px);
  margin-bottom: 0.6rem;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold-1);
  background: radial-gradient(circle at 40% 28%, #6a4c1f, #2c1d0a);
  box-shadow: 0 4px 12px -4px var(--shadow), inset 0 0 12px rgba(0,0,0,0.4);
  transition: box-shadow 0.25s ease;
}
.char-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.char-portrait-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6rem; }
.char-card:hover .char-portrait,
.char-card:focus-visible .char-portrait {
  box-shadow: 0 4px 16px -2px var(--shadow), 0 0 18px rgba(227,179,65,0.7), inset 0 0 12px rgba(0,0,0,0.4);
}
.char-card-text { display: block; }
.char-card h3 { margin: 0.15rem 0 0; color: var(--gold-deep); font-size: 1.08rem; }
.char-card p { margin: 0.12rem 0 0; font-size: 0.82rem; color: var(--ink-soft); }
.char-card-hint {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-2);
  opacity: 0.7;
  transition: opacity 0.2s ease, color 0.2s ease;
}
.char-card:hover .char-card-hint,
.char-card:focus-visible .char-card-hint { opacity: 1; color: var(--gold-deep); }

/* ---------- Charakter-Modal ---------- */
.char-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.2rem;
}
.char-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 14, 0.78);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: cmFade 0.3s ease both;
}
@keyframes cmFade { from { opacity: 0; } to { opacity: 1; } }

.char-modal-card {
  position: relative;
  z-index: 1;
  width: min(700px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  gap: 1.5rem;
  padding: 1.6rem;
  border-radius: 16px;
  background:
    radial-gradient(120% 120% at 18% 0%, rgba(255,255,240,0.5), transparent 50%),
    linear-gradient(160deg, var(--parchment-0), var(--parchment-1) 60%, var(--parchment-2));
  border: 1px solid rgba(120,85,30,0.5);
  box-shadow:
    0 0 0 2px rgba(227,179,65,0.3),
    0 0 0 7px rgba(20,14,8,0.35),
    0 30px 70px -10px rgba(0,0,0,0.7);
  animation: cmRise 0.42s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes cmRise {
  from { opacity: 0; transform: translateY(26px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.char-modal-portrait {
  position: relative;
  flex: 0 0 42%;
  align-self: stretch;
  min-height: 260px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--gold-1);
  background: radial-gradient(circle at 40% 25%, #6a4c1f, #2c1d0a);
  box-shadow: 0 8px 22px -8px var(--shadow), inset 0 0 18px rgba(0,0,0,0.45);
}
.char-modal-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.char-modal-fallback { position: absolute; inset: 0; display: none; place-items: center; font-size: 5rem; }

.char-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  text-align: left;
}
.char-modal-name {
  margin: 0.1rem 0 0;
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  color: var(--gold-deep);
  text-shadow: 0 1px 0 rgba(255,255,230,0.55);
}
.char-modal-title {
  margin: 0.25rem 0 0.9rem;
  font-style: italic;
  color: var(--crimson);
  letter-spacing: 0.02em;
}
.char-modal-desc { margin: 0; line-height: 1.7; color: var(--ink); }
.char-modal-ability {
  margin-top: 1.1rem;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  border: 1px dashed rgba(120,85,30,0.55);
  background: rgba(255,240,200,0.45);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.ability-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-2);
}
.ability-value { font-size: 1.15rem; font-weight: 700; color: var(--gold-deep); }
.char-modal-close {
  position: absolute;
  top: 0.7rem; right: 0.7rem;
  z-index: 2;
  width: 2.2rem; height: 2.2rem;
  display: grid; place-items: center;
  font-size: 1rem;
  cursor: pointer;
  color: #2a1c06;
  background: linear-gradient(160deg, var(--gold-0), var(--gold-1));
  border: 1px solid var(--gold-deep);
  border-radius: 50%;
  box-shadow: 0 3px 8px -3px var(--shadow);
  transition: transform 0.15s ease, filter 0.2s ease;
}
.char-modal-close:hover { transform: rotate(90deg); filter: brightness(1.08); }

body.modal-open { overflow: hidden; }

@media (max-width: 560px) {
  .char-modal-card { flex-direction: column; gap: 1rem; padding: 1.2rem; }
  .char-modal-portrait { flex: none; width: 100%; aspect-ratio: 3 / 4; min-height: 0; }
}

/* ---------- Queststatus ---------- */
.quest-status {
  margin: 1.6rem 0 0.4rem;
  padding: 1.1rem 1.3rem;
  background: rgba(40, 30, 14, 0.08);
  border: 1px dashed rgba(120, 85, 30, 0.5);
  border-radius: 10px;
}
.quest-status h3 {
  margin: 0 0 0.7rem;
  text-align: center;
  color: var(--gold-deep);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.85rem;
}
.quest-status ul { list-style: none; margin: 0; padding: 0; }
.quest-status li {
  padding: 0.35rem 0;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
}
.quest-status li.done { color: var(--green); font-weight: 600; }
.quest-status li.todo { color: var(--ink-soft); }

/* ---------- Footer ---------- */
.page-footer {
  position: relative;
  z-index: 1;
  margin-top: 1.4rem;
  text-align: center;
  color: rgba(220, 205, 170, 0.55);
  font-size: 0.8rem;
  font-style: italic;
}

/* ---------- Responsiv ---------- */
@media (max-width: 520px) {
  .chests { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; gap: 0.7rem; }
  .char-card { flex-direction: row; align-items: center; gap: 0.9rem; text-align: left; padding: 0.8rem 0.9rem; }
  .char-portrait { margin-bottom: 0; flex: 0 0 auto; width: 64px; height: 64px; }
  .char-portrait-fallback { font-size: 1.9rem; }
  .char-card-hint { margin-top: 0.25rem; }
  .answer-row { flex-direction: column; align-items: center; }
  .answer input { width: 100%; }
}

/* ---------- 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;
  }
}
