/* Zauberlehrling v0.3 – Visual Prototype
   Erwachsene, ruhige Laboratmosphäre: dunkles Holz und Stein, warmes Kerzenlicht,
   Pergament für Karten und Journal. Keine externen Assets. */

:root {
  --bg: #15120f;
  --panel: #221c17;
  --panel-2: #2b231c;
  --edge: #4a3c2e;
  --gold: #d2ad6a;
  --gold-soft: rgba(210, 173, 106, 0.35);
  --text: #e9dfca;
  --text-soft: #b3a58c;
  --parchment: #efe4cb;
  --parchment-2: #e4d6b6;
  --ink: #2b2119;
  --ink-soft: #6a5a46;

  --feuer: #bf562b;
  --wasser: #3a7696;
  --erde: #8b7240;
  --luft: #7f9fa3;

  --serif: 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
  --sans: 'Segoe UI', system-ui, -apple-system, sans-serif;

  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; overflow-x: hidden; }
body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 40% 0%, rgba(120, 85, 45, 0.18), transparent 60%),
    var(--bg);
}
h1, h2, h3 { font-family: var(--serif); font-weight: normal; margin: 0; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

kbd {
  font-family: ui-monospace, Consolas, monospace; font-size: 0.68rem; line-height: 1;
  padding: 0.15rem 0.35rem; border: 1px solid currentColor; border-bottom-width: 2px;
  border-radius: 3px; opacity: 0.7; margin-left: 0.35rem; vertical-align: middle;
}

/* ------------------------------------------------------------ Kopfbereich */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap;
  max-width: 1440px; margin: 0 auto; padding: 0.9rem 1.5rem 0.6rem;
}
.brand h1 { font-size: 1.85rem; color: var(--gold); letter-spacing: 0.04em; }
.subtitle {
  margin: 0.1rem 0 0; font-family: var(--serif); font-variant: small-caps; letter-spacing: 0.08em;
  color: var(--text-soft); font-size: 0.95rem;
}
.status { display: flex; gap: 0.6rem; margin: 0; }
.status div {
  padding: 0.3rem 0.8rem; border: 1px solid var(--edge); border-radius: 999px;
  background: rgba(34, 28, 23, 0.8); display: flex; gap: 0.5rem; align-items: baseline;
}
.status div[hidden] { display: none; }
.status dt { font-size: 0.75rem; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.08em; }
.status dd { margin: 0; font-family: var(--serif); font-size: 1.05rem; color: var(--text); }

/* ------------------------------------------------------------ Grundraster */
.layout {
  display: grid; gap: 1rem; max-width: 1440px; margin: 0 auto; padding: 0.4rem 1.5rem 2rem;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas:
    'scene   sidebar'
    'hand    sidebar'
    'journal journal';
}
.scene { grid-area: scene; }
.sidebar { grid-area: sidebar; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.hand-tray { grid-area: hand; }
.journal { grid-area: journal; }

/* ------------------------------------------------------------ Laborszene */
/* Szenengeometrie: Werkbankhöhe und Bildgrößen als Variablen, damit sich die
   Szene bei niedrigen Fenstern kompakter darstellen lässt. */
.scene {
  --scene-h: 560px; --bench-y: 244px; --art-bench: 150px; --art-floor: 160px;
  position: relative; height: var(--scene-h); overflow: hidden; border-radius: 12px;
  border: 1px solid var(--edge);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.65), 0 10px 30px rgba(0, 0, 0, 0.4);
}
.scene-backdrop { position: absolute; inset: 0; background: #2a2018; }
.backdrop-svg { display: block; width: 100%; height: 100%; }

/* v0.5: gezeichnete Laborwand (Unterkante = Werkbankoberkante) */
.lab-wall { position: absolute; left: 0; right: 0; top: 0; height: calc(var(--bench-y) + 2px); }
.lab-wall .sway { transform-box: fill-box; transform-origin: 50% 0; animation: sway 9s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-1.2deg); } 50% { transform: rotate(1.4deg); } }
.lab-wall .steam { animation: steam 5.5s ease-in infinite; }
.lab-wall .steam.late { animation-delay: 2.7s; }
@keyframes steam { 0% { opacity: 0; transform: translateY(4px); } 30% { opacity: 0.55; } 100% { opacity: 0; transform: translateY(-14px); } }

/* Licht: warmes Fensterlicht von links, Lampenkegel rechts, Vignette */
.ambient-light {
  position: absolute; inset: 0; pointer-events: none; transition: opacity 900ms ease;
  background:
    radial-gradient(ellipse 40% 36% at 50% 40%, rgba(255, 196, 120, 0.12), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 45%, transparent 55%, rgba(10, 6, 3, 0.55) 100%);
}
.scene[data-candle='erloschen'] .ambient-light { opacity: 0.55; }
.light-window {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(118deg, transparent 6%, rgba(255, 226, 170, 0.16) 13%, rgba(255, 220, 160, 0.07) 30%, transparent 44%);
}
.light-lamp {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(ellipse 22% 30% at 88% calc(var(--bench-y) - 10px), rgba(255, 214, 150, 0.22), transparent 70%);
}
.dust { position: absolute; inset: 0; pointer-events: none; }
.dust span {
  position: absolute; border-radius: 50%; background: rgba(255, 236, 200, 0.75); filter: blur(0.6px);
  animation-name: drift; animation-timing-function: ease-in-out; animation-iteration-count: infinite;
}
@keyframes drift {
  0% { transform: translate(0, 0); opacity: 0; }
  20% { opacity: 0.7; }
  50% { transform: translate(18px, 26px); opacity: 0.5; }
  80% { opacity: 0.6; }
  100% { transform: translate(4px, 54px); opacity: 0; }
}
.spell-light {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 3; mix-blend-mode: screen;
  background: radial-gradient(ellipse 60% 55% at var(--sx, 50%) var(--sy, 50%), var(--fx, #ffd27a), transparent 70%);
}
.spell-light.flash { animation: spell-light 1600ms ease-out; }
@keyframes spell-light { 0% { opacity: 0; } 18% { opacity: 0.32; } 100% { opacity: 0; } }

/* Werkbank aus Eiche: Platte mit Lichtkante, Schürze mit Messinggriffen */
.bench { position: absolute; left: 0; right: 0; top: var(--bench-y); filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.55)); }
.bench-top {
  height: 16px;
  background:
    repeating-linear-gradient(90deg, rgba(60, 35, 15, 0.18) 0 1px, transparent 1px 37px, rgba(255, 230, 190, 0.05) 37px 39px, transparent 39px 83px),
    linear-gradient(180deg, #b78b58 0%, #96703f 45%, #6d4d2e 100%);
  box-shadow: inset 0 2px 0 rgba(255, 234, 196, 0.35), inset 0 -2px 0 rgba(30, 18, 8, 0.4);
}
.bench-front {
  height: 26px; display: flex; justify-content: space-around; align-items: center;
  background: linear-gradient(180deg, #5c4128, #3c2a1b);
  box-shadow: inset 0 1px 0 rgba(255, 220, 170, 0.12);
}
.bench-front span { width: 28px; height: 5px; border-radius: 3px; background: linear-gradient(180deg, #e0bd78, #8a6a35); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.floor { position: absolute; left: 0; right: 0; top: calc(var(--bench-y) + 42px); bottom: 0; background: #2a1d14; }
.lab-floor-decor { position: absolute; inset: 0; }

.tier { position: absolute; display: flex; justify-content: center; align-items: flex-end; gap: 0.6rem; }
/* Die Illustration steht auf der Werkbank bzw. dem Boden; das Schild sitzt an der
   Vorderkante, die Zustandsmarken hängen darunter. */
.tier-bench {
  left: 130px; right: 16px; --art-h: var(--art-bench);
  height: calc(var(--art-bench) + 32px); top: calc(var(--bench-y) + 26px - var(--art-bench) - 32px);
}
.tier-floor { left: 16px; right: 16px; bottom: 48px; height: calc(var(--art-floor) + 30px); --art-h: var(--art-floor); }

.scene-reset { position: absolute; right: 12px; top: 10px; z-index: 2; padding: 0.15rem 0.6rem; }

/* Versuchsobjekte */
.station {
  position: relative; flex: 1 1 0; min-width: 0; max-width: 190px; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 0 2px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
}
.station::before { /* Lichtkegel unter dem Ziel */
  content: ''; position: absolute; left: 4%; right: 4%; bottom: 14px; height: 40px; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 205, 130, 0.45), transparent 70%);
  opacity: 0; transition: opacity 200ms ease;
}
.station:hover::before { opacity: 0.35; }
.station[aria-pressed='true']::before { opacity: 1; }
.station .art { width: 100%; height: var(--art-h); overflow: visible; position: relative; transition: filter 200ms ease; }
.station:hover .art { filter: brightness(1.1); }
.station:focus-visible { outline: none; }
.station:focus-visible .plate { outline: 2px solid var(--gold); outline-offset: 2px; }

.plate {
  margin-top: 4px; padding: 2px 10px; border-radius: 3px; white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
  font-family: var(--serif); font-size: 0.82rem; letter-spacing: 0.03em; color: #eadcbe;
  background: linear-gradient(180deg, #5a4630, #3c2e21); border: 1px solid #7c6340;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); transition: background 200ms ease, color 200ms ease;
}
.station:hover .plate { border-color: var(--gold); }
.station[aria-pressed='true'] .plate { background: linear-gradient(180deg, #e0bd78, #b38a45); color: #24180d; border-color: #f0d49a; }
.station.created .plate { background: linear-gradient(180deg, #4a4f52, #33373a); border-color: #788288; }
.station.created[aria-pressed='true'] .plate { background: linear-gradient(180deg, #e0bd78, #b38a45); color: #24180d; }

.chips {
  position: absolute; top: calc(100% + 3px); left: -6px; right: -6px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 3px;
}
.chip {
  font-size: 0.7rem; line-height: 1.5; padding: 0 0.45rem; border-radius: 999px; white-space: nowrap;
  background: rgba(18, 14, 11, 0.78); border: 1px solid rgba(210, 173, 106, 0.22); color: var(--text-soft);
}
.chip.warn { color: #e4a77e; border-color: rgba(228, 167, 126, 0.35); }
.chip.cold { color: #b4d8e8; border-color: rgba(180, 216, 232, 0.4); }
.chip.magic { color: #d6cfa8; border-color: rgba(214, 207, 168, 0.45); }
.chip.changed { color: #24180d; background: var(--gold); border-color: #f0d49a; animation: chip-in 700ms ease; }
.chip.removed { text-decoration: line-through; animation: chip-out 2.4s ease forwards; }
@keyframes chip-out { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes chip-in { from { transform: scale(1.25); box-shadow: 0 0 12px var(--gold); } to { transform: scale(1); } }

/* Zauber-Rückmeldung an der Station */
.station.fx-hit .art { animation: fx-hit 1100ms ease-out; }
@keyframes fx-hit {
  0% { filter: drop-shadow(0 0 0 transparent) brightness(1.6); }
  35% { filter: drop-shadow(0 0 18px var(--fx, #ffd27a)) brightness(1.25); }
  100% { filter: drop-shadow(0 0 0 transparent) brightness(1); }
}
.station.fx-miss .art { animation: fx-miss 520ms ease-in-out; }
@keyframes fx-miss {
  20% { transform: translateX(-5px); filter: grayscale(0.7) brightness(0.8); }
  60% { transform: translateX(4px); filter: grayscale(0.5); }
  100% { transform: none; filter: none; }
}
.station.fx-appear .art { animation: fx-appear 900ms ease-out; }
@keyframes fx-appear { from { opacity: 0; transform: translateY(14px) scale(0.85); } to { opacity: 1; transform: none; } }

/* Zustände in den Illustrationen */
.art .floating { animation: float 3s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(-16px); } 50% { transform: translateY(-21px); } }
.art .float-shadow { transform-box: fill-box; transform-origin: center; transform: scale(0.55); opacity: 0.6; }
.art .flame-body { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker 1.8s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(0.96, 1.05); } 60% { transform: scale(1.03, 0.97); } }
.art .smoke { animation: smoke 3.2s ease-in infinite; }
.art .smoke.late { animation-delay: 1.6s; }
@keyframes smoke { 0% { opacity: 0; transform: translateY(6px); } 30% { opacity: 0.7; } 100% { opacity: 0; transform: translateY(-18px); } }
.art .flow { stroke-dasharray: 6 10; animation: flow-r 1.4s linear infinite; }
.art .flow.left { animation-name: flow-l; }
@keyframes flow-r { to { stroke-dashoffset: -32; } }
@keyframes flow-l { to { stroke-dashoffset: 32; } }
.art .confusion { transform-box: fill-box; transform-origin: center; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.art .wind path { stroke-dasharray: 80; animation: wind 1.6s ease-out forwards; }
@keyframes wind { from { stroke-dashoffset: 80; opacity: 1; } to { stroke-dashoffset: -80; opacity: 0; } }
.art .bubble { animation: bubble 2.2s ease-in infinite; }
.art .bubble.late { animation-delay: 1.1s; }
@keyframes bubble { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 0.8; } 100% { opacity: 0; transform: translateY(-8px); } }

/* ------------------------------------------------------------ Seitenleiste */
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--edge);
  border-radius: 12px; padding: 1rem 1.1rem; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.panel h2 {
  font-size: 0.82rem; font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--gold); margin-bottom: 0.8rem;
}
.ritual-slots { display: flex; justify-content: center; gap: 0.6rem; margin-bottom: 0.9rem; }
.slot {
  width: 64px; height: 88px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed rgba(210, 173, 106, 0.35); color: rgba(210, 173, 106, 0.4); font-size: 0.72rem;
}
.slot.filled {
  border: 1px solid #6e5536; background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--el) 22%, var(--parchment)), var(--parchment) 70%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45); animation: slot-in 220ms ease-out;
}
@keyframes slot-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
.slot svg { width: 34px; height: 34px; color: var(--el); }
.ritual-target {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem;
  padding: 0.5rem 0.7rem; border-radius: 6px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--edge);
  margin-bottom: 0.7rem; font-size: 0.92rem;
}
.ritual-target .label { color: var(--text-soft); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; }
.ritual-target strong { font-family: var(--serif); font-weight: normal; font-size: 1.05rem; color: var(--text); }
.ritual-target .none { color: var(--text-soft); font-style: italic; }
.next-step { margin: 0 0 0.8rem; min-height: 1.3em; color: var(--text-soft); font-size: 0.9rem; }
.next-step::before { content: '→ '; color: var(--gold); }

.cast-button {
  width: 100%; padding: 0.8rem 1rem; border-radius: 8px; cursor: pointer;
  font-family: var(--serif); font-size: 1.2rem; letter-spacing: 0.04em; color: #24180d;
  background: linear-gradient(180deg, #e3c07c, #ae863f); border: 1px solid #f0d49a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 120ms ease, box-shadow 200ms ease, filter 200ms ease;
}
.cast-button:not(:disabled) { animation: ready 2.4s ease-in-out infinite; }
.cast-button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.cast-button:active:not(:disabled) { transform: translateY(1px); }
.cast-button:disabled {
  cursor: not-allowed; color: #7d705c; background: linear-gradient(180deg, #3a3129, #2e2620);
  border-color: var(--edge); box-shadow: none;
}
@keyframes ready {
  0%, 100% { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(227, 192, 124, 0); }
  50% { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), 0 0 18px 2px rgba(227, 192, 124, 0.35); }
}

/* Ergebnis (Pergament) */
.result-panel {
  flex: 1; color: var(--ink); border-color: #b7a37c;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, 0.45), transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(150, 110, 60, 0.18), transparent 60%),
    var(--parchment);
}
.result { min-height: 260px; }
.result .kicker { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft); margin: 0 0 0.3rem; }
.result h3 { font-size: 1.7rem; line-height: 1.15; color: var(--ink); margin-bottom: 0.45rem; }
.result .emblems { display: flex; gap: 0.35rem; margin-bottom: 0.55rem; }
.result .description { font-family: var(--serif); font-style: italic; color: var(--ink-soft); margin: 0 0 0.8rem; line-height: 1.4; }
.outcome { border-radius: 6px; padding: 0.65rem 0.75rem; margin-bottom: 0.6rem; line-height: 1.4; }
.outcome .label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 0.2rem; }
.outcome.effective { background: rgba(255, 255, 255, 0.55); border-left: 4px solid var(--fx, var(--gold)); }
.outcome.effective .label { color: #5d4a2c; }
.outcome.ineffective { background: rgba(0, 0, 0, 0.04); border: 1px dashed #a8987a; color: #5b4f40; }
.outcome.ineffective .label { color: #8a7a62; }
.changes { list-style: none; margin: 0.5rem 0 0; padding: 0; font-size: 0.85rem; }
.changes li { display: flex; gap: 0.4rem; align-items: baseline; padding: 0.15rem 0; border-top: 1px dotted rgba(90, 70, 40, 0.25); }
.changes .what { color: var(--ink-soft); min-width: 6.5rem; }
.changes .before { color: #8a7a62; text-decoration: line-through; text-decoration-color: rgba(138, 122, 98, 0.5); }
.changes .after { color: var(--ink); font-weight: 600; }
.aside-note { font-size: 0.82rem; color: var(--ink-soft); margin: 0.25rem 0 0; }
.result .empty { text-align: center; color: var(--ink-soft); padding-top: 2.2rem; }
.result .empty svg { width: 46px; height: 46px; color: rgba(106, 90, 70, 0.35); margin: 0 4px; }
.result .empty p { font-family: var(--serif); font-style: italic; margin: 1rem 0 0; }

.emblem-chip {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.5rem 0.1rem 0.25rem;
  border-radius: 999px; font-size: 0.8rem; color: var(--el); border: 1px solid color-mix(in srgb, var(--el) 45%, transparent);
  background: color-mix(in srgb, var(--el) 10%, transparent);
}
.emblem-chip svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------ Handkarten */
.hand-tray {
  position: relative; display: grid; grid-template-columns: 110px minmax(0, 1fr) 110px; align-items: center; gap: 1rem;
  padding: 1.6rem 1.2rem 0.9rem; border-radius: 12px; border: 1px solid var(--edge);
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.06) 0 3px, transparent 3px 14px),
    linear-gradient(180deg, #33281e, #221a14);
  box-shadow: inset 0 2px 0 rgba(255, 220, 170, 0.06), 0 10px 30px rgba(0, 0, 0, 0.4);
}
.hand-area { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; min-width: 0; }
.hand { display: flex; justify-content: center; gap: 0.9rem; }
.card-slot { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.card-slot kbd { color: var(--text-soft); margin: 0; }

.card {
  --el: var(--erde);
  position: relative; width: 112px; height: 158px; padding: 0; cursor: pointer; border-radius: 10px;
  border: 1px solid #6e5536; color: var(--ink); font: inherit;
  background:
    radial-gradient(ellipse at 50% 45%, color-mix(in srgb, var(--el) 16%, transparent), transparent 65%),
    linear-gradient(160deg, #f4ead3, #e2d3b1);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}
.card::before { content: ''; position: absolute; inset: 6px; border: 1.5px solid var(--el); border-radius: 6px; opacity: 0.75; pointer-events: none; }
.card::after { content: ''; position: absolute; inset: 9px; border: 1px solid color-mix(in srgb, var(--el) 40%, transparent); border-radius: 4px; pointer-events: none; }
.card .card-name {
  margin-top: 14px; font-family: var(--serif); font-variant: small-caps; letter-spacing: 0.1em;
  font-size: 0.95rem; color: color-mix(in srgb, var(--el) 62%, #000);
}
.card .card-emblem { width: 60px; height: 60px; color: var(--el); filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.6)); }
.card .card-rule { margin-bottom: 16px; width: 46px; height: 1px; background: color-mix(in srgb, var(--el) 60%, transparent); position: relative; }
.card .card-rule::before, .card .card-rule::after {
  content: ''; position: absolute; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--el); opacity: 0.6;
}
.card .card-rule::before { left: -8px; }
.card .card-rule::after { right: -8px; }
.card:hover:not(:disabled) { transform: translateY(-6px); box-shadow: 0 10px 18px rgba(0, 0, 0, 0.55); }
.card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.card[aria-pressed='true'] {
  transform: translateY(-16px);
  box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(227, 192, 124, 0.55), 0 14px 22px rgba(0, 0, 0, 0.55);
}
.card .seal {
  position: absolute; top: -9px; right: -9px; width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f0d49a, #a37a35); border: 1px solid #f7e2b5; color: #2a1c0d;
  display: none; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.card[aria-pressed='true'] .seal { display: flex; }
.card:disabled { cursor: not-allowed; filter: saturate(0.35) brightness(0.62); }
.el-feuer { --el: var(--feuer); }
.el-wasser { --el: var(--wasser); }
.el-erde { --el: var(--erde); }
.el-luft { --el: var(--luft); }

.hand-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
button.ghost {
  font: inherit; cursor: pointer; color: var(--text-soft); background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--edge); border-radius: 6px; padding: 0.35rem 0.75rem; transition: color 150ms, border-color 150ms, background 150ms;
}
button.ghost.small { font-size: 0.82rem; }
button.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--gold); background: rgba(210, 173, 106, 0.08); }
button.ghost:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button.ghost:disabled { opacity: 0.6; cursor: not-allowed; }

/* Stapel */
.pile { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; font-size: 0.75rem; color: var(--text-soft); text-align: center; }
.pile .stack { position: relative; width: 76px; height: 106px; }
.pile .back, .pile .face, .pile .empty-slot { position: absolute; inset: 0; border-radius: 8px; }
.pile .back {
  background: radial-gradient(ellipse at 50% 40%, #4d3626, #2c1f17); border: 1px solid #7c6340;
  box-shadow: inset 0 0 0 5px #2c1f17, inset 0 0 0 6px rgba(210, 173, 106, 0.6);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 1.7rem; color: rgba(210, 173, 106, 0.75);
}
.pile .back.layer { transform: translate(var(--o), calc(var(--o) * -1)); }
.pile .face {
  background: linear-gradient(160deg, #f4ead3, #e2d3b1); border: 1px solid #6e5536;
  display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 4px #f4ead3, inset 0 0 0 5px var(--el);
}
.pile .face svg { width: 36px; height: 36px; color: var(--el); }
.pile .empty-slot { border: 1.5px dashed rgba(210, 173, 106, 0.3); }
.pile .count { font-family: var(--serif); font-size: 1.05rem; color: var(--text); }

.toast {
  position: absolute; top: -13px; left: 50%; transform: translate(-50%, -4px); opacity: 0; pointer-events: none;
  padding: 0.25rem 0.9rem; border-radius: 999px; font-size: 0.8rem; color: #24180d;
  background: linear-gradient(180deg, #e3c07c, #b8914a); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  transition: opacity 250ms ease, transform 250ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ Journal */
.journal {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); color: var(--ink);
  border-radius: 10px; border: 1px solid #8f7a55; overflow: hidden;
  background:
    linear-gradient(90deg, transparent calc(55.5% - 18px), rgba(90, 60, 30, 0.22) 55.5%, transparent calc(55.5% + 18px)),
    radial-gradient(ellipse at 10% 0%, rgba(255, 255, 255, 0.4), transparent 50%),
    var(--parchment);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.page { padding: 1rem 1.4rem 1.1rem; min-width: 0; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid rgba(90, 70, 40, 0.3); padding-bottom: 0.4rem; margin-bottom: 0.5rem; }
.page-head h2 { font-size: 1.25rem; color: var(--ink); }
.page-count { font-family: var(--serif); color: var(--ink-soft); }
.journal-list, .log { margin: 0; padding: 0; list-style: none; max-height: 290px; overflow-y: auto; }
.journal-list li { padding: 0.5rem 0; border-bottom: 1px dotted rgba(90, 70, 40, 0.3); }
.journal-list li.fresh { animation: fresh 1.6s ease-out; }
@keyframes fresh { from { background: rgba(210, 173, 106, 0.45); } to { background: transparent; } }
.journal-entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; }
.journal-entry-head strong { font-family: var(--serif); font-size: 1.05rem; font-weight: normal; }
.journal-entry-head .mini-icons { display: inline-flex; gap: 2px; }
.mini-icons svg { width: 17px; height: 17px; }
.journal-desc { font-family: var(--serif); font-style: italic; font-size: 0.88rem; color: var(--ink-soft); margin: 0.15rem 0; }
.journal-obs { font-size: 0.8rem; color: #4a3d2e; }
.journal-obs .no { color: #8a7a62; }
.journal-empty, .log-empty { font-family: var(--serif); color: var(--ink-soft); padding: 0.6rem 0; }
.log li { font-size: 0.84rem; padding: 0.3rem 0; border-bottom: 1px dotted rgba(90, 70, 40, 0.25); display: flex; gap: 0.5rem; }
.log .n { color: var(--ink-soft); font-family: var(--serif); min-width: 1.8rem; }
.log .ok { color: #4f6b35; }
.log .no { color: #8a7a62; }

/* ------------------------------------------------------------ v0.5: Materialien der Oberfläche */
:root {
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .32  0 0 0 0 .24  0 0 0 0 .15  0 0 0 .2 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  --fibers: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='f'><feTurbulence type='fractalNoise' baseFrequency='.012 .2' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 .3  0 0 0 0 .22  0 0 0 0 .14  0 0 0 .12 0'/></filter><rect width='100%25' height='100%25' filter='url(%23f)'/></svg>");
}
body {
  background:
    radial-gradient(ellipse at 40% 0%, rgba(140, 100, 55, 0.2), transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(60, 70, 80, 0.12), transparent 50%),
    var(--grain),
    var(--bg);
}
.topbar { border-bottom: 1px solid rgba(201, 164, 92, 0.18); }
.brand h1 { text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 0 18px rgba(210, 173, 106, 0.18); }

/* Holzpaneele mit feiner Maserung und Messingkante */
.panel {
  background: var(--fibers), linear-gradient(180deg, #2f261e, #221b15);
  border-color: #4d3d2c;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 225, 180, 0.07), inset 0 0 0 1px rgba(201, 164, 92, 0.06);
}
.panel h2 { color: #d9b878; }

/* Pergament: Ergebnis, Journal, Einblendungen, Einstellungen */
.result-panel, .journal, .overlay-card, .settings-panel {
  background-image:
    var(--grain),
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, 0.45), transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(150, 110, 60, 0.2), transparent 60%);
  background-color: var(--parchment);
}
.journal {
  position: relative;
  background-image:
    linear-gradient(90deg, transparent calc(55.5% - 18px), rgba(90, 60, 30, 0.22) 55.5%, transparent calc(55.5% + 18px)),
    var(--grain),
    radial-gradient(ellipse at 10% 0%, rgba(255, 255, 255, 0.4), transparent 50%);
}
.journal::after { /* Lesebändchen */
  content: ''; position: absolute; top: -2px; left: calc(55.5% + 28px); width: 12px; height: 46px;
  background: linear-gradient(180deg, #7a2f24, #5c2018); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}
.journal-list li, .log li { background-image: linear-gradient(transparent calc(100% - 1px), rgba(90, 70, 40, 0.12) 0); }

/* Kartenablage: Holzrahmen mit Filzeinlage */
.hand-tray {
  background:
    radial-gradient(ellipse 80% 70% at 50% 45%, rgba(70, 82, 60, 0.35), transparent 75%),
    var(--grain),
    linear-gradient(180deg, #2e3328, #23271f);
  border: 1px solid #5a4430;
  box-shadow: inset 0 0 0 6px #3e2d1e, inset 0 0 0 7px rgba(201, 164, 92, 0.25), inset 0 8px 24px rgba(0, 0, 0, 0.45), 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Spielkarten: Papierstruktur, geprägtes Emblem, feine Doppelrahmen */
.card {
  background:
    var(--grain),
    radial-gradient(ellipse at 50% 45%, color-mix(in srgb, var(--el) 16%, transparent), transparent 65%),
    linear-gradient(160deg, #f6eedb, #e4d5b3);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.6), inset 0 0 18px rgba(120, 90, 50, 0.15);
}
.card .card-emblem { filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.7)) drop-shadow(0 -1px 0 rgba(60, 40, 20, 0.25)); }
.card .card-name { text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); }

/* ------------------------------------------------------------ Navigation (v0.4) */
.screen-nav { display: flex; gap: 0.3rem; padding: 0.25rem; border: 1px solid var(--edge); border-radius: 10px; background: rgba(0, 0, 0, 0.25); }
.nav-tab {
  font: inherit; font-family: var(--serif); font-size: 1rem; letter-spacing: 0.03em; cursor: pointer;
  padding: 0.35rem 1rem; border-radius: 7px; border: 1px solid transparent; background: none; color: var(--text-soft);
  transition: background 150ms ease, color 150ms ease;
}
.nav-tab:hover { color: var(--text); background: rgba(210, 173, 106, 0.08); }
.nav-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.nav-tab[aria-current='page'] { color: #24180d; background: linear-gradient(180deg, #e3c07c, #b8914a); border-color: #f0d49a; }

/* ------------------------------------------------------------ Klang & Darstellung (v0.5) */
.settings { position: relative; }
.settings-toggle {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; font: inherit; font-size: 0.9rem;
  padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid var(--edge); color: var(--text-soft);
  background: rgba(0, 0, 0, 0.25); transition: color 150ms, border-color 150ms;
}
.settings-toggle svg { width: 18px; height: 18px; }
.settings-toggle:hover { color: var(--text); border-color: var(--gold); }
.settings-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.settings-toggle[data-sound='off'] .wave { opacity: 0.2; }
.settings-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 290px; padding: 1rem 1.1rem;
  color: var(--ink); border-radius: 10px; border: 1px solid #b7a37c;
  background: radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.5), transparent 60%), var(--parchment);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}
.settings-panel h2 { font-size: 1.1rem; margin-bottom: 0.7rem; }
.setting-row { display: flex; align-items: center; gap: 0.55rem; margin: 0.55rem 0 0.2rem; font-weight: 600; cursor: pointer; }
.setting-row input { width: 18px; height: 18px; accent-color: #8a6a3a; }
.setting-slider { display: grid; gap: 0.2rem; margin: 0.25rem 0 0.4rem 1.6rem; font-size: 0.82rem; color: var(--ink-soft); }
.setting-slider:last-of-type { margin-left: 0; margin-top: 0.8rem; }
.setting-slider input[type='range'] { width: 100%; accent-color: #8a6a3a; }
.setting-slider input:disabled { opacity: 0.4; }
.setting-slider select { font: inherit; padding: 0.25rem 0.4rem; border-radius: 5px; border: 1px solid #a8987a; background: #f7f0e0; color: var(--ink); }
.settings-note { margin: 0.6rem 0 0; font-size: 0.8rem; color: var(--ink-soft); line-height: 1.4; }

/* ------------------------------------------------------------ v0.6: Professor, Einführung, Spielstand */
.prof-call {
  display: flex; align-items: center; gap: 0.7rem; width: 100%; cursor: pointer; font: inherit; color: var(--text); text-align: left;
  padding: 0.45rem 0.7rem; border-radius: 12px; border: 1px solid #4d3d2c;
  background: var(--fibers), linear-gradient(180deg, #2f261e, #221b15);
}
.prof-call:hover, .prof-call:focus-visible { border-color: var(--gold); outline: none; }
.prof-call-portrait { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: none; border: 2px solid #c9a45c; }
.prof-call-portrait svg { width: 100%; height: 100%; display: block; }
.prof-call-text { display: grid; flex: 1; }
.prof-call-text strong { font-family: var(--serif); font-weight: normal; color: #efe2c6; }
.prof-call-text small { color: var(--text-soft); font-size: 0.78rem; }
.prof-call kbd { color: var(--text-soft); }
.prof-dialog { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: rgba(12, 10, 8, 0.6); }
.prof-dialog-card {
  width: min(620px, 100%); max-height: calc(100vh - 3rem); overflow-y: auto; color: var(--ink); border-radius: 12px; border: 1px solid #b7a37c;
  padding: 1.2rem 1.4rem; background-image: var(--grain); background-color: var(--parchment); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.prof-dialog-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.7rem; }
.prof-dialog-head h2 { flex: 1; font-size: 1.4rem; }
.prof-dialog-head .ghost { color: var(--ink-soft); background: rgba(255, 255, 255, 0.35); border-color: #a8987a; }
.prof-dialog-portrait { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; border: 2px solid #b38a45; flex: none; }
.prof-dialog-portrait svg { width: 100%; height: 100%; display: block; }
.prof-dialog-text { font-family: var(--serif); font-size: 1.08rem; line-height: 1.55; margin: 0 0 1rem; white-space: pre-line; }
.prof-dialog[data-node='rule'] .prof-dialog-text { padding: 0.7rem 0.9rem; border-left: 3px solid var(--gold); background: rgba(255, 255, 255, 0.45); }
.prof-dialog-options { display: grid; gap: 0.45rem; }
.prof-option {
  display: flex; gap: 0.6rem; align-items: center; text-align: left; cursor: pointer; font: inherit; color: var(--ink);
  padding: 0.5rem 0.75rem; border-radius: 8px; border: 1px solid #a8987a; background: rgba(255, 255, 255, 0.4);
}
.prof-option:hover, .prof-option:focus-visible { background: rgba(255, 255, 255, 0.75); border-color: #8a6a3a; outline: none; }
.prof-option kbd { color: var(--ink-soft); margin: 0; }
.intro { position: fixed; inset: 0; z-index: 50; overflow: hidden; background: #1a1410; }
.intro-scene { position: absolute; inset: 0; }
.intro-light { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(120deg, rgba(255, 230, 180, 0.18), transparent 45%), radial-gradient(ellipse 120% 90% at 50% 40%, transparent 60%, rgba(10, 6, 3, 0.5)); }
.intro-professor { position: absolute; right: 5%; bottom: 3%; height: 72%; aspect-ratio: 400 / 800; }
@media (max-width: 1100px) { .intro-professor { right: 2%; height: 62%; } }
.intro-professor svg { width: 100%; height: 100%; display: block; }
.intro-dialog {
  position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%); width: min(760px, 92vw); cursor: pointer;
  color: var(--ink); border-radius: 12px; border: 1px solid #b7a37c; padding: 1rem 1.3rem 0.8rem;
  background-image: var(--grain); background-color: rgba(239, 228, 203, 0.97); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
}
.intro-speaker { margin: 0 0 0.3rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: #8a6a3a; }
.intro-dialog[data-speaker='player'] .intro-speaker { color: #3a6a7a; }
.intro-dialog[data-speaker='player'] .intro-text { font-style: italic; }
.intro-text { margin: 0 0 0.8rem; font-family: var(--serif); font-size: 1.25rem; line-height: 1.5; min-height: 3em; }
.intro-controls { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.intro-progress { color: var(--ink-soft); font-size: 0.8rem; }
.intro-keys { flex: 1; color: var(--ink-soft); font-size: 0.75rem; }
.intro-controls .ghost { color: var(--ink-soft); background: rgba(255, 255, 255, 0.35); border-color: #a8987a; }
.intro-controls .cast-button { width: auto; padding: 0.5rem 1.2rem; font-size: 1rem; }
.settings-sub { font-size: 1rem !important; margin: 1rem 0 0.2rem !important; }
.settings-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }
.settings-actions .ghost { color: var(--ink); background: rgba(255, 255, 255, 0.4); border-color: #a8987a; }
.ghost.danger, .settings-actions .ghost.danger { color: #8a2e18; }
.cast-button.danger { background: linear-gradient(180deg, #c8714f, #9a4528); border-color: #e0a080; color: #fff7ee; }
.overlay-text.small { font-size: 0.88rem; color: var(--ink-soft); }

/* Prüfungsprotokoll im Labor */
.exam-records-head { margin-top: 0.9rem; }
.exam-records { list-style: none; margin: 0; padding: 0; font-size: 0.84rem; }
.exam-records li { padding: 0.25rem 0; border-bottom: 1px dotted rgba(90, 70, 40, 0.25); }
.exam-records li.ok { color: #4f6b35; }
.exam-records li.no { color: #8a5a3a; }

/* ------------------------------------------------------------ Prüfung (v0.4) */
.exam-layout { grid-template-areas: 'arena sidebar' 'hand sidebar' 'journal journal'; position: relative; }
.arena { grid-area: arena; min-width: 0; }
.arena-zones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }

.zone {
  position: relative; border-radius: 12px; border: 1px solid var(--edge); overflow: hidden;
  background: linear-gradient(180deg, #30281f, #231c16);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.55), 0 8px 22px rgba(0, 0, 0, 0.35);
  transition: border-color 300ms ease;
}
.zone-solved { border-color: #6f8a4a; }
.zone-failed { border-color: #a5532e; }
.zone-head { padding: 0.55rem 0.8rem 0.4rem; background: rgba(0, 0, 0, 0.28); border-bottom: 1px solid rgba(0, 0, 0, 0.4); }
.zone-title { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.zone-title h3 { font-size: 1.12rem; color: var(--text); }
.zone-badge {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; padding: 0.1rem 0.55rem; border-radius: 999px;
  border: 1px solid currentColor;
}
.zone-badge.active { color: #e4a77e; }
.zone-badge.solved { color: #a9c98a; background: rgba(111, 138, 74, 0.15); }
.zone-badge.failed { color: #f08a5d; background: rgba(165, 83, 46, 0.25); }
.zone-severity { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.35rem; font-size: 0.8rem; color: var(--text-soft); }
.meter { flex: 0 0 38%; height: 7px; border-radius: 999px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(210, 173, 106, 0.2); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: #b9a06a; transition: width 500ms ease; }
.meter[data-level='mid'] span { background: #d0883f; }
.meter[data-level='high'] span { background: #c9502b; }
.zone-solved .meter span { background: #7d9a55; }
.zone-trend { margin: 0.2rem 0 0; font-size: 0.78rem; color: var(--text-soft); font-style: italic; }

.zone-scene {
  position: relative; height: 218px;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.2) 0 2px, transparent 2px 40px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0 2px, transparent 2px 80px),
    linear-gradient(180deg, #3b3229 0%, #2d251e 62%, #221c16 62%, #1b1612 100%);
}
.zone-objects {
  position: absolute; left: 8px; right: 8px; top: 4px; bottom: 46px; --art-h: 124px;
  display: flex; align-items: flex-end; justify-content: space-around; gap: 0.3rem;
}
.zone-objects .station { max-width: 150px; height: auto; }
.zone-objects .plate { font-size: 0.76rem; padding: 1px 7px; }
.zone-objects .chip { font-size: 0.66rem; }
.station:disabled { cursor: default; }
.waterline {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(90, 140, 170, 0.42), rgba(40, 80, 105, 0.55));
  border-top: 2px solid rgba(190, 220, 235, 0.6); transition: height 700ms ease;
}
.zone-objects { z-index: 2; }

.station.fx-arena .art { animation: fx-arena 1300ms ease-out; }
@keyframes fx-arena {
  0% { filter: drop-shadow(0 0 0 transparent); }
  40% { filter: drop-shadow(0 0 14px rgba(240, 150, 80, 0.9)) brightness(1.15); }
  100% { filter: none; }
}
.zone-pulse { animation: zone-pulse 1400ms ease-out; }
@keyframes zone-pulse { 0% { box-shadow: inset 0 0 0 2px rgba(240, 150, 80, 0.75), 0 8px 22px rgba(0, 0, 0, 0.35); } 100% { box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.55), 0 8px 22px rgba(0, 0, 0, 0.35); } }
.zone-flip.zone-solved { animation: zone-solved 1600ms ease-out; }
@keyframes zone-solved { 0% { box-shadow: inset 0 0 0 3px #a9c98a, 0 0 24px rgba(169, 201, 138, 0.5); } 100% { box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.55), 0 8px 22px rgba(0, 0, 0, 0.35); } }

.swap-button { width: 100%; margin-top: 0.55rem; }

/* Ergebnis: Zauber vs. Arena */
.result-section {
  font-family: var(--sans); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: #8a6a3a;
  margin: 0.7rem 0 0.3rem; padding-top: 0.5rem; border-top: 1px solid rgba(90, 70, 40, 0.25);
}
.arena-events, .problem-changes { list-style: none; margin: 0; padding: 0; font-size: 0.86rem; }
.arena-events li { padding: 0.18rem 0 0.18rem 1rem; position: relative; color: #4a3d2e; }
.arena-events li::before { content: '›'; position: absolute; left: 0.2rem; color: #b06a3a; }
.arena-events li.ev-expired::before { color: #8a7a62; }
.problem-changes { margin-top: 0.45rem; }
.problem-changes li { padding: 0.3rem 0.55rem; border-radius: 5px; margin-top: 0.25rem; font-weight: 600; }
.problem-changes li.solved { background: rgba(111, 138, 74, 0.18); color: #3f5a24; }
.problem-changes li.reopened { background: rgba(208, 136, 63, 0.18); color: #7a4a1e; }
.problem-changes li.failed { background: rgba(165, 83, 46, 0.22); color: #7a2e14; }
.log-change.solved { color: #4f6b35; }
.log-change.reopened { color: #8a5a2a; }
.log-change.failed { color: #9a3a1a; }

/* ------------------------------------------------------------ v0.5: Archivgewölbe als ein Raum */
.arena {
  position: relative; border-radius: 14px; overflow: hidden; padding: 0.55rem;
  border: 1px solid #3c3a38; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}
.arena-backdrop { position: absolute; inset: 0; }
.arena-light {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(150, 190, 230, 0.08), transparent 30%, transparent 70%, rgba(10, 14, 20, 0.35)),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(5, 8, 12, 0.6) 100%);
}
.arena-zones { position: relative; z-index: 1; gap: 0.55rem; }
.zone {
  background: linear-gradient(180deg, rgba(20, 22, 26, 0.18), rgba(14, 14, 16, 0.08));
  border: 1px solid rgba(200, 210, 220, 0.1);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.35);
}
.zone::after { /* Gefahrenlicht: warmer Schein von unten, abhängig vom Schweregrad */
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 100%, rgba(214, 92, 50, calc(var(--danger, 0) * 0.32)), transparent 70%);
  transition: background 800ms ease;
}
.zone[data-fire='on']::before { /* Feuerschein des Kohlebeckens */
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse 40% 45% at 22% 78%, rgba(255, 160, 80, 0.2), transparent 70%);
  animation: firelight 3.2s ease-in-out infinite;
}
@keyframes firelight { 0%, 100% { opacity: 0.85; } 40% { opacity: 1; } 70% { opacity: 0.7; } }
.zone-solved { border-color: rgba(169, 201, 138, 0.45); }
.zone-failed { border-color: rgba(200, 90, 50, 0.6); }
.zone-head {
  position: relative; z-index: 2; margin: 0.45rem 0.5rem 0; border-radius: 8px;
  background: linear-gradient(180deg, rgba(38, 32, 27, 0.88), rgba(26, 22, 19, 0.88));
  border: 1px solid rgba(201, 164, 92, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 230, 190, 0.08);
}
.zone-title h3 { color: #efe2c6; letter-spacing: 0.02em; }
.zone-solved .zone-head { border-color: rgba(169, 201, 138, 0.55); }
.zone-failed .zone-head { border-color: rgba(220, 110, 70, 0.7); }
.zone-scene { background: none; }
.zone-scene::after { /* Standfläche: Galeriedielen bzw. Steinplatten */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 52px; z-index: 0;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.25) 0 2px, transparent 2px 64px),
    linear-gradient(180deg, rgba(85, 62, 40, 0.85), rgba(45, 32, 22, 0.92));
  box-shadow: inset 0 3px 0 rgba(255, 220, 170, 0.12);
}
.zone[data-level='ground'] .zone-scene::after {
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0 2px, transparent 2px 90px),
    linear-gradient(180deg, rgba(70, 68, 64, 0.88), rgba(34, 33, 31, 0.95));
  box-shadow: inset 0 3px 0 rgba(200, 220, 235, 0.1);
}
.zone-objects { z-index: 2; }
/* Schilder in den Zonen umbrechen lesbar (weiche Trennstellen) statt abgeschnitten zu werden */
.zone-objects .plate { white-space: normal; text-align: center; line-height: 1.15; hyphens: manual; padding: 1px 5px; }
.waterline {
  z-index: 1;
  background: linear-gradient(180deg, rgba(110, 160, 190, 0.38), rgba(40, 80, 105, 0.55));
  border-top: 2px solid rgba(200, 228, 240, 0.65);
}
.waterline::before { /* leichte Wasserbewegung an der Oberfläche */
  content: ''; position: absolute; left: 0; right: 0; top: -2px; height: 6px;
  background: repeating-linear-gradient(90deg, rgba(230, 245, 252, 0.45) 0 18px, transparent 18px 40px);
  animation: ripple 6s linear infinite; opacity: 0.6;
}
@keyframes ripple { to { background-position: 40px 0; } }
.art .pulse { stroke-dasharray: 60; animation: pulse-line 2.4s linear infinite; }
@keyframes pulse-line { from { stroke-dashoffset: 60; } to { stroke-dashoffset: 0; } }

/* Einblendungen (Start / Ende) */
.overlay {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background: rgba(12, 10, 8, 0.72); backdrop-filter: blur(2px);
}
.overlay-card {
  width: min(640px, 100%); max-height: calc(100vh - 3rem); overflow-y: auto; color: var(--ink);
  border-radius: 12px; border: 1px solid #b7a37c; padding: 1.6rem 1.8rem;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, 0.45), transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(150, 110, 60, 0.18), transparent 60%),
    var(--parchment);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.overlay-card .kicker { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-soft); margin: 0 0 0.3rem; }
.overlay-card h2 { font-size: 1.8rem; margin-bottom: 0.6rem; }
.overlay-text { font-family: var(--serif); font-size: 1.02rem; line-height: 1.5; margin: 0 0 0.9rem; }
.overlay-task { font-family: var(--serif); margin: 0.8rem 0; padding: 0.6rem 0.8rem; border-left: 3px solid var(--gold); background: rgba(255, 255, 255, 0.4); }
.intro-problems, .intro-rules { margin: 0; padding-left: 1.2rem; line-height: 1.55; font-size: 0.93rem; }
.intro-rules { color: var(--ink-soft); margin-top: 0.6rem; }
.proto-option { display: flex; gap: 0.6rem; align-items: flex-start; margin: 1rem 0 0; padding: 0.6rem 0.7rem; border: 1px dashed #a8987a; border-radius: 6px; font-size: 0.88rem; cursor: pointer; }
.proto-option input { margin-top: 0.2rem; accent-color: #8a6a3a; }
.proto-option small { display: block; color: var(--ink-soft); }
.overlay-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-top: 1.2rem; }
.overlay-actions .cast-button { width: auto; padding: 0.65rem 1.4rem; }
.overlay-actions .ghost { color: var(--ink-soft); background: rgba(255, 255, 255, 0.35); border-color: #a8987a; }
.overlay-actions .ghost:hover { color: var(--ink); background: rgba(255, 255, 255, 0.6); }
.summary-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0 0 0.8rem; font-size: 0.92rem; }
.summary-facts dt { color: var(--ink-soft); }
.summary-facts dd { margin: 0; }
.summary-spells { margin: 0; padding-left: 1.4rem; font-size: 0.88rem; line-height: 1.5; max-height: 180px; overflow-y: auto; }
.summary-spells li.no { color: #8a7a62; }

/* ------------------------------------------------------------ Bewegung reduzieren */
/* v0.5: minimale Pflanzenbewegung und Wasserglanz */
.art .plant-sway { transform-box: fill-box; transform-origin: 50% 100%; animation: plant-sway 7s ease-in-out infinite; }
@keyframes plant-sway { 0%, 100% { transform: rotate(-0.8deg); } 50% { transform: rotate(1deg); } }
.art .shimmer { animation: shimmer 4.5s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { opacity: 0.25; transform: translateX(-2px); } 50% { opacity: 0.6; transform: translateX(2px); } }

/* Reduzierte Bewegung: per Einstellung (body[data-motion]) – „wie System“ folgt prefers-reduced-motion */
body[data-motion='reduced'] *, body[data-motion='reduced'] *::before, body[data-motion='reduced'] *::after {
  animation: none !important; transition: none !important;
}
body[data-motion='reduced'] .art .floating { transform: translateY(-18px); }
body[data-motion='reduced'] .dust { display: none; }

/* ------------------------------------------------------------ Niedrige Fenster (Laptops) */
@media (max-height: 940px) and (min-width: 921px) {
  .topbar { padding-top: 0.6rem; padding-bottom: 0.4rem; }
  .brand h1 { font-size: 1.6rem; }
  .scene { --scene-h: 468px; --bench-y: 198px; --art-bench: 124px; --art-floor: 134px; }
  .hand-tray { padding-top: 1.3rem; padding-bottom: 0.7rem; }
  .card { width: 100px; height: 140px; }
  .card .card-emblem { width: 50px; height: 50px; }
  .card .card-name { margin-top: 12px; }
  .result { min-height: 220px; }
  /* Prüfung kompakter, damit Zonen und Hand gemeinsam sichtbar bleiben */
  .arena-zones { gap: 0.6rem; }
  .zone-head { padding: 0.4rem 0.7rem 0.3rem; }
  .zone-title h3 { font-size: 1rem; }
  .zone-trend { margin-top: 0.1rem; }
  .zone-scene { height: 168px; }
  .zone-objects { --art-h: 92px; bottom: 42px; }
}

/* ------------------------------------------------------------ Schmalere Fenster */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .tier-bench { left: 100px; }
  /* Stapel als kompakte Anzeigen in den Ecken, damit die Hand Platz hat */
  .hand-tray { grid-template-columns: minmax(0, 1fr); padding-top: 2.1rem; }
  .pile { position: absolute; top: 8px; flex-direction: row; gap: 0.4rem; }
  .pile .stack { display: none; }
  .draw-pile { left: 14px; }
  .discard-pile { right: 14px; }
  .hand { gap: 0.7rem; }
  /* Schilder in den Prüfungszonen dürfen umbrechen statt abgeschnitten zu werden */
  .zone-objects .plate { white-space: normal; text-align: center; line-height: 1.15; font-size: 0.72rem; hyphens: manual; padding: 1px 4px; }
  .card { width: 100px; height: 142px; }
  .card .card-emblem { width: 52px; height: 52px; }
}
@media (max-width: 920px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'scene' 'hand' 'sidebar' 'journal'; }
  .exam-layout { grid-template-areas: 'arena' 'hand' 'sidebar' 'journal'; }
  .arena-zones { grid-template-columns: minmax(0, 1fr); }
  .journal { grid-template-columns: minmax(0, 1fr); background: var(--parchment); }
  .hand-tray { grid-template-columns: minmax(0, 1fr); }
  .pile { display: none; }
  .hand { gap: 0.5rem; }
  .tier-bench { left: 16px; }
}

/* ============================================================ v0.7: Runenwerkstatt (schlicht, im bestehenden Stil) */
.nav-tab.nav-year2 { border-style: dashed; }
.workshop-scene .floor { background: linear-gradient(180deg, #2b2119, #221a13); }
.workshop-scene[data-task='versuch-b'] .floor { background: linear-gradient(180deg, #23201b, #1c1a17); }
/* v0.10.2: volle Werkstattreihen (freies Experimentieren mit 13 Objekten) */
.tier.crowded { gap: 0.25rem; }
.tier.crowded .plate { white-space: normal; text-align: center; line-height: 1.15; font-size: 0.72rem; letter-spacing: 0; padding: 1px 4px; hyphens: auto; }
@media (max-width: 560px) {
  .workshop-scene .tier { gap: 0.2rem; }
  .workshop-scene .tier .plate { white-space: normal; text-align: center; line-height: 1.1; font-size: 0.68rem; letter-spacing: 0; padding: 1px 3px; hyphens: auto; }
}
.frost-veil {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 120% 80% at 50% 0%, rgba(190, 225, 240, 0.16), transparent 60%),
    linear-gradient(180deg, rgba(200, 230, 245, 0.08), rgba(200, 230, 245, 0.02));
  box-shadow: inset 0 0 60px rgba(200, 235, 250, 0.22);
}
.frost-veil[hidden] { display: none; }
.task-tabs { position: absolute; left: 12px; top: 10px; z-index: 2; display: flex; gap: 0.4rem; flex-wrap: wrap; max-width: calc(100% - 330px); }
.task-tab {
  padding: 0.2rem 0.65rem; border-radius: 999px; font: inherit; font-size: 0.8rem; cursor: pointer;
  color: var(--text-soft); background: rgba(34, 28, 23, 0.85); border: 1px solid var(--edge);
}
.task-tab.current { color: #24180d; background: linear-gradient(180deg, #e0bd78, #b38a45); border-color: #f0d49a; }
.task-tab .task-done { color: #8fc48a; font-weight: bold; }
.task-tab.current .task-done { color: #2e5a2a; }
.scene-actions { position: absolute; right: 12px; top: 10px; z-index: 2; display: flex; gap: 0.4rem; }
.scene-actions [hidden] { display: none; }
.station-placeholder { color: #d6cfa8; }
.station-placeholder .placeholder-art { display: block; width: 100%; height: var(--art-h); }
.station-placeholder .placeholder-art svg { width: 100%; height: 100%; opacity: 0.75; }

.runes-panel h2 { margin-bottom: 0.5rem; }
.runes { display: flex; flex-direction: column; gap: 0.45rem; }
.rune {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.4rem 0.6rem; text-align: left;
  font: inherit; color: var(--text); cursor: pointer; border-radius: 8px;
  background: rgba(34, 28, 23, 0.7); border: 1px solid var(--edge); transition: box-shadow 300ms ease, border-color 200ms ease;
}
.rune:hover:not(:disabled) { border-color: var(--gold); }
.rune:disabled { opacity: 0.5; cursor: not-allowed; }
.rune-symbol { flex: 0 0 38px; height: 38px; color: #a89f8a; }
.rune-symbol svg { width: 100%; height: 100%; }
.rune-text { display: flex; flex-direction: column; min-width: 0; }
.rune-text small { color: var(--text-soft); font-size: 0.76rem; }
.rune.status-aktiviert, .rune.status-wartet { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(224, 189, 120, 0.4) inset; }
.rune.status-aktiviert .rune-symbol, .rune.status-wartet .rune-symbol { color: #e0bd78; }
.rune.status-belegt { border-color: #e9d79a; box-shadow: 0 0 18px rgba(240, 215, 140, 0.45), 0 0 0 1px rgba(240, 215, 140, 0.6) inset; }
.rune.status-belegt .rune-symbol { color: #f6e3a4; filter: drop-shadow(0 0 6px rgba(250, 225, 150, 0.9)); animation: rune-glow 2.6s ease-in-out infinite; }
@keyframes rune-glow { 0%, 100% { opacity: 0.85; } 50% { opacity: 1; filter: drop-shadow(0 0 10px rgba(250, 225, 150, 1)); } }
.rune-store { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.rune-store:empty { display: none; }
.store-details summary { cursor: pointer; color: var(--text-soft); font-size: 0.85rem; }
.store-details p { margin: 0.3rem 0; font-size: 0.88rem; }
.trigger-button { padding: 0.45rem 0.8rem; font-size: 0.95rem; }

.chain-step { margin: 0 0 0.5rem; font-size: 0.86rem; color: #e0cf9c; }
.chain-step[hidden], .chain-first[hidden] { display: none; }
.chain-first {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; padding: 0.35rem 0.5rem;
  border: 1px dashed var(--gold); border-radius: 6px; font-size: 0.85rem;
}
.chain-first .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-soft); }
.chain-first .emblems { display: inline-flex; gap: 0.25rem; }
.hand-six { gap: 0.7rem; }
.card-slot.in-chain .card { box-shadow: 0 0 0 2px rgba(224, 189, 120, 0.85), 0 6px 14px rgba(0, 0, 0, 0.5); }
.card-slot.in-chain::after { content: 'A'; font-size: 0.7rem; color: var(--gold); letter-spacing: 0.1em; }
.result-part { padding-top: 0.4rem; margin-top: 0.4rem; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.result-part:first-of-type { border-top: 0; }
.kicker.strong { color: #e0cf9c; }
.goal-banner {
  margin-top: 0.6rem; padding: 0.45rem 0.6rem; border-radius: 6px; font-family: var(--serif);
  color: #1f2a16; background: linear-gradient(180deg, #b9d79a, #8fb56b);
}
.task-intro, .task-goal, .task-observe, .task-status { margin: 0.35rem 0; font-size: 0.92rem; }
.task-goal { font-weight: 600; }
.task-observe { color: var(--text-soft); }
.task-status { padding: 0.3rem 0.5rem; border-left: 3px solid var(--edge); }
.task-status.solved { border-left-color: #8fc48a; color: #cfe7c4; }
@media (max-width: 1100px) {
  .task-tabs { max-width: calc(100% - 190px); }
  .scene-actions { flex-direction: column; align-items: flex-end; }
  .hand-six { gap: 0.45rem; }
}/* Lange Kettenberichte in der Seitenleiste sollen Szene und Hand nicht auseinanderschieben */
.workshop-layout { grid-template-rows: auto 1fr auto; }
.workshop-layout .hand-tray { align-self: start; }
.workshop-layout .result-panel { max-height: 620px; overflow-y: auto; }
/* ============================================================ v0.8: Ausbildung, vier Runen, Transmutation, Prüfungen ab Lehrjahr 2 */
.nav-tab.nav-year3 { border-style: dotted; }
.nav-tab[hidden] { display: none; }

/* Ausbildungsübersicht */
.academy-layout { display: block; }
.academy { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1.4rem 2rem; }
.academy-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.8rem; }
.academy-head h2 { margin: 0.1rem 0 0.3rem; font-family: var(--serif); font-size: 1.7rem; }
.academy-head .prof-call { width: auto; max-width: 280px; }
.academy-summary { margin: 0; color: var(--text-soft); }
.master-banner {
  margin: 0 0 1rem; padding: 0.7rem 1rem; border-radius: 8px; text-align: center; font-family: var(--serif); font-size: 1.25rem;
  color: #2a1c0d; background: linear-gradient(180deg, #f0d49a, #c79c52); border: 1px solid #f7e2b5; box-shadow: 0 0 24px rgba(240, 212, 154, 0.35);
}
.master-banner[hidden] { display: none; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.stage { padding: 0.8rem 1rem; border-radius: 10px; background: rgba(34, 28, 23, 0.78); border: 1px solid var(--edge); }
.stage.current { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(224, 189, 120, 0.35) inset, 0 0 18px rgba(224, 189, 120, 0.15); }
.stage.stage-gesperrt { opacity: 0.6; }
.stage-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.5rem; }
.stage-head h3 { margin: 0; font-family: var(--serif); font-size: 1.1rem; flex: 1 1 auto; }
.stage-year { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-soft); }
.stage-status { font-size: 0.78rem; padding: 0.05rem 0.5rem; border-radius: 999px; border: 1px solid var(--edge); }
.stage-status.bestanden { color: #cfe7c4; border-color: #8fc48a; }
.stage-status.offen { color: #e0cf9c; border-color: var(--gold); }
/* v0.10.5: der nächste Schritt fällt sofort ins Auge */
.stage-status.jetzt { color: #24180d; background: linear-gradient(180deg, #e3c07c, #b8914a); border-color: #f0d49a; font-weight: 600; }
.stage-status.gesperrt { color: var(--text-soft); }
.stage.stage-gesperrt { padding-block: 0.55rem; }
.stage-facts { margin: 0.35rem 0; color: var(--text); font-size: 0.88rem; }
.stage-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.5rem; }
.cast-button.small { padding: 0.35rem 0.8rem; font-size: 0.88rem; width: auto; }
.academy-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.academy-note { margin: 0; font-size: 0.82rem; color: var(--text-soft); max-width: 760px; }
.academy-actions { display: flex; gap: 0.5rem; }
.academy-actions [hidden] { display: none; }

/* Runen: vier Werkzeuge, kompakt */
.runes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; }
.runes .rune { padding: 0.35rem 0.45rem; gap: 0.45rem; }
.runes .rune-symbol { flex-basis: 30px; height: 30px; }
.runes .rune-text strong { font-size: 0.88rem; }
.runes .rune-text small { font-size: 0.7rem; line-height: 1.2; }
.rune.status-hallt { border-color: #b7c9e6; box-shadow: 0 0 14px rgba(170, 200, 240, 0.35), 0 0 0 1px rgba(170, 200, 240, 0.5) inset; }
.rune.status-hallt .rune-symbol { color: #cfe0f6; animation: rune-glow 2.6s ease-in-out infinite; }
.echo-note { margin: 0; font-size: 0.82rem; color: #cfe0f6; }

/* Zahlensymbole und Transmutation */
.card .card-number {
  position: absolute; left: 8px; bottom: 8px; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 700; font-size: 0.95rem;
  color: #2a1c0d; background: #f7efdc; border: 1.5px solid #3b2a19; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.card.transmuted { box-shadow: 0 0 0 2px #b7c9e6, 0 0 18px rgba(170, 200, 240, 0.55), 0 6px 14px rgba(0, 0, 0, 0.5); }
.card.transmuted::before { border-style: dashed; }
.card .card-origin {
  position: absolute; left: 50%; top: -11px; transform: translateX(-50%); white-space: nowrap;
  padding: 0.05rem 0.4rem; border-radius: 999px; font-size: 0.62rem; color: #18222e; background: #cfe0f6; border: 1px solid #8ea6c6;
}
.card-slot.just-transmuted .card { animation: fuse 900ms ease-out; }
@keyframes fuse { 0% { transform: scale(0.82) rotate(-4deg); filter: brightness(1.6); } 60% { transform: scale(1.06); } 100% { transform: none; } }
.transmute-button[hidden], .transmute-pick[hidden] { display: none; }
.transmute-pick { display: inline-flex; align-items: center; gap: 0.3rem; }
.transmute-pick .pick-label { font-size: 0.8rem; color: var(--text-soft); }
.pick-element {
  --el: var(--erde); display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.2rem 0.5rem; cursor: pointer;
  font: inherit; font-size: 0.82rem; color: var(--ink); background: #efe3c6; border: 1px solid var(--el); border-radius: 6px;
}
.pick-element svg { width: 18px; height: 18px; color: var(--el); }
.pick-element:hover, .pick-element:focus-visible { outline: 2px solid var(--gold); }
.emblems .arrow { align-self: center; }

/* Prüfungen ab dem zweiten Lehrjahr */
.exam-scene .tier { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; }
.zone-group { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.25rem 0.4rem 0.3rem; border-radius: 10px; border: 1px dashed rgba(224, 189, 120, 0.35); background: rgba(20, 16, 12, 0.25); }
.zone-group.solved { border-color: rgba(143, 196, 138, 0.6); }
.zone-caption { margin: 0; font-size: 0.78rem; color: #e0cf9c; }
.zone-group.solved .zone-caption { color: #cfe7c4; }
.zone-stations { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: flex-end; }
.task-tab.exam-tab { cursor: default; }
.problem-list { list-style: none; margin: 0.4rem 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; }
.problem-list[hidden] { display: none; }
.problem-list li { padding: 0.25rem 0.5rem; border-left: 3px solid var(--gold); }
.problem-list li small { display: block; color: var(--text-soft); }
.problem-list li.solved { border-left-color: #8fc48a; color: #cfe7c4; }
.problem-list li.failed { border-left-color: #c0573a; }
#w-replay-intro[hidden] { display: none; }

@media (max-width: 1100px) {
  .stages { grid-template-columns: minmax(0, 1fr); }
  .runes .rune-text small { display: none; }
}

/* v0.8: Prüfungsszenen in der Werkstattansicht – Gefahrenzonen fließen in einem Raster statt auf festen Ebenen */
.workshop-scene.exam-scene { height: auto; min-height: var(--scene-h); }
.exam-scene .lab-wall, .exam-scene .bench { display: none; }
.exam-scene .floor { top: 0; background: radial-gradient(ellipse 90% 70% at 50% 30%, #3a2c20, #1f1812); }
.exam-scene .tier {
  position: relative; left: auto; right: auto; top: auto; bottom: auto; height: auto; --art-h: 104px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; align-items: stretch; padding: 0 0.8rem 0.6rem;
}
.exam-scene .tier-bench { padding-top: 2.6rem; }
.exam-scene .zone-stations .station { height: auto; flex: 1 1 0; max-width: 170px; }
.exam-scene .tier > .station { height: auto; max-width: 170px; }
@media (max-width: 1100px) {
  .exam-scene .tier { --art-h: 88px; }
}
/* v0.8: Zustandsmarken hängen unter den Stationen – in Prüfungszonen dafür Platz lassen */
.exam-scene .zone-stations { padding-bottom: 2.6rem; }
.exam-scene .zone-stations .chip { font-size: 0.66rem; }

/* ============================================================ v0.9: Rückmeldungen, Playtest-Bericht */
.feedback-notes { margin: 0.5rem 0 0; padding: 0.35rem 0.6rem 0.35rem 1.4rem; font-size: 0.84rem; color: #2c3a4a; border-left: 3px solid #6f8fb3; background: rgba(111, 143, 179, 0.12); border-radius: 0 6px 6px 0; }
.feedback-notes li + li { margin-top: 0.2rem; }
.playtest-card { max-width: 760px; width: min(760px, 94vw); }
.playtest-text { width: 100%; box-sizing: border-box; font: 0.82rem/1.45 ui-monospace, Consolas, monospace; color: var(--ink); background: #f7efdc; border: 1px solid #b59a68; border-radius: 6px; padding: 0.6rem; resize: vertical; }

/* v0.9: Startmenü (unter den Sicherheitsabfragen, damit „Neues Spiel …“ darüber erscheint) */
.overlay.start-menu { z-index: 19; background: radial-gradient(ellipse at 50% 35%, rgba(60, 44, 28, 0.9), rgba(12, 10, 8, 0.96)); }
.start-card { width: min(520px, 100%); text-align: center; }
.start-card h2 { font-size: 2.4rem; }
.start-actions { display: flex; flex-direction: column; gap: 0.6rem; margin: 1.2rem auto 1rem; max-width: 300px; }
.start-actions .cast-button { width: 100%; padding: 0.75rem 1.4rem; font-size: 1.05rem; }
.start-actions .ghost { color: var(--ink); background: rgba(255, 255, 255, 0.4); border-color: #a8987a; padding: 0.6rem 1.4rem; }
.start-actions .ghost:hover { background: rgba(255, 255, 255, 0.65); }
/* „Neues Spiel …“ in der Ausbildungsübersicht gut sichtbar */
.academy-actions .new-game-button { padding: 0.45rem 1.1rem; font-weight: 600; }
.start-foot .text-button { font: inherit; color: #8a3a2a; background: none; border: none; padding: 0; text-decoration: underline; cursor: pointer; }
.start-foot .text-button:hover, .start-foot .text-button:focus-visible { color: #5e2418; }

/* v0.10: Handwechsel – sichtbar, ob er einen Zug kostet */
.hand-controls .costs-turn { border-color: #c98a4a; color: #f0c48a; }
.hand-controls .costs-turn kbd { opacity: .8; }

/* ============================================================ v0.10.1: Tester-Feedback */
/* Unaufdringlich unten links, über allen Dialogen erreichbar (auch Einführung, Sieg und Niederlage) */
.fb-toggle {
  position: fixed; left: 10px; bottom: 10px; z-index: 60; padding: 0.3rem 0.75rem; font: inherit; font-size: 0.8rem;
  color: #f3e7cc; background: rgba(38, 29, 21, 0.78); border: 1px solid rgba(201, 170, 112, 0.55); border-radius: 999px;
  cursor: pointer; opacity: 0.78; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.fb-toggle:hover, .fb-toggle:focus-visible { opacity: 1; background: rgba(58, 43, 30, 0.95); }
.overlay.fb-dialog { z-index: 70; background: rgba(12, 10, 8, 0.6); }

/* v0.10.3: Alpha-Test-Mitteilung (unter dem Feedback-Knopf, damit der erwähnte Knopf sichtbar bleibt) */
.overlay.alpha-notice { z-index: 55; }
.alpha-card { width: min(600px, 100%); }
.alpha-card .overlay-text { margin-bottom: 0.75rem; }
.alpha-signature { margin-top: 1.1rem; font-style: italic; }
.alpha-signature strong { font-style: normal; font-size: 1.1rem; }
@media (max-width: 560px) {
  .overlay.alpha-notice { padding: 0.6rem; align-items: flex-start; }
  .alpha-card { padding: 1.1rem 1.1rem 1.2rem; max-height: calc(100vh - 1.2rem); max-height: calc(100dvh - 1.2rem); }
  .alpha-card h2 { font-size: 1.4rem; }
  .alpha-card .overlay-text { font-size: 0.96rem; line-height: 1.45; }
  .alpha-card .overlay-actions .cast-button { width: 100%; }
}
.fb-card { width: min(620px, 100%); }
.fb-card h2 { font-size: 1.6rem; }
.fb-field { display: block; margin: 0.7rem 0 0; font-weight: 600; font-size: 0.92rem; border: 0; padding: 0; }
.fb-field legend { padding: 0; margin-bottom: 0.35rem; }
.fb-field small { font-weight: 400; color: var(--ink-soft); }
.fb-field textarea {
  display: block; width: 100%; box-sizing: border-box; margin-top: 0.3rem; font: 400 0.95rem/1.4 inherit; font-family: inherit;
  color: var(--ink); background: #fbf6ea; border: 1px solid #b59a68; border-radius: 6px; padding: 0.45rem 0.55rem; resize: vertical;
}
.fb-categories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem; }
.fb-cat { display: flex; gap: 0.45rem; align-items: center; font-weight: 400; padding: 0.35rem 0.5rem; border: 1px solid #c9b48a; border-radius: 6px; background: rgba(255, 255, 255, 0.35); cursor: pointer; }
.fb-cat:has(input:checked) { border-color: #8a6a3a; background: rgba(255, 255, 255, 0.7); }
.fb-check { display: flex; gap: 0.5rem; align-items: flex-start; font-weight: 400; }
.fb-check input { margin-top: 0.25rem; }
.fb-report { margin-top: 0.35rem; font-size: 0.74rem; }
.fb-honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fb-privacy { font-size: 0.78rem; line-height: 1.4; color: var(--ink-soft); margin: 0.8rem 0 0; }
.fb-status { margin: 0.7rem 0 0; padding: 0.45rem 0.6rem; border-radius: 6px; font-size: 0.88rem; }
.fb-status.ok { background: rgba(84, 130, 74, 0.18); border-left: 3px solid #54824a; }
.fb-status.error { background: rgba(160, 60, 40, 0.14); border-left: 3px solid #a03c28; }
.fb-status.warn { background: rgba(196, 150, 60, 0.18); border-left: 3px solid #c4963c; }
.fb-status.pending { background: rgba(111, 143, 179, 0.14); border-left: 3px solid #6f8fb3; }
.fb-outbox { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-top: 0.7rem; font-size: 0.86rem; }
.fb-outbox .ghost, .fb-status .ghost { color: var(--ink); background: rgba(255, 255, 255, 0.45); border-color: #a8987a; }
.fb-version { margin-left: auto; font-size: 0.75rem; color: var(--ink-soft); }
@media (max-width: 560px) {
  .overlay.fb-dialog { padding: 0.5rem; align-items: flex-start; }
  .fb-card { max-height: calc(100vh - 1rem); padding: 1rem; }
  .fb-categories { grid-template-columns: 1fr; }
  .fb-toggle { left: 6px; bottom: 6px; font-size: 0.74rem; }
}

/* ============================================================ v0.10.4: Persönliches Kompendium */
.settings { display: flex; align-items: center; gap: 0.45rem; }
.overlay.compendium { z-index: 40; align-items: flex-start; }
.cp-card { width: min(860px, 100%); max-height: calc(100vh - 3rem); max-height: calc(100dvh - 3rem); padding: 1.3rem 1.6rem 1.5rem; }
.cp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.cp-head h2 { margin-bottom: 0.2rem; }
.ghost.cp-close { color: var(--ink); background: rgba(255, 255, 255, 0.55); border-color: #a8987a; flex: none; }
.ghost.cp-close:hover { background: rgba(255, 255, 255, 0.8); }
.ghost.cp-close kbd { color: var(--ink-soft); }
.cp-lead { font-family: var(--serif); color: var(--ink-soft); margin: 0 0 0.6rem; }
.cp-tabs { display: flex; gap: 0.3rem; border-bottom: 1px solid rgba(90, 70, 40, 0.35); margin-bottom: 0.9rem; flex-wrap: wrap; }
.cp-tab {
  font: inherit; font-family: var(--serif); font-size: 1rem; cursor: pointer; color: var(--ink-soft);
  padding: 0.35rem 0.9rem; border: 1px solid transparent; border-bottom: 0; border-radius: 7px 7px 0 0; background: none;
}
.cp-tab[aria-selected='true'] { color: var(--ink); background: rgba(255, 255, 255, 0.55); border-color: rgba(90, 70, 40, 0.35); margin-bottom: -1px; }
.cp-tab:focus-visible { outline: 2px solid #8a6a3a; outline-offset: 1px; }
.cp-school { margin: 0 0 1.2rem; }
.cp-school-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; border-bottom: 2px solid rgba(90, 70, 40, 0.25); padding-bottom: 0.25rem; margin-bottom: 0.6rem; }
.cp-school-head h3 { font-size: 1.3rem; }
.cp-school-head span { font-size: 0.82rem; color: var(--ink-soft); }
.school-erde .cp-school-head { border-color: color-mix(in srgb, var(--erde) 60%, transparent); }
.school-feuer .cp-school-head { border-color: color-mix(in srgb, var(--feuer) 60%, transparent); }
.school-wasser .cp-school-head { border-color: color-mix(in srgb, var(--wasser) 60%, transparent); }
.school-luft .cp-school-head { border-color: color-mix(in srgb, var(--luft) 70%, transparent); }
.cp-spell { padding: 0.7rem 0.85rem 0.8rem; margin: 0 0 0.6rem; border: 1px solid rgba(143, 122, 85, 0.45); border-radius: 8px; background: rgba(255, 255, 255, 0.32); scroll-margin-top: 0.5rem; }
.cp-spell-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; }
.cp-spell-head h3 { font-size: 1.15rem; }
.cp-spell-head .mini-icons svg { width: 19px; height: 19px; }
.cp-recipe { font-size: 0.8rem; color: var(--ink-soft); margin-left: auto; }
.cp-desc { font-family: var(--serif); font-style: italic; color: var(--ink-soft); margin: 0.25rem 0 0.5rem; line-height: 1.4; }
.cp-auto h4 { margin: 0 0 0.25rem; font-size: 0.86rem; font-weight: 600; color: #4a3d2e; }
.cp-badge { font-weight: 400; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: #5c6b48; border: 1px solid rgba(92, 107, 72, 0.5); border-radius: 999px; padding: 0 0.45rem; margin-left: 0.2rem; }
.cp-apps { margin: 0; padding: 0; list-style: none; }
.cp-apps li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.5rem; padding: 0.2rem 0 0.2rem 1rem; position: relative; font-size: 0.9rem; }
.cp-apps li::before { content: '✦'; position: absolute; left: 0; color: #8a6a3a; font-size: 0.75rem; top: 0.3rem; }
.cp-apps small { color: var(--ink-soft); font-size: 0.76rem; }
.cp-kind { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: #3a6278; border: 1px solid rgba(58, 98, 120, 0.45); border-radius: 4px; padding: 0 0.3rem; }
.cp-empty { color: var(--ink-soft); margin: 0.1rem 0; font-size: 0.9rem; }
.cp-empty.big { font-size: 1rem; padding: 1rem 0; }
.cp-tried { font-size: 0.78rem; color: #8a7a62; margin: 0.3rem 0 0; }
.cp-hidden { font-size: 0.85rem; color: var(--ink-soft); margin: 0.2rem 0 0; }
/* Persönliche Notizen: deutlich als Handschrift des Spielers abgesetzt */
.cp-note { margin-top: 0.6rem; padding-top: 0.5rem; border-top: 1px dashed rgba(90, 70, 40, 0.35); }
.cp-note-label { display: flex; gap: 0.5rem; align-items: baseline; font-size: 0.8rem; font-weight: 600; color: #6b4a22; margin-bottom: 0.2rem; }
.cp-note-hint { font-size: 0.82rem; color: var(--ink-soft); margin: 0 0 0.5rem; }
.cp-saved { font-weight: 400; font-size: 0.72rem; color: #5c6b48; }
.cp-textarea {
  display: block; width: 100%; box-sizing: border-box; resize: vertical; min-height: 2.6rem;
  font: italic 0.95rem/1.45 var(--serif); color: #3b2a16; padding: 0.4rem 0.55rem; border-radius: 6px;
  border: 1px solid #c3a974; background: repeating-linear-gradient(180deg, #fbf5e6 0 1.38rem, #efe2c4 1.38rem calc(1.38rem + 1px));
}
.cp-textarea:focus { outline: 2px solid #8a6a3a; outline-offset: 1px; }
.cp-textarea-large { min-height: 14rem; }
.cp-tool { margin: 0 0 1.1rem; }
.cp-tool h3 { font-size: 1.25rem; border-bottom: 2px solid rgba(90, 70, 40, 0.25); padding-bottom: 0.2rem; margin-bottom: 0.3rem; }
.cp-tool-list { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 0.9rem; }
.cp-tool-list dt { font-family: var(--serif); font-weight: 600; }
.cp-tool-list dd { margin: 0; font-size: 0.92rem; line-height: 1.4; }
.journal-apps { margin: 0.1rem 0 0; padding-left: 1rem; font-size: 0.8rem; color: #4a3d2e; }
.journal-apps li { padding: 0; border: 0; }
.open-compendium { margin-top: 0.6rem; }
/* Kleine Entdeckungsmeldung oben rechts – kein Dialog */
.cp-toast {
  position: fixed; top: 64px; right: 14px; z-index: 35; max-width: min(340px, calc(100vw - 28px)); cursor: pointer;
  display: grid; gap: 0.1rem; padding: 0.5rem 0.85rem; border-radius: 10px; font-size: 0.82rem; color: #24180d;
  background: linear-gradient(180deg, #ecd294, #c39b52); border: 1px solid #f0d49a; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  opacity: 0; transform: translateY(-6px); transition: opacity 250ms ease, transform 250ms ease;
}
.cp-toast.show { opacity: 1; transform: none; }
.cp-toast strong { font-family: var(--serif); font-size: 0.98rem; font-weight: normal; }
@media (max-width: 560px) {
  .overlay.compendium { padding: 0.5rem; }
  .cp-card { padding: 0.9rem 0.9rem 1.1rem; max-height: calc(100vh - 1rem); max-height: calc(100dvh - 1rem); }
  .cp-head h2 { font-size: 1.4rem; }
  .cp-tab { padding: 0.3rem 0.6rem; font-size: 0.92rem; }
  .cp-recipe { margin-left: 0; width: 100%; }
  .cp-tool-list { grid-template-columns: 1fr; }
  .cp-tool-list dd { margin-bottom: 0.4rem; }
  .compendium-toggle span { display: none; }
  .cp-toast { top: auto; bottom: 48px; right: 10px; }
}
@media (prefers-reduced-motion: reduce) { .cp-toast { transition: none; } }

/* ============================================================ v0.10.5: Lesbarkeit, kompakte Einführungen, Suche */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Knöpfe auf Pergament (Journal-Seiten): dunkle Schrift auf hellem Grund statt heller Schrift auf Pergament */
.journal button.ghost, .page button.ghost { color: var(--ink); background: rgba(255, 255, 255, 0.55); border-color: #9c8660; }
.journal button.ghost:hover:not(:disabled), .page button.ghost:hover:not(:disabled) { color: #1d140c; background: rgba(255, 255, 255, 0.85); border-color: #7a5f35; }
.journal button.ghost kbd, .page button.ghost kbd { color: var(--ink-soft); opacity: 1; }
.workshop-layout .journal { color: var(--ink); }
.task-status { color: var(--ink); }
.task-observe, .task-intro { color: var(--ink-soft); }
/* Deaktivierte Hauptknöpfe bleiben lesbar (heller Text auf dunklem Grund) */
.cast-button:disabled { color: #c2b498; }
/* Aufklappbare Zusatzinfos */
details.more { margin: 0.8rem 0 0; border-top: 1px solid rgba(90, 70, 40, 0.25); padding-top: 0.5rem; }
details.more summary { cursor: pointer; font-size: 0.88rem; font-weight: 600; color: #5a4024; list-style-position: inside; }
details.more summary:focus-visible { outline: 2px solid #8a6a3a; outline-offset: 2px; }
details.more[open] summary { margin-bottom: 0.4rem; }
details.more .overlay-text { font-size: 0.95rem; margin-bottom: 0.5rem; }
/* Prüfungseinführung: Ziel – Gefahren – Regeln */
.intro-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.55rem 1rem; margin: 0.4rem 0 0; }
.intro-facts dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: #6b4a22; font-weight: 600; padding-top: 0.15rem; }
.intro-facts dd { margin: 0; font-size: 0.98rem; }
.intro-facts dd:first-of-type { font-weight: 600; }
.intro-facts .intro-problems, .intro-facts .intro-rules { margin: 0; padding-left: 1.1rem; }
.intro-facts li { margin: 0.12rem 0; }
.proto-option { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.88rem; color: var(--ink-soft); }
/* Kompendium: Suche und Schulfilter */
.cp-find { display: grid; gap: 0.45rem; margin: 0 0 0.8rem; }
.cp-search input {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 1rem; padding: 0.45rem 0.7rem; border-radius: 7px;
  color: var(--ink); background: #fbf5e6; border: 1px solid #b59a68;
}
.cp-search input::placeholder { color: #7d6a50; }
.cp-search input:focus { outline: 2px solid #8a6a3a; outline-offset: 1px; }
.cp-schools { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cp-chip {
  font: inherit; font-size: 0.85rem; cursor: pointer; padding: 0.25rem 0.7rem; border-radius: 999px;
  color: var(--ink); background: rgba(255, 255, 255, 0.5); border: 1px solid #b59a68;
}
.cp-chip[aria-pressed='true'] { color: #fff8ea; background: #6b4a22; border-color: #6b4a22; }
.cp-chip:focus-visible { outline: 2px solid #8a6a3a; outline-offset: 2px; }
.cp-matches { margin: 0; font-size: 0.85rem; color: var(--ink-soft); min-height: 1em; }
.cp-tool-intro { margin: 0.25rem 0 0.5rem; line-height: 1.45; }
/* Impressum/Datenschutz neben „Feedback“ */
.legal-links { position: fixed; left: 100px; bottom: 14px; z-index: 60; display: flex; gap: 0.7rem; font-size: 0.78rem; }
.legal-links a { color: #e8dcc2; text-decoration: underline; text-underline-offset: 2px; opacity: 0.85; }
.legal-links a:hover, .legal-links a:focus-visible { opacity: 1; }
@media (max-width: 560px) {
  button.ghost.small, .cp-chip { font-size: 0.86rem; }
  .stage-year, .cp-badge, .cp-kind { font-size: 0.75rem; }
  .cp-apps small, .cp-saved { font-size: 0.8rem; }
  .intro-facts { grid-template-columns: 1fr; gap: 0.2rem; }
  .intro-facts dd { margin-bottom: 0.4rem; }
  .legal-links { left: 96px; bottom: 15px; }
}
.journal .task-status.solved { color: #2f5a26; border-left-color: #5f9a52; }

/* Deaktivierte kleine Knöpfe: etwas weniger blass */
button.ghost:disabled { opacity: 0.85; }
.intro-facts dd, .intro-facts li { color: var(--ink); }
