/* Stat-Block-Handbuch, dunkel
   Graphit-Grund fuer Kopf und Register, eine Hoehenstufe fuer die Leseseite,
   Haarlinien statt Schatten. Messing ist der einzige Akzent.
   Jeder Eintrag ist ein Stat-Block. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;

  /* Eine feste Neutralskala (Graphit). Alle Grautoene kommen von hier. */
  --n-100: #1b1e21;  /* Grund: Kopf, Register, Bildmulden */
  --n-150: #1f2326;  /* Zeiger auf dem Grund */
  --n-200: #22262a;  /* die eine Hoehenstufe: Leseseite, gewaehlte Zeile, Felder */
  --n-250: #2a2f33;  /* Zeiger auf der Leseseite */
  --n-300: #2f3438;  /* Haarlinie zwischen Flaechen, Zeilen, Segmenten */
  --n-400: #454c52;  /* kraeftigere Linie: Feldrand unter dem Zeiger */
  --n-500: #6a7278;  /* Grundlinie der Bildmulden, Rollbalken */
  --n-600: #9aa1a6;  /* gedaempfter Text */
  --n-700: #b9bfc3;  /* Nebentext: Typzeile, Beschreibung */
  --n-800: #e3e6e8;  /* Text */
  --n-900: #f4f6f7;  /* Namen und Ueberschriften */

  /* Messing, fuer dunklen Grund abgestimmt */
  --brass-400: #cfa248;  /* Keilregeln, Schieber, Auswahl, Fokus */
  --brass-700: #6b5524;  /* Textauswahl */
  --brass-900: #453c26;  /* Markierung geaenderter Zahlen, gewaehlte Tabellenspalte */

  /* Elemente: nur dort, wo sie Bedeutung tragen */
  --el-neutral: #a3a9ad;
  --el-earth: #c48d55;
  --el-fire: #f0745a;
  --el-water: #6aa8e6;
  --el-air: #6cc383;
  --el-all: #b08ad4;
  --neg: #f08a80;  /* negative Resistenzen, wie im Spiel rot */

  /* Werte mit eigener Farbe, abgestimmt auf ihre Spielsymbole (nur Exo-Knöpfe) */
  --stat-ap: #6aa8e6;
  --stat-mp: #6cc383;
  --stat-range: #4fc2b4;
  --stat-summon: #e39a4f;
  --stat-other: #b08ad4;  /* Exo auf anderen Werten ohne Element */

  /* Rollen */
  --ground: var(--n-100);
  --panel: var(--n-200);
  --seam: var(--n-300);
  --tick: var(--n-500);
  --text: var(--n-800);
  --muted: var(--n-600);
  --accent: var(--brass-400);
  --mark: var(--brass-900);

  --display: "Grenze", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --data: "Barlow Semi Condensed", "Arial Narrow", "Segoe UI", system-ui, sans-serif;

  --t-xs: 0.8125rem;
  --t-s: 0.9375rem;
  --t-m: 1.0625rem;
  --t-l: 1.4375rem;
  --t-name: clamp(1.875rem, 1.2rem + 2.6vw, 2.875rem);

  --plate-s: 2.75rem;
  --plate-l: 8rem;
  --r-s: 3px;
  --r-m: 6px;
  --register-w: clamp(19rem, 30vw, 25rem);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* Abdunkelung hinter Dialogen */
  --scrim: rgb(0 0 0 / 0.55);
}

/* Hell: dieselben Rollen, umgekehrte Skala. Die Leseseite liegt heller als der Grund (wie Papier auf dem Tisch),
   Messing und Elementfarben sind abgedunkelt, damit sie als Text auf hellem Grund mindestens 4.5:1 erreichen.
   Gesetzt von theme.js bzw. dem Skript im <head> (Systemvorgabe, bis man selbst umschaltet). */
:root[data-theme="light"] {
  color-scheme: light;

  --n-100: #eceef0;
  --n-150: #e3e6e9;
  --n-200: #fbfbfc;
  --n-250: #f0f2f3;
  --n-300: #d8dcdf;
  --n-400: #b4bbc0;
  --n-500: #868e94;
  --n-600: #5c646a;
  --n-700: #444b50;
  --n-800: #22272b;
  --n-900: #101315;

  --brass-400: #8c6514;
  --brass-700: #e6cf95;
  --brass-900: #f2e4bd;

  --el-neutral: #5f666b;
  --el-earth: #94591f;
  --el-fire: #c23b22;
  --el-water: #2a6db3;
  --el-air: #257a3f;
  --el-all: #7a4ea6;
  --neg: #bf3a2e;

  --stat-ap: #2a6db3;
  --stat-mp: #257a3f;
  --stat-range: #137570;
  --stat-summon: #9c5610;
  --stat-other: #7a4ea6;

  --scrim: rgb(16 19 21 / 0.4);
}

[data-el="neutral"] { --el: var(--el-neutral); }
[data-el="earth"] { --el: var(--el-earth); }
[data-el="fire"] { --el: var(--el-fire); }
[data-el="water"] { --el: var(--el-water); }
[data-el="air"] { --el: var(--el-air); }
[data-el="all"] { --el: var(--el-all); }

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 var(--t-m)/1.45 var(--data);
  font-variant-numeric: lining-nums tabular-nums;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
  accent-color: var(--accent);
  scrollbar-color: var(--tick) transparent;
}
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
option { background: var(--panel); color: var(--text); }
a { color: inherit; }
::selection { background: var(--brass-700); color: var(--n-900); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.page:focus { outline: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: 0.5rem; top: -4rem; z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--accent); color: var(--ground);
  font-weight: 600; text-decoration: none; border-radius: var(--r-s);
}
.skip:focus { top: 0.5rem; outline-color: var(--n-900); }

/* Felder: Panelton mit Haarlinie */
.lang select, .filters select, .filters input, #q {
  background-color: var(--panel);
  border: 1px solid var(--seam);
  border-radius: var(--r-s);
  color: var(--text);
}

/* ---------- Kopf ---------- */
.masthead {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto; /* Logo, Bereiche, Werkzeuge */
  align-items: stretch;
  column-gap: 1.5rem;
  padding: 0 1rem 0 1.25rem;
  background: var(--ground);
  border-bottom: 1px solid var(--seam);
}
/* Logo (img/logo.png, Quelle img/logo-src.png) mit Wortmarke; die Kopfzeile bleibt so hoch wie die Bereiche */
.brand {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0;
  font: 600 1.375rem/1 var(--display);
  letter-spacing: -0.005em;
  color: var(--n-900);
  text-decoration: none;
  white-space: nowrap;
  outline-offset: -2px;
}
.brand img { width: 2.5rem; height: 2.5rem; flex: none; }
/* Schmal: oben Logo und Werkzeuge, darunter die Bereiche über die ganze Breite */
@media (max-width: 480px) {
  .masthead { grid-template-columns: auto minmax(0, 1fr) auto; }
  .brand { grid-area: 1 / 1; min-height: 3.25rem; }
  .mast-tools { grid-area: 1 / 3; }
  .sections { grid-area: 2 / 1 / 3 / -1; margin-inline: -1rem; border-top: 1px solid var(--seam); }
}
@media (max-width: 359px) { .brand > span { display: none; } }
.sections {
  --more-start: 0px; --more-end: 0px;
  display: flex; align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
  /* app.js (navEdges) setzt die Attribute, solange links oder rechts noch Gruppen außerhalb liegen */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--more-start), #000 calc(100% - var(--more-end)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--more-start), #000 calc(100% - var(--more-end)), transparent);
}
.sections[data-more-start] { --more-start: 2.5rem; }
.sections[data-more-end] { --more-end: 2.5rem; }
.sections::-webkit-scrollbar { display: none; }
/* Gruppenknöpfe; die Gruppe des offenen Bereichs ist unterstrichen */
.nav-group {
  display: flex; align-items: center; gap: 0.2rem;
  min-height: 3.25rem; /* bestimmt die Höhe der Kopfleiste */
  padding: 2px 0.55rem 0 0.7rem;
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--muted);
  font: inherit; font-weight: 500;
  letter-spacing: 0.005em;
  white-space: nowrap;
  cursor: pointer;
  outline-offset: -3px;
}
.nav-group[data-current] { color: var(--n-900); font-weight: 600; border-bottom-color: var(--accent); }
.nav-group[aria-expanded="true"] { color: var(--n-900); background: var(--panel); }
.nav-group:active { color: var(--n-900); background: var(--panel); }
.nav-chev {
  width: 0.9rem; height: 0.9rem; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.7;
  transition: transform 160ms var(--ease-out);
}
.nav-group[aria-expanded="true"] .nav-chev { transform: rotate(180deg); }
/* Ausklappliste (Popover, in der obersten Ebene); app.js setzt top und left unter den Knopf */
.nav-menu {
  position: fixed; inset: auto; margin: 0;
  min-width: 11rem; max-width: calc(100vw - 1rem);
  padding: 0.3rem;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--n-400); border-radius: var(--r-m);
  box-shadow: 0 12px 28px rgb(0 0 0 / 0.4), 0 2px 6px rgb(0 0 0 / 0.3);
}
.nav-menu:popover-open { display: flex; flex-direction: column; }
.nav-menu a {
  display: flex; align-items: center;
  min-height: 2.25rem; padding: 0 0.7rem;
  border-radius: var(--r-s);
  color: var(--n-800);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  outline-offset: -2px;
}
.nav-menu a[aria-current="page"] { position: relative; color: var(--n-900); font-weight: 600; }
.nav-menu a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 0.45rem; bottom: 0.45rem; width: 2px; border-radius: 1px; background: var(--accent); }
.nav-menu a:active { background: var(--n-250); }
@media (prefers-reduced-motion: no-preference) {
  .nav-menu:popover-open { animation: nav-menu-in 140ms var(--ease-out); }
}
@keyframes nav-menu-in { from { opacity: 0; transform: translateY(-4px); } }
@media (forced-colors: active) { .nav-menu a[aria-current="page"] { outline: 2px solid Highlight; outline-offset: -2px; } }
.mast-tools { display: flex; align-items: center; gap: 0.5rem; }
.lang { display: flex; align-items: center; }
.lang select { height: 2.25rem; padding: 0 0.4rem; }

/* Hell/Dunkel (theme.js): zeigt das Ziel des Klicks, im Dunkeln die Sonne */
.theme-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 2.25rem; height: 2.25rem; padding: 0;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  color: var(--muted); cursor: pointer;
  transition: border-color 120ms, color 120ms, transform 120ms var(--ease-out);
}
.theme-btn svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .theme-moon, [data-theme="light"] .theme-btn .theme-sun { display: none; }
[data-theme="light"] .theme-btn .theme-moon { display: block; }
.theme-btn:active { transform: scale(0.97); }
@media (hover: hover) { .theme-btn:hover { border-color: var(--n-400); color: var(--text); } }

/* Konto-Knopf und Dialog (account.js) */
.acct-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  height: 2.25rem; max-width: 12rem; padding: 0 0.65rem;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  font-weight: 600; color: var(--text); cursor: pointer;
  transition: border-color 120ms, transform 120ms var(--ease-out);
}
.acct-btn svg { width: 1.05rem; height: 1.05rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.acct-btn.signed-in svg { stroke: var(--accent); }
.acct-btn > span:not(.av) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btn:active { transform: scale(0.97); }
@media (hover: hover) { .acct-btn:hover { border-color: var(--n-400); } }
@media (max-width: 480px) {
  .acct-btn { width: 2.25rem; padding: 0; justify-content: center; }
  .acct-btn > span:not(.av) { display: none; }
  .acct-btn .av { margin-left: 0; }
}

.acct {
  width: min(26rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem);
  padding: 0; overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--n-400); border-radius: var(--r-m);
}
.acct::backdrop { background: var(--scrim); }
.acct-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--seam); }
.acct-head h2 { margin: 0; font: 600 var(--t-l)/1.1 var(--display); color: var(--n-900); }
.acct-head [data-close] { margin-left: auto; }
.acct-tabs { display: flex; padding: 0 0.6rem; border-bottom: 1px solid var(--seam); }
.acct-tabs button {
  min-height: 2.75rem; margin-bottom: -1px; padding: 2px 0.6rem 0;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); font-weight: 500; cursor: pointer; outline-offset: -3px;
}
.acct-tabs [aria-selected="true"] { color: var(--n-900); font-weight: 600; border-bottom-color: var(--accent); }
.acct-body, .acct-body form { display: grid; gap: 0.85rem; }
.acct-body { padding: 1rem; }
.acct-lead { margin: 0; color: var(--n-700); }
.acct-lead strong { color: var(--n-900); }
.acct-field { display: grid; gap: 0.3rem; font-size: var(--t-s); font-weight: 600; color: var(--n-700); }
.acct-field input {
  height: 2.75rem; padding: 0 0.65rem;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 500 var(--t-m)/1 var(--data); color: var(--n-900);
}
.acct-field input:focus-visible { outline-offset: 1px; border-color: var(--accent); }
.acct-hint, .acct-note { margin: 0; font-size: var(--t-xs); line-height: 1.45; color: var(--muted); }
.acct-reveal { display: flex; align-items: center; gap: 0.45rem; width: fit-content; font-size: var(--t-s); color: var(--n-700); cursor: pointer; }
.acct-error { margin: 0; color: var(--el-fire); font-size: var(--t-s); font-weight: 600; }
.acct-error:empty { display: none; }
.acct .bd-btn { justify-content: center; }
.acct .bd-btn:disabled { opacity: 0.6; cursor: progress; }
.acct .acct-submit { border-color: var(--accent); }
.acct .acct-danger { border-color: var(--el-fire); color: var(--el-fire); }
.acct-more { padding-top: 0.75rem; border-top: 1px solid var(--seam); }
.acct-more summary { width: fit-content; font-weight: 600; color: var(--n-700); cursor: pointer; }
.acct-more[open] summary { margin-bottom: 0.75rem; color: var(--n-900); }

/* ---------- Aufbau: Register links, Leseseite rechts ---------- */
.layout { display: grid; grid-template-columns: var(--register-w) minmax(0, 1fr); }

@media (min-width: 861px) {
  body { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .layout { min-height: 0; grid-template-rows: minmax(0, 1fr); }
  .register, .page { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .register { border-right: 1px solid var(--seam); }
}

/* ---------- Register ---------- */
.register {
  background: var(--ground);
  scrollbar-width: thin;
}

/* Die Suche schwebt ueber der Liste; Zeilen laufen darunter durch. */
.search {
  position: sticky; top: 0; z-index: 2;
  padding: 0.875rem 1rem 0.625rem;
  background: color-mix(in srgb, var(--ground) 82%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
}
.search::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 100%;
  height: 0.75rem;
  background: linear-gradient(color-mix(in srgb, var(--ground) 72%, transparent), transparent);
  pointer-events: none;
}
/* Auf dem Desktop schweben Suche und Filter gemeinsam über der Liste (.reg-head klebt, die Suche darin nicht mehr).
   Auf dem Handy löst sich .reg-head auf und nur die Suche klebt wie oben. */
@media (min-width: 861px) {
  .reg-head {
    position: sticky; top: 0; z-index: 2;
    padding-bottom: 0.625rem;
    background: color-mix(in srgb, var(--ground) 82%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
  }
  .reg-head:has(> .filters:empty) { padding-bottom: 0; }
  .reg-head::after {
    content: "";
    position: absolute; left: 0; right: 0; top: 100%;
    height: 0.75rem;
    background: linear-gradient(color-mix(in srgb, var(--ground) 72%, transparent), transparent);
    pointer-events: none;
  }
  .reg-head > .search { position: relative; z-index: auto; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .reg-head > .search::after { display: none; }
  /* Offene Werte-Übersicht kann höher als der Bildschirm sein: dann rollt der Kopf mit, sonst wäre ihr Ende unerreichbar */
  .reg-head:has(.vf:not([hidden])) { position: relative; }
}
@media (max-width: 860px) { .reg-head { display: contents; } }
.field { position: relative; }
/* Erste Zeile: Suchfeld links, Umschalter Liste/Raster ganz rechts; die Kategorien darunter über die volle Breite */
.search { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.search .field, .search .cat-strip { grid-column: 1; }
.search .cat-strip { grid-column: 1 / -1; }
.search .view-toggle { grid-column: 2; grid-row: 1; margin-left: 0.75rem; }
.field svg {
  position: absolute; left: 0.8rem; top: 50%;
  width: 1.125rem; height: 1.125rem;
  transform: translateY(-50%);
  fill: none; stroke: var(--muted); stroke-width: 1.75; stroke-linecap: round;
  pointer-events: none;
}
#q {
  width: 100%; height: 2.875rem;
  padding: 0 0.75rem 0 2.6rem;
  font-size: 1.125rem;
}
#q::placeholder, .filters input::placeholder { color: var(--muted); opacity: 1; }
#q:focus-visible { outline-offset: 1px; border-color: var(--accent); }
.field:focus-within svg { stroke: var(--accent); }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.25rem 1rem 0; }
.filters:empty { display: none; }
.filters select, .filters input { height: 2.5rem; padding: 0 0.5rem; font-size: 1rem; }
.filters select { flex: 1 1 100%; min-width: 0; max-width: 100%; }
.filters input { flex: 1 1 6rem; width: 6rem; min-width: 0; }
.filters :focus-visible { outline-offset: 1px; }

.count {
  margin: 0;
  padding: 0.7rem 1rem 0.45rem;
  min-height: 2.5rem;
  color: var(--muted);
  font-size: var(--t-s);
  letter-spacing: 0.01em;
}
.count .error { color: var(--text); font-weight: 600; }

/* Zähler und Umschalter Liste/Raster in einer Zeile */
.list-head { display: flex; align-items: center; gap: 0.5rem; padding-right: 1rem; }
.list-head .count { flex: 1; min-width: 0; }
.view-toggle { display: inline-flex; padding: 2px; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m); }
.view-toggle[hidden] { display: none; }
.view-toggle button {
  display: grid; place-items: center; width: 2rem; height: 1.75rem; padding: 0;
  background: none; border: 0; border-radius: var(--r-s); color: var(--muted); cursor: pointer;
}
.view-toggle svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.view-toggle button[aria-pressed="true"] { background: var(--panel); color: var(--accent); }
@media (hover: hover) { .view-toggle button:hover { color: var(--n-900); } }
.view-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Werte auf der Rasterkarte (nur im Raster sichtbar) */
.card-stats { display: none; }

/* ---------- Raster: die Liste nimmt die ganze Fläche ein ---------- */
@media (min-width: 861px) {
  .layout.grid-mode { grid-template-columns: minmax(0, 1fr); --grid-pad: clamp(1.5rem, 6vw - 1rem, 7rem); }
  .layout.grid-mode:not(.has-detail) .page { display: none; }
  .layout.grid-mode.has-detail .register { display: none; }
  .layout.grid-mode .register { border-right: 0; }
  /* Kopf des Registers: Suche und Filter in einer Zeile */
  .layout.grid-mode .search, .layout.grid-mode .filters, .layout.grid-mode .list-head { padding-inline: 1.5rem; }
  .layout.grid-mode .filters { padding-top: 0; }
  .layout.grid-mode .filters select { flex: 0 1 15rem; }
  .layout.grid-mode .filters .num, .layout.grid-mode .filters input { flex: 0 1 9rem; }
  .layout.grid-mode .search { display: grid; }
  .layout.grid-mode .field { max-width: 40rem; }
  /* Eintrag geöffnet: volle Breite, mit "Zurück zur Liste" */
  .layout.grid-mode .block { margin-inline: auto; }
  .layout.grid-mode .backbar {
    /* top gleicht den oberen Innenabstand der Seite aus: sticky zählt ihn mit, sonst klebt die Leiste 2.25rem zu tief */
    display: block; position: sticky; top: -2.25rem; z-index: 3;
    margin: -2.25rem calc(-1 * var(--page-pad)) 1.5rem; padding: 0 var(--page-pad);
    background: color-mix(in srgb, var(--panel) 80%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
    border-bottom: 1px solid var(--seam);
  }
  .layout.grid-mode .page .back {
    display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.875rem; font-weight: 600; text-decoration: none;
  }
  .layout.grid-mode .back svg { width: 1rem; height: 1rem; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
}
.layout.grid-mode .results {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr)); gap: 0.75rem;
  padding: 0.25rem var(--grid-pad, 1.5rem) 1.5rem; border-top: 0;
}
.layout.grid-mode .results > li { min-width: 0; }
.layout.grid-mode .results a {
  height: 100%;
  grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto;
  grid-template-areas: "pl pl" "txt side" "st st";
  align-items: start; align-content: start; row-gap: 0.4rem;
  padding: 0.75rem 0.85rem 0.8rem;
  background: color-mix(in srgb, var(--ground) 40%, var(--panel));
  border: 0; border-radius: var(--r-m);
  transition: background-color 0.15s var(--ease-out);
}
@media (hover: hover) { .layout.grid-mode .results a:hover { background: var(--n-250); } }
.layout.grid-mode .results a[aria-current="true"] { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.layout.grid-mode .results a[aria-current="true"]::before { display: none; }
.layout.grid-mode .results .plate {
  grid-area: pl; justify-self: center; width: 5rem; height: 5rem;
}
/* Dungeon im Raster: Bossbilder auf einem Schimmer in der Bossfarbe, Name, Bosse, unten Level und Schwierigkeit */
.layout.grid-mode .results:has(.dj) { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.layout.grid-mode .results a.dj {
  --dj-accent: var(--accent);
  display: flex; flex-direction: column; align-items: stretch; gap: 0.3rem; padding: 0 0 0.8rem; overflow: hidden;
}
.dj-art {
  display: flex; justify-content: center; align-items: flex-end; gap: 0.25rem;
  height: 7.5rem; margin-bottom: 0.45rem; padding: 0.75rem 1rem 0.6rem;
  background:
    radial-gradient(60% 75% at 50% 70%, color-mix(in srgb, var(--dj-accent) 24%, transparent), transparent 75%),
    linear-gradient(color-mix(in srgb, var(--ground) 55%, transparent), transparent);
  border-bottom: 1px solid var(--seam);
}
.dj-art img { height: 100%; max-width: 100%; object-fit: contain; filter: drop-shadow(0 4px 6px rgb(0 0 0 / 0.45)); }
.dj-art.multi img { height: 80%; max-width: 32%; }
.dj-art .dj-sym { height: 3.25rem; opacity: 0.55; align-self: center; filter: none; }
.dj-name {
  padding-inline: 0.9rem;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900);
}
.dj-boss {
  padding-inline: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--t-s); font-style: italic; color: var(--n-700);
}
.dj-boss.none { color: var(--muted); }
.dj-foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem 0.6rem;
  margin-top: auto; padding: 0.55rem 0.9rem 0; font-size: var(--t-xs); color: var(--muted);
}
.dj-foot b { font: 600 var(--t-s)/1 var(--data); color: var(--n-900); font-variant-numeric: lining-nums tabular-nums; }
.dj-lvl { padding: 0.2rem 0.45rem; border-radius: var(--r-s); background: color-mix(in srgb, var(--dj-accent) 16%, var(--n-150)); color: var(--n-700); }
.dj-diff { display: inline-flex; gap: 0.18rem; }
.dj-diff i { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--n-400); }
.dj-diff i.on { background: var(--dj-accent); }
.dj-no { margin-left: auto; }

/* Reittier im Raster: Bild auf einem Schimmer in seiner Hauptfarbe, Name, Familie, Boni auf höchster Stufe */
.layout.grid-mode .results:has(.rt) { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.layout.grid-mode .results a.rt {
  --rt-accent: var(--accent);
  display: flex; flex-direction: column; align-items: stretch; gap: 0.2rem; padding: 0 0 0.85rem; overflow: hidden;
}
.rt-art {
  display: grid; place-items: center; height: 8.5rem; margin-bottom: 0.5rem; padding: 0.6rem 1rem;
  background:
    radial-gradient(60% 70% at 50% 60%, color-mix(in srgb, var(--rt-accent) 22%, transparent), transparent 75%),
    linear-gradient(color-mix(in srgb, var(--ground) 55%, transparent), transparent);
  border-bottom: 1px solid var(--seam);
}
.rt-art { overflow: hidden; }
.rt-art img { width: 100%; height: 100%; min-height: 0; object-fit: contain; filter: drop-shadow(0 4px 6px rgb(0 0 0 / 0.45)); }
.rt-head { display: flex; align-items: baseline; gap: 0.5rem; padding-inline: 0.9rem; }
.rt-name { flex: 1; min-width: 0; font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900); }
.rt-no { flex: none; font-size: var(--t-xs); color: var(--muted); }
.rt-fam { padding-inline: 0.9rem; font-size: var(--t-s); font-style: italic; color: var(--n-700); }
.rt-stats {
  display: flex; flex-direction: column; gap: 0.15rem;
  margin: 0.55rem 0.9rem 0; padding-top: 0.55rem; border-top: 1px solid var(--seam);
  font-size: var(--t-s); line-height: 1.3;
}
.rt-cap { margin-bottom: 0.2rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* Zauber im Raster, kompakt: Symbol links, Text in der Mitte, Kosten und Reichweite rechts oben */
.layout.grid-mode .results:has(.sc) { grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 0.6rem; }
.layout.grid-mode .results a.sc {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: none;
  align-items: start; column-gap: 0.75rem; row-gap: 0; padding: 0.7rem 0.8rem;
}
.layout.grid-mode .results a.sc .plate { grid-area: auto; justify-self: auto; width: 3rem; height: 3rem; }
.sc-body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.sc-name { font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900); overflow-wrap: anywhere; }
.sc-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-xs); font-style: italic; color: var(--n-700); }
.sc-who[data-breed] { font-style: normal; font-weight: 600; color: var(--accent); }
.sc-fx {
  display: flex; align-items: center; gap: 0.35rem; margin-top: 0.2rem; min-width: 0;
  font-size: var(--t-xs); font-weight: 600; color: var(--el, var(--n-800)); --ico: 1rem;
}
.sc-fx > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-key { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; }
.sc-key > span {
  display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.15rem 0.4rem;
  border-radius: var(--r-s); background: var(--n-100); border: 1px solid var(--seam);
  font: 600 var(--t-xs)/1 var(--data); color: var(--n-900); white-space: nowrap; font-variant-numeric: tabular-nums;
  --ico: 0.95rem;
}

/* Monster im Raster: Bild auf einem Schimmer in seiner Hauptfarbe, Name mit Level, Rasse, Werte, Resistenzen */
.layout.grid-mode .results:has(.mo) { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.layout.grid-mode .results a.mo {
  --mo-accent: var(--accent);
  display: flex; flex-direction: column; align-items: stretch; gap: 0.2rem; padding: 0 0 0.8rem; overflow: hidden;
}
.mo-art {
  position: relative; display: grid; place-items: center; height: 7.5rem; margin-bottom: 0.5rem; padding: 0.6rem 1rem;
  overflow: hidden;
  background:
    radial-gradient(60% 70% at 50% 65%, color-mix(in srgb, var(--mo-accent) 22%, transparent), transparent 75%),
    linear-gradient(color-mix(in srgb, var(--ground) 55%, transparent), transparent);
  border-bottom: 1px solid var(--seam);
}
.mo-art img { width: 100%; height: 100%; min-height: 0; object-fit: contain; filter: drop-shadow(0 4px 6px rgb(0 0 0 / 0.45)); }
.mo-tag {
  position: absolute; top: 0.5rem; left: 0.6rem; padding: 0.15rem 0.45rem; border-radius: var(--r-s);
  background: color-mix(in srgb, var(--accent) 22%, var(--n-150)); color: var(--n-900);
  font: 600 0.6875rem/1.2 var(--data); letter-spacing: 0.05em; text-transform: uppercase;
}
.mo-head { display: flex; align-items: baseline; gap: 0.5rem; padding-inline: 0.9rem; }
.mo-name { flex: 1; min-width: 0; font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900); overflow-wrap: anywhere; }
.mo-lvl { flex: none; font: 600 var(--t-xs)/1 var(--data); color: var(--n-700); font-variant-numeric: tabular-nums; }
.mo-race { padding-inline: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-s); font-style: italic; color: var(--n-700); }
/* Werte auf einer Fläche ohne Rahmen und Trenner; Resistenzen frei darunter */
.mo-stats, .mo-res { display: flex; margin: 0.45rem 0.9rem 0; }
.mo-stats { border-radius: var(--r-s); background: var(--n-250); } /* knapp heller als die Karte */
/* Resistenzen: fünf gleich breite Spalten, mit etwas Abstand unter den Werten */
.mo-res { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 0.6rem; }
.mo-stats > span, .mo-res > span {
  flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem;
  padding: 0.35rem 0.15rem; --ico: 0.95rem;
}
.mo-stats > span:first-child { flex-grow: 1.6; }
.mo-stats b, .mo-res b { font: 600 var(--t-xs)/1 var(--data); color: var(--n-900); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.mo-res .neg b { color: var(--neg); }

/* Set im Raster: alle Teile als kleines Raster über dem Namen */
.layout.grid-mode .results .set-pieces {
  grid-area: pl; justify-self: stretch;
  display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 0.25rem;
  /* Platz für zwei Reihen, damit die Namen benachbarter Karten auf einer Linie stehen */
  min-height: 6.4rem; padding: 0.25rem 0 0.4rem;
}
.layout.grid-mode .results .set-pieces .plate { grid-area: auto; justify-self: auto; width: 2.75rem; height: 2.75rem; }
.layout.grid-mode .results .txt { grid-area: txt; }
.layout.grid-mode .results .side { grid-area: side; align-self: start; }
.layout.grid-mode .results .name { -webkit-line-clamp: 2; line-clamp: 2; }
.layout.grid-mode .card-stats {
  grid-area: st;
  display: flex; flex-direction: column; gap: 0.12rem; margin-top: 0.15rem; padding-top: 0.5rem;
  border-top: 1px solid var(--seam);
  font-size: var(--t-s); font-style: normal; line-height: 1.3;
}
.cs { display: grid; grid-template-columns: 1.15em minmax(0, 1fr); column-gap: 0.45rem; align-items: start; color: var(--n-900); --ico: 1.15em; }
.cs-mk { display: grid; place-items: center; height: 1.3em; }
.cs b { font-weight: 600; }
.cs[data-el] b { color: var(--el); }
.cs[data-neg] b { color: var(--neg); }
.layout.grid-mode .more { width: calc(100% - 2 * var(--grid-pad, 1.5rem)); margin-inline: var(--grid-pad, 1.5rem); }

/* ---------- Item-Übersicht: Kategorien, Chips, Karten (itemfilter.js) ---------- */
/* Kategorien als Reiter unter dem Suchfeld; sie stehen mit der Suche über der Liste */
.cat-strip {
  display: flex; margin: 0.5rem -0.6rem 0;
  overflow-x: auto; scrollbar-width: none;
}
.cat-strip::-webkit-scrollbar { display: none; }
.cat-strip[hidden] { display: none; }
.cat-strip button {
  flex: none; min-height: 2.5rem; padding: 2px 0.6rem 0;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); font-weight: 500; white-space: nowrap; cursor: pointer; outline-offset: -3px;
  transition: color 120ms;
}
.cat-strip button { display: inline-flex; align-items: center; gap: 0.45rem; }
/* Spielsymbol des Reiters, als Maske in Textfarbe; beim gewählten Reiter in Messing */
.cat-ico {
  flex: none; width: 1.15rem; height: 1.15rem;
  background: currentColor; opacity: 0.85;
  -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat;
}
.cat-strip button[aria-pressed="true"] .cat-ico { background: var(--accent); opacity: 1; }
@media (forced-colors: active) { .cat-ico { background: CanvasText; } }
.cat-strip button[aria-pressed="true"] { color: var(--n-900); font-weight: 600; border-bottom-color: var(--accent); }
.cat-strip button:active { color: var(--n-900); }
@media (hover: hover) { .cat-strip button:hover { color: var(--n-900); } }
.search:has(.cat-strip:not([hidden])) { padding-bottom: 0; border-bottom: 1px solid var(--seam); }

/* Leiste: Typen, darunter Werte, Level und Sortierung. Im Register stehen die Felder untereinander. */
.filters > .if { flex: 1 1 100%; min-width: 0; display: grid; gap: 0.5rem; }
.if-types, .if-stats, .if-level, .if-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; min-width: 0; }
.if-types:empty { display: none; }
.if-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; min-width: 0; }
.if-stats, .if-level { flex: 1 1 100%; }
.if-level { flex-wrap: nowrap; }
.if-reset {
  min-height: 2rem; padding: 0 0.25rem; background: none; border: 0;
  color: var(--n-700); font-size: var(--t-s); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.18em;
}
.if-reset[hidden] { display: none; }
.filters .if-sort { flex: 1 1 10rem; }
.layout:not(.grid-mode) .if-reset { order: 1; }
@media (hover: hover) { .if-reset:hover { color: var(--n-900); } }

/* Werte: Knopf klappt unter der Leiste eine Übersicht auf (Suche, Häkchen, Mindestwert); gewählte Werte als Chips daneben */
.vf-chips { display: contents; }
.vf-btn {
  flex: none; display: inline-flex; align-items: center; gap: 0.5rem; height: 2.5rem; padding: 0 0.6rem 0 0.75rem;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  color: var(--text); font: inherit; font-size: 1rem; cursor: pointer;
  transition: border-color 120ms;
}
.layout.grid-mode .vf-btn { height: 2.25rem; }
.vf-btn svg { width: 0.75rem; height: 0.75rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); transition: transform 160ms var(--ease-out); }
.vf-btn[aria-expanded="true"] { border-color: var(--accent); }
.vf-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.vf-count {
  min-width: 1.25rem; padding: 0 0.3rem; border-radius: 999px;
  background: var(--accent); color: var(--n-100); font-size: var(--t-xs); font-weight: 700; line-height: 1.25rem; text-align: center;
}
@media (hover: hover) { .vf-btn:hover { border-color: var(--n-400); } }

.vf {
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-m);
  animation: vf-in 160ms var(--ease-out);
}
.vf[hidden] { display: none; }
@keyframes vf-in { from { opacity: 0; transform: translateY(-4px); } }
.vf-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--seam); }
.filters .if .vf-head input { flex: 0 1 20rem; width: auto; max-width: none; min-width: 0; height: 2.25rem; background: var(--ground); }
.filters .vf-head input:focus-visible { outline: none; border-color: var(--accent); }
.vf-done {
  flex: none; height: 2.25rem; margin-left: auto; padding: 0 0.875rem;
  background: var(--n-250); border: 0; border-radius: var(--r-s); color: var(--n-900); font: inherit; font-weight: 600; cursor: pointer;
}
@media (hover: hover) { .vf-done:hover { background: var(--n-300); } }
/* Gruppen nebeneinander, so viele Spalten wie passen */
.vf-body {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); align-items: start;
  gap: 0 1rem; padding: 0.25rem 0.375rem 0.625rem;
}
.vf-group[hidden], .vf-row[hidden] { display: none; }
.vf-group h3 {
  margin: 0; padding: 0.625rem 0.5rem 0.25rem;
  color: var(--muted); font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.vf-row { display: flex; align-items: center; gap: 0.5rem; min-height: 2.25rem; padding-right: 0.25rem; }
.vf-check {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 0.55rem;
  align-self: stretch; padding: 0 0.5rem; border-radius: var(--r-s);
  color: var(--n-800); cursor: pointer; user-select: none; --ico: 1.15em;
}
.vf-check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filters .if .vf-check input { flex: none; width: 1rem; height: 1rem; margin: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
.vf-row:has(:checked) .vf-check { color: var(--n-900); font-weight: 600; }
@media (hover: hover) { .vf-check:hover { background: var(--n-250); } }
.vf-min { display: none; flex: none; align-items: center; gap: 0.3rem; }
.vf-row:has(:checked) .vf-min { display: inline-flex; }
.vf-unit { color: var(--muted); font-size: var(--t-s); }
.filters .vf .num, .layout.grid-mode .filters .if .vf .num { flex: none; height: 2rem; --num-w: 3.25rem; --num-bg: var(--ground); }
.filters .vf .num > input[type="number"] { width: var(--num-w); height: auto; padding: 0; font-size: var(--t-s); background: none; border: 0; }
.filters .vf .num-btn { width: 1.5rem; }
.vf-empty { grid-column: 1 / -1; margin: 0; padding: 0.75rem 0.5rem; color: var(--muted); font-size: var(--t-s); }
.vf-empty[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .vf { animation: none; } .vf-btn svg { transition: none; } }

.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 2rem; max-width: 100%; padding: 0 0.6rem;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  color: var(--n-700); font-size: var(--t-s); font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: border-color 120ms, background-color 120ms, color 120ms, transform 120ms var(--ease-out);
  --ico: 1.1em;
}
.chip-n { color: var(--muted); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
/* Typsymbol aus dem Spiel: weiße Silhouette als Maske, damit es die Farbe des Chips annimmt */
.chip-ico {
  flex: none; width: 1.05rem; height: 1.05rem; margin-left: -0.1rem;
  background: currentColor; opacity: 0.8;
  -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat;
}
.chip[aria-pressed="true"] .chip-ico, .chip-x .chip-ico { color: var(--accent); opacity: 1; }
@media (forced-colors: active) { .chip-ico { background: CanvasText; } }
.chip svg { flex: none; width: 0.7rem; height: 0.7rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; opacity: 0.75; }
.chip[aria-pressed="true"], .chip-x { background: var(--mark); border-color: var(--accent); color: var(--n-900); }
.chip[aria-pressed="true"] .chip-n { color: var(--n-700); }
.chip:active { transform: scale(0.97); }
.chip:focus-visible { outline-offset: 1px; }
@media (hover: hover) {
  .chip:hover { border-color: var(--n-400); color: var(--n-900); }
  .chip[aria-pressed="true"]:hover, .chip-x:hover { border-color: var(--accent); }
  .chip-x:hover svg { opacity: 1; }
}
@media (pointer: coarse) { .chip, .if-reset { min-height: 2.5rem; } }
@media (prefers-reduced-motion: reduce) { .chip, .cat-strip button { transition: none; } }
@media (forced-colors: active) { .chip[aria-pressed="true"], .chip-x { border-color: Highlight; } }

/* Raster: alles in Zeilen, Sortierung rechts */
.layout.grid-mode .filters:has(> .if) { padding-top: 0.75rem; }
.layout.grid-mode .if { gap: 0.625rem; }
.layout.grid-mode .if-row { gap: 0.5rem 1.25rem; }
.layout.grid-mode .if-stats { flex: 0 1 auto; }
/* Level-Gruppe nicht stauchen (sonst schieben sich die Knöpfe unter "Filter zurücksetzen"); lieber umbrechen */
.layout.grid-mode .if-level { flex: 0 0 auto; }
.layout.grid-mode .filters .if select { flex: 0 1 auto; width: auto; max-width: 15rem; height: 2.25rem; }
.layout.grid-mode .filters .if .num { flex: 0 0 7.5rem; height: 2.25rem; }
.layout.grid-mode .filters .if .num > input { height: auto; }
.layout.grid-mode .filters .if-types select { height: 2rem; font-size: var(--t-s); }
.layout.grid-mode .if-presets { flex-wrap: nowrap; gap: 0.25rem; margin-left: 0.25rem; }
.layout.grid-mode .if-sort { margin-left: auto; }
@media (max-width: 860px) {
  .layout.grid-mode .if-level { flex-wrap: wrap; }
  .layout.grid-mode .if-presets { margin-left: 0; }
  .layout.grid-mode .if-sort { margin-left: 0; }
  .layout.grid-mode .filters .if .if-sort { flex: 1 1 auto; max-width: 100%; }
  /* Typen in einer Zeile zum Wischen, damit die Karten nicht zu weit nach unten rutschen */
  .layout.grid-mode .if-types { flex-wrap: nowrap; margin-inline: -1rem; padding-inline: 1rem; overflow-x: auto; scrollbar-width: none; }
  .layout.grid-mode .if-types::-webkit-scrollbar { display: none; }
  .layout.grid-mode .if-types > * { flex: none; }
}

/* Karte: Kopf mit Bild, Name, Typ und Level; Schaden der Waffe für sich; darunter die Werte */
.layout.grid-mode .results:has(.icard) { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.layout.grid-mode .results a.icard {
  display: flex; flex-direction: column; align-items: stretch; row-gap: 0; padding: 0; overflow: hidden;
}
.icard-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; column-gap: 0.65rem;
  padding: 0.7rem 0.8rem 0.65rem;
}
.layout.grid-mode .results .icard .plate { grid-area: auto; justify-self: auto; width: 4.5rem; height: 4.5rem; }
.layout.grid-mode .results .icard .txt { grid-area: auto; align-self: center; }
.icard-head .name { overflow-wrap: break-word; hyphens: auto; }
.icard-head .lvl { font-style: normal; }
.icard-head .lvl::before { content: "·"; margin-inline: 0.4em; font-weight: 400; color: var(--muted); }
.icard-set {
  display: block; margin-top: -0.3rem; padding: 0 0.8rem 0.6rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--accent); font-size: var(--t-xs); font-weight: 500; letter-spacing: 0.01em;
}
.layout.grid-mode .icard .card-stats { margin-top: 0; padding: 0.5rem 0.8rem 0.55rem; }
.layout.grid-mode .icard .card-stats:last-child { padding-bottom: 0.7rem; }
.icard .card-dmg { background: color-mix(in srgb, var(--ground) 65%, transparent); }
.cs[data-hit] { margin-inline: -0.3rem; padding-inline: 0.3rem; background: color-mix(in srgb, var(--mark) 55%, transparent); border-radius: 2px; }
.cs-more { margin-top: 0.2rem; padding-left: 1.6em; color: var(--muted); font-size: var(--t-xs); }

.results { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--seam); }
.results a {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.75rem;
  min-height: 2.875rem;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid var(--seam);
  text-decoration: none;
  outline-offset: -3px;
}
.results.plain a { grid-template-columns: minmax(0, 1fr) auto; }
.results .txt { min-width: 0; }
.results .name {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden;
  font-weight: 500; line-height: 1.2;
  overflow-wrap: anywhere;
}
.results .sub {
  display: block; margin-top: 0.1rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted);
  font-size: var(--t-s); font-style: italic; line-height: 1.25;
}
.results .side {
  align-self: stretch;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end;
  text-align: right; white-space: nowrap;
  line-height: 1.25;
}
.results .lvl { font-size: var(--t-s); font-weight: 600; color: var(--n-700); }
.results .catno { margin-top: auto; font-size: var(--t-xs); color: var(--muted); }

.results a:active { background: var(--n-250); }
/* Auswahl: die Zeile hebt sich auf die Hoehe der Leseseite, Messingnaht an der Vorderkante */
.results a[aria-current="true"] { background: var(--panel); color: var(--n-900); }
.results a[aria-current="true"]::before {
  content: "";
  position: absolute; inset-block: -1px; inset-inline-start: 0;
  width: 2px;
  background: var(--accent);
}
.results a[aria-current="true"] .lvl { color: var(--text); }

.more {
  display: block;
  width: calc(100% - 2rem); height: 2.875rem;
  margin: 0.9rem 1rem 1.75rem;
  background: var(--panel);
  border: 1px solid var(--seam);
  border-radius: var(--r-s);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 140ms var(--ease-out);
}
.more:active { transform: scale(0.97); background: var(--n-250); }
.more[hidden] { display: none; }

/* ---------- Erfolge: Kategoriebaum wie im Spiel ---------- */
.results .ach-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.75rem;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.45rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--seam);
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  text-transform: none;
  cursor: pointer;
  outline-offset: -3px;
}
.results .ach-row .name { font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; font-size: var(--t-s); }
.results .ach-row .sub { font-style: normal; font-variant-numeric: tabular-nums; }
.results .ach-row:active { background: var(--n-250); }
@media (hover: hover) { .results .ach-row:hover { background: var(--n-150); } }
.results .ach-row[aria-expanded="true"] { background: var(--panel); }

/* Plus/Minus und Pfeil, aus zwei Strichen gebaut */
.ach-plus, .ach-go { position: relative; width: 0.875rem; height: 0.875rem; }
.ach-plus::before, .ach-plus::after {
  content: ""; position: absolute; inset: 50% 0 auto; height: 1.5px; margin-top: -0.75px;
  background: var(--n-700); border-radius: 1px;
  transition: transform 200ms var(--ease-out);
}
.ach-plus::after { transform: rotate(90deg); }
[aria-expanded="true"] > .ach-plus::after { transform: rotate(0deg); }
[aria-expanded="true"] > .ach-plus::before, [aria-expanded="true"] > .ach-plus::after { background: var(--accent); }
.ach-go::before {
  content: ""; position: absolute; inset: 0.15rem 0.3rem 0.15rem 0.05rem;
  border: solid var(--n-600); border-width: 1.5px 1.5px 0 0; transform: rotate(45deg);
}

.ach-sub { list-style: none; margin: 0; padding: 0; background: var(--panel); border-bottom: 1px solid var(--seam); }
.ach-sub[hidden] { display: none; }
.results .ach-sub a {
  display: flex; align-items: baseline; gap: 0.75rem;
  min-height: 2.5rem;
  padding: 0.45rem 1rem 0.45rem 1.75rem;
  border-bottom: 0;
  font-size: var(--t-s);
}
.results .ach-sub li:first-child a { color: var(--n-900); }
.results .ach-sub .name { flex: 1; font-weight: 400; -webkit-line-clamp: 2; }

/* Fortschritt je Kategorie: 52 % wie im Erfolgsfenster, Messing sobald etwas erledigt ist */
/* .plain: Bereiche ohne Bilder (Quests) haben sonst ein zweispaltiges Raster */
.results .ach-row, .results.plain .ach-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.ach-pct {
  color: var(--muted); font-size: var(--t-s); font-weight: 600;
  font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; text-align: right;
}
.ach-row .ach-pct { min-width: 3.25rem; }
.ach-pct.some { color: var(--n-800); }
.ach-pct.full { color: var(--accent); }

.ach-prog { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.5rem; }
.ach-bar {
  flex: 1; max-width: 12rem; height: 4px; border-radius: 2px; overflow: hidden;
  background: color-mix(in srgb, var(--n-500) 55%, transparent);
}
.ach-bar i { display: block; height: 100%; background: var(--accent); transition: width 240ms var(--ease-out); }
.ach-prog-txt { color: var(--n-700); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }

/* Abhaken: Kästchen vor jeder Erfolgszeile, Knopf im Stat-Block */
.results .ach-li { display: flex; border-bottom: 1px solid var(--seam); }
.results .ach-li > a { flex: 1; min-width: 0; border-bottom: 0; padding-left: 0.35rem; }
.results .ach-li:has(a[aria-current="true"]) { background: var(--panel); }
.ach-check {
  flex: none; display: grid; place-items: center;
  width: 2.75rem; padding: 0 0 0 0.6rem;
  background: none; border: 0; cursor: pointer;
  outline-offset: -3px;
}
.chk {
  width: 1.25rem; height: 1.25rem; padding: 1px;
  border: 1.5px solid var(--n-500); border-radius: var(--r-s);
  fill: none; stroke: transparent; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  transition: background-color 140ms var(--ease-out), border-color 140ms var(--ease-out), transform 140ms var(--ease-out);
}
@media (hover: hover) { .ach-check:hover .chk, .ach-toggle:hover .chk { border-color: var(--n-700); } }
.ach-check:active .chk, .ach-toggle:active .chk { transform: scale(0.9); }
[aria-pressed="true"] > .chk { background: var(--accent); border-color: var(--accent); stroke: var(--ground); }
.results .ach-li.done .name { color: var(--n-700); }

/* Erledigt: gefüllter Knopf ohne Rahmen; abgehakt in Messing */
.ach-toggle {
  display: inline-flex; align-items: center; gap: 0.55rem;
  height: 2.5rem; padding: 0 1rem 0 0.75rem;
  background: var(--n-250); border: 0; border-radius: var(--r-s);
  color: var(--n-900); font: inherit; font-weight: 600; cursor: pointer;
  transition: background-color 140ms var(--ease-out), color 140ms var(--ease-out), transform 140ms var(--ease-out);
}
@media (hover: hover) { .ach-toggle:hover { background: var(--n-300); } }
.ach-toggle:active { transform: scale(0.97); }
.ach-toggle[aria-pressed="true"] { background: var(--accent); color: var(--ground); }
@media (hover: hover) { .ach-toggle[aria-pressed="true"]:hover { background: color-mix(in srgb, var(--accent) 88%, var(--n-900)); } }
.ach-toggle[aria-pressed="true"] > .chk { background: none; border-color: var(--ground); stroke: var(--ground); }
@media (prefers-reduced-motion: reduce) { .chk, .ach-bar i { transition: none; } }
@media (hover: hover) { .results .ach-sub a:hover { background: var(--n-250); } }

/* Kopf einer geöffneten Kategorie: Banner aus dem Spiel, darüber der Weg zurück */
.ach-head { position: relative; border-bottom: 1px solid var(--seam); overflow: hidden; }
/* Die Banner aus dem Spiel enden bei Zeile 80 von 108, darunter liegt ein flacher dunkler Streifen.
   135 % Höhe (108/80) mit Ausrichtung oben schneidet ihn weg. */
.ach-banner {
  position: absolute; top: 0; left: 0; width: 100%; height: 135%;
  object-fit: cover; object-position: 100% 0;
  opacity: 0.55;
  mask-image: linear-gradient(to right, transparent 0%, #000 70%);
}
.ach-head-txt { position: relative; padding: 0.75rem 1rem 0.8rem; }
.ach-head.no-banner { background: var(--n-150); }
.results .ach-head a { display: inline; min-height: 0; padding: 0; border: 0; }
.results .ach-head .ach-back {
  display: inline-flex; align-items: center; gap: 0.35rem;
  color: var(--muted); font-size: var(--t-xs); letter-spacing: 0.04em; text-transform: uppercase;
  text-decoration: none;
}
.results .ach-head .ach-back::before { content: "‹"; font-size: 1.1em; color: var(--accent); }
@media (hover: hover) { .results .ach-head .ach-back:hover { color: var(--text); } }
.ach-title {
  margin: 0.3rem 0 0;
  font-family: var(--display); font-size: var(--t-l); line-height: 1.15; color: var(--n-900);
  overflow-wrap: anywhere;
}
.results .ach-title a { color: var(--n-700); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.18em; }
.ach-meta { margin: 0.2rem 0 0; color: var(--n-700); font-size: var(--t-s); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .ach-plus::before, .ach-plus::after { transition: none; } }

/* Pokal hinter Punktzahlen, in Textfarbe */
.pts-ico { display: inline-block; width: 0.95em; height: 0.85em; vertical-align: -0.08em; }

/* Kamas und EP eines Erfolgs: Zahl und Spielsymbol wie im Belohnungsfeld des Spiels, ohne Kästchen */
.ach-gain { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.75rem; margin-bottom: 1rem; }
/* .ach-gain davor: sonst gewinnt der Absatzabstand von `.part p` und schiebt die Zeile nach oben */
.ach-gain .gain-vals, .gain-vals { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; margin: 0; }
.gain { display: inline-flex; align-items: center; gap: 0.4rem; --ico: 1.15em; }
.gain b {
  font: 600 1.3125rem/1.2 var(--data);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--n-900);
}
.gain-kamas b { color: var(--accent); }
.ach-lvl {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--muted); font-size: var(--t-s);
}
.ach-lvl input {
  width: 4.5rem; height: 2.25rem; padding: 0 0.5rem;
  font-size: 1rem; font-variant-numeric: tabular-nums;
}

/* Erfolg: rechts im Kopf Punkte/Level/Ziele und darunter Abhaken (ohne Katalognummer) */
.head.has-side { align-items: center; }
.head-side {
  align-self: start;
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.7rem;
}
.head-meta {
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.35rem 1.1rem;
  margin: 0;
  font-size: var(--t-m); color: var(--n-700);
}
/* Schmal: die Angaben rutschen unter Bild und Namen */
@media (max-width: 560px) {
  .head.has-side { grid-template-columns: auto minmax(0, 1fr); }
  .head-side { display: contents; }
  .head.has-side .title { grid-column: 2; grid-row: 1; }
  .head.no-plate.has-side .title { grid-column: 1 / -1; }
  .head.has-side .plate { grid-row: 1; }
  .head-meta { grid-column: 1 / -1; justify-content: flex-start; margin-top: 0.9rem; }
  .ach-toggle { grid-column: 1 / -1; justify-self: start; margin-top: 0.6rem; }
}
.hm { display: inline-flex; align-items: center; gap: 0.35rem; --ico: 1.05em; }
.hm b { font-weight: 600; color: var(--n-900); font-variant-numeric: lining-nums tabular-nums; }
.hm-lvl {
  font: 700 0.72em/1 var(--data); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--n-800);
}

/* ---------- Bildplatten: ueberall gleich gross, Mulde auf Grundniveau, gemeinsame Grundlinie ---------- */
.plate {
  display: block; flex: none;
  width: var(--plate-s); height: var(--plate-s);
}
.plate-l { width: var(--plate-l); height: var(--plate-l); }
.plate img {
  width: 100%; height: 100%;
  padding: 8% 8% 5%;
  object-fit: contain; object-position: 50% 100%;
}
/* Haarfeine Kontur, damit auch schwarze Grafik sich von der Mulde loest. */
.plate img { filter: drop-shadow(0 0 1px color-mix(in srgb, var(--n-600) 85%, transparent)); }
.plate img.broken { visibility: hidden; }

/* ---------- Leseseite ---------- */
.page {
  min-width: 0;
  --page-pad: clamp(1.5rem, 4vw, 4rem);
  padding: 2.25rem var(--page-pad) 4rem;
  background: var(--panel);
}
.page a {
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.page[aria-busy="true"] .block { opacity: 0.5; transition: opacity 120ms linear 200ms; }

.backbar { display: none; }

.block { max-width: 52rem; margin-inline: auto; }
/* Neben dem Register: Mitte des Blocks auf die Mitte des Fensters. Linker Abstand = halbe Fensterbreite − halbe
   Blockbreite − Register − Innenabstand; nie negativ und nie so groß, dass der Block schmaler würde. */
@media (min-width: 861px) {
  .block {
    margin-left: clamp(0px, calc(50vw - 26rem - var(--register-w) - var(--page-pad)),
      calc(100vw - var(--register-w) - 2 * var(--page-pad) - 52rem));
    margin-right: auto;
  }
}

/* Kopf des Stat-Blocks: Platte, Name, Typzeile, Katalognummer */
.head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 1.25rem;
}
.head.no-plate { grid-template-columns: minmax(0, 1fr) auto; }
.title { min-width: 0; }
.title h1 {
  margin: 0;
  font: 700 var(--t-name)/1 var(--display);
  letter-spacing: -0.012em;
  color: var(--n-900);
  text-wrap: balance;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.typeline {
  margin: 0.3rem 0 0;
  font: italic 400 1.1875rem/1.3 var(--display);
  letter-spacing: 0.004em;
  color: var(--n-700);
}
.catno { font-variant-numeric: lining-nums tabular-nums; letter-spacing: 0.01em; white-space: nowrap; }

/* Kompakter Dungeon-Kopf: Bild auf einem Schimmer in der Bossfarbe, Typ mit Mindestlevel, Name, Ort in einer Zeile;
   darunter eine goldene Trennlinie (WEDGE) zu den Rubriken */
.dg-hero {
  --dg-accent: var(--accent);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 1.25rem;
}
.dg-fig {
  display: grid; place-items: center; width: 6.5rem; height: 6.5rem; border-radius: 0.9rem;
  background: radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--dg-accent) 22%, var(--n-150)), var(--n-150) 72%);
}
.dg-fig img { width: 86%; height: 86%; object-fit: contain; filter: drop-shadow(0 4px 6px rgb(0 0 0 / 0.45)); }
.dg-fig .dg-sym { width: 55%; height: 55%; opacity: 0.6; filter: none; }
.dg-title { min-width: 0; }
.dg-kicker {
  margin: 0 0 0.35rem; font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
}
.dg-title h1 {
  margin: 0; font: 700 clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem)/1.05 var(--display); letter-spacing: -0.012em;
  color: var(--n-900); text-wrap: balance; overflow-wrap: anywhere;
}
.dg-where {
  display: flex; align-items: flex-start; gap: 0.4rem; margin: 0.55rem 0 0;
  font-size: var(--t-s); color: var(--n-700);
}
.dg-where svg { flex: none; width: 1rem; height: 1rem; margin-top: 0.15rem; fill: none; stroke: var(--accent); stroke-width: 1.4; }
.dg-dot { margin-inline: 0.45rem; color: var(--muted); }
.dg-no { align-self: start; margin: 0; color: var(--muted); font-size: var(--t-s); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 560px) {
  .dg-hero { grid-template-columns: auto minmax(0, 1fr); column-gap: 1rem; }
  .dg-fig { width: 4.75rem; height: 4.75rem; }
  .dg-no { display: none; }
}
.head .catno {
  align-self: start;
  margin: 0; padding-top: 0.15rem;
  font-size: var(--t-s); font-weight: 500;
  color: var(--muted);
}
.lore {
  margin: 0.9rem 0 0;
  max-width: 62ch;
  font: 400 var(--t-m)/1.5 var(--data);
  color: var(--n-700);
  text-wrap: pretty;
}

/* Keilregel */
.wedge {
  height: 5px;
  margin: 1rem 0 0.85rem;
  border: 0;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
/* Haarlinie: jede weitere Trennung unter der Keilregel. Messing bleibt einmal je Seite. */
.rule {
  height: 0;
  margin: 1rem 0 0.85rem;
  border: 0;
  border-top: 1px solid var(--seam);
}

/* Eigenschaftszeilen mit fettem Einstieg */
.props p { margin: 0; padding: 0.1rem 0; max-width: 70ch; }
.props b, .lead { font-weight: 700; margin-right: 0.3em; color: var(--n-900); }
kbd {
  padding: 0 0.4em;
  font: 600 0.9em var(--data);
  background: var(--ground);
  border: 1px solid var(--n-400);
  border-radius: var(--r-s);
}

/* ---------- Stufenschieber ---------- */
.grade { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin: 0 0 0.9rem; }
.grade-label { font-weight: 600; }
.scrub {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(2.875rem, 1fr));
  padding: 3px;
  background: var(--ground);
  border: 1px solid var(--seam);
  border-radius: var(--r-m);
  touch-action: pan-y;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
/* Der Schieber: eine Messingkopie der Ziffernreihe, beschnitten auf die gewaehlte Stufe.
   So bleibt die Ziffer lesbar, waehrend der Ausschnitt gleitet. */
.scrub-thumb {
  position: absolute; inset: 3px; z-index: 2;
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  background: var(--accent);
  color: var(--ground);
  font-weight: 700; font-size: 1.0625rem;
  clip-path: inset(0 100% 0 0 round 3px);
  transition: clip-path 220ms var(--ease-in-out), transform 140ms var(--ease-out);
  will-change: clip-path;
  pointer-events: none;
}
.scrub-thumb > span { display: grid; place-items: center; }
.scrub.instant .scrub-thumb { transition: none; }
.scrub.pressed .scrub-thumb { transform: scale(0.97); }
.scrub button {
  position: relative; z-index: 1;
  height: 2.375rem;
  padding: 0;
  background: none; border: 0; border-radius: var(--r-s);
  color: var(--n-700);
  font-weight: 600; font-size: 1.0625rem;
  cursor: pointer;
}
/* Der Fokus sitzt immer auf der gewaehlten Stufe, also unter dem Messing: der Ring fasst den ganzen Schieber. */
.scrub button:focus-visible { outline: none; }
.scrub:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Kampfraeume der Dungeons ---------- */
/* Viele Raeume: der Schieber rollt seitlich in seiner Leiste, die Seite selbst nie. */
.scrub-rail {
  flex: 0 1 auto; min-width: 0; max-width: 100%;
  overflow-x: auto; overscroll-behavior-x: contain;
  padding: 3px; margin: -3px; /* Platz fuer den Fokusring */
  scrollbar-width: thin; scrollbar-color: var(--tick) transparent;
}
.rooms-pick .scrub { grid-template-columns: repeat(var(--n), minmax(2.5rem, 1fr)); }
.scrub-rail.overflows .scrub { touch-action: pan-x pan-y; }
.scrub-rail.overflows .scrub button { scroll-margin-inline: 1.5rem; }

.room { margin: 0; }
.room-stage {
  padding: 0.75rem;
  background: var(--ground);
  border: 1px solid var(--seam);
  border-radius: var(--r-m);
}
.room-grid { display: block; width: 100%; height: auto; max-height: min(70vh, 36rem); }
.room-grid path, .swatch path { stroke: var(--ground); stroke-width: 0.07; stroke-linejoin: round; }
.cell-floor { fill: var(--n-300); }
.cell-red { fill: var(--el-fire); }
.cell-blue { fill: var(--el-water); }
.block-top { fill: var(--n-500); }
.block-left { fill: var(--n-400); }
.block-right { fill: color-mix(in srgb, var(--n-400), var(--n-300)); }
/* Kontur des Startfelds unter dem Zeiger: ueber allen Feldern, unter den Hindernisbloecken */
.room-grid .cell-hover { fill: none; stroke: var(--n-900); stroke-width: 0.09; pointer-events: none; }
/* Sichtlinie: sichtbare Felder leuchten messingfarben auf, verdeckte versinken im Grund */
.los-seen { fill: var(--accent); fill-opacity: 0.38; }
.los-hidden { fill: var(--ground); fill-opacity: 0.72; }
.los-from { fill: var(--accent); }
.room-grid :is(.los-seen, .los-hidden, .los-from) { pointer-events: none; }

/* Werkzeugzeile ueber dem Raster: Schalter und Hinweis */
.room-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; margin: 0 0 0.5rem; }
.room-hint { flex: 1 1 18rem; color: var(--muted); font-size: var(--t-s); }
.switch {
  display: inline-flex; align-items: center; gap: 0.6rem;
  min-height: 2.75rem;
  font-weight: 600; color: var(--n-900);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.switch input {
  appearance: none;
  position: relative; flex: none;
  width: 2.75rem; height: 1.5rem; margin: 0;
  background: var(--ground);
  border: 1px solid var(--n-400);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.switch input::before {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: calc(1.5rem - 6px); height: calc(1.5rem - 6px);
  border-radius: 50%;
  background: var(--n-600);
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::before { transform: translateX(1.25rem); background: var(--ground); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.room-legend {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem;
  margin: 0.6rem 0 0; padding: 0; list-style: none;
  color: var(--n-700);
}
.room-legend li { display: inline-flex; align-items: center; gap: 0.45rem; }
.room-legend b { color: var(--n-900); font-weight: 600; }
.swatch { width: 1.6em; height: auto; flex: none; overflow: visible; }

/* ---------- Werte in beschrifteten Segmenten ----------
   Ein gemeinsames Feld ohne Zellrahmen: jede Gruppe ist eine Zeile mit gleich breiten Spalten, Werte mittig.
   Eine Gruppe mit .quiet (z. B. Wurfregeln eines Zaubers) liegt als dunkleres Band unter der Hauptzeile. */
.seg-groups { display: grid; overflow: hidden; border-radius: var(--r-m); background: var(--n-150); }
.seg-group { min-width: 0; }
.seg-title {
  margin: 0; padding: 0.7rem 1rem 0;
  font: 600 var(--t-s)/1.2 var(--data);
  letter-spacing: 0.01em;
  color: var(--n-700);
}
.segs { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); margin: 0; padding: 1rem 0.5rem; }
.seg { display: flex; flex-direction: column-reverse; align-items: center; gap: 0.3rem; min-width: 0; padding: 0 0.35rem; text-align: center; }
.seg dt {
  display: flex; align-items: center; justify-content: center; gap: 0.35rem;
  font-size: var(--t-xs); line-height: 1.3;
  letter-spacing: 0.015em;
  color: var(--n-700);
  white-space: nowrap;
}
.seg dd {
  display: flex; align-items: center; justify-content: center; gap: 0.45rem;
  margin: 0;
  font: 600 1.75rem/1.1 var(--data);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--n-900);
  white-space: nowrap;
}
.seg-group.quiet { background: color-mix(in srgb, var(--ground) 70%, var(--n-150)); }
.seg-group.quiet .segs { padding: 0.7rem 0.5rem 0.75rem; }
.seg-group.quiet .seg { flex-direction: column-reverse; gap: 0.15rem; }
.seg-group.quiet dd { font-size: 1.0625rem; color: var(--n-800); }
.seg dd.word { font-size: 1rem; line-height: 1.575; }
/* In der leisen Gruppe stehen Wörter (unbegrenzt, keine) gleich groß und auf derselben Linie wie Zahlen */
.seg-group.quiet dd.word { font-size: 1.0625rem; line-height: 1.15; }
.seg dd.neg { font-weight: 700; }

/* Attribut-Icons aus dem Spiel: eine Groesse (rund 17px, in em), mittig zur Beschriftung, ohne Kachel dahinter. */
.ico {
  flex: none;
  width: var(--ico, 1em); height: var(--ico, 1em);
  max-width: none;
  object-fit: contain;
}
.seg dt { --ico: 1.3em; }
.effects .mk { --ico: 1.2em; }
.grades th { --ico: 1.125em; }
.grades th:first-child .ico { display: inline-block; margin-right: 0.35rem; vertical-align: -0.2em; }

.pip {
  flex: none;
  width: 0.5rem; height: 0.5rem;
  background: var(--el, transparent);
  border: 1.5px solid var(--el, var(--tick));
}

/* Geaenderte Zahlen: Markierung, die per Skript ausblendet */
.chg { margin: 0 -0.15em; padding: 0 0.15em; border-radius: 2px; }

/* Zweitansicht: alle Stufen als Tabelle, weitere Einklapper */
.fold { margin-top: 0.9rem; }
.fold summary {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.3rem 0.25rem 0.3rem 0;
  list-style: none;
  color: var(--n-700); font-weight: 500;
  cursor: pointer;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before {
  content: "";
  width: 0.45rem; height: 0.45rem; margin-left: 0.15rem;
  border-right: 2px solid; border-bottom: 2px solid;
  transform: rotate(-45deg);
}
.fold[open] summary::before { transform: rotate(45deg) translate(-0.1rem, -0.1rem); }
.table-wrap { max-width: 100%; overflow-x: auto; margin-top: 0.4rem; scrollbar-width: thin; }
.grades { border-collapse: collapse; min-width: 100%; font-size: var(--t-s); }
.grades th, .grades td {
  padding: 0.28rem 0.75rem;
  border-bottom: 1px solid var(--seam);
  text-align: right; white-space: nowrap;
}
.grades td { color: var(--n-700); }
.grades th:first-child { padding-left: 0; text-align: left; font-weight: 500; }
.grades th:first-child .pip { display: inline-block; margin-right: 0.35rem; }
.grades thead th { font-weight: 600; }
.grades .on { background: var(--mark); color: var(--n-900); font-weight: 600; }

/* ---------- Merkmale eines Monsters, gegliedert wie das Merkmalfenster im Spiel ----------
   Links Grundwerte und Merkmale in zwei Spalten, darunter die Kampfwerte; rechts Schaden und
   Resistenzen je Element. Nullwerte treten zurück, damit die vorhandenen Werte herausstehen. */
.mstats { container-type: inline-size; }
/* Kopfzeile links und Spaltenköpfe rechts sind gleich hoch, damit die Zeilen beider Seiten fluchten. */
.mstats-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 1.5rem;
  min-height: 2.25rem; margin: 0;
  font-family: var(--data); color: var(--n-700);
}
.mstats-head span { display: inline-flex; align-items: center; gap: 0.35rem; --ico: 1.2em; }
.mstats-head b { font-size: var(--t-m); font-weight: 600; color: var(--n-900); font-variant-numeric: tabular-nums; }
.mstats-body { display: grid; gap: 0.9rem 1.75rem; }
.mstats-body > section { min-width: 0; }
.mstat-cols {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  column-gap: 1.5rem;
}
.mstat-fight { margin-top: 0.55rem; padding-top: 0.55rem; border-top: 1px solid var(--seam); }
.mstat-col { margin: 0; }
.mstat { display: flex; align-items: center; gap: 0.75rem; min-height: 2rem; }
.mstat dt {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 0.55rem;
  color: var(--n-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  --ico: 1.35em;
}
.mstat dt .pip { margin: 0 0.425em; }
.mstat dd, .mstats-res td {
  margin: 0;
  font: 600 var(--t-m)/1.2 var(--data);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--n-900);
  white-space: nowrap;
}
.mstats .zero { color: var(--muted); font-weight: 400; }
.mstats .neg { color: var(--neg); }

.mstats-res { padding-top: 0.9rem; border-top: 1px solid var(--seam); }
.mstats-res table { width: 100%; border-collapse: collapse; }
.mstats-res th, .mstats-res td { height: 2rem; padding: 0 0 0 0.9rem; text-align: right; }
.mstats-res thead th {
  height: 2.25rem; vertical-align: middle;
  font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.mstats-res tbody th {
  padding-left: 0; text-align: left; font-weight: 400; color: var(--n-700); white-space: nowrap;
  --ico: 1.35em;
}
.mstats-res tbody th .ico, .mstats-res tbody th .pip { display: inline-block; margin-right: 0.55rem; vertical-align: -0.3em; }
@container (min-width: 44rem) {
  .mstats-body { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .mstats-res { padding: 0 0 0 1.75rem; border-top: 0; border-left: 1px solid var(--seam); }
}

/* ---------- Abschnitte: kleine Ueberschrift mit Linie ---------- */
.part { margin-top: 1.9rem; }
.wedge + .part { margin-top: 1.15rem; }
.part > h2 {
  margin: 0 0 0.65rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--seam);
  font: 600 var(--t-l)/1.15 var(--display);
  letter-spacing: 0;
  color: var(--n-900);
}
.part p { margin: 0 0 0.6rem; max-width: 70ch; }
/* ---------- Items ---------- */
/* Bedingungen zum Anlegen als Hinweis unter dem Kopf */
.item-cond {
  margin: 0; padding: 0.55rem 0.8rem; max-width: 70ch;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--seam)); border-radius: var(--r-s);
  background: color-mix(in srgb, var(--accent) 7%, var(--n-100));
  color: var(--n-700); font-size: var(--t-s);
}
.item-cond b { color: var(--n-900); margin-right: 0.35em; }

/* Waffe: Schaden groß je Element, darunter die Werte als Liste */
.weapon-hits { list-style: none; margin: 0 0 0.7rem; padding: 0; display: grid; gap: 0.25rem; }
.weapon-hits li {
  display: grid; grid-template-columns: 1.4em minmax(0, 1fr); align-items: center; column-gap: 0.5rem;
  font: 600 var(--t-l)/1.25 var(--data); color: var(--n-900); --ico: 1.3em;
}
.weapon-hits li[data-el] { color: var(--el); }
.weapon-facts { margin-top: 0.2rem; }

/* Boni: Abzüge rot */
.effects.item-fx > li[data-neg] { color: var(--neg); }

/* Herkunft als Karten */
.og-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr)); gap: 0.8rem; }
.og-card {
  padding: 0.7rem 0.85rem 0.8rem;
  background: color-mix(in srgb, var(--ground) 45%, var(--panel));
  border: 1px solid var(--seam); border-radius: var(--r-m);
}
.og-k {
  display: flex; align-items: center; gap: 0.45rem; margin: 0 0 0.35rem !important;
  font: 600 var(--t-xs)/1.3 var(--data); letter-spacing: 0.06em; text-transform: uppercase; color: var(--n-700);
  --ico: 1.15rem;
}
.og-k .ico { width: 1.15rem; height: 1.15rem; }
.og-v { color: var(--n-800); line-height: 1.45; }
.og-v b { color: var(--n-900); }
.og-v .note { font-size: var(--t-s); }

/* Rezept als Baum: eingerückte Ebenen mit Linie, Herkunft je Zutat rechts */
.rtree { list-style: none; margin: 0; padding: 0; }
.rtree .rtree { margin: 0.1rem 0 0.3rem 1.35rem; padding-left: 0.8rem; border-left: 1px solid var(--n-400); }
.rt-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "pl nm qty" "pl from from";
  align-items: center; column-gap: 0.65rem; padding: 0.3rem 0; border-bottom: 1px solid var(--seam);
}
.rt-row > .plate { grid-area: pl; }
.rt-row > a { grid-area: nm; font-weight: 600; color: var(--n-900); text-decoration-color: transparent; }
@media (hover: hover) { .rt-row > a:hover { text-decoration-color: var(--accent); } }
.rt-qty { grid-area: qty; font-weight: 600; color: var(--n-900); font-variant-numeric: tabular-nums; }
.rt-from { grid-area: from; color: var(--muted); font-size: var(--t-s); }
.rt-from:empty { display: none; }
.rt-open {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--accent); font: inherit; font-weight: 600;
}
.rt-caret { width: 0.4rem; height: 0.4rem; border-right: 2px solid; border-bottom: 2px solid; transform: rotate(-45deg); transition: transform 0.15s var(--ease-out); }
.rt-open[aria-expanded="true"] .rt-caret { transform: rotate(45deg); }
.rtree-base { margin: 0.7rem 0 0 !important; }
/* Beruf mit Spielsymbol */
.job { display: inline-flex; align-items: center; gap: 0.3em; vertical-align: bottom; }
.job .ico { width: 1.25em; height: 1.25em; object-fit: contain; }
.rt-from a { color: var(--n-700); text-decoration-color: color-mix(in srgb, var(--n-700) 45%, transparent); }
@media (hover: hover) { .rt-from a:hover { color: var(--n-900); text-decoration-color: var(--accent); } }
/* Grundressourcen: deutlich vom Baum abgesetzt */
[data-rtree-total]:not(:empty) { margin-top: 1.6rem; }

/* Set-Vorschau auf der Item-Seite */
.set-prev-head { margin: 0 0 0.5rem !important; }
.set-prev-head a { font-weight: 600; }
.set-prev .set-strip { margin-bottom: 0.7rem; }
.set-strip a { display: block; border: 1px solid var(--seam); border-radius: var(--r-m); }
.set-strip a[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
@media (hover: hover) { .set-strip a:hover { border-color: var(--accent); } }

/* Ähnliche Items */
.sim-table th[scope="row"] a { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--n-900); text-decoration-color: transparent; }
.sim-table th[scope="row"] .plate { width: 2rem; height: 2rem; }
.sim-table td, .sim-table thead th:last-child { text-align: left; vertical-align: middle; }
.sim-table td:nth-child(2) { text-align: right; font-variant-numeric: tabular-nums; }
.sim-table tr.cur { background: var(--mark); }
.sim-table tr.cur th a { color: var(--n-900); }
.sim-stats { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; white-space: normal !important; }
.sim-st { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 600; color: var(--n-800); font-variant-numeric: tabular-nums; --ico: 1em; }
.sim-st[data-el] { color: var(--el); }

/* ---------- Sets ---------- */
/* Teile-Leiste unter dem Kopf: Symbole, ein Klick springt zur Karte des Teils */
.set-strip { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.set-strip button {
  padding: 0; background: none; border: 1px solid var(--seam); border-radius: var(--r-m); cursor: pointer;
  transition: border-color 0.15s var(--ease-out);
}
@media (hover: hover) { .set-strip button:hover { border-color: var(--accent); } }

/* Gesamtwerte der angelegten Teile */
.set-total-head { margin: 0 0 0.6rem; }
.set-total-head b { color: var(--n-900); }
.set-total-head .note { display: block; font-size: var(--t-s); }
.set-total {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); column-gap: 2rem;
}
.set-total li {
  display: grid; grid-template-columns: 1.2em auto minmax(0, 1fr) auto; align-items: baseline; column-gap: 0.5rem;
  padding: 0.22rem 0; border-bottom: 1px solid var(--seam);
}
.set-total .mk { align-self: center; }
.st-v { font: 600 var(--t-m)/1.3 var(--data); font-variant-numeric: tabular-nums; color: var(--n-900); white-space: nowrap; }
.set-total li[data-el] .st-v { color: var(--el); }
.st-k { color: var(--n-700); }
.st-set { color: var(--muted); font-size: var(--t-xs); white-space: nowrap; }

/* Teile als Karten; abgelegte Teile treten zurück */
.set-pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); gap: 0.9rem; }
.sp-card {
  display: flex; flex-direction: column; gap: 0.6rem; min-width: 0;
  padding: 0.8rem 0.95rem 0.9rem;
  background: color-mix(in srgb, var(--ground) 45%, var(--panel));
  border: 1px solid var(--seam); border-radius: var(--r-m);
  transition: opacity 0.2s var(--ease-out);
}
.sp-card.off { opacity: 0.5; }
.sp-card:target, .sp-card.flash { border-color: var(--accent); }
.sp-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 0.7rem; }
.sp-title h3 { margin: 0; font: 600 var(--t-m)/1.2 var(--data); }
.sp-title h3 a { color: var(--n-900); text-decoration-color: transparent; }
@media (hover: hover) { .sp-title h3 a:hover { text-decoration-color: var(--accent); } }
.sp-title p { margin: 0.1rem 0 0; color: var(--muted); font-size: var(--t-s); }
.sp-wear { font-size: var(--t-s); }
.sp-card .effects, .sp-card .effects:has(li:nth-child(7)) { columns: auto; }
.sp-from { margin: auto 0 0; padding-top: 0.4rem; border-top: 1px solid var(--seam); color: var(--muted); font-size: var(--t-s); }

/* Boni als Tabelle: gleichbleibende Werte treten zurück, die Spalte der angelegten Teile ist markiert */
.set-bonus td { color: var(--n-900); font-weight: 600; font-variant-numeric: tabular-nums; }
.set-bonus td.same { color: var(--muted); font-weight: 400; }
.set-bonus td.none { color: var(--n-500); font-weight: 400; }
.set-bonus tr[data-el] th { color: var(--el); }
.set-bonus .on { background: var(--mark); }

/* Herstellung: Berufe über der Zutatenliste */
.set-jobs { display: flex; flex-wrap: wrap; gap: 0.3rem 1.5rem; margin: 0 0 0.6rem; color: var(--n-700); }
.set-jobs b { color: var(--n-900); }
a.job { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
@media (hover: hover) { a.job:hover { text-decoration-color: var(--accent); } }

/* Berufe: Werkstätten nach Region, je mit Kartensymbol, Gebiet und Position */
.part .ws-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; margin: 0 0 0.3rem; }
.ws-regions { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); gap: 0 1.5rem; }
.ws-region { margin-top: 0.8rem; }
.ws-region h3 {
  display: flex; align-items: baseline; gap: 0.45rem;
  margin: 0; padding-bottom: 0.25rem; border-bottom: 1px solid var(--n-400);
  font: 600 var(--t-xs)/1.3 var(--data); letter-spacing: 0.06em; text-transform: uppercase; color: var(--n-700);
}
.ws-list { list-style: none; margin: 0; padding: 0; }
.ws-list a {
  display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) auto; align-items: center; column-gap: 0.55rem;
  min-height: 2.4rem; padding: 0.2rem 0.1rem; border-bottom: 1px solid var(--seam);
  color: var(--n-900);
}
.page .ws-list a { text-decoration: none; }
.ws-ico { width: 1.5rem; height: 1.5rem; object-fit: contain; }
.ws-n { line-height: 1.25; overflow-wrap: break-word; }
.ws-pos { color: var(--muted); font: 400 var(--t-s)/1.3 var(--data); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (hover: hover) { .ws-list a:hover { background: var(--n-150); } }
.ws-list a:active { background: var(--seam); }

/* Berufe: alle Rezepte in Levelstufen, Suche und Typfilter darüber */
.jr-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0 0 0.4rem; }
.jr-tools input[type="search"], .jr-tools select {
  height: 2.5rem; padding: 0 0.6rem; font-size: 1rem;
  background-color: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s); color: var(--text);
}
.jr-tools input[type="search"] { flex: 1 1 14rem; min-width: 0; }
.jr-tools select:disabled { color: var(--muted); }
/* Berufslevel: Beschriftung und Zahlenfeld (numfield.js) nebeneinander */
.jr-joblv { display: inline-flex; align-items: center; gap: 0.5rem; flex: none; color: var(--n-700); font-size: var(--t-s); }
.jr-joblv .num { height: 2.5rem; --num-bg: var(--panel); --num-w: 2.75rem; }
.jr-joblv .num > input[type="number"] { font-size: 1rem; font-variant-numeric: tabular-nums; }
.part .jr-hint { margin: 0.2rem 0 0; color: var(--muted); font-size: var(--t-s); }
.jr-tools input::placeholder { color: var(--muted); opacity: 1; }
.jr-tools select { flex: 0 1 16rem; min-width: 0; }
.jr-tools :focus-visible { outline-offset: 1px; border-color: var(--accent); }
.part .jr-count { margin: 0 0 0 auto; color: var(--muted); font-size: var(--t-s); font-variant-numeric: tabular-nums; }
.jr-band { margin-top: 1.1rem; content-visibility: auto; contain-intrinsic-size: auto 40rem; }
.jr-band h3 {
  display: flex; align-items: baseline; gap: 0.45rem;
  margin: 0; padding-bottom: 0.25rem; border-bottom: 1px solid var(--n-400);
  font: 600 var(--t-xs)/1.3 var(--data); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--n-700);
}
.jr-bn { color: var(--muted); font-weight: 400; letter-spacing: 0; }
.jr-list { list-style: none; margin: 0; padding: 0; }
.jr {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; column-gap: 0.75rem;
  padding: 0.55rem 0; border-bottom: 1px solid var(--seam);
}
.jr[hidden] { display: none !important; }
/* Ergebnis-Bild auf dunklem Feld wie die Zutaten (und wie im Herstellungsfenster des Spiels) */
.jr > .plate { background: var(--ground); border-radius: var(--r-s); }
.jr > .plate img { padding: 10%; object-position: 50% 50%; }
.jr-meta { display: none; }
.jr-tools .view-toggle { flex: none; }
.part .jr-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.6rem; margin: 0.1rem 0 0.3rem; }
.jr-head > .jr-name { font-weight: 600; color: var(--n-900); text-decoration-color: transparent; }
@media (hover: hover) { .jr-head > .jr-name:hover { text-decoration-color: var(--accent); } }
.jr-type { color: var(--muted); font-size: var(--t-s); }
.jr-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; padding-top: 0.15rem; }
.jr-lvl, .jr-xp {
  white-space: nowrap;
  font: 600 var(--t-s)/1.3 var(--data); color: var(--n-800); font-variant-numeric: tabular-nums;
}
.jr-xp { color: var(--accent); }
.jr-xp:empty { display: none; }
.jr-xp.zero { color: var(--muted); font-weight: 400; }
/* Über dem eingestellten Berufslevel: noch nicht herstellbar */
.jr-locked > .plate, .jr-locked .jr-main, .jr-locked .jr-side { opacity: 0.42; }
.jr-ings { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 0.4rem; }
.jr-ings a {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.1rem 0.5rem 0.1rem 0.2rem;
  background: color-mix(in srgb, var(--ground) 45%, var(--panel));
  border: 1px solid var(--seam); border-radius: var(--r-s);
  font-size: var(--t-s); line-height: 1.3; color: var(--n-700); text-decoration: none;
}
.jr-ings img { width: 1.6rem; height: 1.6rem; object-fit: contain; }
.jr-q { font-weight: 600; color: var(--n-900); font-variant-numeric: tabular-nums; }
@media (hover: hover) { .jr-ings a:hover { border-color: var(--n-400); color: var(--n-900); } }
.jr-ings a:active { background: var(--seam); }
/* Karten wie das Herstellungsfenster im Spiel: großes Bild, Name und Level, Zutaten als Felder mit Menge oben links */
.jr-cards .jr-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(21rem, 100%), 1fr)); gap: 0.6rem;
  padding-top: 0.6rem;
}
.jr-cards .jr {
  grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 0.85rem;
  padding: 0.7rem 0.8rem;
  background: color-mix(in srgb, var(--ground) 45%, var(--panel));
  border: 0; border-radius: var(--r-m);
}
.jr-cards .jr > .plate { grid-column: 1; grid-row: 1; width: 4.5rem; height: 4.5rem; }
.jr-cards .jr-main { grid-column: 2; grid-row: 1; }
.jr-cards .jr-side { grid-column: 3; grid-row: 1; }
.jr-cards .jr-lvl, .jr-cards .jr-type { display: none; }
.jr-cards .jr-xp { font-size: var(--t-m); }
.part .jr-cards .jr-head { margin: 0.05rem 0 0; padding-right: 0; }
.part .jr-cards .jr-meta { display: block; margin: 0 0 0.5rem; color: var(--muted); font-size: var(--t-s); }
.jr-cards .jr-ings { gap: 0.3rem; }
.jr-cards .jr-ings a {
  position: relative; display: block; width: 2.75rem; height: 2.75rem; padding: 0;
  background: var(--ground); border-color: var(--seam);
}
.jr-cards .jr-ings img { width: 100%; height: 100%; padding: 0.3rem; }
.jr-cards .jr-q {
  position: absolute; left: 0.2rem; top: 0.1rem;
  font: 700 0.8rem/1 var(--data); color: var(--n-900);
  text-shadow: 0 0 2px var(--ground), 0 1px 2px var(--ground), 0 0 4px var(--ground);
}
.jr-cards .jr-x, .jr-cards .jr-n {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
@media (max-width: 560px) {
  .jr { grid-template-columns: auto minmax(0, 1fr); }
  .jr > .plate { grid-column: 1; grid-row: 1; }
  .jr-main { grid-column: 2; grid-row: 1; }
  .jr-side { grid-column: 2; grid-row: 2; flex-direction: row; gap: 0.9rem; padding-top: 0.35rem; }
}

/* Drops nach Kategorie, wie das Beutefenster im Spiel */
.drop-group + .drop-group, .refs + .drop-group { margin-top: 0.9rem; }
.drop-group h3 {
  display: flex; align-items: baseline; gap: 0.45rem;
  margin: 0 0 0.2rem;
  font: 600 var(--t-xs)/1.3 var(--data); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--n-700);
}
.drop-count { color: var(--muted); font-weight: 400; letter-spacing: 0; }
.part .drop-cond { margin: 0 0 0.3rem; color: var(--muted); font-size: var(--t-s); }.note { color: var(--muted); }

.effects { list-style: none; margin: 0; padding: 0; column-gap: 2.5rem; }
/* Erst lange Listen laufen zweispaltig. */
.effects:has(li:nth-child(7)) { columns: 2 17rem; }
.effects > li {
  display: grid; grid-template-columns: 1em minmax(0, 1fr); column-gap: 0.5rem;
  align-items: start;
  padding: 0.14rem 0;
  break-inside: avoid;
  font-weight: 500;
}
/* Markenspalte: Icon oder Elementmarke, immer gleich breit und auf die erste Zeile gemittelt. */
.mk { display: grid; place-items: center; height: 1.45em; }
/* Alle sechs Elementfarben erreichen auf der Leseseite mindestens 4.5:1, also faerbt sich auch der Text. */
.effects > li[data-el] { color: var(--el); }
.effects .dur { color: var(--muted); font-weight: 400; }

/* Verweise auf andere Eintraege */
.refs {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  column-gap: 1.5rem;
}
.refs a {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; column-gap: 0.7rem;
  min-height: 3.25rem;
  padding: 0.25rem 0.3rem 0.25rem 0;
  border-bottom: 1px solid var(--seam);
  text-decoration: none;
  outline-offset: -2px;
}
.refs.plain a { grid-template-columns: minmax(0, 1fr) auto; min-height: 2.5rem; padding-left: 0.1rem; }
.refs .n { font-weight: 500; line-height: 1.25; overflow-wrap: break-word; hyphens: auto; }
/* Bedingungen: ganze Wörter, ohne Silbentrennung (sonst "Le-vel") */
.refs .cond { display: block; margin-top: 0.1rem; color: var(--muted); font-size: var(--t-s); font-weight: 400; line-height: 1.35; hyphens: manual; }
/* Mit Bedingungstext brauchen Einträge mehr Breite, damit der Name nicht eingequetscht wird */
.refs:has(.cond) { grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr)); }
.refs .v { font-weight: 600; color: var(--n-900); white-space: nowrap; text-align: right; }
.refs.plain .v { font-weight: 400; color: var(--muted); font-size: var(--t-s); }
.refs a:active { background: var(--seam); }
/* Belohnungs-Items eines Erfolgs: ohne Trennstrich darunter */
.ach-items .refs a { border-bottom: 0; }

/* Set-Boni */
.bonus {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); column-gap: 1rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--seam);
}
.bonus .lead { margin: 0; }
.bonus .effects { columns: auto; }
.part .props p { margin: 0; }

/* NPC: Sätze als leise Zitate, Platzhalter für den Charakternamen wie bei Herausforderungen */
.npc-lines { list-style: none; margin: 0; padding: 0; max-width: 62ch; }
.npc-lines li {
  margin: 0 0 0.5rem; padding: 0.05rem 0 0.05rem 0.75rem;
  border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  font: italic 400 var(--t-s)/1.5 var(--display); color: var(--n-700);
}
.fold .npc-lines { margin-top: 0.5rem; }
/* NPC-Aussehen aus dem Look-Renderer: hohe Figur, unten ausgerichtet */
.plate-npc img { padding: 4% 10% 2%; }

/* Quest-Schritte und Ziele */
.steps { list-style: none; margin: 0; padding: 0; max-width: 46rem; counter-reset: step; }
.steps > li {
  counter-increment: step;
  display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; column-gap: 0.5rem;
  align-items: baseline;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--seam);
}
.steps > li::before { content: counter(step) "."; font-weight: 600; color: var(--muted); grid-row: 1; }
.steps > li > p { margin: 0; grid-column: 2; grid-row: 1; }
.steps > li > .v { color: var(--muted); font-size: var(--t-s); white-space: nowrap; grid-column: 3; grid-row: 1; }
/* Ziele eines Schritts: unter der Beschreibung, eigene Marken statt Nummern */
.steps > li > .goals { grid-column: 2 / -1; grid-row: 3; margin-top: 0.35rem; color: var(--muted); }
/* Der Auftrag in den Worten des NPCs: zwischen Beschreibung und Zielen, als Zitat mit Messingnaht */
.steps > li > .step-dialog {
  grid-column: 2 / -1; grid-row: 2;
  margin: 0.45rem 0 0.1rem; padding: 0.1rem 0 0.1rem 0.75rem;
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  font: italic 400 var(--t-s)/1.5 var(--display); color: var(--n-700);
  max-width: 62ch;
}
/* Anführungszeichen der jeweiligen Sprache (lang am Zitat) */
.steps > li > .step-dialog { quotes: auto; }
.steps > li > .step-dialog::before { content: open-quote; }
.steps > li > .step-dialog::after { content: close-quote; }
.steps > li > .goals a { color: var(--ink, inherit); }
.steps { max-width: none; }
.steps > li { scroll-margin-top: 4rem; }
/* Rechts im Schritt: Level, Belohnung (EP, Kamas) und Items des Schritts */
.steps > li > .step-side {
  grid-column: 3; grid-row: 1 / span 2;
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem;
  min-width: 6.5rem; text-align: right;
}
.steps > li > .step-side .v { color: var(--muted); font-size: var(--t-s); white-space: nowrap; }
.step-gain { margin: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 0.1rem; }
.step-gain .gain { display: inline-flex; align-items: center; gap: 0.3rem; font-size: var(--t-s); font-variant-numeric: tabular-nums; }
.step-gain .gain b { font-weight: 600; color: var(--n-900); }
.step-gain .ico, .step-gain .mono { width: 1.15rem; height: 1.15rem; }
.step-tiles, .obj-things { margin: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.25rem; }
.step-other { margin: 0; font-size: var(--t-xs); color: var(--muted); max-width: 12rem; }
/* Kachel für Item oder Monster mit Anzahl, wie im Spiel */
.obj-tile {
  position: relative; display: inline-grid; place-items: center;
  width: 2.5rem; height: 2.5rem; border-radius: var(--r-s);
  background: var(--n-100); box-shadow: inset 0 0 0 1px var(--n-400);
  text-decoration: none;
}
.obj-tile img { width: 86%; height: 86%; object-fit: contain; }
.obj-tile b {
  position: absolute; left: 0.15rem; top: 0.05rem;
  font: 600 var(--t-xs)/1 var(--data); color: var(--n-900);
  text-shadow: 0 0 2px var(--n-100), 0 0 2px var(--n-100);
}
.obj-tile:hover { box-shadow: inset 0 0 0 1px var(--accent); }

/* Auge neben dem Ziel: Kartenbild ein- und ausblenden */
.obj-eye {
  display: inline-grid; place-items: center; vertical-align: -0.2rem;
  width: 1.5rem; height: 1.5rem; margin-left: 0.3rem; padding: 0;
  border: 0; border-radius: var(--r-s); background: none; color: var(--muted); cursor: pointer;
}
.obj-eye svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.4; }
.obj-eye[aria-expanded="true"] { color: var(--accent); }
.obj-eye:hover { color: var(--n-900); background: var(--n-250); }
.goals li > .obj-card { grid-column: 1 / -1; }
.obj-card { margin: 0.4rem 0 0.6rem; max-width: 36rem; }
/* Bosse und Monster eines Dungeons: dieselben Karten im Raster */
.mob-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(26rem, 100%), 1fr)); gap: 1rem; align-items: start; }
.mob-cards .obj-card { margin: 0; max-width: none; }

/* Monsterkarte im Dungeon: Kopf (Bild, Name mit Level, Rasse), Werte und Resistenzen auf ruhigen Flächen, Zauber, Drops */
.mc {
  --mc-accent: var(--accent); /* app.js: tintMobCards setzt die Hauptfarbe des Monsterbilds */
  padding: 1.25rem 1.25rem 1.35rem;
  border-radius: 0.75rem; /* ohne Rahmen: die Karte hebt sich über ihre Fläche ab */
  background:
    radial-gradient(90% 70% at 100% 0%, color-mix(in srgb, var(--mc-accent) 7%, transparent), transparent 70%),
    var(--n-100);
}
.mc .note { margin: 0; color: var(--muted); }
/* Die Karte ist selbst Bedienfläche: keine Unterstreichung der Leseseite (.page a) */
.page .mc a { text-decoration-line: none; }
.page .mc .mc-name:hover { text-decoration-line: underline; }
.mc-head { display: flex; align-items: center; gap: 1rem; padding-bottom: 0.85rem; margin-bottom: 0.9rem; border-bottom: 1px solid var(--seam); }
.mc-fig {
  flex: none; display: grid; place-items: center; width: 4.25rem; height: 4.25rem;
  border-radius: 0.65rem; box-shadow: inset 0 0 0 1px var(--seam);
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--mc-accent) 16%, var(--n-150)), var(--n-150) 70%);
}
.mc-fig img { width: 88%; height: 88%; object-fit: contain; }
/* 1. Level steht neben dem Namen */
.mc-title { flex: 1; display: grid; gap: 0.15rem; min-width: 0; padding-left: 0.9rem; border-left: 2px solid var(--mc-accent); }
.mc-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.2rem 0.75rem; }
.mc-lv { font: 600 var(--t-m)/1 var(--data); color: color-mix(in srgb, var(--mc-accent) 55%, var(--n-900)); font-variant-numeric: lining-nums tabular-nums; }
.mc-lv:empty { display: none; }
.mc-name { font: 700 1.375rem/1.15 var(--data); color: var(--n-900); text-decoration: none; overflow-wrap: anywhere; }
.mc-name:hover { color: var(--mc-accent); }
.mc-race { color: var(--n-700); font-size: var(--t-m); }
.mc-race:empty { display: none; }

.mc-stats { display: flex; border-radius: var(--r-m); background: var(--n-150); }
.mc-stat {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0 0.75rem; --ico: 1.3rem;
}
.mc-stat b { font: 600 1.125rem/1 var(--data); color: var(--n-900); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.mc-hp { flex-grow: 1.8; }

.mc-sec { margin-top: 1.1rem; }
.mc-h {
  display: flex; align-items: center; gap: 0.7rem; margin: 0 0 0.6rem;
  font: 600 var(--t-m)/1.2 var(--data); color: var(--n-800);
}
.mc-h::before { content: ""; flex: none; width: 3px; height: 1em; border-radius: 2px; background: var(--mc-accent); }
.mc-h::after { content: ""; flex: 1; height: 1px; background: var(--seam); }

.mc-res { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 0.6rem 0; border-radius: var(--r-m); background: var(--n-150); }
.mc-r { min-width: 0; display: flex; align-items: center; justify-content: center; gap: 0.4rem; --ico: 1.35rem; }
.mc-r b { font: 600 1.0625rem/1 var(--data); color: var(--n-900); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.mc-r.neg b { color: var(--neg); }

/* höchstens zwei Spalten, auf schmalen Karten eine */
.mc-spells { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(min(13rem, 100%), calc(50% - 0.25rem)), 1fr)); gap: 0.5rem; }
.mc-spell {
  display: flex; align-items: center; gap: 0.75rem; min-width: 0;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  border-radius: var(--r-m); background: color-mix(in srgb, var(--n-150) 55%, transparent);
  color: var(--n-800); font-weight: 500; line-height: 1.2; text-decoration: none;
  transition: background-color 120ms;
}
.mc-spell img { flex: none; width: 2.25rem; height: 2.25rem; border-radius: var(--r-s); object-fit: contain; }
.mc-spell span { min-width: 0; overflow-wrap: anywhere; }

.mc-drops { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.25rem, 1fr)); gap: 0.45rem; }
.mc-drop {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--seam); border-radius: var(--r-m); background: var(--n-150);
  text-decoration: none; transition: border-color 120ms;
}
.mc-drop img { width: 100%; aspect-ratio: 1; padding: 14%; object-fit: contain; }
.mc-drop i {
  padding: 0.25rem 0 0.3rem; background: var(--n-250);
  font: 600 var(--t-xs)/1 var(--data); font-style: normal; text-align: center; color: var(--n-800);
  font-variant-numeric: lining-nums tabular-nums;
}
/* Erklärung der Kennzeichen unter den Drops */
.mc-legend { display: flex; flex-wrap: wrap; gap: 0.15rem 1.25rem; margin: 0.55rem 0 0; font-size: var(--t-xs); color: var(--muted); }
@media (hover: hover) {
  .mc-spell:hover { background: var(--n-250); color: var(--n-900); }
  .mc-drop:hover { border-color: var(--mc-accent); }
}
@media (prefers-reduced-motion: reduce) { .mc-spell, .mc-drop { transition: none; } }
/* Schmale Karte (Handy): enger, damit die fünf Resistenzen in eine Zeile passen */
.mc { container-type: inline-size; }
@container (max-width: 26rem) {
  .mc-head { gap: 0.9rem; }
  .mc-fig { width: 4.5rem; height: 4.5rem; }
  .mc-title { padding-left: 0.8rem; }
  .mc-name { font-size: 1.25rem; }
  .mc-r { gap: 0.2rem; --ico: 1rem; }
  .mc-r b { font-size: var(--t-xs); }
  .mc-drops { grid-template-columns: repeat(auto-fill, minmax(3.75rem, 1fr)); }
}
@media (max-width: 480px) { .mc { padding: 1rem 0.85rem 1.1rem; } }

/* Kampfziele: Dungeon-Symbol bzw. gekreuzte Schwerter statt der Marke, so breit wie die Marken-Spalte erlaubt */
.goals li.goal-typed { grid-template-columns: 1.15rem minmax(0, 1fr); column-gap: 0.45rem; }
.goal-kind { display: inline-grid; place-items: center; width: 1.15rem; height: 1.15rem; align-self: center; color: var(--n-700); }
.goal-kind img { width: 1.15rem; height: 1.15rem; object-fit: contain; }
.goal-kind .ico { --ico: 1rem; width: 1rem; height: 1rem; }

/* Kartenbild eines Ziels: Karte als Hintergrund, unten ein Band mit NPC, Name und Dingen */
.obj-map {
  position: relative; overflow: hidden;
  margin: 0; aspect-ratio: 12 / 5;
  border-radius: var(--r-m); background: var(--n-100);
  box-shadow: inset 0 0 0 1px var(--seam);
}
.has-mob .obj-map { border-radius: var(--r-m) var(--r-m) 0 0; }
.obj-who a { color: var(--n-900); text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.obj-who a:hover { color: var(--accent); }
.obj-qty { color: var(--n-700); font-weight: 500; }
.obj-dj {
  display: flex; align-items: center; gap: 0.3rem; margin-top: 0.2rem;
  font: 500 var(--t-xs)/1.2 var(--data);
}
.obj-who .obj-dj { color: var(--n-700); }
.obj-dj img { width: 1.1rem; height: 1.1rem; object-fit: contain; }

/* Monster unter seinem Kartenbild: Level, Werte, Resistenzen, Zauber, Drops */
.obj-mob {
  padding: 0.65rem 0.8rem 0.75rem;
  border-radius: 0 0 var(--r-m) var(--r-m);
  background: var(--n-100); box-shadow: inset 0 0 0 1px var(--seam);
  font-size: var(--t-s); color: var(--text);
}
.obj-mob p { margin: 0; }
.obj-mob .note { color: var(--muted); }
.mob-line { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; color: var(--n-700); }
.mob-lv { font-weight: 600; color: var(--n-900); }
.mob-stats { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.4rem !important; }
.mob-stats .hm { display: inline-flex; align-items: center; gap: 0.3rem; font-variant-numeric: tabular-nums; }
.mob-stats .hm b { font-weight: 600; color: var(--n-900); }
.mob-stats .hm.neg b { color: var(--el-fire); }
.mob-stats .ico { --ico: 1.05rem; width: 1.05rem; height: 1.05rem; }
.mob-sec { margin-top: 0.6rem; }
.mob-h { font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.3rem !important; }
.mob-spells { display: flex; flex-wrap: wrap; gap: 0.3rem 0.4rem; }
.mob-spell {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.15rem 0.5rem 0.15rem 0.2rem; border-radius: var(--r-s);
  background: var(--n-200); color: var(--text); text-decoration: none; font-size: var(--t-xs);
}
.mob-spell img { width: 1.4rem; height: 1.4rem; object-fit: contain; }
.mob-spell:hover { background: var(--n-250); color: var(--n-900); }
.mob-drops { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.mob-drop { width: 2.75rem; height: 2.75rem; }
.mob-drop img { width: 74%; height: 74%; margin-bottom: 0.45rem; }
.mob-drop i {
  position: absolute; left: 0; right: 0; bottom: 0.08rem;
  font: 600 0.6875rem/1 var(--data); font-style: normal; text-align: center; color: var(--n-700);
  font-variant-numeric: tabular-nums;
}
.obj-map-wait {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: var(--t-xs); color: var(--muted);
}
.obj-map-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }
.obj-map-bg.broken, .no-map .obj-map-wait { display: none; }
.no-map { aspect-ratio: auto; min-height: 7rem; }
.obj-map-xy {
  position: absolute; top: 0.5rem; right: 0.5rem; padding: 0.15rem 0.45rem;
  border-radius: var(--r-s); background: color-mix(in srgb, var(--n-100) 82%, transparent);
  font: 600 var(--t-xs)/1.2 var(--data); color: var(--accent); font-variant-numeric: tabular-nums;
}
.obj-band {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.2rem 0.6rem;
  min-height: 3.6rem; padding: 0.45rem 0.75rem;
  background: linear-gradient(to top, color-mix(in srgb, var(--n-100) 92%, transparent), color-mix(in srgb, var(--n-100) 72%, transparent));
}
.obj-map.has-fig .obj-band { padding-left: 8.5rem; }
.obj-who { font: 600 var(--t-s)/1.2 var(--data); color: var(--n-900); }
/* NPC steht links auf dem Band, Füße am unteren Rand */
.obj-fig {
  position: absolute; left: 0.75rem; bottom: 0.35rem;
  width: 7rem; height: 11rem; object-fit: contain; object-position: 50% 100%;
  filter: drop-shadow(0 2px 3px rgb(0 0 0 / 0.6));
}
.obj-fig-mob { height: 6.5rem; }
.obj-fig.broken { display: none; }
/* Ohne Kartenbild (ausgeschaltet oder keine Karte bekannt): nur das Band, Figur kleiner links darin */
.obj-card.map-off .obj-map { aspect-ratio: auto; min-height: 5.5rem; display: flex; }
.obj-card.map-off .obj-map-bg, .obj-card.map-off .obj-map-wait, .obj-card.map-off .obj-map-xy { display: none; }
.obj-card.map-off .obj-band { position: static; flex: 1; min-height: 5.5rem; background: var(--n-100); }
.obj-card.map-off .obj-map.has-fig .obj-band { padding-left: 6.25rem; }
.obj-card.map-off .obj-fig { left: 0.6rem; bottom: 0.4rem; width: 5rem; height: 4.8rem; }
.obj-card.map-off .obj-fig-mob { height: 4.8rem; }
.has-mob.map-off .obj-mob { border-top: 1px solid var(--seam); }

/* Schalter über den Schritten: alle Kartenbilder an oder aus */
.quest-maps {
  float: right; margin-top: -2.3rem;
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: var(--t-s); color: var(--n-700); cursor: pointer;
}
.quest-maps input { accent-color: var(--accent); width: 1rem; height: 1rem; margin: 0; }

/* Übersicht: Koordinatenraster mit Pins, daneben die Schritte zum Springen */
.quest-over { display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 1fr); gap: 1rem 1.75rem; align-items: start; }
.quest-over:not(:has(.route)) { grid-template-columns: 1fr; }
.route { margin: 0; }
.route svg { display: block; width: 100%; height: auto; max-height: 17rem; background: var(--n-100); border-radius: var(--r-m); }
.route-grid { fill: none; stroke: var(--n-300); stroke-width: 1px; }
/* Fundorte als Karten: je Zone ein Kartenausschnitt (16:10), Gebiet dunkel getönt wie auf der großen Karte */
.zone-all { margin: -0.2rem 0 0.7rem !important; font-size: var(--t-s); }
.zone-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); gap: 0.9rem; }
.zone-card {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: color-mix(in srgb, var(--ground) 45%, var(--panel));
  border: 1px solid var(--seam); border-radius: var(--r-m);
}
.zc-map { aspect-ratio: 16 / 10; background: var(--n-100); }
.zc-map a:has(svg) { display: block; height: 100%; }
.zc-map svg { display: block; width: 100%; height: 100%; transition: filter 0.2s var(--ease-out); }
@media (hover: hover) { .zc-map a:hover svg { filter: brightness(1.08); } }
.zc-map a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.zc-note {
  display: flex; align-items: center; justify-content: center; gap: 0.45rem; height: 100%; padding: 0 1rem;
  color: var(--muted); font-size: var(--t-s); text-align: center;
}
a.zc-note { color: var(--n-700); }
a.zc-note img { width: 1.5rem; height: 1.5rem; object-fit: contain; }
@media (hover: hover) { a.zc-note:hover { color: var(--n-900); } }
.zone-card .zc-dungeon {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem; height: 100%;
  background: radial-gradient(ellipse at 50% 60%, var(--n-250), var(--n-100) 70%);
  color: var(--n-700); font-size: var(--t-s); text-decoration: none;
}
.zc-boss { height: 62%; max-width: 70%; object-fit: contain; filter: drop-shadow(0 3px 4px rgb(0 0 0 / 0.55)); }
.zc-dungeon span { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0 0.75rem; text-align: center; }
.zc-dungeon span img { width: 1.2rem; height: 1.2rem; object-fit: contain; }
@media (hover: hover) { .zc-dungeon:hover { color: var(--n-900); } }
.zc-body { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.6rem 0.8rem 0.7rem; border-top: 1px solid var(--seam); }
.zone-card .zc-name { font-weight: 600; color: var(--n-900); text-decoration-color: transparent; }
@media (hover: hover) { .zone-card .zc-name:hover { text-decoration-color: var(--accent); } }
.zc-sub { color: var(--muted); font-size: var(--t-s); }
.zm-fill { fill: rgb(27 30 33 / 0.42); }
.zm-edge { fill: none; stroke: rgb(27 30 33 / 0.9); stroke-width: 2px; }
/* Auf dem Kartenbild: dunkles Raster wie auf der großen Karte */
.route svg.has-map .route-grid { stroke: rgb(15 17 19 / 0.35); }
.route-pin { cursor: pointer; outline: none; }
.route-pin rect { fill: #c8452f; stroke: #f4d8cf; stroke-width: 1.5px; transition: fill 0.15s var(--ease-out); }
.route-pin path { fill: #c8452f; }
.route-pin text { fill: #fff; font-family: var(--data); font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.route-pin:hover rect, .route-pin:focus-visible rect { fill: var(--accent); }
.route-pin:focus-visible rect { stroke: #fff; stroke-width: 2.5px; }
.route figcaption { margin-top: 0.3rem; font-size: var(--t-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.route-steps { list-style: none; margin: 0; padding: 0; columns: 2 14rem; column-gap: 1.25rem; }
.route-steps li { break-inside: avoid; }
.route-steps button {
  display: grid; grid-template-columns: 1.6rem 1fr; align-items: baseline; width: 100%;
  padding: 0.25rem 0.35rem; border: 0; border-radius: var(--r-s); background: none;
  font: inherit; font-size: var(--t-s); color: var(--text); text-align: left; cursor: pointer;
}
.route-steps button:hover { background: var(--n-250); }
.route-n { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
/* Sprungziel kurz hervorheben */
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } to { background: transparent; } }
.flash { animation: flash 1.4s var(--ease-out); }
.goals li { scroll-margin-top: 4rem; }
@media (max-width: 40rem) {
  .quest-over { grid-template-columns: 1fr; }
  .steps > li > .step-side { grid-column: 2 / -1; grid-row: auto; align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; }
  .step-gain { flex-direction: row; gap: 0.75rem; }
  .quest-maps { float: none; margin: 0 0 0.5rem; }
  .obj-map.has-fig .obj-band { padding-left: 5.5rem; }
  .obj-fig { width: 4.5rem; height: 7rem; }
}
/* Ortsangaben: Koordinaten wie im Spiel, Gebiet als Verweis, beides leiser als der Zieltext */
.where { color: var(--muted); white-space: nowrap; }
.coords { font-variant-numeric: tabular-nums lining-nums; }
.goals { list-style: none; margin: 0; padding: 0; max-width: 46rem; }
.goals li {
  display: grid; grid-template-columns: 0.5rem minmax(0, 1fr); column-gap: 0.55rem;
  align-items: baseline;
  padding: 0.14rem 0;
}
.goals .pip { align-self: center; }
.goal-note { color: var(--muted); }
.goal-note a { color: var(--n-800); }
/* Ab-Level eines Dungeons hinter seinem Namen (Kategorie-Zeile eines Erfolgs) */
.props .chal-lv { color: var(--muted); font-size: var(--t-s); }
/* Ziele eines Erfolgs: Kästchen, Symbol der Art (Monsterbild, Quest, Level, Erfolg), Text */
.goals-ach li.goal {
  grid-template-columns: auto 1.6rem minmax(0, 1fr); align-items: center; column-gap: 0.55rem;
  padding: 0.1rem 0;
}
.goal-check { width: auto; min-height: 2rem; padding: 0; margin-left: -0.2rem; }
.goal-check .chk { width: 1.05rem; height: 1.05rem; }
span.goal-check { width: 0.85rem; }
.goal-ico { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; --ico: 1.1rem; color: var(--n-700); }
.goal-ico img { max-width: 100%; max-height: 100%; object-fit: contain; }
/* Quest-„!“ ist hoch und schmal: kleiner, damit es neben Monsterbildern nicht dominiert */
.goal-ico img[src$="sprite_quete.png"] { max-height: 1.05rem; }
.goal-ico .hm-lvl { font-size: 0.68rem; color: var(--n-700); }
.goals-ach li.goal:has([aria-pressed="true"]) .goal-txt { color: var(--n-700); }
.part .refs + .refs, .part .refs + .props, .part .goals + .props { margin-top: 0.6rem; }

/* ---------- Zeiger: Hover nur mit feinem Zeiger ---------- */
@media (hover: hover) and (pointer: fine) {
  .nav-group:hover { color: var(--n-900); }
  .nav-menu a:hover { background: var(--n-250); color: var(--n-900); }
  .results a:hover { background: var(--n-150); }
  .results a[aria-current="true"]:hover { background: var(--panel); }
  .more:hover { border-color: var(--tick); }
  .lang select:hover, .filters select:hover, .filters input:hover, #q:hover { border-color: var(--n-400); }
  .page a:hover { text-decoration-thickness: 2px; }
  .refs a:hover { background: var(--n-250); }
  .scrub button:hover { color: var(--n-900); }
  .fold summary:hover { color: var(--n-900); }
}

/* ---------- Mittlere Breiten: Bereiche enger, sie scrollen waagerecht, wenn sie nicht passen ---------- */
@media (max-width: 1180px) {
  .masthead { padding: 0 1rem; column-gap: 1rem; }
  .sections { padding: 0 0.4rem; }
  .nav-group { min-height: 3rem; padding-inline: 0.65rem 0.5rem; }
}

/* ---------- Schmale Bildschirme: Register und Eintrag nacheinander ---------- */
@media (max-width: 860px) {
  .nav-group { min-height: 2.75rem; }

  .layout { display: block; }
  .layout.has-detail .register { display: none; }
  .layout:not(.has-detail) .page { display: none; }
  .register { min-height: calc(100vh - 6rem); min-height: calc(100dvh - 6rem); }

  .page { --page-pad: 1rem; min-height: 100vh; min-height: 100dvh; padding: 0 var(--page-pad) 3rem; }
  /* Schwebende Rueckleiste: Material statt fester Balken */
  .backbar {
    display: block;
    position: sticky; top: 0; z-index: 3;
    margin: 0 -1rem 1rem;
    padding: 0 1rem;
    background: color-mix(in srgb, var(--panel) 80%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    border-bottom: 1px solid var(--seam);
  }
  .page .back {
    display: inline-flex; align-items: center; gap: 0.35rem;
    min-height: 2.875rem;
    padding-right: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 140ms var(--ease-out);
    transform-origin: left center;
  }
  .back:active { transform: scale(0.97); }
  .back svg { width: 1rem; height: 1rem; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

  .effects:has(li:nth-child(7)) { columns: auto; }
  .scrub button { height: 2.625rem; }
}

@media (max-width: 560px) {
  :root { --plate-l: 5.5rem; }
  .head { column-gap: 0.85rem; }
  .typeline { font-size: 1.0625rem; }
  .lore { font-size: 1.0625rem; }
  .seg-group.quiet .segs { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 0.7rem; }
  .seg dd { font-size: 1.375rem; }
  .seg dd.word { font-size: 1rem; line-height: 1.425; }
  .bonus { grid-template-columns: 1fr; }

  .grade { justify-content: space-between; }
}

/* ---------- Voreinstellungen der Nutzer ---------- */
@media (prefers-reduced-motion: reduce) {
  .scrub-thumb, .more, .page .back { transition: none; }
  .scrub.pressed .scrub-thumb, .more:active, .back:active { transform: none; }
  .switch input, .switch input::before { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .search, .reg-head { background: var(--ground); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .search::after, .reg-head::after { display: none; }
  .backbar { background: var(--panel); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --seam: var(--n-500); --tick: var(--n-600); --muted: var(--n-700); }
  .mb-card { box-shadow: inset 0 0 0 1px var(--seam); } /* Build-Karten: sonst nur der knappe Grauunterschied */
  .search, .reg-head { background: var(--ground); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .search { border-bottom: 1px solid var(--seam); }
  @media (min-width: 861px) { .reg-head > .search { border-bottom: 0; } .reg-head { border-bottom: 1px solid var(--seam); } }
  .search::after, .reg-head::after { display: none; }
  .backbar { background: var(--panel); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .typeline, .lore, .seg-title, .grades td, .results .lvl { color: var(--text); }
  .results a[aria-current="true"]::before { width: 4px; }
}
@media (forced-colors: active) {
  .wedge { background: CanvasText; }
  .scrub-thumb { background: Highlight; color: HighlightText; forced-color-adjust: none; }
  .results a[aria-current="true"]::before { background: Highlight; }
  .pip { forced-color-adjust: none; }
  .switch input { appearance: auto; width: auto; height: auto; }
  .switch input::before { display: none; }
}

/* ==========================================================================
   Kartenansicht (#/map): Vollbild-Karte, Bedienelemente schweben als
   Graphit-Material darüber. Messing bleibt der einzige Akzent.
   ========================================================================== */

a.coords { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 0.18em; }

body.map-mode { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
body.map-mode > .masthead { flex: none; }
body.map-mode > main.layout { display: none; }

.mapview { position: relative; flex: 1 1 auto; min-height: 0; isolation: isolate; }
.mapview[hidden] { display: none; }
.mv-map { position: absolute; inset: 0; background: var(--ground); }
.mv-map.leaflet-container { background: var(--ground); font: 500 var(--t-s)/1.3 var(--data); }

/* Gemeinsames Material der schwebenden Flächen */
.mv-panel, .mv-pos, .mv-world select, .mv-toast,
.mv-map .leaflet-bar {
  background: color-mix(in srgb, var(--n-100) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--seam);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--n-900) 4%, transparent);
  border-radius: var(--r-m);
}

/* ---------- Panel links ---------- */
.mv-panel {
  position: absolute; z-index: 500;
  top: 1rem; left: 1rem; bottom: 6.25rem;
  width: min(22.5rem, calc(100% - 2rem));
  display: flex; flex-direction: column;
  overflow: hidden;
}
.mv-grab { display: none; }

.mv-search {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0.75rem 0.75rem 0.5rem;
  padding: 0 0.6rem;
  height: 2.5rem;
  border: 1px solid var(--seam);
  border-radius: var(--r-s);
  background: color-mix(in srgb, var(--n-200) 90%, transparent);
}
.mv-search:focus-within { border-color: var(--accent); }
.mv-search svg { width: 1rem; height: 1rem; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.6; }
.mv-search input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; background: transparent; color: var(--text);
  font: 500 var(--t-m)/1 var(--data);
}
.mv-search input::placeholder { color: var(--muted); }
.mv-search input:focus { outline: none; }
.mv-search kbd {
  flex: none; padding: 0.1rem 0.35rem;
  border: 1px solid var(--seam); border-radius: var(--r-s);
  color: var(--muted); font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.01em;
}

.mv-tabs { display: flex; gap: 0.25rem; padding: 0 0.75rem; border-bottom: 1px solid var(--seam); }
.mv-tabs button {
  flex: 1; padding: 0.55rem 0.25rem 0.6rem;
  border: 0; background: none; color: var(--muted);
  font: 600 var(--t-s)/1 var(--data);
  box-shadow: inset 0 -2px 0 transparent;
  transition: color 120ms ease, box-shadow 160ms var(--ease-out);
  cursor: pointer;
}
.mv-tabs button[aria-selected="true"] { color: var(--n-900); box-shadow: inset 0 -2px 0 var(--accent); }
.mv-tabs .n { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) { .mv-tabs button:hover { color: var(--text); } }
.mv-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.mv-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0.25rem 0.5rem 0.75rem; overscroll-behavior: contain; }
.mv-group h3 {
  margin: 0.85rem 0.5rem 0.3rem;
  color: var(--muted); font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.02em;
}
.mv-list { list-style: none; margin: 0; padding: 0; }
.mv-list button {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.55rem;
  width: 100%; padding: 0.42rem 0.5rem;
  border: 0; border-radius: var(--r-s); background: none;
  color: var(--text); text-align: left; font: 500 var(--t-s)/1.25 var(--data);
  cursor: pointer;
  transition: background-color 100ms ease, transform 120ms var(--ease-out);
}
.mv-list button:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) { .mv-list button:hover { background: var(--n-250); } }
.mv-list button[aria-current="true"] { background: var(--n-200); box-shadow: inset 2px 0 0 var(--accent); }
.mv-list button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mv-list .nm { grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-list .nm small { display: block; color: var(--muted); font-size: var(--t-xs); }
.mv-list .lv { grid-column: 3; color: var(--muted); font-size: var(--t-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mv-res img, .mv-res .ph { width: 1.75rem; height: 1.75rem; object-fit: contain; }
.mv-res .ph { border-radius: var(--r-s); background: var(--n-200); }
.mv-empty, .mv-note { margin: 0.75rem 0.5rem; color: var(--muted); font-size: var(--t-s); }
.mv-note { font-size: var(--t-xs); }

/* Schalter für Zaaps und Dungeons */
.mv-toggles { display: grid; gap: 0.35rem; padding: 0.6rem 0.5rem 0.2rem; }
.mv-switch { display: flex; align-items: center; gap: 0.6rem; color: var(--text); font: 500 var(--t-s)/1.2 var(--data); cursor: pointer; }
.mv-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mv-switch .track {
  position: relative; flex: none; width: 2rem; height: 1.15rem;
  border-radius: 999px; background: var(--n-300);
  transition: background-color 160ms ease;
}
.mv-switch .track::after {
  content: ""; position: absolute; top: 0.15rem; left: 0.15rem;
  width: 0.85rem; height: 0.85rem; border-radius: 50%; background: var(--n-800);
  transition: transform 200ms var(--ease-out);
}
.mv-switch input:checked + .track { background: var(--accent); }
.mv-switch input:checked + .track::after { transform: translateX(0.85rem); background: var(--n-100); }
.mv-switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.mv-switch .n { color: var(--muted); }

/* Karte der gewählten Zone */
.mv-card { margin: 0.6rem 0.25rem 0.5rem; padding: 0.85rem 0.85rem 0.75rem; border: 1px solid var(--seam); border-radius: var(--r-s); background: var(--panel); }
.mv-card h2 { margin: 0; font: 700 1.5rem/1.1 var(--display); color: var(--n-900); letter-spacing: -0.01em; }
.mv-card header p { margin: 0.2rem 0 0; color: var(--n-700); font-size: var(--t-s); }
.mv-card-label { margin: 0.75rem 0 0.35rem; color: var(--muted); font: 600 var(--t-xs)/1.2 var(--data); }
.mv-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.mv-chips li {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.45rem 0.15rem 0.25rem;
  border: 1px solid var(--seam); border-radius: 999px;
  color: var(--text); font-size: var(--t-xs);
}
.mv-chips img { width: 1.25rem; height: 1.25rem; object-fit: contain; }
.mv-mobs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.mv-mobs a { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: var(--r-s); background: var(--ground); }
.mv-mobs img { width: 2.4rem; height: 2.4rem; object-fit: contain; }
.mv-more { margin: 0.3rem 0 0; color: var(--muted); font-size: var(--t-xs); }
.mv-actions { display: flex; gap: 1rem; align-items: center; margin-top: 0.85rem; font-size: var(--t-s); }
.mv-actions a { color: var(--n-900); text-decoration-color: var(--accent); text-underline-offset: 0.18em; }
.mv-actions button { border: 0; background: none; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .mv-actions button:hover { color: var(--text); } }

/* ---------- Weltkarten-Auswahl und Zoom oben rechts ---------- */
.mv-world { position: absolute; z-index: 500; top: 1rem; right: 4rem; }
.mv-world select {
  height: 2.5rem; max-width: min(18rem, 50vw);
  padding: 0 2rem 0 0.75rem;
  color: var(--text); font: 600 var(--t-s)/1 var(--data);
  appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1rem) 1.05rem, calc(100% - 0.7rem) 1.05rem;
  background-size: 0.3rem 0.3rem; background-repeat: no-repeat;
}
.mv-world select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mv-map .leaflet-top.leaflet-right { top: 1rem; right: 1rem; }
.mv-map .leaflet-top .leaflet-control { margin: 0; }
.mv-map .leaflet-bar { overflow: hidden; }
/* Raster-Schalter unter den Zoom-Knöpfen; gedrückt in Messing */
.mv-map .leaflet-bar.mv-gridctl { margin-top: 0.5rem; }
.mv-gridctl a { display: grid !important; place-items: center; }
.mv-gridctl svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
/* Zuschnitt der Kachelebene (map.js: clipTiles) zieht beim Zoomen mit wie die Kacheln selbst */
.leaflet-zoom-anim .mv-map .leaflet-tile-pane, .mv-map.leaflet-zoom-anim .leaflet-tile-pane { transition: clip-path 0.25s cubic-bezier(0, 0, 0.25, 1); }
.mv-map .leaflet-bar a {
  width: 2.5rem; height: 2.5rem; line-height: 2.5rem;
  background: transparent; color: var(--text); border-bottom-color: var(--seam);
  font: 500 1.25rem/2.5rem var(--data);
  transition: background-color 100ms ease;
}
/* Leaflet färbt einen fokussierten Knopf hellgrau (bleibt nach dem Klicken stehen) */
.mv-map .leaflet-bar a:focus { background-color: transparent; }
.mv-map .leaflet-bar.mv-gridctl a[aria-pressed="true"] { color: var(--accent); background-color: color-mix(in srgb, var(--accent) 16%, transparent); }
@media (hover: hover) and (pointer: fine) { .mv-map .leaflet-bar a:hover { background: var(--n-250); color: var(--n-900); } }
.mv-map .leaflet-bar a.leaflet-disabled { background: transparent; color: var(--n-500); }
.mv-map .leaflet-bar a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- Positionsleiste unten ---------- */
.mv-pos {
  position: absolute; z-index: 500;
  left: 50%; bottom: 1rem; transform: translateX(-50%);
  display: flex; align-items: center; gap: 1rem;
  padding: 0.55rem 0.6rem 0.55rem 0.9rem;
  max-width: calc(100% - 2rem);
}
.mv-xy { display: grid; line-height: 1; }
.mv-xy span { color: var(--muted); font: 600 var(--t-xs)/1 var(--data); margin-bottom: 0.25rem; }
.mv-xy b { color: var(--n-900); font: 700 1.75rem/1 var(--data); font-variant-numeric: tabular-nums lining-nums; letter-spacing: -0.01em; white-space: nowrap; }
.mv-where { display: grid; min-width: 0; max-width: 18rem; }
.mv-where b { color: var(--n-900); font: 600 var(--t-m)/1.2 var(--data); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-where span { color: var(--muted); font-size: var(--t-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-travel {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--seam); border-radius: var(--r-s);
  background: var(--panel); color: var(--text);
  font: 600 var(--t-s)/1 var(--data); cursor: pointer;
  transition: border-color 120ms ease, transform 120ms var(--ease-out);
}
.mv-travel code { font: 600 var(--t-s)/1 var(--data); color: var(--accent); font-variant-numeric: tabular-nums; }
.mv-travel span { color: var(--muted); font-size: var(--t-xs); }
.mv-travel:active { transform: scale(0.97); }
.mv-travel:disabled { opacity: 0.5; cursor: default; }
@media (hover: hover) and (pointer: fine) { .mv-travel:not(:disabled):hover { border-color: var(--accent); } }
.mv-travel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mv-toast {
  position: absolute; z-index: 600; left: 50%; bottom: 5.75rem;
  margin: 0; padding: 0.5rem 0.8rem;
  color: var(--text); font: 600 var(--t-s)/1.2 var(--data);
  opacity: 0; transform: translate(-50%, 6px);
  transition: opacity 180ms ease, transform 200ms var(--ease-out);
  pointer-events: none;
}
.mv-toast[data-show="true"] { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Marken auf der Karte ----------
   Die Form sitzt im ::before, damit sie in weiten Zoomstufen schrumpfen kann,
   ohne dass Leaflets Positionierung (transform am Element) gestört wird. */
.mv-glyph { position: relative; display: inline-block; width: 18px; height: 18px; flex: none; }
.mv-glyph::before { content: ""; position: absolute; inset: 0; transition: transform 160ms var(--ease-out); }
/* Zaap: Messing-Raute mit dunklem Rand, liest sich auf hellen und dunklen Landschaften */
.mv-zaap::before {
  background: var(--accent);
  border: 2px solid var(--n-100);
  border-radius: 4px;
  transform: rotate(45deg) scale(0.82);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 6%, transparent);
}
/* Dungeon: dunkler Torbogen mit Messingrand */
.mv-dungeon::before {
  background: var(--n-100);
  border: 2px solid var(--accent);
  border-radius: 9px 9px 2px 2px;
}
.mv-far .leaflet-marker-icon.mv-zaap::before { transform: rotate(45deg) scale(0.5); }
.mv-far .leaflet-marker-icon.mv-dungeon::before { transform: scale(0.6); }
.mv-target::before {
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  box-shadow: 0 0 0 2px var(--n-100);
}
.mv-list .mv-glyph { width: 14px; height: 14px; }
/* Symbole aus dem Spiel (Kartenhinweise, Zaap, Dungeon): das Bild statt der eigenen Form; in weiten
   Zoomstufen kleiner wie die eigenen Zeichen */
.mv-img::before { content: none; }
.mv-img img, .leaflet-container .leaflet-marker-pane .mv-img img { display: block; width: 100%; height: 100%; object-fit: contain; transition: transform 160ms var(--ease-out); }
.mv-far .leaflet-marker-icon.mv-img img { transform: scale(0.65); }
.leaflet-marker-icon.mv-img { cursor: pointer; }
.mv-list .mv-glyph.mv-img, .mv-switch .mv-glyph.mv-img { width: 18px; height: 18px; }
.leaflet-marker-icon.mv-zaap, .leaflet-marker-icon.mv-dungeon { cursor: pointer; }

.leaflet-tooltip.mv-tip {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--seam); border-radius: var(--r-s); box-shadow: none;
  font: 600 var(--t-s)/1.3 var(--data); padding: 0.25rem 0.5rem;
}
.mv-tip-sub { color: var(--muted); font-weight: 500; margin-left: 0.3rem; }
.leaflet-tooltip-top.mv-tip::before { border-top-color: var(--seam); }
.leaflet-tooltip-right.mv-tip::before { border-right-color: var(--seam); }

/* ---------- Schmale Bildschirme: Panel als Blatt von unten ---------- */
@media (max-width: 860px) {
  .mv-panel {
    top: auto; left: 0.5rem; right: 0.5rem; bottom: 0.5rem; width: auto;
    height: min(60%, 34rem);
    transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1); /* Schublade wie unter iOS */
  }
  /* Eingeklappt: das Blatt gleitet nach unten, bis nur Griff, Suche und Reiter sichtbar sind */
  .mv-panel[data-open="false"] { transform: translateY(calc(100% - 7.5rem)); }
  .mv-grab {
    display: block; flex: none; align-self: center;
    width: 3rem; height: 1.25rem; margin: 0.15rem 0 -0.35rem;
    border: 0; background: none; cursor: pointer;
  }
  .mv-grab::before { content: ""; display: block; width: 2.25rem; height: 0.3rem; margin: 0 auto; border-radius: 999px; background: var(--n-400); }
  .mv-grab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .mv-search kbd { display: none; }
  .mv-pos { top: 0.5rem; bottom: auto; left: 0.5rem; right: 3.5rem; transform: none; gap: 0.6rem; padding: 0.45rem 0.5rem 0.45rem 0.65rem; max-width: none; }
  .mv-xy b { font-size: 1.25rem; }
  .mv-where { max-width: none; flex: 1; }
  .mv-travel span { display: none; }
  .mv-world { top: auto; right: auto; left: 0.5rem; bottom: calc(min(60%, 34rem) + 1rem); }
  .mv-panel[data-open="false"] ~ .mv-world { bottom: 8.5rem; }
  .mv-map .leaflet-top.leaflet-right { top: 0.5rem; right: 0.5rem; }
  .mv-toast { bottom: auto; top: 4.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .mv-panel, .mv-switch .track::after, .mv-toast { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .mv-panel, .mv-pos, .mv-world select, .mv-toast, .mv-map .leaflet-bar {
    background: var(--ground); -webkit-backdrop-filter: none; backdrop-filter: none;
  }
}
@media (prefers-contrast: more) {
  .mv-panel, .mv-pos, .mv-world select, .mv-map .leaflet-bar { background: var(--ground); border-color: var(--n-500); }
}

/* ---------- Karte: Auswahl, Route, Markierungen, Legenden ---------- */
.mv-tabs { gap: 0; }
.mv-tabs button { font-size: var(--t-xs); padding-inline: 0.15rem; }

/* Nummerierte Punkte: Quest-Route (S, 1, 2 …) und Wegfindung (A, B) */
/* Erntestellen einer Ressource (map.js selectResource): Symbol mit Anzahl; herausgezoomt nur ein Punkt */
/* .leaflet-marker-icon setzt display: block; mit doppelter Klasse gewinnt das Raster */
.leaflet-marker-icon.mv-spot { display: grid; place-items: center; }
.mv-spot img {
  width: 26px; height: 26px; object-fit: contain;
  filter: drop-shadow(0 0 1.5px rgb(15 17 19 / 0.95)) drop-shadow(0 1px 2px rgb(15 17 19 / 0.6));
}
.mv-spot b {
  position: absolute; right: -6px; bottom: -4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  font: 700 11px/16px var(--data); text-align: center; color: var(--n-900);
  background: var(--n-100); border: 1px solid var(--n-400); border-radius: 8px;
}
.mv-far .mv-spot img, .mv-far .mv-spot b { display: none; }
.mv-far .mv-spot::before {
  content: ""; display: block; box-sizing: border-box; width: 9px; height: 9px; border-radius: 50%;
  background: var(--el-water); border: 1.5px solid var(--n-100);
}
/* Ganz herausgezoomt ist eine Karte nur ein paar Pixel groß: Punkte würden zu Streifen verschmelzen.
   Dort zeigt die Tönung der Zonen genug; die Erntestellen kommen beim Hineinzoomen. */
.mv-very-far .mv-spot { display: none; }
.mv-pin {
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--n-100);
  background: var(--accent); color: var(--n-100);
  font: 700 0.75rem/1 var(--data); font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 1.5px var(--accent);
}
.mv-pin-start { background: var(--n-100); color: var(--accent); }
.mv-pin-npc, .mv-pin-dungeon, .mv-pin-workshop { width: 16px !important; height: 16px !important; margin: -8px 0 0 -8px !important; }
/* Eigene Markierung: Wimpel */
.mv-flag::before {
  background: var(--el-water);
  border: 2px solid var(--n-100);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg) scale(0.85);
}
.mv-npc::before { background: var(--n-800); border: 2px solid var(--n-100); border-radius: 50%; transform: scale(0.6); }
.mv-placing .mv-map, .mv-placing .mv-map .leaflet-interactive { cursor: crosshair; }

.mv-card-head { display: flex; gap: 0.7rem; align-items: center; }
.mv-card-head img { width: 2.75rem; height: 2.75rem; object-fit: contain; flex: none; }
.mv-card-head h2 { font-size: 1.3rem; }
.mv-legend { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.25rem; color: var(--text); font-size: var(--t-s); }
.mv-legend li { display: flex; align-items: center; gap: 0.5rem; }
.mv-legend i, .mv-dot { display: inline-block; flex: none; width: 0.75rem; height: 0.75rem; border-radius: 3px; }
/* wie die markierten Gebiete auf der Karte: dunkel getönt mit Rand */
.mv-legend i.mv-swatch-dark { background: rgb(27 30 33 / 0.55); border: 2px solid var(--n-500); border-radius: 2px; }
.mv-zone-legend { grid-template-columns: repeat(3, auto); }
.mv-list .mv-dot { grid-column: 1; }
.mv-route-steps { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.1rem; }
.mv-route-steps li > button, .mv-route-steps li:not(:has(button)) {
  display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: 0.5rem; align-items: center;
  width: 100%; padding: 0.35rem 0.4rem; border: 0; border-radius: var(--r-s); background: none;
  color: var(--text); text-align: left; font: 500 var(--t-s)/1.3 var(--data); cursor: pointer;
}
.mv-route-steps li:not(:has(button)) { cursor: default; }
@media (hover: hover) and (pointer: fine) { .mv-route-steps li > button:hover { background: var(--n-250); } }
.mv-route-steps .no, .mv-route-points .no {
  display: grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  background: var(--accent); color: var(--n-100); font: 700 0.75rem/1 var(--data);
}
.mv-route-steps .nm small { display: block; color: var(--muted); font-size: var(--t-xs); }
.mv-route-steps .lv { color: var(--muted); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.mv-route-points { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; margin: 0.5rem 0.5rem 0; }
.mv-route-points button {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.6rem;
  border: 1px solid var(--seam); border-radius: var(--r-s); background: var(--panel);
  color: var(--text); font: 600 var(--t-s)/1.2 var(--data); font-variant-numeric: tabular-nums; cursor: pointer;
}
.mv-route-points button[aria-pressed="true"] { border-color: var(--accent); }

/* Level-Bereich */
.mv-range { display: flex; gap: 0.75rem; padding-left: 2.6rem; color: var(--muted); font-size: var(--t-xs); }
.mv-range input {
  width: 3.75rem; margin-left: 0.3rem; padding: 0.2rem 0.35rem;
  border: 1px solid var(--seam); border-radius: var(--r-s); background: var(--panel); color: var(--text);
  font: 600 var(--t-s)/1.2 var(--data); font-variant-numeric: tabular-nums;
}
.mv-range input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mv-toggles .mv-legend { padding-left: 2.6rem; grid-template-columns: repeat(3, auto); justify-content: start; column-gap: 0.9rem; font-size: var(--t-xs); }

/* Chips als Knöpfe (Ressourcen in der Zonenkarte) */
.mv-chips button {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; cursor: pointer;
}
.mv-mobs button { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0; border: 0; border-radius: var(--r-s); background: var(--ground); cursor: pointer; }
.mv-mobs button:focus-visible, .mv-chips button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mv-icons { display: flex !important; gap: 0.2rem; margin-top: 0.15rem; }
.mv-icons img { width: 1.125rem; height: 1.125rem; object-fit: contain; }

/* Treffer der Suche */
.mv-found { border-bottom: 1px solid var(--seam); padding-bottom: 0.5rem; margin-bottom: 0.25rem; }

/* Markierungen */
.mv-actions-top { margin: 0.25rem 0.5rem 0.5rem; flex-wrap: wrap; }
.mv-actions-top button { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.18em; }
.mv-marker-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.mv-marker-row input {
  width: 100%; padding: 0.1rem 0.25rem; border: 1px solid transparent; border-radius: var(--r-s);
  background: transparent; color: var(--text); font: 500 var(--t-s)/1.25 var(--data);
}
.mv-marker-row input:focus { outline: none; border-color: var(--accent); background: var(--panel); }
.mv-del { width: 2rem; height: 2rem; border: 0; border-radius: var(--r-s); background: none; color: var(--muted); font-size: 1.15rem; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .mv-del:hover { color: var(--el-fire); background: var(--n-250); } }
.mv-note code { font-size: 0.95em; color: var(--n-700); word-break: break-all; }

/* Almanax heute */
.mv-almanax h2 { font-size: 1.3rem; margin-top: 0.15rem; }
.mv-almanax-text { margin: 0.35rem 0 0; color: var(--n-700); font-size: var(--t-s); }
.mv-almanax .mv-list { margin: 0 -0.5rem; }

/* ---------- Globale Suche (Strg+K) ---------- */
.palette {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; justify-items: center; align-content: start; padding: 12vh 1rem 1rem;
  background: var(--scrim);
  opacity: 0; pointer-events: none;
  transition: opacity 140ms ease;
}
.palette[data-open="true"] { opacity: 1; pointer-events: auto; }
.palette-box {
  width: min(40rem, 100%);
  max-height: 70vh; display: flex; flex-direction: column;
  border: 1px solid var(--seam); border-radius: var(--r-m);
  background: color-mix(in srgb, var(--n-100) 94%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  transform: translateY(-6px) scale(0.98);
  transition: transform 180ms var(--ease-out);
}
.palette[data-open="true"] .palette-box { transform: none; }
.palette-field { display: flex; align-items: center; gap: 0.6rem; padding: 0 1rem; height: 3.25rem; border-bottom: 1px solid var(--seam); }
.palette-field svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: var(--muted); stroke-width: 1.6; flex: none; }
.palette-field input { flex: 1; min-width: 0; border: 0; background: none; color: var(--n-900); font: 600 var(--t-l)/1 var(--data); }
.palette-field input:focus { outline: none; }
.palette-field kbd { color: var(--muted); border: 1px solid var(--seam); border-radius: var(--r-s); padding: 0.1rem 0.35rem; font: 600 var(--t-xs)/1.2 var(--data); }
.palette-list { list-style: none; margin: 0; padding: 0.35rem; overflow-y: auto; }
.palette-list li[role="option"] {
  display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 0.7rem; align-items: center;
  padding: 0.45rem 0.6rem; border-radius: var(--r-s); cursor: pointer;
}
.palette-list li[aria-selected="true"] { background: var(--n-250); box-shadow: inset 2px 0 0 var(--accent); }
@media (hover: hover) and (pointer: fine) { .palette-list li[role="option"]:hover { background: var(--n-250); } }
.palette-list img, .palette-list .ph { width: 2rem; height: 2rem; object-fit: contain; }
.palette-list .ph { border-radius: var(--r-s); background: var(--n-200); }
.palette-list .nm { color: var(--n-900); font: 600 var(--t-m)/1.2 var(--data); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-list .nm small { display: block; color: var(--muted); font: 500 var(--t-xs)/1.3 var(--data); }
.palette-list button {
  padding: 0.25rem 0.55rem; border: 1px solid var(--seam); border-radius: var(--r-s); background: none;
  color: var(--muted); font: 600 var(--t-xs)/1 var(--data); cursor: pointer;
}
@media (hover: hover) and (pointer: fine) { .palette-list button:hover { color: var(--text); border-color: var(--accent); } }
.palette-empty { padding: 1rem; color: var(--muted); font-size: var(--t-s); }
.palette-hint { margin: 0; padding: 0.55rem 1rem; border-top: 1px solid var(--seam); color: var(--muted); font-size: var(--t-xs); }
@media (prefers-reduced-motion: reduce) { .palette, .palette-box { transition: none; } }
@media (prefers-reduced-transparency: reduce) { .palette-box { background: var(--ground); -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* Wegpunkte A und B: größer und hell, damit sie sich vom Zonen-Messing abheben */
.mv-pin-route { background: var(--n-900); color: var(--n-100); font-size: 0.875rem; box-shadow: 0 0 0 2px var(--n-100), 0 0 0 3.5px var(--n-900); }
.mv-pin-start span, .mv-pin-objective span { line-height: 1; }

/* ---------- Set-Creator ----------
   Eine Leseseite wie jeder Eintrag: Kopf mit Klassenbild, Keilregel, links die Plätze, rechts die Werte.
   Item-Auswahl und Anpassung kommen als Seitenleiste von rechts; auf breiten Schirmen weicht die Seite aus. */
body.builder-mode > main.layout { display: none; }
.builder { --drawer-w: min(30rem, 100vw); background: var(--panel); }
.builder[hidden] { display: none; }
/* Breite Schirme: Kopf fest, der Set-Creator scrollt in der zweiten Rasterzeile wie die Leseseite. */
@media (min-width: 861px) {
  .builder { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.bd-main { max-width: 96rem; margin-inline: auto; container: bd / inline-size; padding: 2rem clamp(1rem, 4vw, 3.5rem) 4rem; }
.bd-main[aria-busy="true"] .bd-board { opacity: 0.55; transition: opacity 120ms linear 200ms; }
/* Mit offener Seitenleiste zentriert sich die Seite im freien Platz links davon. */
@media (min-width: 1200px) { .builder.drawer-open { padding-right: var(--drawer-w); } }

.bd-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 1.25rem; row-gap: 1rem; }
.bd-ident { min-width: 0; }
/* Titelzeile über die ganze Kopfbreite: Name (so breit wie sein Text, builder.js: sizeName), Tags, rechts der Ersteller */
.bd-titlerow { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; min-width: 0; margin-bottom: -0.45rem; }
.bd-name {
  display: block; flex: 0 1 auto; min-width: 6ch; max-width: 100%; margin: 0; padding: 0 0 0.1rem;
  background: none; border: 0; border-bottom: 1px dashed transparent; border-radius: 0;
  font: 700 var(--t-name)/1.05 var(--display); letter-spacing: -0.012em; color: var(--n-900);
  text-overflow: ellipsis;
}
.bd-name::placeholder { color: var(--n-600); }
.bd-name:hover { border-bottom-color: var(--n-400); }
.bd-name:focus-visible { outline: none; border-bottom: 1px solid var(--accent); }
.bd-char { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 0.55rem; }
.bd-char label { display: inline-flex; align-items: center; gap: 0.5rem; font: italic 400 1.1875rem/1.3 var(--display); color: var(--n-700); }
.bd-char select, .bd-char input, .bd-points input, .bd-rolls input, .bd-pf select, .bd-field {
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900);
}
.bd-char select { padding: 0.35rem 0.5rem; max-width: 14rem; }
.bd-char input { width: 4.75rem; padding: 0.35rem 0.5rem; text-align: right; }
.bd-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.25rem; align-self: end; }
/* Kopfleiste: Werkzeugknöpfe ohne Rahmen (Symbol + Wort), „Neuer Build“ als einzige Hauptaktion in Messing.
   Symbole gedämpft, unter dem Zeiger Messing; der Kampf-Link steht durch einen Strich abgesetzt vorn. */
.bd-tb {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.5rem; padding: 0 0.7rem;
  background: transparent; border: 0; border-radius: var(--r-m);
  font: 600 var(--t-s)/1 var(--data); color: var(--n-800); cursor: pointer; list-style: none;
  transition: background-color 120ms var(--ease-out), color 120ms var(--ease-out), transform 120ms var(--ease-out);
}
.builder a.bd-tb { text-decoration: none; }
.bd-tb::-webkit-details-marker { display: none; }
.bd-tb:active { transform: scale(0.97); }
.bd-tb .bd-glyph { color: var(--n-600); transition: color 120ms var(--ease-out), transform 160ms var(--ease-out); }
.bd-tb .small { width: 0.95rem; height: 0.95rem; }
.bd-tb .chev { margin-left: -0.15rem; }
.bd-menu[open] > .bd-tb { background: var(--n-300); color: var(--n-900); }
.bd-menu[open] > .bd-tb .bd-glyph { color: var(--accent); }
.bd-menu[open] > .bd-tb .chev { transform: rotate(180deg); }
.bd-tb.primary { margin-left: 0.35rem; padding: 0 1rem 0 0.8rem; background: var(--accent); color: var(--n-100); font-weight: 700; }
.bd-tb.primary .bd-glyph { color: currentColor; }
.bd-sep { width: 1px; height: 1.5rem; margin: 0 0.3rem; background: var(--n-400); }

.bd-btn {
  display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0 0.85rem;
  background: var(--ground); border: 1px solid var(--n-400); border-radius: var(--r-s);
  font: 600 var(--t-s)/1 var(--data); color: var(--n-900); cursor: pointer; list-style: none;
  transition: border-color 120ms, transform 120ms var(--ease-out);
}
.bd-btn::-webkit-details-marker { display: none; }
.bd-btn:active { transform: scale(0.97); }
.bd-btn.quiet { border-color: var(--seam); color: var(--n-700); }
.bd-btn.small { min-height: 2rem; padding: 0 0.6rem; font-size: var(--t-xs); }
/* Knopf zum Spielfeld-Simulator (Zauberkarten, Zauberseite): Play-Symbol in Messing, dezenter Messingrahmen */
.sim-try {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.25rem; padding: 0 0.9rem 0 0.7rem;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--seam)); border-radius: var(--r-m);
  font: 600 var(--t-s)/1 var(--data); color: var(--n-900); cursor: pointer;
  transition: background-color 120ms, border-color 120ms, transform 120ms var(--ease-out);
}
.sim-try svg {
  flex: none; width: 1.15rem; height: 1.15rem; padding: 0.22rem 0.18rem 0.22rem 0.26rem;
  border-radius: 50%; background: var(--accent); fill: var(--n-100);
}
.sim-try:active { transform: scale(0.97); }
.sim-try:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .sim-try:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); border-color: var(--accent); } }
@media (prefers-reduced-motion: reduce) { .sim-try { transition: none; } .sim-try:active { transform: none; } }
.bd-link {
  padding: 0; background: none; border: 0; cursor: pointer;
  font: 500 var(--t-s)/1.4 var(--data); color: var(--text);
  text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em;
}
.builder a { text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
.bd-menu { position: relative; }
.bd-menu[open] > summary { border-color: var(--accent); }
.bd-pop {
  position: absolute; right: 0; top: calc(100% + 0.35rem); z-index: 20;
  width: min(22rem, calc(100vw - 2rem)); max-height: 60vh; overflow-y: auto;
  padding: 0.35rem; background: var(--ground); border: 1px solid var(--n-400); border-radius: var(--r-m);
}
.bd-pop ul { list-style: none; margin: 0; padding: 0; }
.bd-pop li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-bottom: 1px solid var(--seam); }
.bd-pop li:last-child { border-bottom: 0; }
.bd-pop .note { margin: 0.5rem; font-size: var(--t-s); }
.bd-load { display: grid; padding: 0.45rem 0.5rem; background: none; border: 0; text-align: left; cursor: pointer; border-radius: var(--r-s); }
.bd-load .n { font-weight: 600; color: var(--n-900); }
.bd-load .sub { font-size: var(--t-xs); color: var(--muted); }
/* „offen“ / „aktuell“: der Build bzw. die Version, die gerade im Set-Creator steht */
.bd-open { display: inline-block; margin-left: 0.3rem; padding: 0.15rem 0.4rem; border-radius: 999px; background: var(--n-250);
  font: 600 var(--t-xs)/1 var(--data); color: var(--n-800); vertical-align: 0.1em; }
.bd-pop li.on .bd-load { cursor: default; }

/* Versionen: oben „festhalten“, darunter die Liste, neueste zuerst; je Version Zeit, Änderungen, Wiederherstellen */
.bd-vpop { width: min(26rem, calc(100vw - 2rem)); max-height: 70vh; padding: 0.5rem; }
.bd-vkeep { display: grid; gap: 0.35rem; padding: 0.25rem 0.25rem 0.6rem; border-bottom: 1px solid var(--seam); font-size: var(--t-xs); color: var(--n-700); }
.bd-vkeep-row { display: flex; gap: 0.35rem; }
.bd-vkeep input { flex: 1 1 auto; min-width: 0; min-height: 2rem; padding: 0 0.5rem; background: var(--ground);
  border: 1px solid var(--n-400); border-radius: var(--r-s); font: 500 var(--t-s)/1 var(--data); color: var(--n-900); }
.bd-vkeep input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bd-vkeep .bd-btn { gap: 0.3rem; white-space: nowrap; }
.bd-vpop .bd-vlist { list-style: none; margin: 0; padding: 0; }
.bd-pop .bd-ver { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 0.25rem 0.5rem; padding: 0.55rem 0.25rem; }
.bd-vhead { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; font: 600 var(--t-s)/1.3 var(--data); color: var(--n-900); }
.bd-vhead .bd-open { margin-left: 0; }
.bd-vlabel { display: inline-flex; align-items: center; gap: 0.2rem; font-weight: 600; color: var(--accent); }
.bd-vlabel .bd-glyph { width: 0.85rem; height: 0.85rem; }
.bd-ver .bd-btn { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.bd-pop .bd-vchanges { grid-column: 1; list-style: none; margin: 0; padding: 0; font-size: var(--t-xs); color: var(--n-700); }
.bd-pop .bd-vchanges li { display: block; border: 0; padding: 0.05rem 0; overflow-wrap: anywhere; }
.bd-vchanges .add, .bd-vchanges .del, .bd-vchanges .chg { display: inline-block; width: 0.8rem; font-weight: 700; text-align: center; }
.bd-vchanges .add { color: var(--el-air); }
.bd-vchanges .del { color: var(--el-fire); }
.bd-vchanges .chg { color: var(--n-600); }
.bd-vchanges .more { color: var(--muted); }
.bd-pop .bd-vnote { margin: 0.4rem 0.25rem 0.15rem; padding-top: 0.5rem; border-top: 1px solid var(--seam); font-size: var(--t-xs); color: var(--muted); }
/* Eigenschaften im Kopf: ein Knopf mit Zusammenfassung (Geschlecht · Level · Tags · Sichtbarkeit), öffnet den Dialog */
.bd-props {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.5rem; padding: 0 0.7rem;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900); cursor: pointer;
  transition: border-color 120ms var(--ease-out), transform 120ms var(--ease-out);
}
.bd-props:active { transform: scale(0.98); }
.bd-props .dot { color: var(--n-500); }
.bd-props .muted { font-weight: 500; color: var(--muted); }
/* Tags neben dem Namen: Chips; der ganze Block ist ein Knopf zum Dialog. Ohne Tags ein leiser „+ Tags“-Knopf. */
.bd-titletags {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; min-width: 0; padding: 0.2rem;
  background: none; border: 1px solid transparent; border-radius: var(--r-m); cursor: pointer;
  transition: border-color 120ms var(--ease-out);
}
.bd-ttag {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.65rem 0.3rem 0.45rem;
  background: var(--n-200); border: 1px solid var(--seam); border-radius: 999px;
  font: 600 var(--t-s)/1.1 var(--data); color: var(--n-900);
}
.bd-ttag .ico { --ico: 1.1rem; }
.bd-titletags.empty { gap: 0.35rem; padding: 0.35rem 0.7rem 0.35rem 0.5rem; border: 1px dashed var(--n-400); border-radius: 999px;
  font: 600 var(--t-s)/1 var(--data); color: var(--n-700); }
.bd-titletags.empty .bd-glyph { color: var(--n-600); }
.bd-titletags:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Ersteller ganz rechts, Link zum Profil */
.bd-creator { display: flex; align-items: center; gap: 0.45rem; margin: 0 0 0 auto; font-size: var(--t-s); color: var(--muted); white-space: nowrap; }
.bd-creator a { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; color: var(--n-900); text-decoration: none; }
.bd-creator a .bd-glyph { color: var(--n-600); }
/* Speicherstand neben dem Namen: leise, damit er nicht nach Aktion aussieht; „Speichert …“ dreht sich nicht, er
   blendet nur das Symbol ab, damit das Tippen im Namen nicht flackert */
.bd-status { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0; font: 500 var(--t-xs)/1 var(--data); color: var(--muted); white-space: nowrap; }
.bd-status .bd-glyph { width: 0.95rem; height: 0.95rem; color: var(--n-600); transition: opacity 160ms linear; }
.bd-status[data-state="saved"] .bd-glyph { color: var(--accent); }
.bd-status[data-state="pending"] .bd-glyph { opacity: 0.5; }
.bd-status[data-state="blank"] .bd-glyph, .bd-status[data-state="draft"] .bd-glyph { fill: currentColor; }
.bd-vis {
  display: inline-flex; align-items: center; gap: 0.3rem; margin-left: 0.2rem; padding: 0.2rem 0.5rem 0.2rem 0.4rem;
  border-radius: 999px; background: var(--n-250); font: 600 var(--t-xs)/1.1 var(--data); color: var(--n-700);
}
.bd-vis.on { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.bd-props .edit { margin-left: 0.15rem; color: var(--n-600); }
.bd-author { margin: 0.5rem 0 0; font-size: var(--t-s); color: var(--n-700); }
.bd-author strong { color: var(--n-900); }

/* Dialog „Eigenschaften des Builds“: wie der Konto-Dialog, etwas breiter für die Tags in zwei Spalten */
.acct.bd-dlg { width: min(30rem, calc(100vw - 2rem)); }
.bd-dlg .acct-body { gap: 1.1rem; }
.bd-fs { display: grid; gap: 0.5rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.bd-fs legend, .bd-fs .legend { padding: 0; font-size: var(--t-s); font-weight: 600; color: var(--n-700); }
.bd-fs legend { margin-bottom: 0.5rem; }
.bd-fs legend .note { margin-left: 0.35rem; font-weight: 400; color: var(--muted); }
.bd-seg { display: inline-flex; width: fit-content; padding: 0.2rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m); }
.bd-seg label { position: relative; }
.bd-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bd-seg span { display: block; padding: 0.45rem 0.9rem; border-radius: var(--r-s); font: 600 var(--t-s)/1 var(--data); color: var(--n-700); cursor: pointer; }
.bd-seg input:checked + span { background: var(--n-300); color: var(--n-900); }
.bd-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.bd-lvl { justify-items: start; }
.bd-lvl input { width: 4.75rem; padding: 0.35rem 0.5rem; text-align: right;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s); font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900); }
.bd-dlg .bd-taggrid { margin-inline: -0.5rem; }
.bd-visopt { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.55rem 0.6rem; border: 1px solid var(--seam); border-radius: var(--r-s); cursor: pointer; }
.bd-visopt:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.bd-visopt input { flex: none; margin: 0.15rem 0 0; accent-color: var(--accent); }
.bd-visopt b { display: block; font-weight: 600; color: var(--n-900); }
.bd-visopt .sub { display: block; margin-top: 0.15rem; font-size: var(--t-xs); color: var(--muted); }
.bd-dlg .acct-note .bd-link { font-size: inherit; }
.bd-taggrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(12, auto); grid-auto-flow: column; column-gap: 0.5rem; }
.bd-tagopt {
  display: flex; align-items: center; gap: 0.55rem; min-height: 2.25rem; padding: 0 0.5rem;
  border-radius: var(--r-s); font: 500 var(--t-s)/1.2 var(--data); color: var(--n-800); cursor: pointer;
}
.bd-tagopt .ico { --ico: 1.3rem; }
.bd-tagopt input { flex: none; width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); cursor: pointer; }
.bd-tagopt:has(input:checked) { color: var(--n-900); font-weight: 600; }
.bd-tagopt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.bd-tagopt input:focus-visible { outline: none; }
@media (max-width: 420px) { .bd-taggrid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; } }
.bd-del { padding: 0.35rem 0.5rem; background: none; border: 0; color: var(--muted); font: 500 var(--t-xs)/1 var(--data); cursor: pointer; border-radius: var(--r-s); }

/* Charakterblatt: links Kampfwerte und Punkte, Mitte Puppe und Resistenzen, rechts Attribute und Schaden.
   Die Spalten richten sich nach der Breite der Seite (Container), nicht des Fensters, damit es auch mit
   offener Seitenleiste passt. */
.bd-board {
  display: grid; gap: 1.25rem clamp(1rem, 2vw, 1.75rem); align-items: start; margin-top: 1.15rem;
  grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr) minmax(15rem, 19rem);
  grid-template-areas: "left center right";
}
.bd-left { grid-area: left; }
.bd-center { grid-area: center; min-width: 0; }
.bd-right { grid-area: right; }
.bd-side, .bd-lists { display: grid; gap: 0.9rem; align-content: start; min-width: 0; }
@container bd (max-width: 74rem) {
  .bd-board { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "center center" "left right"; }
}
/* Eine Spalte: Puppe, dann Kampfwerte und Punkte, dann Attribute und Schaden, zuletzt die Resistenzen */
@container bd (max-width: 40rem) {
  .bd-board { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
  .bd-center { display: contents; }
  .bd-left, .bd-right { grid-area: auto; }
  .bd-doll { order: 1; }
  #bd-issues { order: 2; }
  .bd-left { order: 3; }
  .bd-right { order: 4; }
  .bd-res { order: 5; margin-top: 0; }
}
#bd-issues:empty { display: none; }
.bd-part { margin-top: 1.9rem; }
.bd-part > h2 {
  margin: 0 0 0.65rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--seam);
  font: 600 var(--t-l)/1.15 var(--display); color: var(--n-900);
}
.bd-sub { margin: 1rem 0 0.45rem; font: 600 var(--t-s)/1.2 var(--data); letter-spacing: 0.01em; color: var(--n-700); }
.bd-sub .note { font-weight: 400; margin-left: 0.35rem; }

/* Puppe wie im Inventar: zwei Spalten mit je fünf Plätzen, die Mitte als Mulde, darunter sechs Dofus-Plätze.
   Alle Kacheln gleich groß (--cell), damit die Reihen eine gemeinsame Kante bilden. */
.bd-doll {
  --cell: clamp(3.25rem, 2.4rem + 2.6vw, 4.75rem);
  --gap: clamp(0.35rem, 0.2rem + 0.5vw, 0.55rem);
  display: grid; grid-template-columns: var(--cell) minmax(0, 1fr) var(--cell); gap: var(--gap);
  max-width: 40rem; margin-inline: auto;
}
.bd-col, .bd-dofus { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap); }
.bd-col { grid-auto-rows: var(--cell); }
.bd-dofus { grid-column: 1 / -1; grid-template-columns: repeat(6, var(--cell)); justify-content: space-between; margin-top: calc(var(--gap) * 1.5); }
.bd-slot { min-width: 0; }
.bd-slot > button {
  position: relative; display: grid; place-items: center;
  width: var(--cell); height: var(--cell); padding: 0;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  color: var(--n-600); cursor: pointer;
  transition: border-color 120ms, background-color 120ms, color 120ms, transform 120ms var(--ease-out);
}
.bd-slot > button:active { transform: scale(0.96); }
.bd-slot img {
  width: 100%; height: 100%; padding: 9% 9% 6%;
  object-fit: contain; object-position: 50% 100%;
  filter: drop-shadow(0 0 1px color-mix(in srgb, var(--n-600) 85%, transparent));
}
/* Platzsymbol aus dem Spiel als Maske: nimmt die Textfarbe an, wird beim Zeigen heller */
.bd-picto {
  width: 56%; height: 56%; background: currentColor;
  -webkit-mask: var(--picto) center / contain no-repeat; mask: var(--picto) center / contain no-repeat;
}
.bd-gap { pointer-events: none; }
.bd-slot.empty > button { background: none; border-style: dashed; border-color: var(--n-400); }
.bd-slot.bad > button { border-color: var(--el-fire); }
.bd-slot > button[aria-expanded="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--n-700); }
/* Zustandsmarken in den Ecken: Bedingung verletzt / nicht prüfbar, Werte angepasst */
.bd-mark {
  position: absolute; top: -0.4rem; right: -0.4rem;
  display: grid; place-items: center; width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: var(--n-400); color: var(--n-900); font: 700 0.75rem/1 var(--data);
}
.bd-mark.bad { background: var(--el-fire); color: var(--n-100); }
.bd-dot { position: absolute; right: 0.3rem; bottom: 0.3rem; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--accent); }
/* Exo: gestrichelter Rand in der Farbe des Werts, Symbole der Werte als Marken unten rechts */
.bd-slot[data-exo] > button { border-width: 2px; border-style: dashed; }
.bd-slot[data-exo]:not(.bad) > button { border-color: var(--exo, var(--n-600)); }
/* Geöffnet: Exo-Rand bleibt, Messing-Ring mit Abstand außen herum */
.bd-slot[data-exo] > button[aria-expanded="true"] { box-shadow: none; outline: 2px solid var(--accent); outline-offset: 3px; }
.bd-slot[data-exo] .bd-dot { right: auto; left: 0.3rem; }
.bd-exos { position: absolute; right: -0.45rem; bottom: -0.45rem; display: flex; flex-direction: row-reverse; }
.bd-exob {
  display: grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%;
  background: var(--n-100); border: 1.5px solid var(--exo, var(--n-600)); --ico: 0.85rem;
}

/* Mitte: Mulde mit Klasse und Kernwerten, beim Zeigen auf einen Platz dessen Item */
.bd-stage {
  display: grid; place-items: center; min-width: 0; padding: 1rem;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m);
  text-align: center; overflow: hidden;
}
.bd-hero, .bd-tip { display: grid; justify-items: center; gap: 0.25rem; min-width: 0; max-width: 100%; }
.bd-hero-img { width: clamp(4rem, 2rem + 8vw, 8.5rem); height: auto; aspect-ratio: 1; object-fit: contain; }
/* Zuordnung Item -> Skin in der Seitenleiste: Vergleichsbild, Vorschläge als Kacheln */
.bd-skin-mapped { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); column-gap: 0.75rem; align-items: center; }
.bd-skin-mapped img { grid-row: span 3; width: 5.5rem; height: 7.5rem; object-fit: contain; background: var(--panel); border-radius: var(--r-s); }
.bd-skin-mapped p { margin: 0; font-weight: 600; color: var(--n-900); }
.bd-skin-mapped .note { font-weight: 400; }
.bd-skin-pick { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 0.75rem; align-items: center; margin-bottom: 0.6rem; }
.bd-skin-pick p { margin: 0; font-size: var(--t-xs); line-height: 1.45; }
.bd-skin-icon { margin: 0; display: grid; justify-items: center; gap: 0.2rem; }
.bd-skin-icon img { width: 4.5rem; height: 4.5rem; object-fit: contain; background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s); }
.bd-skin-icon figcaption { font-size: 0.6875rem; color: var(--muted); text-align: center; }
.bd-skin-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(6.25rem, 1fr)); gap: 0.5rem; }
.bd-skin-card {
  display: grid; justify-items: center; gap: 0.1rem; width: 100%; padding: 0.4rem 0.3rem 0.45rem;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s); cursor: pointer;
  font: 600 var(--t-xs)/1.25 var(--data); color: var(--n-900);
}
.bd-skin-card img { width: 100%; height: 8.5rem; object-fit: contain; background: color-mix(in srgb, var(--ground) 60%, var(--panel)); border-radius: 2px; }
.bd-skin-card .note { font-weight: 400; font-size: 0.6875rem; }
.bd-skin-card.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bd-skin-manual { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.5rem; margin: 0.6rem 0 0; font-size: var(--t-xs); color: var(--n-700); }
.bd-skin-manual input { width: 6rem; height: 2rem; padding: 0 0.45rem; background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s); color: var(--n-900); text-align: right; }
@media (hover: hover) and (pointer: fine) { .bd-skin-card:hover { border-color: var(--n-600); } }

/* Eigenes Aussehen: einklappbar unter der Puppe */
.bd-setbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin: 1rem 0 0; }
.bd-look { max-width: 40rem; margin: 1rem auto 0; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m); }
.bd-look > summary {
  display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.55rem 0.75rem; cursor: pointer; list-style: none; font-weight: 600; color: var(--n-800);
}
.bd-look > summary::-webkit-details-marker { display: none; }
.bd-look > summary::before {
  content: ""; align-self: center; width: 0.45rem; height: 0.45rem;
  border-right: 2px solid; border-bottom: 2px solid; transform: rotate(-45deg); transition: transform 120ms var(--ease-out);
}
.bd-look[open] > summary::before { transform: rotate(45deg); }
.bd-look > summary .note { font-weight: 400; font-size: var(--t-s); }
.bd-look-body { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0 0.75rem 0.75rem; }
.bd-look-body input {
  flex: 1 1 16rem; min-width: 0; height: 2rem; padding: 0 0.5rem;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 500 var(--t-s)/1 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--n-900);
}
.bd-look-body input:focus-visible { border-color: var(--accent); outline: none; }
.bd-look-body .note, .bd-look-msg { flex-basis: 100%; margin: 0; font-size: var(--t-xs); line-height: 1.45; }
.bd-look-msg:empty { display: none; }
.bd-look-msg { color: var(--n-700); }
.bd-look-msg.bad { color: var(--el-fire); font-weight: 600; }
.bd-look code { font-size: 0.95em; color: var(--n-800); }
/* Ganzkörperbild: füllt die Mitte der Puppe, Name und Level darunter */
.bd-hero-body { height: calc(var(--cell) * 4.3); width: auto; max-width: 100%; object-fit: contain; }
.bd-hero-name, .bd-tip-name { margin: 0.25rem 0 0; font: 600 var(--t-l)/1.15 var(--display); color: var(--n-900); overflow-wrap: anywhere; text-wrap: balance; }
.bd-tip-name { margin: 0; }
.bd-hero-sub, .bd-tip-sub, .bd-tip-hint { margin: 0; font-size: var(--t-s); color: var(--muted); }
.bd-tip .bd-flag { margin: 0.2rem 0 0; }
.bd-tip .bd-chips { justify-content: center; margin-top: 0.5rem; }

.bd-flag { display: block; margin-top: 0.1rem; font-size: var(--t-xs); line-height: 1.25; color: var(--muted); }
.bd-flag.bad { color: var(--el-fire); font-weight: 600; }
.bd-budget .bd-flag { display: inline; margin-left: 0.5rem; }

.bd-issues {
  margin-top: 1.25rem; padding: 0.6rem 0.9rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--el-fire) 55%, var(--seam)); border-radius: var(--r-s);
  background: color-mix(in srgb, var(--el-fire) 7%, var(--panel));
}
.bd-issues h2 { margin: 0 0 0.25rem; font: 600 var(--t-m)/1.3 var(--data); color: var(--n-900); }
.bd-issues ul { margin: 0; padding-left: 1.1rem; }
.bd-issues li { margin: 0.1rem 0; }
.bd-issues b { color: var(--n-900); }

#bd-sets .lead { display: grid; gap: 0.1rem; }
.bd-count { font-weight: 400; font-size: var(--t-s); color: var(--muted); }

/* Kästen mit Wertelisten: Mulde, kleine Überschrift, Zeilen mit Haarlinie */
.bd-box { background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m); overflow: hidden; }
.bd-cap {
  margin: 0; padding: 0.5rem 0.75rem 0.4rem; border-bottom: 1px solid var(--seam);
  font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.04em; text-transform: uppercase; color: var(--n-600);
}
.bd-statlist { margin: 0; }
.bd-stat {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 0.75rem;
  padding: 0.38rem 0.75rem; --ico: 1.2em;
}
.bd-stat + .bd-stat { border-top: 1px solid color-mix(in srgb, var(--seam) 70%, var(--ground)); }
.bd-stat dt { display: flex; align-items: center; gap: 0.5rem; min-width: 0; font-weight: 500; color: var(--n-800); }
.bd-stat .mk { width: 1.2em; flex: none; }
.bd-stat[data-el] dt { color: var(--el); }
.bd-stat dd { margin: 0; font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900); white-space: nowrap; }
/* Unveränderte Nullen treten zurück, damit gesetzte Werte auf einen Blick lesbar sind */
.bd-stat.zero dd { color: var(--n-600); font-weight: 500; }
.bd-stat.over dd { color: var(--el-fire); }
.bd-stat.over dd::after { content: " !"; }
.bd-res { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 0.9rem; margin-top: 1.25rem; }

/* Attributspunkte: Basis und Schriftrolle nebeneinander, Restpunkte im Fuß */
.bd-box input { background: var(--panel); }
.bd-points { border-collapse: collapse; width: 100%; font-size: var(--t-s); }
.bd-points th, .bd-points td { padding: 0.22rem 0.35rem; text-align: right; white-space: nowrap; }
.bd-points thead th { padding-top: 0.45rem; font: 600 var(--t-xs)/1.2 var(--data); color: var(--n-600); }
.bd-points tbody th { padding-left: 0.75rem; text-align: left; font-weight: 500; color: var(--n-800); --ico: 1.2em; }
.bd-points tbody th .mk { display: inline-grid; vertical-align: middle; width: 1.2em; margin-right: 0.5rem; }
.bd-points tbody tr[data-el] th { color: var(--el); }
.bd-points td:last-child { padding-right: 0.75rem; }
.bd-points input { width: 4.25rem; padding: 0.25rem 0.4rem; text-align: right; font-size: var(--t-s); }
.bd-pfoot {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  margin-top: 0.35rem; padding: 0.45rem 0.75rem; border-top: 1px solid var(--seam);
}
.bd-budget { margin: 0; color: var(--n-700); font-size: var(--t-s); }
.bd-budget b { font-size: var(--t-m); color: var(--n-900); margin-right: 0.15rem; }
.bd-tools { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin: 0; }
.bd-pointsbox .bd-tools { padding: 0 0.75rem 0.6rem; }
.bd-rules { margin: 1.1rem 0 0; max-width: 72ch; font-size: var(--t-xs); line-height: 1.5; color: var(--muted); }

/* Seitenleiste */
.bd-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
  width: var(--drawer-w); overflow-y: auto; overscroll-behavior: contain;
  background: var(--ground); border-left: 1px solid var(--n-400);
  animation: bd-in 220ms var(--ease-out);
}
.bd-drawer[hidden] { display: none; }
@keyframes bd-in { from { transform: translateX(2.5rem); opacity: 0; } }
.bd-dh {
  position: sticky; top: 0; z-index: 2;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 0.75rem;
  padding: 1rem 1.1rem 0.75rem; background: var(--ground); border-bottom: 1px solid var(--seam);
}
.bd-dh h2 { margin: 0; font: 600 var(--t-l)/1.15 var(--display); color: var(--n-900); overflow-wrap: anywhere; }
.bd-kicker { margin: 0 0 0.15rem; font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.bd-ditem { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.75rem; align-items: center; }
.bd-dsub { margin: 0.15rem 0 0; font-size: var(--t-s); color: var(--n-700); }
.bd-x {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem;
  background: none; border: 1px solid var(--seam); border-radius: var(--r-s); color: var(--n-700); cursor: pointer;
}
.bd-x svg { width: 0.9rem; height: 0.9rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.bd-current { margin: 0; padding: 0.6rem 1.1rem; font-size: var(--t-s); color: var(--n-700); border-bottom: 1px solid var(--seam); }
.bd-current b { color: var(--n-900); }
.bd-pf { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; padding: 0.75rem 1.1rem 0.25rem; }
.bd-field { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.5rem; padding: 0 0.6rem; }
.bd-field svg { width: 1.05rem; height: 1.05rem; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.6; }
.bd-field input { flex: 1; min-width: 0; height: 2.6rem; background: none; border: 0; color: var(--n-900); font: 500 var(--t-m)/1 var(--data); }
.bd-field input:focus { outline: none; }
.bd-field:focus-within { border-color: var(--accent); }
.bd-pf select { min-height: 2.5rem; padding: 0 0.5rem; font-weight: 500; font-size: var(--t-s); min-width: 0; }
.bd-pf select:only-of-type { grid-column: 1 / -1; }
.bd-check { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.5rem; min-height: 2.25rem; font-size: var(--t-s); color: var(--n-700); cursor: pointer; }
.bd-check input { width: 1.05rem; height: 1.05rem; margin: 0; }
.bd-dcount { margin: 0.35rem 1.1rem; font-size: var(--t-xs); color: var(--muted); }
.bd-list { list-style: none; margin: 0; padding: 0 0 0.5rem; }
.bd-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; column-gap: 0.7rem;
  width: 100%; padding: 0.5rem 1.1rem; background: none; border: 0; border-bottom: 1px solid var(--seam);
  text-align: left; cursor: pointer; outline-offset: -2px;
}
.bd-row.on { background: var(--n-200); box-shadow: inset 0 0 0 1px var(--accent); }
.bd-row .txt { display: grid; min-width: 0; }
.bd-row .name { font-weight: 600; color: var(--n-900); line-height: 1.25; }
.bd-row .sub { font-size: var(--t-xs); color: var(--muted); }
.bd-row .lvl { font-size: var(--t-s); font-weight: 600; color: var(--n-700); white-space: nowrap; padding-top: 0.05rem; }
.bd-row .lvl.bad { color: var(--el-fire); }
/* Set-Teil oder Dofus, der schon auf einem anderen Platz liegt: nur einmal anlegbar */
.bd-row.taken { cursor: not-allowed; }
.bd-row.taken > :not(.txt), .bd-row.taken .name, .bd-row.taken .sub:not(.taken-note) { opacity: 0.5; }
.bd-row .taken-note { color: var(--n-700); font-weight: 600; }
.bd-chips { display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; margin-top: 0.3rem; }
.bd-chip { display: inline-flex; align-items: center; gap: 0.2rem; font: 600 var(--t-xs)/1.3 var(--data); color: var(--n-800); white-space: nowrap; --ico: 1.15em; }
.bd-chip .lbl { font-weight: 500; color: var(--muted); }
.bd-chip.up { color: var(--el-air); }
.bd-chip.down { color: var(--el-fire); }
#bd-more { margin: 0.75rem 1.1rem 1.5rem; width: calc(100% - 2.2rem); }

.bd-dbody { padding: 0.5rem 1.1rem 2rem; }
.bd-cond { margin: 0.6rem 0 0; padding: 0.5rem 0.7rem; border: 1px solid var(--seam); border-radius: var(--r-s); background: var(--panel); font-size: var(--t-s); }
.bd-cond b { margin-right: 0.3rem; color: var(--n-900); }
.bd-cond.bad { border-color: color-mix(in srgb, var(--el-fire) 55%, var(--seam)); }
.bd-cond.ok { border-color: color-mix(in srgb, var(--el-air) 55%, var(--seam)); }
.bd-state { margin-left: 0.3rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.bd-cond.bad .bd-state { color: var(--el-fire); }
.bd-cond.ok .bd-state { color: var(--el-air); }
.bd-condnote { margin: 0.3rem 0 0; font-size: var(--t-xs); }
.bd-rolls { list-style: none; margin: 0; padding: 0; }
.bd-rolls li {
  display: grid; grid-template-columns: minmax(0, 1fr) 6rem 7rem; align-items: center; column-gap: 0.6rem;
  padding: 0.25rem 0; border-bottom: 1px solid var(--seam);
}
.bd-rolls label { display: flex; align-items: center; gap: 0.45rem; font-weight: 500; min-width: 0; --ico: 1.2em; }
.bd-rolls li[data-el] label { color: var(--el); }
.bd-rolls input { width: 100%; padding: 0.3rem 0.45rem; text-align: right; }
.bd-range { display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; font-size: var(--t-xs); color: var(--muted); white-space: nowrap; text-align: right; }
/* Etikett für Exo und Overmage: gefüllt in der Farbe der Sache, dunkle Schrift */
.bd-tag {
  display: inline-block; padding: 0.12rem 0.4rem 0.1rem; border-radius: 999px;
  background: var(--tag); color: var(--n-100); font: 700 0.6875rem/1.1 var(--data);
  letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; vertical-align: 0.1em;
}
.bd-rolls .bd-link { justify-self: end; font-size: var(--t-xs); }
.bd-exo-add { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; margin: 0.55rem 0 0; }
.bd-exo-add:empty { display: none; }
/* Exo-Knopf: vollflächig in der Farbe des Werts, Spielsymbol in einer dunklen Mulde, dunkle Schrift.
   Die Farbe sagt, welcher Wert es ist. */
.bd-exo {
  --c: var(--n-600);
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 2.25rem; padding: 0 0.85rem 0 0.3rem;
  background: var(--c); border: 1px solid var(--c); border-radius: 999px;
  font: 700 var(--t-xs)/1 var(--data); color: var(--n-100); cursor: pointer;
  transition: background-color 140ms var(--ease-out), border-color 140ms var(--ease-out), transform 120ms var(--ease-out);
}
.bd-exo[data-stat="actionPoints"] { --c: var(--stat-ap); }
.bd-exo[data-stat="movementPoints"] { --c: var(--stat-mp); }
.bd-exo[data-stat="range"] { --c: var(--stat-range); }
.bd-exo[data-stat="maxSummonedCreaturesBoost"] { --c: var(--stat-summon); }
.bd-exo .mk {
  display: grid; place-items: center; width: 1.65rem; height: 1.65rem; border-radius: 50%;
  background: color-mix(in oklab, var(--n-100) 82%, var(--c)); --ico: 1.05rem;
}
.bd-exo .v { font-size: var(--t-s); font-weight: 800; }
.bd-exo:active { transform: scale(0.96); }
/* Exo auf einem anderen Wert: Suchfeld mit aufklappbarer Liste */
.bd-combo { position: relative; margin-top: 0.55rem; }
.bd-combo .bd-field { background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s); }
.bd-combo .bd-field:focus-within { border-color: var(--accent); }
.bd-combo input { flex: 1; min-width: 0; height: 2.5rem; background: none; border: 0; outline: none; color: var(--n-900); font: 500 var(--t-s)/1 var(--data); }
.bd-combo input::placeholder { color: var(--muted); }
.bd-chev { width: 1rem; height: 1rem; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 160ms var(--ease-out); }
.bd-combo:has([aria-expanded="true"]) .bd-chev { transform: rotate(180deg); }
.bd-combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 6;
  max-height: 17rem; overflow-y: auto; overscroll-behavior: contain;
  margin: 0; padding: 0.3rem; list-style: none;
  background: var(--panel); border: 1px solid var(--n-400); border-radius: var(--r-m);
  box-shadow: 0 12px 28px rgb(0 0 0 / 0.4), 0 2px 6px rgb(0 0 0 / 0.3);
  scrollbar-width: thin; scrollbar-color: var(--tick) transparent;
}
.bd-combo-list[hidden] { display: none; }
.bd-combo-list [role="option"] {
  display: flex; align-items: center; gap: 0.55rem; min-height: 2.25rem; padding: 0 0.55rem;
  border-radius: var(--r-s); font: 500 var(--t-s)/1.2 var(--data); color: var(--n-800); cursor: pointer; --ico: 1.15rem;
}
.bd-combo-list .mk { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; flex: none; }
.bd-combo-list [aria-selected="true"] { background: var(--n-250); color: var(--n-900); }
.bd-combo-list .bd-pct { margin-left: -0.25rem; color: var(--muted); font-weight: 600; }
.bd-combo-empty { padding: 0.6rem 0.55rem; font-size: var(--t-s); color: var(--muted); }
@media (forced-colors: active) { .bd-combo-list [aria-selected="true"] { outline: 2px solid Highlight; } }
.bd-dactions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--seam); }
/* Aktionsknöpfe vollflächig mit Strichsymbol: Messing = Hauptaktion, Rot = Item ablegen, Graphit = sonstige. */
/* Zweitknopf wie .bd-btn: Grund mit Rand, unter dem Zeiger Messingrand. Gefüllt ist nur der Hauptknopf (.primary). */
.bd-act {
  --c: var(--ground); --edge: var(--n-400); --on: var(--n-900);
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0 1rem 0 0.8rem;
  background: var(--c); border: 1px solid var(--edge); border-radius: var(--r-m);
  font: 700 var(--t-s)/1 var(--data); color: var(--on); cursor: pointer;
  transition: background-color 140ms var(--ease-out), border-color 140ms var(--ease-out), transform 120ms var(--ease-out);
}
.bd-glyph { width: 1.2rem; height: 1.2rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bd-act.primary { --c: var(--accent); --edge: var(--accent); --on: var(--n-100); }
/* Ablegen ist leicht rückgängig zu machen: ruhig mit rotem Symbol, erst unter dem Zeiger voll rot */
.bd-act.danger { --c: transparent; --edge: transparent; --on: var(--el-fire); }
.bd-act:active { transform: scale(0.97); }
.bd-dactions .danger { margin-left: auto; }
/* Schmal: Knöpfe füllen ihre Zeile, statt einzeln am Rand zu hängen */
@media (max-width: 520px) { .bd-dactions .bd-act { flex: 1 1 auto; justify-content: center; } }

.bd-toast {
  position: fixed; left: 50%; bottom: 1.25rem; z-index: 40;
  max-width: min(32rem, calc(100vw - 2rem)); margin: 0; padding: 0.6rem 0.95rem;
  background: var(--n-900); color: var(--n-100); border-radius: var(--r-m);
  font: 600 var(--t-s)/1.35 var(--data);
  transform: translate(-50%, 0.75rem); opacity: 0; pointer-events: none;
  transition: opacity 160ms linear, transform 220ms var(--ease-out);
}
.bd-toast.on { opacity: 1; transform: translate(-50%, 0); }
/* Meldung mit Knopf (Rückgängig): klickbar, Knopf in Messing */
.bd-toast.act { display: flex; align-items: center; gap: 0.9rem; }
.bd-toast.act.on { pointer-events: auto; }
.bd-toast button { flex: none; margin: -0.3rem -0.4rem -0.3rem 0; padding: 0.35rem 0.55rem; background: none; border: 0; border-radius: var(--r-s);
  font: 700 var(--t-s)/1 var(--data); color: var(--accent); cursor: pointer; }
.bd-toast button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Tabs unter dem Kopf: Charakterblatt oder Schaden. Messing markiert nur den gewählten Tab. */
.bd-tabs { display: flex; gap: clamp(1rem, 3vw, 2rem); border-bottom: 1px solid var(--seam); }
.bd-tabs button {
  padding: 0.45rem 0 0.6rem; border: 0; background: none; cursor: pointer;
  font: 600 var(--t-m)/1.1 var(--data); color: var(--muted);
  box-shadow: inset 0 -3px 0 transparent;
  transition: color 120ms ease, box-shadow 160ms var(--ease-out);
}
.bd-tabs button[aria-selected="true"] { color: var(--n-900); box-shadow: inset 0 -3px 0 var(--accent); }
.bd-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s); }
.bd-panel[hidden] { display: none; }
#bd-panel-dmg { margin-top: 1.15rem; }

/* Schaden-Tab (damage.js): oben drei Kästen (Klasse, Anzeige, Resistenzen des Ziels), darunter die Karten. */
.dm-options {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0.9rem;
  align-items: start; margin-bottom: 1.25rem;
}
@container bd (max-width: 74rem) {
  .dm-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dm-options > :first-child { grid-column: 1 / -1; }
}
@container bd (max-width: 40rem) { .dm-options { grid-template-columns: minmax(0, 1fr); } }
.dm-breeds { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr)); gap: 0.35rem; padding: 0.6rem 0.75rem 0.75rem; }
.dm-breeds button {
  aspect-ratio: 1; padding: 0; overflow: hidden; cursor: pointer;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
}
.dm-breeds img { display: block; width: 100%; height: 100%; object-fit: contain; }
.dm-breeds button:not([aria-pressed="true"]) img { opacity: 0.75; }
.dm-breeds button[aria-pressed="true"] { background: var(--mark); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.dm-breeds button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dm-opt { display: grid; gap: 0.4rem; padding: 0.6rem 0.75rem 0.7rem; }
.dm-opt + .dm-opt { border-top: 1px solid var(--seam); }
.dm-lbl { font: 600 var(--t-xs)/1.2 var(--data); color: var(--muted); }
.dm-seg { display: inline-flex; justify-self: start; border: 1px solid var(--n-400); border-radius: var(--r-s); overflow: hidden; }
.dm-seg button {
  min-height: 2rem; padding: 0 0.75rem; background: var(--ground); border: 0;
  font: 600 var(--t-xs)/1 var(--data); color: var(--n-700); cursor: pointer;
}
.dm-seg button + button { border-left: 1px solid var(--n-400); }
.dm-seg button[aria-pressed="true"] { background: var(--mark); color: var(--n-900); box-shadow: inset 0 -2px var(--accent); }
.dm-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dm-elf { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.dm-elf button {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2rem; padding: 0 0.55rem; --ico: 1.1em;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s); cursor: pointer;
  font: 600 var(--t-xs)/1 var(--data); color: var(--n-600);
}
.dm-elf button[aria-pressed="true"] {
  color: var(--el); border-color: color-mix(in srgb, var(--el) 60%, var(--seam));
  background: color-mix(in srgb, var(--el) 10%, var(--ground));
}
.dm-elf button:not([data-el])[aria-pressed="true"] { color: var(--n-900); border-color: var(--accent); background: var(--mark); }
.dm-elf button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dm-box .dm-res { margin-top: 0.15rem; }
.dm-res tbody tr[data-el] th { color: var(--el); }
.dm-reset { margin: 0.4rem 0.75rem 0.65rem; font-size: var(--t-xs); }

/* Buffs: Schalter je Buff (eingeschaltet mit Messingrand), bei stapelbaren ein Zähler daneben; darunter eigene Werte. */
.dm-buffs { margin-bottom: 1.25rem; }
.dm-bcap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dm-bcap h3 { margin: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
.dm-bcap .bd-link { font-size: var(--t-xs); letter-spacing: 0; text-transform: none; }
.dm-bcount { color: var(--accent); }
.dm-blist {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 0.4rem;
  list-style: none; margin: 0; padding: 0;
}
.dm-buff { display: flex; min-width: 0; background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s); }
.dm-buff.on { background: color-mix(in srgb, var(--brass-900) 55%, var(--panel)); border-color: var(--accent); }
.dm-buff > button {
  flex: 1; min-width: 0; display: grid; grid-template-columns: 2rem minmax(0, 1fr); align-items: center; gap: 0.55rem;
  padding: 0.35rem 0.55rem; background: none; border: 0; border-radius: var(--r-s); text-align: left; cursor: pointer;
  font: 500 var(--t-s)/1.25 var(--data); color: var(--n-700);
}
.dm-buff.on > button { color: var(--n-900); }
.dm-buff > button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dm-buff .plate { width: 2rem; height: 2rem; }
.dm-buff .t small { display: block; font-size: var(--t-xs); color: var(--muted); }
.dm-stack { display: flex; align-items: stretch; border-left: 1px solid color-mix(in srgb, var(--accent) 45%, var(--seam)); }
.dm-stack button {
  width: 1.9rem; padding: 0; background: none; border: 0; cursor: pointer;
  font: 600 var(--t-m)/1 var(--data); color: var(--n-900);
}
.dm-stack button:disabled { color: var(--n-500); cursor: default; }
.dm-stack button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dm-stack output { align-self: center; min-width: 1.9rem; text-align: center; font: 600 var(--t-s)/1 var(--data); font-variant-numeric: tabular-nums; }
.dm-custom { border-top: 1px solid var(--seam); }
.dm-cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr)); gap: 0.4rem 1rem; }
.dm-cgrid label { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: var(--t-s); color: var(--n-800); }
.dm-cgrid input {
  width: 4.5rem; padding: 0.25rem 0.4rem; text-align: right;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 600 var(--t-s)/1.2 var(--data); color: var(--n-900);
}
.dm-cgrid input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Karten je Zauber: 4 nebeneinander, schmaler 2, auf dem Telefon 1 (nie 3, damit die beiden Varianten
   eines Zauberplatzes immer nebeneinander stehen). Die Karten einer Reihe sind gleich hoch, die Eckdaten unten. */
#dm-list > .bd-sub:first-child { margin-top: 0; }
.dm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }
@container bd (max-width: 74rem) { .dm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container bd (max-width: 40rem) {
  .dm-grid { grid-template-columns: minmax(0, 1fr); }
  .dm-card.empty { display: none; }
}
.dm-card {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m); overflow: hidden;
}
.dm-card.empty { visibility: hidden; }
.dm-card.locked .dm-body, .dm-card.locked .dm-sum { opacity: 0.55; }
.dm-ch {
  display: grid; grid-template-columns: var(--plate-s) minmax(0, 1fr) auto; align-items: center; column-gap: 0.6rem;
  padding: 0.65rem 0.75rem 0.55rem;
}
.dm-title { min-width: 0; }
.dm-title h4 { margin: 0; font: 600 var(--t-m)/1.2 var(--data); overflow-wrap: anywhere; }
.builder .dm-title a { color: var(--n-900); text-decoration: none; }
.dm-title p { margin: 0.1rem 0 0; font-size: var(--t-xs); color: var(--muted); }
.dm-title b { font-weight: 600; color: var(--accent); }
.dm-modon { font-weight: 600; color: var(--accent); }
.dm-grades { display: inline-flex; gap: 0.2rem; align-self: start; }
.dm-grades button {
  min-width: 1.65rem; height: 1.65rem; padding: 0 0.3rem; cursor: pointer;
  background: var(--panel); border: 1px solid var(--n-400); border-radius: var(--r-s);
  font: 600 var(--t-xs)/1 var(--data); color: var(--n-700);
}
.dm-grades button.later { border-style: dashed; color: var(--n-600); }
.dm-grades button[aria-pressed="true"] { background: var(--mark); border: 1px solid var(--accent); color: var(--n-900); }
.dm-grades button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dm-card > .dm-seg { display: flex; margin: 0 0.75rem 0.55rem; }
.dm-card > .dm-seg button { flex: 1; min-height: 1.75rem; }
.dm-dist { margin: 0 0.75rem 0.55rem; font-size: var(--t-xs); color: var(--muted); }
.dm-body { flex: 1; padding: 0 0.75rem 0.5rem; border-top: 1px solid var(--seam); }
.dm-group h4 {
  margin: 0.5rem 0 0.15rem;
  font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.04em; text-transform: uppercase; color: var(--n-600);
}
.dm-lines { list-style: none; margin: 0; padding: 0; }
.dm-lines li {
  display: grid; grid-template-columns: 1.2em minmax(0, 1fr) auto; column-gap: 0.5rem; align-items: center;
  padding: 0.1rem 0; --ico: 1.15em; color: var(--el, var(--text));
}
.dm-n { font: 600 var(--t-m)/1.35 var(--data); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.dm-k { font: 600 var(--t-s)/1.35 var(--data); font-variant-numeric: lining-nums tabular-nums; text-align: right; white-space: nowrap; }
.dm-k abbr { text-decoration: none; font-weight: 500; font-size: var(--t-xs); color: var(--muted); }
.dm-tags { grid-column: 2 / -1; font: 400 var(--t-xs)/1.3 var(--data); color: var(--muted); }
.dm-none { margin: 0.6rem 0 0.2rem; font-size: var(--t-s); }
.dm-sum {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.35rem;
  margin: 0; padding: 0.45rem 0.75rem; border-top: 1px solid var(--seam); font-size: var(--t-s); color: var(--n-700);
}
.dm-sum .dm-avg { font: 700 var(--t-m)/1.2 var(--data); font-variant-numeric: tabular-nums; color: var(--accent); }
.dm-sum small { flex-basis: 100%; font-size: var(--t-xs); color: var(--muted); }
.dm-facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.15rem 0.75rem;
  list-style: none; margin: 0; padding: 0.5rem 0.75rem 0.6rem;
  background: var(--n-150); border-top: 1px solid var(--seam); font-size: var(--t-xs); color: var(--n-700);
}
.dm-facts b { color: var(--n-900); }
.dm-note { margin: 0.6rem 0 0; }

@media (hover: hover) and (pointer: fine) {
  .dm-breeds button:not([aria-pressed="true"]):hover { border-color: var(--n-600); }
  .dm-breeds button:not([aria-pressed="true"]):hover img { opacity: 1; }
  .dm-elf button:hover { border-color: var(--n-600); }
  .dm-grades button:not([aria-pressed="true"]):hover { border-color: var(--n-600); color: var(--n-900); }
  .bd-tabs button:not([aria-selected="true"]):hover { color: var(--text); }
  .dm-seg button:not([aria-pressed="true"]):hover { color: var(--n-900); }
  .bd-btn:hover { border-color: var(--accent); }
  .bd-tb:hover { background: var(--n-300); color: var(--n-900); }
  .bd-tb:hover .bd-glyph { color: var(--accent); }
  .bd-tb.primary:hover { background: color-mix(in oklab, var(--accent) 86%, var(--n-900)); color: var(--n-100); }
  .bd-tb.primary:hover .bd-glyph { color: currentColor; }
  .bd-exo:hover { background: color-mix(in oklab, var(--c) 86%, var(--n-900)); border-color: color-mix(in oklab, var(--c) 86%, var(--n-900)); }
  .bd-act:hover { border-color: var(--accent); }
  .bd-act.primary:hover { background: color-mix(in oklab, var(--c) 86%, var(--n-900)); border-color: color-mix(in oklab, var(--c) 86%, var(--n-900)); }
  .bd-act.danger:hover { background: var(--el-fire); border-color: var(--el-fire); color: var(--n-100); }
  .bd-slot > button:hover { border-color: var(--n-600); background-color: var(--n-150); color: var(--n-800); }
  .bd-slot[data-exo]:not(.bad) > button:hover { border-color: color-mix(in oklab, var(--exo) 75%, var(--n-900)); }
  .bd-load:hover { background: var(--n-250); }
  .bd-props:hover { border-color: var(--n-400); }
  .bd-titletags:not(.empty):hover { border-color: var(--n-400); }
  .bd-titletags.empty:hover { border-color: var(--n-600); color: var(--n-900); }
  .bd-creator a:hover { text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
  .bd-creator a:hover .bd-glyph { color: var(--accent); }
  .bd-props:hover .edit { color: var(--accent); }
  .bd-seg span:hover { color: var(--n-900); }
  .bd-tagopt:hover { background: var(--n-250); }
  .bd-row:hover { background: var(--n-150); }
  .bd-row.on:hover { background: var(--n-200); }
  .bd-x:hover { color: var(--n-900); border-color: var(--n-400); }
  .bd-del:hover { color: var(--el-fire); background: var(--n-250); }
  .bd-link:hover { text-decoration-thickness: 2px; }
  .bd-char select:hover, .bd-char input:hover, .bd-points input:hover, .bd-rolls input:hover, .bd-pf select:hover { border-color: var(--n-400); }
}

@media (max-width: 860px) {
  .bd-main { padding: 1.25rem 1rem 3rem; }
  .bd-head { grid-template-columns: minmax(0, 1fr); }
  /* linksbündig: rahmenlose Knöpfe um ihren Innenabstand nach links, damit das Symbol in der Flucht steht */
  .bd-actions { justify-content: flex-start; margin-left: -0.7rem; }
  .bd-stage { padding: 0.6rem; }
  .bd-hero-name, .bd-tip-name { font-size: 1.1875rem; }
  .bd-drawer { border-left: 0; }
  .bd-pop { right: auto; left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bd-drawer { animation: none; }
  .bd-toast, .bd-btn, .bd-tb, .bd-tb .bd-glyph, .bd-exo, .bd-act, .bd-slot > button, .bd-tabs button { transition: none; }
}
@media (forced-colors: active) { .bd-tb { border: 1px solid ButtonText; } .bd-tb.primary { border-color: Highlight; } }
@media (forced-colors: active) {
  .bd-slot.bad > button, .bd-row.on, .bd-slot > button[aria-expanded="true"] { outline: 2px solid CanvasText; outline-offset: -2px; }
}

/* ---------- Klassen (#/breeds) ----------
   Ganze Breite statt Register: oben die Leiste aller Klassen, darunter eine Buehne mit beiden Figuren,
   die sich zur Mitte drehen. Dann links das Zauberraster (pro Platz zwei Varianten uebereinander),
   rechts der gewaehlte Zauber als Stat-Block. Messing markiert nur die Wahl. */
body.breeds-mode > main.layout { display: none; }
.breeds { background: var(--panel); }
.breeds[hidden] { display: none; }
@media (min-width: 861px) {
  .breeds { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.breeds a {
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

/* Klassenleiste: schwebt ueber der Seite, rollt seitlich, wenn sie nicht passt */
.br-strip-wrap {
  position: sticky; top: 0; z-index: 3;
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none;
  background: color-mix(in srgb, var(--ground) 86%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--seam);
}
.br-strip-wrap::-webkit-scrollbar { display: none; }
.br-strip {
  display: flex; gap: 0.2rem;
  width: max-content; margin: 0 auto; padding: 0.45rem 1rem;
  list-style: none;
}
.br-strip a {
  position: relative;
  display: grid; place-items: center;
  width: 3.25rem; height: 3.25rem;
  border-radius: var(--r-m);
  outline-offset: -2px;
  -webkit-tap-highlight-color: transparent;
}
.br-strip img {
  width: 2.6rem; height: 2.6rem;
  filter: saturate(0.5) brightness(0.8);
  transition: filter 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.br-strip-name {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.br-strip a[aria-current="page"] { background: var(--panel); }
.br-strip a[aria-current="page"] img { filter: none; }
.br-strip a[aria-current="page"]::after {
  content: "";
  position: absolute; left: 22%; right: 22%; bottom: 0;
  height: 2px;
  background: var(--accent);
}
.br-strip a:active img { transform: scale(0.94); }

/* Buehne */
.br-main { max-width: 84rem; margin-inline: auto; padding: 1.25rem clamp(1rem, 4vw, 3.5rem) 4rem; }
.br-main[aria-busy="true"] > * { opacity: 0.5; transition: opacity 120ms linear 200ms; }
.br-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 26rem) minmax(0, 1fr);
  grid-template-areas: "m id f";
  align-items: end;
  column-gap: clamp(0.5rem, 2vw, 2rem);
  background: radial-gradient(ellipse 46% 60% at 50% 64%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 72%);
}
.br-body { margin: 0; display: grid; justify-items: center; gap: 0.35rem; }
.br-body-m { grid-area: m; justify-self: end; }
.br-body-f { grid-area: f; justify-self: start; }
.br-body img { height: clamp(13rem, 6rem + 18vw, 21rem); width: auto; }
/* Beide Figuren stehen im Spiel nach rechts; die rechte wird gespiegelt, damit sie zur Mitte schauen. */
.br-body-f img { transform: scaleX(-1); }
.br-body figcaption { font-size: var(--t-xs); color: var(--muted); letter-spacing: 0.02em; }
.br-body-none {
  display: grid; place-items: center;
  width: 8rem; height: clamp(13rem, 6rem + 18vw, 21rem);
  color: var(--muted); font-size: var(--t-s);
  border: 1px dashed var(--n-400); border-radius: var(--r-m);
}

.br-ident { grid-area: id; align-self: center; min-width: 0; padding-bottom: 1.5rem; text-align: center; }
.br-kicker { margin: 0 0 0.35rem; color: var(--muted); font-size: var(--t-s); letter-spacing: 0.02em; }
.br-kicker .catno::before { content: "·"; margin: 0 0.4em; }
.br-ident h1 {
  margin: 0;
  font: 700 clamp(2.25rem, 1.3rem + 3.4vw, 3.75rem)/1 var(--display);
  letter-spacing: -0.012em;
  color: var(--n-900);
  text-wrap: balance; overflow-wrap: anywhere; hyphens: auto;
}
.br-ident .typeline { margin-top: 0.45rem; }
.br-complex { display: inline-flex; align-items: center; gap: 0.6rem; margin: 0.9rem 0 0; color: var(--n-700); font-size: var(--t-s); }
.br-pips { display: inline-flex; gap: 3px; }
.br-pips span {
  width: 0.95rem; height: 0.5rem;
  background: var(--ground);
  border: 1px solid var(--n-400);
  transform: skewX(-20deg);
}
.br-pips .on { background: var(--accent); border-color: var(--accent); }

.br-lore {
  max-width: 66ch; margin: 1.25rem auto 0;
  font: 400 1.125rem/1.55 var(--data);
  color: var(--n-700);
  text-wrap: pretty;
}
.br-wedge { margin: 1.5rem 0 1.4rem; }

/* Zauber: Liste links, gewaehlter Zauber rechts */
.br-spells { display: grid; gap: 2rem clamp(2rem, 4vw, 3.5rem); }
.br-grid-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin-bottom: 0.45rem; padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--seam);
}
.br-grid-head h2 { margin: 0; font: 600 var(--t-l)/1.15 var(--display); color: var(--n-900); }
.br-more { font-size: var(--t-s); white-space: nowrap; }
.br-hint { margin: 0 0 0.8rem; color: var(--muted); font-size: var(--t-s); }
.br-grid-head-sub { margin-top: 1.6rem; }
/* Liste wie im Spiel: pro Platz eine Zeile, beide Varianten nebeneinander in einer gemeinsamen Mulde. */
.br-grid {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.4rem;
  margin: 0; padding: 0; list-style: none;
}
.br-pair {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px;
  padding: 2px;
  background: var(--ground);
  border: 1px solid var(--seam);
  border-bottom-color: var(--tick);
  border-radius: var(--r-m);
}
.br-cell {
  display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); grid-template-rows: auto auto;
  align-items: center; column-gap: 0.5rem;
  min-height: 2.9rem; padding: 0.2rem 0.55rem 0.2rem 0.2rem;
  background: var(--n-150); border: 0; border-radius: var(--r-s);
  color: var(--n-700); text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms var(--ease-out), color 120ms var(--ease-out);
}
.br-cell-icon { grid-row: 1 / 3; width: 2.25rem; height: 2.25rem; }
.br-cell-icon img { width: 100%; height: 100%; object-fit: contain; transition: transform 140ms var(--ease-out); }
.br-cell-name {
  align-self: end;
  font: 600 var(--t-s)/1.2 var(--data); letter-spacing: 0.01em;
  overflow-wrap: break-word; hyphens: auto;
}
.br-cell:not(:has(.br-cell-lv)) .br-cell-name { grid-row: 1 / 3; align-self: center; }
.br-cell-lv { align-self: start; color: var(--muted); font: 500 var(--t-xs)/1.25 var(--data); }
.br-cell:active .br-cell-icon img { transform: scale(0.94); }
.br-cell[aria-pressed="true"] {
  background: var(--n-250); color: var(--n-900);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.br-cell[aria-pressed="true"] .br-cell-lv { color: var(--n-700); }
.br-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Zwei Spalten von Plätzen, links die erste Hälfte (wie im Spiel) */
@media (min-width: 700px) {
  .br-grid { grid-auto-flow: column; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 11), auto); column-gap: 0.75rem; }
}

.br-spell { min-width: 0; }
.br-spell[aria-busy="true"] .br-spell-card { opacity: 0.5; transition: opacity 120ms linear 200ms; }
.br-spell-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; column-gap: 1rem;
}
.plate-m { width: 4.25rem; height: 4.25rem; }
.br-spell-head h3 {
  margin: 0;
  font: 700 clamp(1.625rem, 1.3rem + 1vw, 2rem)/1.05 var(--display);
  letter-spacing: -0.008em;
  color: var(--n-900);
  overflow-wrap: anywhere; hyphens: auto;
}
.br-spell-head h3 a { text-decoration-color: transparent; }
.br-spell-meta { margin: 0.3rem 0 0; color: var(--n-700); font-size: var(--t-s); }
.br-alt {
  padding: 0;
  background: none; border: 0;
  color: var(--n-900); font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em;
  cursor: pointer;
}
.br-spell-head .catno { align-self: start; margin: 0; padding-top: 0.15rem; color: var(--muted); font-size: var(--t-s); font-weight: 500; }
.br-spell-lore {
  max-width: 64ch; margin: 0.9rem 0 1.1rem;
  font: 400 var(--t-m)/1.5 var(--data);
  color: var(--n-700);
  white-space: pre-line;
  text-wrap: pretty;
}
.br-spell-card > .grade { margin-top: 1rem; }
.br-spell .part { margin-top: 1.5rem; }
.br-spell .part > h4 {
  margin: 0 0 0.55rem; padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--seam);
  font: 600 1.1875rem/1.15 var(--display);
  color: var(--n-900);
}

.br-failure { max-width: 40rem; margin: 2rem auto; }
.br-failure h1 { margin: 0 0 0.5rem; font: 700 var(--t-name)/1 var(--display); color: var(--n-900); }

/* Breite Schirme: Liste und Zauber nebeneinander; die Liste bleibt stehen, waehrend lange Zauber rollen.
   Schmaler stehen sie untereinander, breeds.js rollt nach einem Klick zum Zauber. */
.br-spell { scroll-margin-top: 6rem; }
@media (min-width: 1200px) {
  .br-spells { grid-template-columns: minmax(0, 48rem) minmax(0, 1fr); align-items: start; column-gap: clamp(2rem, 3vw, 3rem); }
  /* Mit den gemeinsamen Zaubern höher als das Fenster: dann rollt die Liste in sich */
  .br-grid-wrap {
    position: sticky; top: 5.25rem;
    max-height: calc(100vh - 6.25rem); overflow-y: auto; overscroll-behavior: contain;
    /* Rand, damit der Fokusrahmen der Zellen nicht abgeschnitten wird */
    padding: 4px 0.25rem 4px 4px; margin: -4px 0 0 -4px; scrollbar-gutter: stable;
  }
}

@media (hover: hover) and (pointer: fine) {
  .br-strip a:hover img { filter: none; }
  .br-strip a:hover { background: var(--n-250); }
  .br-strip a[aria-current="page"]:hover { background: var(--panel); }
  .br-cell:hover { background: var(--n-250); color: var(--n-900); }
  .br-cell:hover .br-cell-icon img { transform: scale(1.06); }
  .br-spell-head h3 a:hover { text-decoration-color: var(--accent); }
  .breeds a:hover, .br-alt:hover { text-decoration-thickness: 2px; }
}

@media (max-width: 860px) {
  .br-main { padding-top: 1rem; }
  .br-hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "id id" "m f";
    row-gap: 0.5rem;
    background: radial-gradient(ellipse 70% 40% at 50% 78%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 72%);
  }
  .br-ident { padding-bottom: 0.5rem; }
  .br-body img, .br-body-none { height: clamp(11rem, 6rem + 22vw, 15rem); }
  .br-lore { font-size: 1.0625rem; }
}
@media (max-width: 560px) {
  .br-spell-head { column-gap: 0.75rem; }
  .plate-m { width: 3.5rem; height: 3.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .br-strip img, .br-cell-icon img, .br-cell { transition: none; }
  .br-strip a:active img, .br-cell:active .br-cell-icon img, .br-cell:hover .br-cell-icon img { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .br-strip-wrap { background: var(--ground); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .br-strip-wrap { background: var(--ground); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .br-strip img { filter: none; }
  .br-hint, .br-spell-meta, .br-lore, .br-spell-lore, .br-cell, .br-cell-lv { color: var(--text); }
}
@media (forced-colors: active) {
  .br-strip a[aria-current="page"]::after { background: Highlight; }
  .br-cell[aria-pressed="true"] { outline: 3px solid Highlight; box-shadow: none; }
  .br-pips span { forced-color-adjust: none; }
}

/* ---------- Verweise in Effekten und Texten (web/refcard.js) ---------- */
/* Name mit Icon, gestrichelt unterstrichen: sieht nach Text aus, verrät aber, dass man ihn aufklappen kann. */
.fx-ref {
  display: inline; padding: 0; margin: 0; border: 0; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; text-align: inherit;
  cursor: pointer;
  text-decoration: underline dashed 1px;
  text-decoration-color: color-mix(in srgb, currentColor 50%, transparent);
  text-underline-offset: 0.2em;
  border-radius: 2px;
  transition: text-decoration-color 120ms var(--ease-out), color 120ms var(--ease-out);
}
.fx-ref .ico { --ico: 1.3em; display: inline-block; margin-right: 0.28em; vertical-align: -0.3em; }
.fx-ref .ref-glyph { fill: none; stroke: currentColor; stroke-width: 1.3; opacity: 0.8; --ico: 1.05em; vertical-align: -0.15em; }
.fx-ref:hover, .fx-ref[aria-expanded="true"] { text-decoration-style: solid; text-decoration-color: var(--accent); }
.fx-ref:hover { color: var(--n-900); }
.effects > li[data-el] .fx-ref:hover { color: inherit; }
.fx-ref:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lore .fx-ref, .br-spell-lore .fx-ref, .ms-lore .fx-ref { font-style: inherit; }

/* Aufgeklappte Angaben (web/refcard.js): direkt unter der Zeile bzw. dem Absatz, als eingelassene Mulde.
   Höhe wächst über grid-template-rows 0fr -> 1fr, so passt sie sich auch an, wenn der Inhalt nachlädt. */
.rc {
  display: grid; grid-template-rows: 0fr;
  color: var(--text); font: 400 var(--t-s)/1.45 var(--data); letter-spacing: 0;
  cursor: auto;
  transition: grid-template-rows 200ms var(--ease-out), opacity 160ms var(--ease-out);
  opacity: 0;
}
.rc.open { grid-template-rows: 1fr; opacity: 1; }
.rc-in { min-height: 0; overflow: hidden; }
.rc-box {
  margin: 0.3rem 0 0.35rem;
  padding: 0.55rem 0.8rem 0.65rem;
  border: 1px solid var(--seam);
  border-radius: var(--r-m);
  background: var(--ground);
}
.effects > li > .rc { grid-column: 2 / -1; }
p + .rc .rc-box, .rc + p { margin-top: 0.4rem; }
.rc-box > * { margin: 0 0 0.5rem; }
.rc-box > :last-child { margin-bottom: 0; }
.rc-kind { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; }
.rc-kind b { color: var(--accent); font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.08em; text-transform: uppercase; }
.rc-no { color: var(--muted); font-size: var(--t-xs); }
.rc-kind a { margin-left: auto; color: var(--accent); font: 600 var(--t-xs)/1.2 var(--data); text-decoration: none; }
.rc-kind a::after { content: " ›"; }
.rc-kind a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.rc-lore { color: var(--n-700); font: 400 var(--t-m)/1.45 var(--data); white-space: pre-line; }
/* Element-Symbole im Spieltext (<sprite name="eau">) */
.txt-sprite { display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -0.2em; margin: 0 0.1em; }
.rc-facts { color: var(--n-700); }
.rc-sub { color: var(--muted); font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.06em; text-transform: uppercase; }
.rc-rules { list-style: none; padding: 0; }
.rc-rules li { position: relative; padding: 0.1rem 0 0.1rem 1rem; }
.rc-rules li::before { content: ""; position: absolute; left: 0.1rem; top: 0.68em; width: 0.4rem; height: 0.4rem; background: var(--accent); transform: rotate(45deg); }
.rc-box .effects { columns: auto; }
.rc-by { list-style: none; padding: 0; display: grid; gap: 0.15rem; }
.rc-by > li > .rc { margin-left: 0.2rem; }
.rc .fx-ref { font-weight: 700; color: var(--n-900); text-decoration-color: transparent; }
.rc .fx-ref:hover, .rc .fx-ref[aria-expanded="true"] { text-decoration: underline solid 1px; text-decoration-color: currentColor; }
.rc .rc-lore .fx-ref { font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .rc, .fx-ref { transition: none; }
}
@media (prefers-contrast: more) {
  .fx-ref { text-decoration-style: solid; text-decoration-color: currentColor; }
  .rc-box { background: none; border-color: var(--n-700); }
}
@media (forced-colors: active) {
  .fx-ref { color: LinkText; }
  .rc-box { border-color: CanvasText; }
  .rc-rules li::before { background: CanvasText; }
}

/* ---------- Effektzeilen: Icon links, Name fett, Dauer mit Uhr, Ziele rechts ---------- */
.effects > li {
  grid-template-columns: 1em minmax(0, 1fr) auto;
  margin-inline: -0.45rem; padding: 0.22rem 0.45rem;
  border-radius: var(--r-s);
}
.effects > li.has-ref { cursor: pointer; transition: background-color 120ms var(--ease-out); }
.effects > li.has-ref:hover:not(:has(> .rc:hover)) { background: var(--n-250); }
.effects .mk .ref-glyph { --ico: 0.95em; fill: none; stroke: currentColor; stroke-width: 1.3; opacity: 0.8; }

/* Verweise in Effekten: fett statt unterstrichen; die ganze Zeile reagiert. */
.effects .fx-ref { font-weight: 700; color: var(--n-900); text-decoration-color: transparent; }
.effects > li[data-el] .fx-ref { color: inherit; }
.effects > li.has-ref:hover:not(:has(> .rc:hover)) > span .fx-ref, .effects .fx-ref[aria-expanded="true"] { text-decoration: underline solid 1px; text-decoration-color: currentColor; }

.effects .dur { white-space: nowrap; }
.clock {
  display: inline-block; width: 0.95em; height: 0.95em; margin-left: 0.12em; vertical-align: -0.12em;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}

/* Ziele: Zaubernder (Messing), Verbündete (grüne Raute, hohl = außer dem Zaubernden), Gegner (Schädel) */
.tg { display: inline-flex; align-items: center; gap: 0.3rem; height: 1.45em; padding-left: 0.4rem; }
.tg svg { width: 1em; height: 1em; flex: none; }
.tg-caster { fill: var(--accent); }
.tg-allies, .tg-alliesExceptCaster { fill: var(--el-air); }
.tg-alliesExceptCaster { fill: none; stroke: var(--el-air); stroke-width: 1.7; stroke-linejoin: round; }
.tg .tg-enemies { fill: var(--n-800); width: 1.1em; height: 1.1em; }

@media (prefers-reduced-motion: reduce) { .effects > li.has-ref { transition: none; } }
@media (forced-colors: active) {
  .tg svg { fill: CanvasText; }
  .tg .tg-alliesExceptCaster { fill: none; stroke: CanvasText; }
  .effects > li.has-ref:hover { outline: 1px solid CanvasText; }
}
/* Mit Zone oder Ziel-Symbolen rechts einspaltig: sonst brechen lange Zeilen mehrfach um. */
.effects.effects:has(.fx-side) { columns: auto; }
.fx-side { display: inline-flex; align-items: center; justify-content: flex-end; }

/* Einfarbige Spielsymbole (weiß im Spiel): als Maske in der Farbe des Umfelds */
/* Art einer Quest (app.js: questMark): Spielsymbol als Maske in der Farbe der Art, vor dem Namen */
.qk { display: inline-flex; vertical-align: -0.18em; margin-right: 0.4em; color: var(--qk); }
/* In der Liste: umbrechende Namen bleiben bündig neben dem Symbol */
.results .name:has(> .qk) { display: flex; align-items: flex-start; }
.results .name > .qk { flex: none; margin-top: 0.15em; }
.qk .ico { --ico: 1.05em; width: 1.05em; height: 1.05em; }
.typeline .qk .ico { --ico: 1.15em; width: 1.15em; height: 1.15em; }
.ico-mono {
  display: inline-block;
  background: currentColor;
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}
/* Wirkungszone: Form-Symbol und Größe, gedämpft wie die Dauer */
.zone {
  display: inline-flex; align-items: center; gap: 0.22rem; height: 1.45em; padding-left: 0.4rem;
  color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.zone-ico { width: 1.05em; height: 1.05em; flex: none; }
@media (forced-colors: active) { .ico-mono { forced-color-adjust: none; background: CanvasText; } }
/* Glyphen, Auren, Fallen, Runen: Bodenfarbe als kleine Raute vor dem Namen */
.glyph-color {
  display: inline-block; width: 0.62em; height: 0.62em; margin: 0 0.35em 0 0.1em; vertical-align: 0.05em;
  background: var(--c); transform: rotate(45deg); border-radius: 1px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--n-900) 25%, transparent);
}
@media (forced-colors: active) { .glyph-color { forced-color-adjust: none; } }

/* ---------- Kampf-Herausforderungen ---------- */
/* Die Spielsymbole sind dunkle Silhouetten: auf Messing statt auf dem dunklen Grund */
.plate.plate-chal { background: var(--accent); border: 1px solid var(--brass-700); }
.plate.plate-chal img { padding: 18%; object-position: 50% 50%; filter: none; }
.chal { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; }
.chal li {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.75rem; align-items: start;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--seam);
}
.chal-ico {
  display: grid; place-items: center;
  width: 2.25rem; height: 2.25rem;
  border-radius: var(--r-s);
  background: var(--accent);
}
.chal-ico img { width: 1.6rem; height: 1.6rem; object-fit: contain; }
.chal-n { font-weight: 600; color: var(--n-900); }
.chal-t { color: var(--muted); font-size: var(--t-s); }
.chal p { margin: 0.15rem 0 0; color: var(--n-700); font-size: var(--t-s); max-width: 70ch; }
@media (forced-colors: active) {
  .chal-ico, .plate.plate-chal { forced-color-adjust: none; }
}

/* Kartenhinweise (Kategorie aus den Spieldaten): dunkle Scheibe, Rand und Zeichen in der Kategoriefarbe.
   Nur noch Ersatz, falls ein Spielsymbol fehlt (out/images/hints, vor dem nächsten Export der Bilder). */
.mv-hint { --hc: var(--n-700); --hi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='3.2'/%3E%3C/svg%3E"); }
.mv-hint::before { background: var(--n-100); border: 2px solid var(--hc); border-radius: 50%; }
.mv-hint::after {
  content: ""; position: absolute; inset: 4px;
  background: var(--hc);
  -webkit-mask: var(--hi) center / contain no-repeat; mask: var(--hi) center / contain no-repeat;
  transition: transform 160ms var(--ease-out);
}
/* 1 Klassentempel: Stern */
.mv-hint-1 { --hc: var(--el-all); --hi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1.2l2 4.3 4.7.5-3.5 3.2 1 4.6L8 11.5l-4.2 2.3 1-4.6L1.3 6l4.7-.5z'/%3E%3C/svg%3E"); }
/* 2 Verkaufsstände: Münze */
.mv-hint-2 { --hc: var(--el-earth); --hi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 1.5a6.5 6.5 0 1 1 0 13 6.5 6.5 0 0 1 0-13zm0 3a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7z'/%3E%3C/svg%3E"); }
/* 3 Werkstätten: Hammer */
.mv-hint-3 { --hc: var(--el-water); --hi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.2 5.6 1.3l2.6 2.5-1.4 1.4 7.6 7.4-1.8 1.8-7.5-7.5-1.4 1.4z'/%3E%3C/svg%3E"); }
/* 9 Transporte: Pfeil */
.mv-hint-9 { --hc: var(--el-air); --hi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 6.6h8.6L7.4 3.9l1.5-1.5L14.5 8l-5.6 5.6-1.5-1.5 2.7-2.7H1.5z'/%3E%3C/svg%3E"); }
.mv-far .leaflet-marker-icon.mv-hint::before, .mv-far .leaflet-marker-icon.mv-hint::after { transform: scale(0.6); }
.leaflet-marker-icon.mv-hint { cursor: pointer; }
.mv-switch .mv-glyph { width: 14px; height: 14px; vertical-align: -2px; }
.mv-switch .mv-hint::after, .mv-list .mv-hint::after { inset: 3px; }
@media (forced-colors: active) {
  .mv-hint::before { border-color: CanvasText; }
  .mv-hint::after { background: CanvasText; }
}
/* Varianten einer Herausforderung: Gegner, Dungeon, abweichender Text */
.chal-ph {
  padding: 0 0.3em; border-radius: var(--r-s);
  background: var(--n-250); color: var(--n-900); font-style: normal; font-weight: 600;
}
.chal-vars { border-collapse: collapse; min-width: 100%; font-size: var(--t-s); }
.chal-vars th, .chal-vars td { padding: 0.35rem 0.75rem 0.35rem 0; border-bottom: 1px solid var(--seam); text-align: left; vertical-align: middle; }
.chal-vars thead th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.chal-vars td { color: var(--n-700); }
.chal-vars td:last-child { max-width: 34rem; }
.chal-mob { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--n-900); font-weight: 500; }
.chal-mob img { width: 1.9rem; height: 1.9rem; object-fit: contain; flex: none; }
.chal-lv { color: var(--muted); white-space: nowrap; }
.chal-vars tr.hl td { background: var(--mark); color: var(--n-900); }
.chal-vars tr.hl td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.chal-vars .chg { background: var(--mark); color: var(--n-900); border-radius: 2px; padding: 0 0.15em; }
@media (forced-colors: active) {
  .chal-vars tr.hl td { outline: 1px solid Highlight; }
}

/* ---------- Zauber: Wurfregeln und Simulator (spellsim.js) ---------- */
.spell-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-top: 0.75rem; }
.cast-rules { flex: 1 1 14rem; margin: 0; color: var(--n-700); font-size: var(--t-s); }
.cast-rules:empty { display: none; }

/* Zauber eines Monsters, ausgeschrieben auf der Stufe des Monsters. Zwei Karten nebeneinander, wenn Platz ist;
   Karten einer Reihe sind gleich hoch, der Simulator-Knopf sitzt unten. */
.mob-spells.ms-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(24rem, 100%), 1fr));
  gap: 1rem 1.25rem; /* Karten einer Reihe gleich hoch, der Knopf sitzt unten */
}
.ms-card {
  display: flex; flex-direction: column; gap: 0.85rem;
  min-width: 0; padding: 1rem 1.1rem 1.1rem;
  background: color-mix(in srgb, var(--ground) 45%, var(--panel));
  border: 1px solid var(--seam); border-radius: var(--r-m);
}
/* Kopf: Symbol, Name mit Stufe, rechts Kosten und Reichweite */
/* Kennzahlen (AP, Reichweite, Kritisch) unter dem Namen, damit lange Namen Platz haben */
.ms-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 0.8rem; }
.ms-head .plate { grid-row: span 2; }
.ms-head .ms-key { grid-column: 2; margin-top: 0.45rem; }
.ms-head .plate { width: 3.25rem; height: 3.25rem; flex: none; }
.ms-head h3 { margin: 0; font: 600 var(--t-l)/1.15 var(--display); color: var(--n-900); }
.ms-head h3 a { color: inherit; text-decoration-color: transparent; text-underline-offset: 0.15em; }
@media (hover: hover) { .ms-head h3 a:hover { text-decoration-color: var(--accent); } }
.ms-meta { margin: 0.2rem 0 0; color: var(--muted); font-size: var(--t-xs); letter-spacing: 0.01em; }
.ms-key { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; }
.ms-key dd {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin: 0; padding: 0.3rem 0.6rem;
  font: 600 var(--t-m)/1 var(--data); font-variant-numeric: tabular-nums; color: var(--n-900);
  background: color-mix(in srgb, var(--n-250) 75%, transparent); border-radius: var(--r-s);
  white-space: nowrap; --ico: 1.15em;
}
.part .ms-lore {
  margin: 0; max-width: none;
  font: 400 var(--t-s)/1.5 var(--data); color: var(--n-700);
  white-space: pre-line;
}
/* Weitere Werte als Liste wie im Spiel-Tooltip: Beschriftung gedämpft, Wert hell, Symbol dahinter */
.spell-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: var(--t-s); line-height: 1.4; }
.spell-facts li { display: inline-flex; flex-wrap: nowrap; align-items: center; column-gap: 0.3rem; white-space: nowrap; --ico: 1.1em; }
.sf-k, .sf-rule { color: var(--muted); }
.sf-v { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; color: var(--n-900); font-variant-numeric: tabular-nums; }
/* Effekte; der kritische Treffer abgesetzt mit Linie */
.ms-fx { display: flex; flex-direction: column; gap: 0.3rem; }
.ms-card h4 {
  display: flex; align-items: center; gap: 0.4rem; margin: 0;
  font: 600 var(--t-xs)/1.3 var(--data); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--n-700); --ico: 1.15em; /* Kritisch-Symbol im selben Verhältnis zum Text wie im Kopf */
}
.ms-fx { padding: 0.5rem 0.8rem 0.55rem; border-radius: var(--r-m); }
.ms-fx:not(.ms-crit) { background: color-mix(in srgb, var(--n-250) 60%, transparent); }
.ms-fx.ms-crit { background: color-mix(in srgb, var(--n-250) 28%, transparent); }
/* Normale und kritische Effekte in derselben Schrift; die Felder unterscheiden sich nur in der Fläche */
.ms-fx .effects > li { font-size: var(--t-m); font-weight: 600; }
.ms-same { margin: 0; color: var(--muted); font-size: var(--t-s); }
.ms-card .effects, .ms-card .effects:has(li:nth-child(7)) { columns: auto; }
.ms-card [data-spell-sim] { align-self: flex-start; margin-top: auto; }

.sim {
  width: min(82rem, calc(100vw - 2rem)); max-width: none; max-height: calc(100dvh - 2rem);
  padding: 0; overflow: hidden;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--n-400); border-radius: var(--r-m);
}
.sim::backdrop { background: var(--scrim); }
.sim-frame { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }
.sim-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--seam); }
.sim-head [data-close] { margin-left: auto; }
.sim-icon { width: 2.75rem; height: 2.75rem; flex: none; }
.sim-name h2, .sim-head > h2 { margin: 0; font: 600 var(--t-l)/1.1 var(--display); color: var(--n-900); }
.sim-sub { margin: 0.1rem 0 0; color: var(--muted); font-size: var(--t-s); }
.sim-loading { padding: 1rem; margin: 0; color: var(--muted); }
.sim-body {
  display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1rem 1.5rem;
  padding: 1rem; overflow: auto; overscroll-behavior: contain;
}
.sim-main { min-width: 0; }
.sim-tools {
  display: inline-flex; flex-wrap: wrap; gap: 0.25rem; padding: 3px; margin-bottom: 0.5rem;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m);
}
.sim-tools button {
  min-height: 2.25rem; padding: 0 0.75rem; border: 0; border-radius: var(--r-s);
  background: none; color: var(--n-700); font: 600 var(--t-s)/1 var(--data); cursor: pointer;
}
.sim-tools button[aria-checked="true"] { background: var(--accent); color: var(--n-100); }
.sim-tools button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Schmal: jede Leiste volle Breite mit gleich breiten Segmenten; lange Beschriftungen brechen im Segment um statt die Leiste */
@media (max-width: 520px) {
  .ft-toolbar .sim-tools { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
  .ft-toolbar .sim-tools button { padding: 0.35rem 0.5rem; line-height: 1.15; text-align: center; text-wrap: balance; }
}
.sim-stage {
  padding: 0.5rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m);
  cursor: crosshair; touch-action: manipulation;
}
.sim-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sim-grid { max-height: min(66dvh, 42rem); }
.sim-status { min-height: 2.9em; margin: 0.5rem 0 0; color: var(--n-700); font-size: var(--t-s); }

.sim-side { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }
.sim-side h3 { margin: 0 0 0.4rem; font: 600 var(--t-m)/1.2 var(--display); color: var(--n-900); }
.sim-grade { margin: 0; }
.sim-facts { display: flex; gap: 1.75rem; margin: 0; }
.sim-facts dt { color: var(--muted); font-size: var(--t-xs); }
.sim-facts dd { margin: 0; font: 600 1.375rem/1.15 var(--data); color: var(--n-900); font-variant-numeric: tabular-nums; }
.sim-rules { margin: 0; color: var(--n-700); font-size: var(--t-s); }
.sim-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }

/* ---------- Resistenzen der Vogelscheuche (mobres.js), im Rahmen des Zauber-Simulators ---------- */
.mr { width: min(60rem, calc(100vw - 2rem)); border: 0; box-shadow: 0 18px 48px rgb(0 0 0 / 0.45); }
.mr-body {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 1.5rem;
  padding: 1rem; overflow: auto; overscroll-behavior: contain;
}
.mr-vals .dm-res th[scope="row"] { white-space: nowrap; }
.mr-body h3 { margin: 0 0 0.5rem; font: 600 var(--t-m)/1.2 var(--display); color: var(--n-900); }
.mr-find { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.mr-q {
  width: 100%; min-height: 2.5rem; padding: 0 0.75rem;
  background: var(--ground); color: var(--text); border: 1px solid var(--n-400); border-radius: var(--r-s); font: inherit;
}
.mr-q:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mr-pick:not(:empty) { display: grid; gap: 0.5rem; justify-items: start; margin-top: 0.75rem; padding: 0.75rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m); }
.mr-pick .note { margin: 0; }
.mr-card { display: flex; align-items: center; gap: 0.75rem; }
.mr-cardtxt { display: grid; }
.mr-name { font-weight: 600; color: var(--n-900); }
.mr-img { width: 2.75rem; height: 2.75rem; object-fit: contain; flex: none; }
.mr-grades { margin: 0; }
.mr-grades button { display: grid; justify-items: center; gap: 0.15rem; min-height: 2.75rem; padding: 0.3rem 0.65rem; }
.mr-grades small { font-size: var(--t-xs); font-weight: 500; opacity: 0.8; }
.mr-count { margin: 0.6rem 0 0.25rem; font-size: var(--t-xs); }
.mr-count:empty { display: none; }
.mr-hits { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--seam); max-height: 22rem; overflow: auto; }
.mr-hits .bd-row { align-items: center; padding: 0.45rem 0.6rem; }
.mr-hits .bd-row .mr-img { width: 2.25rem; height: 2.25rem; }
.mr-chips { display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; margin-top: 0.15rem; }
.mr-chip { display: inline-flex; align-items: center; gap: 0.2rem; color: var(--el); font: 600 var(--t-xs)/1.2 var(--data); font-variant-numeric: tabular-nums; --ico: 1em; }
.mr-vals .dm-res th .ico { --ico: 1.1em; display: inline-block; margin-right: 0.4rem; vertical-align: -0.2em; }
.mr-vals .dm-res .num { --num-bg: var(--panel); }
.mr-vals .note { margin: 0.5rem 0 0.25rem; font-size: var(--t-xs); }
@media (hover: hover) { .mr-hits .bd-row:hover { background: var(--n-150); } }
@media (max-width: 720px) {
  .mr-body { grid-template-columns: minmax(0, 1fr); }
  .mr-hits { max-height: 16rem; }
}
.ft-res { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.35rem 0.75rem; }
.ft-res .note b { font-weight: 600; color: var(--n-800); }
/* Werte der Resistenzen unter der Herkunft: Symbol, Prozent, feste Resistenz klein dahinter */
.ft-reslist {
  flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem;
  list-style: none; margin: 0.1rem 0 0; padding: 0;
}
.ft-reslist li {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font: 600 var(--t-s)/1.2 var(--data); color: var(--el, var(--n-900)); font-variant-numeric: tabular-nums; --ico: 1.15em;
}
.ft-reslist small { font-size: var(--t-xs); font-weight: 500; color: var(--n-700); }
.ft-reslist li.zero { opacity: 0.55; }

/* Fragezeichen mit Erklärung (Zeigen, Fokus oder Antippen); die Erklärung liegt unter der ganzen Zeile */
.ft-delayrow { position: relative; display: flex; align-items: center; gap: 0.4rem; }
.bd-box:has(.qtip) { overflow: visible; } /* sonst schneidet der Kasten die Erklärung ab */
.qtip { display: inline-flex; }
.qtip-btn {
  display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; padding: 0;
  border: 1px solid var(--n-400); border-radius: 50%; background: none; color: var(--n-700);
  font: 700 var(--t-xs)/1 var(--data); cursor: help;
}
.qtip-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qtip-box {
  position: absolute; left: 0; right: 0; top: calc(100% + 0.2rem); z-index: 5;
  padding: 0.6rem 0.75rem; border-radius: var(--r-m); background: var(--panel); color: var(--n-800);
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.38), 0 1px 3px rgb(0 0 0 / 0.3);
  font-size: var(--t-s); font-weight: 400; line-height: 1.4;
  visibility: hidden; opacity: 0; transition: opacity 120ms var(--ease-out), visibility 0s 120ms;
  pointer-events: none;
}
.qtip:hover .qtip-box, .qtip.open .qtip-box, .qtip-btn:focus-visible + .qtip-box {
  visibility: visible; opacity: 1; transition: opacity 120ms var(--ease-out);
}
@media (hover: hover) { .qtip-btn:hover { color: var(--n-900); border-color: var(--n-600); } }
@media (prefers-reduced-motion: reduce) { .qtip-box { transition: none; } }
.sim-stepper { display: inline-flex; align-items: center; gap: 0.4rem; }
.sim-stepper .bd-btn { min-width: 2rem; justify-content: center; }
.sim-stepper .bd-btn:disabled { opacity: 0.45; cursor: default; }
.sim-stepper output { min-width: 2.75rem; text-align: center; font: 600 var(--t-m)/1 var(--data); color: var(--n-900); }
.sim-bonus.off, .sim-bonus.off output { color: var(--muted); }
.sim-crit:has(input:disabled) { opacity: 0.5; }
.sim-fx .effects.effects { columns: auto; }
.sim-approx { margin: 0.4rem 0 0; font-size: var(--t-xs); }
.sim-map-name { margin: 0 0 0.45rem; color: var(--n-700); font-size: var(--t-s); }
.sim-legend { margin: 0; }
.sim-dot { display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 50%; border: 1px solid var(--n-100); }
.sim-dot.caster { background: var(--accent); }
.sim-dot.enemy { background: var(--n-800); }

/* Ebenen im Feld: Reichweite blau wie im Spiel, Wirkungsbereich rot, Ziel als Kontur */
.sim-range-ok { fill: var(--el-water); fill-opacity: 0.46; }
.sim-range-no { fill: var(--el-water); fill-opacity: 0.14; }
.sim-zone { fill: var(--el-fire); fill-opacity: 0.66; }
.sim-grid .sim-aim { fill: none; stroke: var(--n-900); stroke-width: 0.1; }
.sim-grid .sim-aim.bad { stroke: var(--el-fire); stroke-dasharray: 0.18 0.12; }
.sim-grid .sim-hover { fill: none; stroke: var(--n-900); stroke-width: 0.09; }
.sim-grid :is(.sim-range-ok, .sim-range-no, .sim-zone, .sim-aim, .sim-hover, .sim-tokens) { pointer-events: none; }
.sim-token ellipse { fill: rgb(0 0 0 / 0.4); }
.sim-token circle { stroke: var(--n-100); stroke-width: 0.06; }
.sim-token.caster circle { fill: var(--accent); }
.sim-token.enemy circle { fill: var(--n-800); }

@media (max-width: 52rem) {
  .sim { width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .sim-frame { height: 100%; max-height: 100dvh; }
  .sim-body { grid-template-columns: 1fr; padding: 0.75rem 1rem 1.25rem; }
  .sim-grid { max-height: 58dvh; }
}
@media (forced-colors: active) {
  .sim-range-ok, .sim-range-no { fill: Highlight; }
  .sim-zone { fill: Mark; }
  .sim-tools button[aria-checked="true"] { outline: 2px solid Highlight; }
}

/* ---------- Kampf-Simulator #/kampf (fight.js) ----------
   Eigene Seite wie der Set-Creator: Kopf mit Build-Wahl, links Spielfeld, Runde und Zauberleiste,
   rechts Kampf, Vogelscheuche, Ergebnis, Verlauf und Vergleich. */
body.fight-mode > main.layout, body.compare-mode > main.layout { display: none; }
.fight { background: var(--panel); }
.fight[hidden] { display: none; }
@media (min-width: 861px) {
  .fight { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.ft-main { max-width: 100rem; margin-inline: auto; container: ft / inline-size; padding: 2rem clamp(1rem, 4vw, 3.5rem) 4rem; }
.ft-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 1rem 1.5rem; }
.ft-title { margin: 0; font: 600 var(--t-name)/1.05 var(--display); color: var(--n-900); }
.ft-sub { margin: 0.35rem 0 0; color: var(--n-700); max-width: 60ch; }
.ft-build { display: grid; gap: 0.35rem; justify-items: end; }
.ft-build label { display: flex; align-items: center; gap: 0.5rem; font: italic 500 var(--t-m)/1 var(--display); color: var(--n-700); }
.ft-build select {
  max-width: 22rem; padding: 0.35rem 0.5rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900);
}
.ft-binfo { margin: 0; font-size: var(--t-s); color: var(--muted); text-align: right; }
.ft-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(19rem, 25rem); gap: 1.25rem; align-items: start; }
.ft-left { min-width: 0; display: grid; gap: 0.6rem; }
.ft-side { display: grid; gap: 0.9rem; min-width: 0; }
@container ft (max-width: 62rem) {
  .ft-grid { grid-template-columns: minmax(0, 1fr); }
  .ft-head { grid-template-columns: minmax(0, 1fr); }
  .ft-build { justify-items: start; }
  .ft-binfo { text-align: left; }
}
.ft-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; }
.ft-stage { min-height: 12rem; }
.ft-left .sim-status { margin: 0; min-height: 1.5em; }
.ft-map { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; margin: 0.2rem 0 0; font-size: var(--t-s); color: var(--n-700); }
.ft-map span { margin-right: auto; }

/* HUD auf dem Kampffeld (fight.js renderTurnbar/renderBuffs): Tafeln in den unteren Ecken über dem Feld.
   Die Buff-Tafel ist reine Anzeige und lässt Klicks zum Feld durch; die Runden-Tafel hat Knöpfe. Auf schmalen
   Feldern stehen beide unter dem Feld statt darauf. */
.ft-field { position: relative; container: ftf / inline-size; }
.ft-hud {
  position: absolute; bottom: 0.6rem; z-index: 2;
  padding: 0.5rem 0.6rem; border: 1px solid var(--seam); border-radius: var(--r-m);
  background: color-mix(in srgb, var(--n-100) 86%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.32);
}
.ft-hud[hidden] { display: none; }
.ft-hud p { margin: 0; }
.ft-hud-cap { margin: 0 0 0.3rem; font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--n-700); }

/* Unten rechts: AP-Stern, BP-Raute, Runde, Rückgängig, Runde beenden */
.ft-turn { right: 0.6rem; display: grid; justify-items: end; gap: 0.4rem; }
.ft-pts-row { display: flex; gap: 0.7rem; }
.ft-pts { display: inline-flex; align-items: center; gap: 0.15rem; font: 600 var(--t-s)/1 var(--data); color: var(--muted); font-variant-numeric: tabular-nums; }
.ft-tline { display: flex; align-items: center; gap: 0.4rem; }
.ft-round { margin-right: 0.25rem !important; font-size: var(--t-s); color: var(--muted); white-space: nowrap; }
.ft-round b { font: 700 var(--t-m)/1 var(--data); color: var(--n-900); }
.ft-undo, .ft-end {
  display: inline-grid; place-items: center; height: 2rem; border-radius: var(--r-s); cursor: pointer;
  transition: background-color 120ms, border-color 120ms, transform 120ms var(--ease-out);
}
.ft-undo { width: 2rem; padding: 0; background: var(--panel); border: 1px solid var(--seam); color: var(--n-800); }
.ft-undo svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ft-end { padding: 0 0.85rem; background: var(--accent); border: 1px solid var(--accent); font: 700 var(--t-s)/1 var(--data); color: var(--n-100); white-space: nowrap; }
.ft-undo:active:not(:disabled), .ft-end:active:not(:disabled) { transform: scale(0.96); }
.ft-undo:disabled, .ft-end:disabled { opacity: 0.4; cursor: default; }
.ft-undo:focus-visible, .ft-end:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .ft-undo:hover:not(:disabled) { border-color: var(--n-500); background: var(--n-250); }
  .ft-end:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 85%, var(--n-900)); }
}

/* Unten links: Buffs mit Zauber-Icon, Stapel, Herkunft und übrigen Runden */
.ft-buffs { left: 0.6rem; width: min(17rem, 42%); max-height: calc(100% - 1.2rem); overflow: hidden; pointer-events: none; }
.ft-buffs ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.ft-buffs li { display: flex; align-items: center; gap: 0.5rem; }
.ft-bi { position: relative; flex: none; width: 1.8rem; height: 1.8rem; }
.ft-bi img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: var(--r-s); }
.ft-stack {
  position: absolute; right: -0.3rem; bottom: -0.25rem; padding: 0.05rem 0.2rem; border-radius: 999px;
  background: var(--n-900); font: 700 0.625rem/1 var(--data); color: var(--n-100);
}
.ft-bt { flex: 1; min-width: 0; display: grid; font-size: var(--t-xs); line-height: 1.3; }
.ft-bt .n { font-weight: 600; color: var(--n-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-btotal { font-weight: 700; color: var(--accent); }

/* Würfel-Modus über dem Ergebnis (fight.js ROLLS): Umschalter, bei Zufall „Neu würfeln“ */
.ft-rollrow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.ft-roll { margin: 0; }
.ft-roll button { min-height: 1.85rem; padding: 0 0.55rem; font-size: var(--t-xs); }
.ft-rollrow .bd-btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.ft-dice { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.4; }
.ft-dice circle { fill: currentColor; stroke: none; }
.cb-pad > .ft-rollhint { margin: 0.35rem 0 0.6rem; font-size: var(--t-xs); }
.ft-bt small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-bleft {
  flex: none; min-width: 1.3rem; padding: 0.15rem 0.25rem; border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 700 var(--t-xs)/1 var(--data); color: var(--n-900); text-align: center; font-variant-numeric: tabular-nums;
}

/* Schaden-Tooltip am Zielfeld (fight.js damageTip): folgt dem Zielfeld, fängt keine Klicks ab */
.ft-dtip {
  position: absolute; left: 0; top: 0; z-index: 3; width: max-content; max-width: 16rem;
  padding: 0.5rem 0.65rem; border: 1px solid var(--seam); border-radius: var(--r-m);
  background: var(--panel); box-shadow: 0 10px 28px rgb(0 0 0 / 0.38), 0 1px 3px rgb(0 0 0 / 0.3);
  font-size: var(--t-s); line-height: 1.3; pointer-events: none;
}
.ft-dtip[hidden] { display: none; }
.ft-dtip p { margin: 0; }
.ft-dtip .ft-dhead { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.35rem; }
.ft-dhead img { width: 1.5rem; height: 1.5rem; object-fit: contain; border-radius: var(--r-s); }
.ft-dhead span { font-weight: 600; color: var(--n-900); }
.ft-dhead b { margin-left: auto; padding-left: 0.6rem; font: 700 var(--t-m)/1 var(--data); color: var(--accent); }
.ft-dtab { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.ft-dtab thead th { padding: 0 0 0.15rem 0.7rem; font-size: var(--t-xs); font-weight: 600; color: var(--muted); text-align: right; }
.ft-dtab tbody th { --ico: 1.05em; display: flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0; font-weight: 500; color: var(--n-800); text-align: left; }
.ft-dtab td { padding: 0.1rem 0 0.1rem 0.7rem; font: 700 var(--t-s)/1.2 var(--data); color: var(--el); text-align: right; white-space: nowrap; }
.ft-dtab td.k { color: color-mix(in srgb, var(--el) 75%, var(--n-900)); }
.ft-dtip .ft-dfacts { margin-top: 0.35rem; padding-top: 0.3rem; border-top: 1px solid var(--seam); font-size: var(--t-xs); color: var(--muted); }
.ft-dtip .ft-dlife { margin-top: 0.2rem; font-size: var(--t-xs); color: var(--n-700); }
.ft-dlife b { color: var(--n-900); }
.ft-dlife b.bad { color: var(--el-fire); }

@container ftf (max-width: 40rem) {
  .ft-hud { position: static; width: auto; max-height: none; margin-top: 0.5rem; box-shadow: none; }
  .ft-turn { grid-template-columns: auto 1fr; align-items: center; }
  .ft-tline { justify-content: flex-end; }
}

/* Zauberleiste wie im Spiel: Kacheln mit AP-Kosten, je Platz der gewählte Zauber */
.ft-bar { display: flex; flex-wrap: wrap; gap: 0.55rem 0.5rem; padding: 0.6rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m); }
.ft-slot { position: relative; }
.ft-slot.weapon { display: flex; gap: 0.5rem; margin-right: 0.5rem; padding-right: 0.65rem; border-right: 1px solid var(--seam); }
.ft-spell {
  position: relative; display: block; width: 3.25rem; height: 3.25rem; padding: 0.15rem; cursor: pointer;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  transition: border-color 120ms, transform 120ms var(--ease-out);
}
.ft-spell img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* AP-Stern und BP-Raute aus dem Kampf-HUD des Spiels mit der Zahl darin (fight.js apStar/mpGem). Der Stern hat
   seinen Schwerpunkt etwas unter der Mitte: die Zahl rückt dort ein wenig nach unten. */
.ap-star, .mp-gem {
  --s: 1.75rem; --ink: #1d2a6b;
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--s); height: var(--s);
  background: url("/images/characteristics/2x/sprite_paCounter.png") center / contain no-repeat;
  font: 800 calc(var(--s) * 0.42)/1 var(--data); color: #fff; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 2px var(--ink), 0 1px 1px var(--ink), 0 0 1px var(--ink);
}
.ap-star { padding-top: calc(var(--s) * 0.07); }
.mp-gem { --ink: #1f5a12; background-image: url("/images/characteristics/2x/sprite_pmCounter.png"); }
.ap-star.big, .mp-gem.big { --s: 2.5rem; }
.ft-spell .ap-star { position: absolute; left: -0.65rem; bottom: -0.65rem; }
.ft-spell.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.ft-spell[aria-disabled="true"] img { opacity: 0.35; filter: grayscale(0.8); }
.ft-spell:active { transform: scale(0.96); }
.ft-spell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ft-slot.locked .ft-spell { border-style: dashed; }

/* Auswahl der Zauberleiste: Liste wie auf der Klassenseite (.br-grid, .br-pair, .br-cell), aufklappbar */
.ft-pick { margin-top: 0.4rem; }
.ft-pick > summary {
  display: flex; align-items: baseline; gap: 0.75rem; padding: 0.3rem 0 0.35rem; margin-bottom: 0.45rem;
  border-bottom: 1px solid var(--seam); list-style: none; cursor: pointer;
}
.ft-pick > summary::-webkit-details-marker { display: none; }
.ft-pick > summary::before {
  content: ""; align-self: center; width: 0.45rem; height: 0.45rem; margin-left: 0.15rem;
  border-right: 2px solid var(--n-700); border-bottom: 2px solid var(--n-700); transform: rotate(-45deg);
}
.ft-pick[open] > summary::before { transform: rotate(45deg) translate(-0.1rem, -0.1rem); }
.ft-pick > summary h2 { margin: 0; font: 600 var(--t-l)/1.15 var(--display); color: var(--n-900); }
.ft-pick > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ft-pick .br-cell.ft-later .br-cell-icon img { opacity: 0.45; filter: grayscale(0.7); }
.ft-pick-sub { margin: 1.1rem 0 0.5rem; font: 600 var(--t-m)/1.2 var(--display); color: var(--n-900); }
.ft-pick-sub .note { margin-left: 0.5rem; font: 400 var(--t-s)/1.3 var(--data); }

/* Feld: Laufweite grün, Weg kräftiger; die Vogelscheuche rot (der Zaubernde ist Messing) */
.sim-move { fill: var(--el-air); fill-opacity: 0.22; }
.sim-path { fill: var(--el-air); fill-opacity: 0.6; }
.sim-grid :is(.sim-move, .sim-path) { pointer-events: none; }
.sim-token.dummy circle { fill: var(--el-fire); }

/* Vogelscheuche: Lebensbalken */
.ft-hpbar { height: 0.6rem; background: var(--panel); border: 1px solid var(--seam); border-radius: 2px; overflow: hidden; }
.ft-hpbar i { display: block; height: 100%; background: var(--el-fire); }

/* Verlauf je Runde */
.ft-log { list-style: none; margin: 0; padding: 0.2rem 0 0.4rem; max-height: 26rem; overflow-y: auto; }
.ft-log > li + li { border-top: 1px solid var(--seam); }
.ft-lt { display: flex; align-items: baseline; gap: 0.6rem; margin: 0; padding: 0.45rem 0.75rem 0.2rem; font-size: var(--t-xs); color: var(--muted); }
.ft-lt b { font: 600 var(--t-s)/1.2 var(--data); color: var(--n-900); }
.ft-lt .v, .ft-la .v { margin-left: auto; font: 600 var(--t-s)/1.2 var(--data); font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; }
.ft-log ul { list-style: none; margin: 0; padding: 0 0.75rem 0.4rem; }
.ft-la { display: flex; align-items: center; gap: 0.6rem; padding: 0.25rem 0; font-size: var(--t-s); }
.ft-la + .ft-la { border-top: 1px dashed color-mix(in srgb, var(--seam) 70%, transparent); }
/* Zauber-Icon (bzw. Fußspur/Tropfen) vor jeder Zeile */
.ft-li {
  flex: none; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; padding: 0.1rem;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
}
.ft-li img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ft-li svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }
.ft-la.move .ft-li { color: var(--el-air); background: none; border-style: dashed; }
.ft-la.poison .ft-li { color: var(--el, var(--el-air)); background: none; border-style: dashed; }
.ft-la.bad .ft-li img { opacity: 0.4; filter: grayscale(0.9); }
.ft-la.move .v { font-weight: 500; color: var(--muted); }
.ft-la .n { flex: 1 1 auto; min-width: 0; font-weight: 500; color: var(--n-800); }
/* Schaden je Element in der Farbe des Elements */
.ft-dmg { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.15rem 0.55rem; }
.ft-el { --ico: 1.05em; display: inline-flex; align-items: center; gap: 0.22rem; color: var(--el); font-weight: 700; }
.ft-la .n small { display: block; font-size: var(--t-xs); font-weight: 400; color: var(--muted); }
.ft-la .v { color: var(--n-900); }
.ft-la.bad .n { color: var(--n-600); }
.ft-la.bad .n small { color: var(--el-fire); font-weight: 600; }

/* Bausteine für Kampf, Ergebnis und Vergleich */
.cb-pad { padding: 0.6rem 0.75rem 0.75rem; }
.cb-pad > p { margin: 0 0 0.4rem; }
.cb-rotrow { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.6rem 0.75rem; }
.cb-rotrow input {
  flex: 1 1 12rem; min-width: 0; padding: 0.35rem 0.5rem; background: var(--panel);
  border: 1px solid var(--seam); border-radius: var(--r-s); font: 600 var(--t-s)/1.2 var(--data); color: var(--n-900);
}
.cb-saved { list-style: none; margin: 0; padding: 0 0.4rem 0.45rem; max-height: 12rem; overflow-y: auto; }
.cb-saved li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-top: 1px solid var(--seam); }
.cb-load { display: grid; padding: 0.4rem 0.35rem; background: none; border: 0; text-align: left; cursor: pointer; border-radius: var(--r-s); }
.cb-load .n { font-weight: 600; color: var(--n-900); }
.cb-load .sub { font-size: var(--t-xs); color: var(--muted); }
.cb-load:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cb-dummy { display: grid; gap: 0.5rem; }
.cb-dummy label:not(.switch) { display: flex; align-items: center; gap: 0.6rem; font-weight: 500; color: var(--n-800); }
.cb-dummy input[type="number"] {
  width: 8rem; padding: 0.3rem 0.45rem; text-align: right; background: var(--panel);
  border: 1px solid var(--seam); border-radius: var(--r-s); font: 600 var(--t-s)/1.2 var(--data); color: var(--n-900);
}
.cb-dummy .note { margin: 0; font-size: var(--t-xs); }
.cb-big { margin: 0 0 0.15rem; font: 500 var(--t-m)/1.3 var(--data); color: var(--n-700); }
.cb-big span { font: 700 var(--t-l)/1.1 var(--data); font-variant-numeric: tabular-nums; color: var(--accent); margin-right: 0.3rem; }
.cb-result .bad, .cb-table .bad { color: var(--el-fire); }
.cb-bars { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.25rem; }
.cb-bars li { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) 4.5rem; align-items: center; gap: 0.5rem; font-size: var(--t-xs); color: var(--muted); }
.cb-bars .bar { height: 0.55rem; background: var(--panel); border-radius: 2px; overflow: hidden; }
.cb-bars .bar i { display: block; height: 100%; background: var(--accent); }
.cb-bars .v { text-align: right; font: 600 var(--t-s)/1 var(--data); font-variant-numeric: tabular-nums; color: var(--n-900); }
.cb-table { width: 100%; border-collapse: collapse; font-size: var(--t-s); }
.cb-table th, .cb-table td { padding: 0.4rem 0.75rem; text-align: right; border-bottom: 1px solid var(--seam); white-space: nowrap; }
.cb-table thead th { font: 600 var(--t-xs)/1.2 var(--data); color: var(--n-600); }
.cb-table thead th:first-child { text-align: left; }
.cb-table tbody th { text-align: left; font-weight: 600; color: var(--n-900); white-space: normal; }
.cb-table tbody th small { display: block; font-weight: 400; font-size: var(--t-xs); color: var(--muted); white-space: normal; min-width: 14rem; }
.cb-table tbody th small.bad { color: var(--el-fire); }
.ft-swap { border-bottom: 1px solid var(--seam); }
.ft-swap .note { margin: 0.4rem 0 0; font-size: var(--t-xs); }
.cb-table td { font-variant-numeric: tabular-nums; color: var(--n-800); }
.cb-table td small { color: var(--muted); }
.cb-table .up { color: var(--el-air); }
.cb-table .down { color: var(--el-fire); }
.cb-table tr.cur th, .cb-table tr.cur td { color: var(--accent); }
.cb-table tr:last-child th, .cb-table tr:last-child td { border-bottom: 0; }
.cb-compare { overflow-x: auto; }
.fight a.bd-btn { text-decoration: none; }
.fight a { text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }

/* Feld oder Liste: was nur zu einer Ansicht gehört */
.fight:not(.ft-list) .ft-onlist, .fight.ft-list .ft-onfield { display: none !important; }

/* Ablauf als Liste: je Runde eine Zeile, Züge als Chips */
.ft-seq { display: grid; gap: 0.6rem; }
.ft-seqlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.ft-sturn { padding: 0.5rem 0.6rem 0.6rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m); }
.ft-sturn.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--ground)); }
.ft-sthead { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.45rem; }
.ft-stpick {
  padding: 0.2rem 0.5rem; background: none; border: 1px solid transparent; border-radius: var(--r-s);
  font: 600 var(--t-s)/1.2 var(--data); color: var(--n-900); cursor: pointer;
}
.ft-stpick[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.ft-stpick:focus-visible, .ft-strm:focus-visible, .ft-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ft-stap { display: inline-flex; align-items: center; gap: 0.15rem; font: 600 var(--t-xs)/1 var(--data); color: var(--muted); font-variant-numeric: tabular-nums; }
.ft-stap .ap-star { --s: 1.5rem; }
.ft-sthead .v { margin-left: auto; font: 600 var(--t-s)/1.2 var(--data); font-variant-numeric: tabular-nums; color: var(--accent); }
.ft-strm {
  width: 1.75rem; height: 1.75rem; padding: 0; background: none; border: 1px solid var(--seam); border-radius: var(--r-s);
  font-size: 1rem; line-height: 1; color: var(--n-700); cursor: pointer;
}
.ft-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ft-chip {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.5rem; max-width: 100%; padding: 0.2rem 0.5rem 0.2rem 0.25rem;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: inherit; font-size: var(--t-s); font-weight: 500; line-height: 1.2; color: var(--n-800); text-align: left; cursor: pointer;
}
.ft-chip img { flex: none; width: 2rem; height: 2rem; object-fit: contain; border-radius: var(--r-s); }
.ft-chip svg { flex: none; width: 1.1rem; height: 1.1rem; margin: 0 0.35rem; fill: currentColor; }
.ft-chip .n { display: grid; min-width: 0; }
.ft-chip .n small { font-size: var(--t-xs); color: var(--muted); }
.ft-chip .v { font: 600 var(--t-s)/1.2 var(--data); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ft-chip .v small { font-weight: 400; font-size: var(--t-xs); color: var(--muted); }
.ft-chip .x { margin-left: 0.1rem; font-size: 1rem; line-height: 1; color: var(--n-600); }
.ft-chip.bad { border-color: color-mix(in srgb, var(--el-fire) 55%, var(--seam)); }
.ft-chip.bad img { opacity: 0.4; filter: grayscale(0.9); }
.ft-chip.bad .n small { color: var(--el-fire); font-weight: 600; }
.ft-chip.move { color: var(--el-air); border-style: dashed; }
.ft-chip.move .n { color: var(--n-700); }
.ft-chip.item, .ft-chip.poison { cursor: default; border-style: dashed; background: none; }
.ft-chip.poison { color: var(--el, var(--el-air)); }
.ft-chip.poison .n { color: var(--n-800); }
.ft-chip-empty { align-self: center; padding: 0.4rem 0.2rem; font-size: var(--t-s); color: var(--muted); }
.ft-sbuffs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; margin: 0; }
.ft-sbuffs .ft-hud-cap { margin: 0 0.2rem 0 0; }
.ft-sbuff { display: inline-flex; align-items: center; gap: 0.3rem; font-size: var(--t-xs); color: var(--n-800); }
.ft-sbuff img { width: 1.35rem; height: 1.35rem; object-fit: contain; border-radius: var(--r-s); }
.ft-seqfoot { display: flex; justify-content: flex-end; align-items: center; gap: 0.4rem; }

/* Waffen unter der Zauberauswahl */
.ft-weap { margin-top: 1rem; display: grid; gap: 0.5rem; }
.ft-wcap { margin: 0; font: 600 var(--t-m)/1.2 var(--display); color: var(--n-900); }
.ft-weap .br-hint { margin: 0; }
.ft-wlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.ft-wlist li { display: flex; align-items: center; gap: 0.55rem; padding: 0.3rem 0.5rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s); }
.ft-wlist li small { margin-left: auto; font-size: var(--t-xs); color: var(--muted); }
.ft-wlist li .bd-link { margin-left: auto; }
.ft-wlist img, .ft-wfrom img, .ft-wpick img { flex: none; width: 1.9rem; height: 1.9rem; object-fit: contain; }
.ft-wlist .n { font-weight: 600; color: var(--n-900); }
.ft-wlist .ap-star, .ft-wfrom .ap-star { --s: 1.45rem; }
.ft-wfrom { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: var(--t-s); color: var(--n-700); }
.ft-wfrom > span { margin-right: 0.2rem; }
.ft-wfrom .bd-btn { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.4rem; }
.ft-wsearch { display: grid; gap: 0.3rem; max-width: 28rem; }
.ft-wsearch label { font-size: var(--t-s); font-weight: 500; color: var(--n-700); }
.ft-wsearch input {
  padding: 0.4rem 0.55rem; background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 500 var(--t-s)/1.2 var(--data); color: var(--n-900);
}
.ft-wsearch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ft-wres { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; }
.ft-wres .note { font-size: var(--t-xs); padding: 0.2rem 0; }
.ft-wpick {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.55rem; align-items: center; width: 100%;
  padding: 0.25rem 0.4rem; background: none; border: 1px solid transparent; border-radius: var(--r-s); text-align: left; cursor: pointer;
}
.ft-wpick img { grid-row: span 2; }
.ft-wpick .n { font-weight: 600; color: var(--n-900); }
.ft-wpick small { font-size: var(--t-xs); color: var(--muted); }
.ft-wpick:disabled { opacity: 0.5; cursor: default; }
.ft-wpick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Item-Sonderwirkungen */
.ft-fxpad { display: grid; gap: 0.55rem; }
.ft-fxpad .note { margin: 0; font-size: var(--t-xs); }
.ft-fx { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.ft-fx li { display: grid; grid-template-columns: 1.1rem 2rem minmax(0, 1fr); align-items: start; gap: 0.5rem; padding: 0.35rem 0; border-top: 1px solid var(--seam); }
.ft-fx li:first-child { border-top: 0; }
.ft-fx input[type="checkbox"] { margin: 0.55rem 0 0; width: 1rem; height: 1rem; accent-color: var(--accent); }
.ft-fxi img { display: block; width: 2rem; height: 2rem; object-fit: contain; }
.ft-fxt { display: grid; gap: 0.1rem; font-size: var(--t-s); cursor: pointer; }
.ft-fxt .n { font-weight: 600; color: var(--n-900); }
.ft-fxt .sub { font-weight: 400; color: var(--n-700); }
.ft-fxt small { font-size: var(--t-xs); line-height: 1.4; color: var(--muted); }
.ft-fx li.off .ft-fxt { cursor: default; }
.ft-fx li.off .ft-fxt .n { color: var(--n-700); }
.ft-fx li.off img { opacity: 0.5; filter: grayscale(0.7); }
.ft-fx input:disabled + .ft-fxi img, .ft-fx input:disabled ~ .ft-fxt { opacity: 0.55; }

@media (hover: hover) and (pointer: fine) {
  .ft-spell:not([aria-disabled="true"]):hover { border-color: var(--accent); }
  .cb-load:hover { background: var(--n-250); }
  .ft-chip:is(button):hover { border-color: var(--el-fire); }
  .ft-chip:is(button):hover .x { color: var(--el-fire); }
  .ft-stpick:hover { border-color: var(--seam); }
  .ft-strm:hover { border-color: var(--el-fire); color: var(--el-fire); }
  .ft-wpick:not(:disabled):hover { background: var(--n-250); }
}
@media (prefers-reduced-motion: reduce) { .ft-spell { transition: none; } }
@media (forced-colors: active) {
  .ft-spell.on { outline: 2px solid Highlight; }
  .sim-move, .sim-path { fill: Highlight; }
  .ft-sturn.on, .ft-stpick[aria-pressed="true"] { outline: 2px solid Highlight; }
}

/* ---------- Item-Tooltip (itemtip.js): folgt dem Zeiger, nur mit Maus ---------- */
.itip {
  position: fixed; left: 0; top: 0; z-index: 60;
  width: max-content; max-width: min(22rem, calc(100vw - 1rem));
  padding: 0.7rem 0.85rem 0.6rem;
  background: var(--panel); color: var(--text);
  border: 0; border-radius: var(--r-m); /* ohne Rahmen: der Schatten setzt den Tooltip ab */
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.38), 0 1px 3px rgb(0 0 0 / 0.3);
  font-size: var(--t-s); line-height: 1.35;
  pointer-events: none;
  animation: itip-in 120ms var(--ease-out);
}
.itip[hidden] { display: none; }
@keyframes itip-in { from { opacity: 0; } }
.itip p { margin: 0; }
.itip-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; }
.itip-head .plate { width: 2.6rem; height: 2.6rem; }
.itip-name { font: 600 var(--t-m)/1.2 var(--display); color: var(--n-900); text-wrap: balance; }
.itip-sub, .itip-weapon, .itip-none { font-size: var(--t-xs); color: var(--muted); }
.itip-set { font-size: var(--t-xs); font-weight: 600; color: var(--accent); }
.itip .itip-weapon { margin-top: 0.15rem; }
.itip .effects { columns: auto; margin-top: 0.45rem; padding-top: 0.4rem; border-top: 1px solid var(--seam); }
/* Exo abgesetzt, gestrichelt wie der Rand des Platzes */
.itip .itip-exo { border-top-style: dashed; }
.itip .effects > li { margin-inline: 0; padding: 0.08rem 0; grid-template-columns: 1em minmax(0, 1fr); }
.itip .effects > li > :nth-child(n + 3) { display: none; } /* Ziele u. Ä. rechts: im Tooltip zu eng */
.itip .fx-ref { pointer-events: none; }
/* Beschreibung eines ausgelösten Zaubers: unter dem Effekt, in der Textspalte */
.itip .effects > li.itip-desc { padding: 0 0 0.25rem; font-size: var(--t-xs); line-height: 1.4; color: var(--n-700); white-space: pre-line; }
.itip .itip-none { margin-top: 0.4rem; }
.itip .itip-cond { margin-top: 0.45rem; padding-top: 0.4rem; border-top: 1px solid var(--seam); font-size: var(--t-xs); color: var(--n-700); }
.itip-cond b { color: var(--n-900); }
.itip .itip-kicker { margin-bottom: 0.3rem; font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.itip-hint { color: var(--n-700); }
.itip-range { font-weight: 400; font-size: var(--t-xs); color: var(--muted); white-space: nowrap; }
.itip .itip-flag { margin-top: 0.4rem; font-size: var(--t-xs); font-weight: 600; color: var(--muted); }
/* Erfolge und Quests (app.js: achTipHtml, questTipHtml) */
.itip-lore { margin-top: 0.1rem !important; font: 400 var(--t-s)/1.4 var(--data); color: var(--n-700); }
.itip .itip-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.9rem; margin-top: 0.5rem; color: var(--n-700); }
.itip-goals { list-style: none; margin: 0.3rem 0 0; padding: 0; font-size: var(--t-xs); line-height: 1.35; color: var(--n-800); }
.itip-goals li { display: grid; grid-template-columns: 0.95rem minmax(0, 1fr); align-items: center; column-gap: 0.4rem; padding: 0.06rem 0; }
.itip-mark { width: 0.8rem; height: 0.8rem; border: 1px solid var(--n-500); border-radius: 2px; }
.itip-mark .chk { display: block; width: 100%; height: 100%; padding: 0; border: 0; stroke: var(--ground); stroke-width: 2.6; }
.itip-goals li.on .itip-mark { background: var(--accent); border-color: var(--accent); }
.itip-goals li.on > span:last-child { color: var(--n-700); }
.itip-goals .itip-more { color: var(--muted); }
.itip-goals .itip-more span:first-child { width: auto; border: 0; }
.itip-chal { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.55rem; align-items: start; margin-top: 0.5rem; }
.itip-chal .chal-ico { width: 1.7rem; height: 1.7rem; }
.itip-chal .chal-ico img { width: 1.2rem; height: 1.2rem; }
.itip-chal p { font-size: var(--t-xs); line-height: 1.4; color: var(--n-700); }
.itip-chal b { color: var(--n-900); }
.itip-res { margin-top: 0.3rem !important; gap: 0.25rem 0.7rem !important; font-size: var(--t-xs); }
/* Monster-Tooltip (app.js: monsterTipHtml) */
/* Name mittig neben der Figur (unten bündig wirkte er zu tief) */
.mt-head { align-items: center; }
.mt-fig { flex: none; display: grid; place-items: end center; width: 4rem; height: 4rem; }
.mt-fig img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 2px 3px rgb(0 0 0 / 0.55)); }
.itip .mt-head .itip-kicker { margin-bottom: 0.1rem; }
.itip .mt-ctx {
  margin-top: 0.45rem; padding: 0.35rem 0.55rem; border-radius: var(--r-s);
  background: var(--mark); font-size: var(--t-xs); color: var(--n-700);
}
.mt-ctx b { color: var(--n-900); }
.mt-ctx .mt-pct { color: var(--accent); }
/* Monster-Tooltip: feste Breite, damit Werte und Resistenzen als Leisten die Breite füllen */
.itip:has(.mt-head) { width: 20rem; }
/* Werte auf einer gemeinsamen Fläche ohne Rahmen (wie die Monsterkarte), Resistenzen frei darunter */
.mt-stats { display: flex; margin-top: 0.6rem; border-radius: var(--r-s); background: var(--n-250); }
.mt-st {
  flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  min-height: 2rem; padding: 0 0.5rem; --ico: 1.05rem;
}
.mt-st.mt-hp { flex-grow: 1.6; }
.mt-st b { font: 600 var(--t-s)/1 var(--data); color: var(--n-900); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.mt-resline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 0.5rem; }
.mt-res { min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 0.2rem; --ico: 0.95rem; }
.mt-res b { font: 600 var(--t-xs)/1 var(--data); color: var(--n-900); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.mt-res.neg b { color: var(--neg); }
.mt-sec { margin-top: 0.6rem; }
.itip .mt-h {
  display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.45rem;
  font: 600 0.6875rem/1 var(--data); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.itip .mt-h::after { content: ""; flex: 1; height: 1px; background: var(--seam); }
/* Zauber: schlichte Zeilen mit Symbol und Name; bei vielen nur die Symbole */
.mt-spells { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.mt-spell { display: inline-flex; align-items: center; gap: 0.5rem; }
.mt-spell img { width: 1.5rem; height: 1.5rem; border-radius: var(--r-s); object-fit: contain; }
.mt-spells:has(.named) { flex-direction: column; gap: 0.2rem; }
.mt-spell.named { min-width: 0; }
.mt-spell.named span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-xs); font-weight: 500; color: var(--n-800); }
.mt-drops { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.25rem; }
.mt-drop { display: flex; flex-direction: column; overflow: hidden; background: var(--n-100); border: 1px solid var(--seam); border-radius: var(--r-s); }
.mt-drop img { width: 100%; aspect-ratio: 1; padding: 14%; object-fit: contain; }
/* Prozentzeile mit fester Höhe, mittig: kurze und lange Werte (1 %, 8,04 %) stehen auf derselben Linie */
.mt-drop i {
  display: flex; align-items: center; justify-content: center; height: 1.15rem;
  font: 600 0.6875rem/1 var(--data); font-style: normal; color: var(--n-700); white-space: nowrap;
  letter-spacing: -0.01em; font-variant-numeric: lining-nums tabular-nums;
}
.itip .mt-where { display: flex; align-items: flex-start; gap: 0.35rem; margin-top: 0.55rem; font-size: var(--t-xs); color: var(--n-700); }
.mt-where svg { flex: none; width: 0.9rem; height: 0.9rem; margin-top: 0.05rem; fill: none; stroke: var(--muted); stroke-width: 1.4; }
.mt-where em { font-style: normal; color: var(--muted); }
/* Item-Tooltip: Herkunft und Verwendung (itemtip.js: originHtml) */
.itip-origin { margin-top: 0.5rem; padding-top: 0.4rem; border-top: 1px solid var(--seam); font-size: var(--t-xs); line-height: 1.4; color: var(--n-700); }
.itip .itip-origin-t { margin-bottom: 0.1rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.itip-origin b { color: var(--n-900); font-weight: 600; }
.itip-more-n { color: var(--muted); white-space: nowrap; }
.itip .itip-lore + .itip-meta, .itip .itip-meta + .itip-lore { margin-top: 0.45rem !important; }
.itip-done { margin-left: auto; font-size: var(--t-xs); font-weight: 600; color: var(--muted); }
/* Karte als Bild (Koordinaten mit Karten-ID): breiter als andere Tooltips */
.itip:has(.itip-map) { max-width: min(30rem, calc(100vw - 1rem)); padding: 0.4rem 0.4rem 0.45rem; }
.itip-map {
  position: relative; width: min(29rem, calc(100vw - 2rem)); aspect-ratio: 1280 / 900;
  border-radius: var(--r-s); overflow: hidden; background: var(--n-100);
}
.itip-map img { position: relative; display: block; width: 100%; height: 100%; object-fit: cover; }
.itip-map-wait { position: absolute; inset: 0; display: grid; place-items: center; font-size: var(--t-xs); color: var(--muted); }
.itip-map + .itip-sub { margin: 0.35rem 0.2rem 0 !important; }
.itip-done.on { color: var(--accent); }
.itip-gain { margin-top: 0.5rem; padding-top: 0.45rem; border-top: 1px solid var(--seam); }
.itip .gain-vals { gap: 0.25rem 1rem; align-items: center; }
.itip .gain b { font-size: var(--t-m); }
.itip-at { font-size: var(--t-xs); color: var(--muted); }
.itip .itip-things { margin-top: 0.3rem; font-size: var(--t-xs); color: var(--n-700); }
.itip-flag.bad { color: var(--el-fire); }
/* Zauber-Tooltip im Kampf-Simulator (fight.js spellTip): Werte in zwei Spalten, Beschreibung, Effekte */
.itip .stip-facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, auto)); gap: 0.12rem 1.4rem;
  margin: 0.45rem 0 0; padding-top: 0.45rem; border-top: 1px solid var(--seam);
}
.stip-f { display: flex; align-items: baseline; gap: 0.35rem; }
.stip-f dt { color: var(--muted); }
.stip-f dd { --ico: 1.1em; display: inline-flex; align-items: center; gap: 0.3rem; margin: 0; font: 600 var(--t-s)/1.3 var(--data); color: var(--n-900); font-variant-numeric: tabular-nums; }
.stip-f dd small { font-family: inherit; font-size: var(--t-xs); font-weight: 400; color: var(--muted); }
.itip .stip-rules { margin-top: 0.3rem; font-size: var(--t-xs); color: var(--muted); }
.itip .stip-desc { margin-top: 0.45rem; padding-top: 0.45rem; border-top: 1px solid var(--seam); color: var(--accent); text-wrap: pretty; white-space: pre-line; }
.itip .stip-h {
  margin: 0.55rem -0.85rem 0; padding: 0.25rem 0.85rem; background: var(--ground);
  border-block: 1px solid var(--seam); font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--n-700);
}
.itip .stip-h + .effects { margin-top: 0.3rem; padding-top: 0; border-top: 0; }
@media (prefers-reduced-motion: reduce) { .itip { animation: none; } }
@media (forced-colors: active) { .itip { outline: 1px solid CanvasText; } }

/* ---------- Zahlenfelder mit −/+ (numfield.js) ----------
   Der Rahmen gehört dem Feld als Ganzem; das Eingabefeld darin ist randlos und zeigt die Zahl mittig.
   Breite des Zahlbereichs je Ort über --num-w, Grund über --num-bg. */
.num {
  display: inline-flex; align-items: stretch; vertical-align: middle; min-width: 0;
  background: var(--num-bg, var(--ground)); border: 1px solid var(--seam); border-radius: var(--r-s);
  transition: border-color 120ms;
}
.num:focus-within { border-color: var(--accent); }
.num > input[type="number"] {
  flex: 1 1 auto; width: var(--num-w, 3rem); min-width: 0;
  margin: 0; padding: 0.3rem 0.1rem; border: 0; border-radius: 0; background: none;
  text-align: center; -moz-appearance: textfield; appearance: textfield;
}
.num > input[type="number"]::-webkit-inner-spin-button,
.num > input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.num > input[type="number"]:focus-visible { outline: none; }
.num-btn {
  display: grid; place-items: center; flex: none; width: 1.75rem; padding: 0;
  background: none; border: 0; border-radius: calc(var(--r-s) - 1px); color: var(--n-700); cursor: pointer;
  touch-action: manipulation; transition: background-color 120ms, color 120ms;
}
.num-btn svg { width: 0.75rem; height: 0.75rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.num-btn:disabled { color: var(--n-400); cursor: default; }
.num-btn:not(:disabled):active { background: var(--n-300); color: var(--n-900); }
@media (hover: hover) and (pointer: fine) {
  .num:hover:not(:focus-within) { border-color: var(--n-400); }
  .num-btn:not(:disabled):hover { background: var(--n-250); color: var(--n-900); }
}
@media (prefers-reduced-motion: reduce) { .num, .num-btn { transition: none; } }
@media (forced-colors: active) { .num { border-color: CanvasText; } .num-btn:disabled { color: GrayText; } }

/* Orte */
.bd-char .num { --num-w: 2.75rem; }
.bd-points .num { --num-w: 2.25rem; }
.bd-points .num-btn { width: 1.5rem; }
.bd-rolls .num { width: 100%; }
.bd-rolls .num-btn { width: 1.5rem; }
.filters .num { flex: 1 1 6rem; --num-bg: var(--panel); }
.filters .num > input[type="number"] { width: 100%; }
.dm-cgrid .num, .dm-res .num, .cb-dummy .num, .mv-range .num { --num-bg: var(--panel); }
.dm-res .num { --num-w: 2.5rem; }
.dm-cgrid .num { --num-w: 2.75rem; }
.cb-dummy .num { --num-w: 5.5rem; }
.mv-range .num { margin-left: 0.3rem; --num-w: 2.5rem; }
.mv-range .num > input[type="number"] { margin: 0; }

/* ---------- Meine Builds #/builds (builds.js) ----------
   Eigene Seite wie der Kampf-Simulator: Kopf, Werkzeugleiste (Suche, Klasse, Sortierung), Karten im Raster.
   Karte: Klassenkopf, Name, Level und Datum, 16 Plätze (2 × 8, ohne Begleiter und Seelenstein), Kernwerte, Werkzeugknöpfe wie in der Kopfleiste. */
body.builds-mode > main.layout { display: none; }
.mybuilds { background: var(--panel); }
.mybuilds[hidden] { display: none; }
@media (min-width: 861px) {
  .mybuilds { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.mybuilds a.bd-tb { text-decoration: none; }
.mb-main { max-width: 96rem; margin-inline: auto; padding: 2rem clamp(1rem, 4vw, 3.5rem) 4rem; }
.mb-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem 1.5rem; }
.mb-title { margin: 0; font: 600 var(--t-name)/1.05 var(--display); color: var(--n-900); }
.mb-sub { margin: 0.35rem 0 0; color: var(--n-700); }
.mb-sub strong { color: var(--n-900); font-weight: 600; }

/* Meine Builds / Öffentliche Builds: Reiter wie im Set-Creator, als Links */
.mb-views { display: flex; gap: clamp(1rem, 3vw, 2rem); margin-top: 1.25rem; border-bottom: 1px solid var(--seam); }
.mb-views a {
  padding: 0.45rem 0 0.6rem; font: 600 var(--t-m)/1.1 var(--data); color: var(--muted); text-decoration: none;
  box-shadow: inset 0 -3px 0 transparent; transition: color 120ms ease, box-shadow 160ms var(--ease-out);
}
.mb-views a[aria-current="page"] { color: var(--n-900); box-shadow: inset 0 -3px 0 var(--accent); }
.mb-views a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s); }
.mb-meta strong, .mb-author { color: var(--n-900); font-weight: 600; }
.mb-author { text-decoration: underline 1px var(--n-500); text-underline-offset: 0.2em; }
.mb-sub a { color: var(--n-900); text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
.mb-public {
  flex: none; align-self: start; margin-left: auto; padding: 0.2rem 0.5rem;
  border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font: 600 var(--t-xs)/1.1 var(--data);
}
.mb-public + .mb-del { margin-left: 0; }
.mb-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin: 1.5rem 0 1.25rem; }
.mb-tools label { display: inline-flex; align-items: center; gap: 0.5rem; font: italic 400 1.1875rem/1.3 var(--display); color: var(--n-700); }
.mb-tools select, .mb-search input {
  min-height: 2.5rem; padding: 0.35rem 0.5rem;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900);
}
.mb-tools label.mb-search { position: relative; flex: 1 1 15rem; max-width: 24rem; }
.mb-search svg {
  position: absolute; left: 0.65rem; top: 50%; translate: 0 -50%; width: 1.1rem; height: 1.1rem;
  fill: none; stroke: var(--n-600); stroke-width: 1.8; stroke-linecap: round; pointer-events: none;
}
.mb-search input { width: 100%; padding-left: 2.2rem; font-weight: 500; }
.mb-search input::placeholder { color: var(--muted); font-weight: 400; }
.mb-tools :focus-visible { outline-offset: 1px; border-color: var(--accent); }
.mb-count { margin: 0 0 0 auto; font-size: var(--t-s); color: var(--muted); }

.mb-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 23rem), 1fr)); gap: 1rem;
}
.mb-card {
  display: grid; gap: 0.9rem; align-content: start; padding: 1rem 1rem 0.75rem;
  background: var(--ground); border-radius: var(--r-m); /* ohne Rahmen: der dunklere Grund hebt sie von --panel ab */
}
.mb-top { position: relative; display: flex; align-items: center; gap: 0.8rem; min-width: 0; }
.mb-face { flex: none; display: grid; place-items: center; width: 3.5rem; height: 3.5rem; overflow: hidden; background: var(--n-200); border-radius: var(--r-m); }
.mb-face img { width: 100%; height: 100%; object-fit: cover; }
.mb-id { min-width: 0; }
.mb-name { margin: 0; font: 600 var(--t-l)/1.15 var(--display); color: var(--n-900); overflow-wrap: anywhere; }
.mb-name a { text-decoration: none; }
/* Die ganze Kopfzeile (Bild, Name, Zeile darunter) öffnet den Build: Der Namenslink deckt sie mit ::after ab,
   Kontoname, Abzeichen und Löschen liegen darüber und bleiben eigene Ziele (Links dürfen nicht verschachtelt sein). */
.mb-name a::after { content: ""; position: absolute; inset: -0.35rem; border-radius: var(--r-m); transition: background-color 0.15s; }
.mb-name a:focus-visible { outline: none; }
.mb-name a:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 0; }
.mb-author, .mb-public, .mb-del { position: relative; z-index: 1; }
.mb-meta { margin: 0.2rem 0 0; font-size: var(--t-s); color: var(--n-700); }
.mb-at { color: var(--muted); }

.mb-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: -0.3rem 0 0; padding: 0; list-style: none; }
.mb-tags li {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.55rem 0.2rem 0.4rem;
  background: var(--n-200); border-radius: 999px; font: 600 var(--t-xs)/1.2 var(--data); color: var(--n-800);
}
.mb-tags .ico { --ico: 1rem; }
.mb-gear { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0.3rem; }
.mb-gear li { display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; background: var(--n-200); border-radius: var(--r-s); }
.mb-gear li.empty { background: transparent; box-shadow: inset 0 0 0 1px var(--n-300); }
.mb-gear img { width: 90%; height: 90%; object-fit: contain; }
.mb-picto {
  width: 56%; height: 56%; background: var(--n-400);
  -webkit-mask: var(--picto) center / contain no-repeat; mask: var(--picto) center / contain no-repeat;
}

.mb-stats {
  display: grid; grid-template-columns: repeat(5, auto); justify-content: space-between; gap: 0.5rem;
  margin: 0; padding-top: 0.75rem; border-top: 1px solid var(--seam);
}
.mb-stats div { display: grid; gap: 0.2rem; }
.mb-stats dt { display: flex; align-items: center; gap: 0.3rem; font-size: var(--t-xs); color: var(--muted); }
.mb-stats dt .ico { width: 1rem; height: 1rem; }
.mb-stats dd { margin: 0; font: 700 var(--t-m)/1.1 var(--data); color: var(--n-900); }
.mb-stats[aria-busy="true"] dd { color: var(--n-500); }
.mb-main-stat dd { color: var(--c, var(--n-900)); }
.mb-fail { grid-column: 1 / -1; font-size: var(--t-s); color: var(--muted); }

/* Knöpfe ohne Rahmen um ihren Innenabstand nach außen, damit die Symbole mit dem Karteninhalt fluchten */
.mb-actions { display: flex; flex-wrap: wrap; gap: 0.1rem; margin: -0.35rem -0.7rem 0; }
/* Löschen: nur Papierkorb oben rechts, erst unter dem Zeiger rot */
.mb-del { align-self: start; margin: -0.4rem -0.4rem 0 auto; padding: 0 0.6rem; }

.mb-empty { display: grid; justify-items: center; gap: 0.75rem; max-width: 34rem; margin: 3.5rem auto; text-align: center; }
.mb-empty h2 { margin: 0; font: 600 var(--t-l)/1.2 var(--display); color: var(--n-900); }
.mb-empty p { margin: 0; color: var(--n-700); }
.mb-empty .bd-tb { margin-top: 0.5rem; }
.mb-empty-note { margin: 2rem 0; color: var(--muted); }
.mb-none { grid-column: 1 / -1; padding: 2.5rem 0; text-align: center; color: var(--muted); }

/* Öffentliches Profil (#/builds/profil/<Name>): Kennzahlen, Charakterkarten wie die Build-Köpfe, darunter die Builds */
.mb-prof[hidden] { display: none; }
.mb-prof { margin-top: 1.5rem; }
.mb-prof-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 1rem 1.5rem; }
.mb-facts { display: flex; flex-wrap: wrap; gap: 0.75rem clamp(1.5rem, 4vw, 3rem); margin: 0; }
.mb-facts div { display: grid; gap: 0.2rem; }
.mb-facts dt { font-size: var(--t-xs); color: var(--muted); }
.mb-facts dd { margin: 0; font: 700 var(--t-m)/1.2 var(--data); color: var(--n-900); overflow-wrap: anywhere; }
.mb-unset { color: var(--muted); font-weight: 400; font-style: italic; }
.mb-prof-head .bd-tb { margin: -0.4rem -0.7rem 0 0; }
.mb-h2 { margin: 2rem 0 0.9rem; font: 600 var(--t-l)/1.2 var(--display); color: var(--n-900); }
.mb-prof:not([hidden]) + #mb-body .mb-tools { margin-top: 0; }
.mb-prof-note { margin: 0; max-width: 46rem; color: var(--n-700); }
.mb-prof-note a { color: var(--n-900); text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
.mb-chars {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: 0.75rem;
}
.mb-char { display: flex; align-items: center; gap: 0.8rem; min-width: 0; padding: 0.75rem; background: var(--ground); border-radius: var(--r-m); }
.mb-char .mb-face { width: 3rem; height: 3rem; }
.mb-char-name { margin: 0; font: 600 1.1875rem/1.2 var(--display); color: var(--n-900); overflow-wrap: anywhere; }

/* Bearbeiten: Server, dann eine Zeile je Charakter (Name | Klasse | Level | Entfernen) */
.mb-prof-form {
  display: grid; gap: 1.1rem; max-width: 46rem; margin-top: 0.5rem; padding: 1.25rem;
  background: var(--ground); border-radius: var(--r-m);
}
.mb-prof-form .mb-h2 { margin: 0; }
.mb-field { display: grid; gap: 0.3rem; max-width: 20rem; font-size: var(--t-s); font-weight: 600; color: var(--n-700); }
.mb-prof-form input:not([type="number"]), .mb-prof-form select {
  min-width: 0; min-height: 2.5rem; padding: 0.35rem 0.5rem;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900);
}
.mb-prof-form input::placeholder { color: var(--muted); font-weight: 400; }
.mb-prof-form :is(input, select):focus-visible { outline-offset: 1px; border-color: var(--accent); }
.mb-prof-form .num { --num-bg: var(--panel); --num-w: 3rem; min-height: 2.5rem; }
.mb-charset { display: grid; gap: 0.5rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.mb-charset legend { margin-bottom: 0.5rem; padding: 0; font-size: var(--t-s); font-weight: 600; color: var(--n-700); }
.mb-char-rows { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.mb-char-cols, .mb-char-row {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 7.5rem 2.5rem; gap: 0.5rem; align-items: center;
}
.mb-char-cols span { font-size: var(--t-xs); color: var(--muted); }
.mb-row-del { justify-content: center; padding: 0; }
.mb-charset > [data-mb="char-add"] { justify-self: start; margin-left: -0.7rem; }
.mb-charset > [data-mb="char-add"]:disabled { opacity: 0.5; cursor: default; }
.mb-form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.mb-form-actions .bd-tb.primary { margin-left: 0; }
.mb-prof-form .bd-tb:disabled { cursor: progress; }
.acct-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

/* Profilbild (avatar.js): Ornament als Rahmen, darin auf einer Füllung das Motiv. Die Innenfläche der Ornamente
   liegt bei 22–106 von 128 px, also 17,2 % Rand; die Füllung verdeckt die Krone des Ornaments. */
.av { --av: 4rem; position: relative; display: inline-block; flex: none; width: var(--av); height: var(--av); }
.av.framed { background: var(--frame) center / contain no-repeat; }
.av-in {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden;
  background: var(--fill, var(--n-200)); border-radius: var(--r-m);
}
.av.framed .av-in { inset: 17.2%; border-radius: 9%; }
.av-in img { width: 100%; height: 100%; object-fit: contain; }
.av-in img[src*="/monsters/"] { scale: 1.2; } /* Monsterbilder haben viel leeren Rand */
.av-letter { font: 700 calc(var(--av) * 0.46)/1 var(--display); color: var(--n-900); }
.av.framed .av-letter { font-size: calc(var(--av) * 0.32); text-shadow: 0 1px 2px rgb(0 0 0 / 0.6); }
.av.on-light .av-letter { color: var(--n-100); text-shadow: none; }
.av.big { --av: 7rem; }
.mb-ident { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.mb-avatar[hidden] { display: none; }
/* Konto-Knopf: Profilbild statt Personensymbol, bündig mit dem linken Innenrand */
.acct-btn .av { --av: 1.75rem; margin-left: -0.45rem; }
.acct-btn .av.framed .av-in { inset: 15%; } /* so klein trägt der Rahmen sonst zu dick auf */
/* Build-Karten: kleines Profilbild vor dem Kontonamen */
.mb-author .av { --av: 1.5rem; margin: -0.25rem 0.3rem -0.2rem 0; vertical-align: middle; }
.mb-avatar .av { --av: clamp(4rem, 3rem + 3vw, 5.5rem); }

.av-pick { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem 1.25rem; align-items: start; }
.av-preview { display: grid; justify-items: center; gap: 0.4rem; }
.av-preview .bd-tb:disabled { opacity: 0.45; cursor: default; }
.av-tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.av-tabs button {
  min-height: 2.25rem; padding: 0 0.8rem; background: transparent; border: 1px solid var(--seam); border-radius: 999px;
  font: 600 var(--t-s)/1 var(--data); color: var(--n-700); cursor: pointer;
  transition: background-color 120ms var(--ease-out), border-color 120ms var(--ease-out), color 120ms var(--ease-out);
}
.av-tabs [aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); color: var(--n-900); }
.av-tabs button:focus-visible, .av-grid button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.av-search { position: relative; display: block; max-width: 20rem; margin-top: 0.6rem; }
.av-search[hidden] { display: none; }
.av-search svg {
  position: absolute; left: 0.65rem; top: 50%; translate: 0 -50%; width: 1.1rem; height: 1.1rem;
  fill: none; stroke: var(--n-600); stroke-width: 1.8; stroke-linecap: round; pointer-events: none;
}
.mb-prof-form .av-search input { width: 100%; padding-left: 2.2rem; font-weight: 500; }
.av-grid {
  list-style: none; margin: 0.6rem 0 0; padding: 0.15rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(3.5rem, 1fr)); gap: 0.35rem;
  max-height: 15.5rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.av-grid button {
  display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 0.2rem;
  background: var(--panel); border: 1px solid transparent; border-radius: var(--r-s); cursor: pointer;
  transition: border-color 120ms var(--ease-out), background-color 120ms var(--ease-out);
}
.av-grid.frames button { padding: 0.1rem; }
.av-grid img { width: 100%; height: 100%; object-fit: contain; }
.av-grid [aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.av-none { width: 70%; aspect-ratio: 1; border: 2px dashed var(--n-500); border-radius: var(--r-m); }
.av-status { margin: 0.4rem 0 0; font-size: var(--t-xs); color: var(--muted); }
.av-status:empty { display: none; }
@media (hover: hover) and (pointer: fine) {
  .av-tabs button:hover { color: var(--n-900); border-color: var(--n-400); }
  .av-grid button:hover { border-color: var(--n-400); }
}
@media (max-width: 560px) {
  .av-pick { grid-template-columns: minmax(0, 1fr); }
  .av-preview { grid-auto-flow: column; justify-content: start; align-items: center; gap: 0.75rem; }
  .av.big { --av: 5.5rem; }
}
@media (hover: hover) and (pointer: fine) {
  .mb-row-del:hover .bd-glyph { color: var(--el-fire); }
  .mb-prof-form :is(input:not([type="number"]), select):hover { border-color: var(--n-400); }
}
@media (max-width: 560px) {
  .mb-char-cols { display: none; }
  /* Name über die volle Breite, darunter Klasse | Level | Entfernen */
  .mb-char-row { grid-template-columns: minmax(0, 1fr) 7.5rem 2.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--seam); }
  .mb-char-row [name="cname"] { grid-column: 1 / -1; }
  .mb-prof-form { padding: 1rem; }
}

.bd-pop .bd-all { display: block; margin: 0.25rem 0 0; padding: 0.55rem 0.5rem 0.3rem; border-top: 1px solid var(--seam); font-size: var(--t-s); color: var(--n-800); }
.acct-go { display: inline-flex; align-items: center; gap: 0.4rem; justify-self: start; font-weight: 600; color: var(--n-900); text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
.acct-go svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (hover: hover) and (pointer: fine) {
  .mb-name a:hover { text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
  .mb-name a:hover::after { background: color-mix(in srgb, var(--accent) 6%, transparent); }
  .mb-del:hover .bd-glyph { color: var(--el-fire); }
  .mb-views a:hover { color: var(--n-900); }
  .mb-author:hover { text-decoration-color: var(--accent); }
  .mb-tools select:hover, .mb-search input:hover { border-color: var(--n-400); }
}
@media (max-width: 520px) {
  .mb-stats { grid-template-columns: repeat(3, auto); justify-content: start; column-gap: 1.5rem; }
  .mb-count { margin-left: 0; }
}

/* ---------- Aus Screenshot erkennen (scan.js) ----------
   Dialog wie der Konto-Dialog. Ergebnis: links das Bild mit nummerierten Plätzen (grün sicher, Messing unsicher),
   rechts die Treffer zum Prüfen; Zeile und Kasten heben sich gegenseitig hervor. */
.scan {
  width: min(62rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem);
  padding: 0; overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--n-400); border-radius: var(--r-m);
}
.scan::backdrop { background: var(--scrim); }
.scan-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--seam); }
.scan-head h2 { margin: 0; font: 600 var(--t-l)/1.1 var(--display); color: var(--n-900); }
.scan-head [data-close] { margin-left: auto; }
.scan-body { display: grid; gap: 1rem; padding: 1rem; }

.scan-drop {
  display: grid; justify-items: center; gap: 0.6rem; padding: 2.25rem 1rem;
  border: 1px dashed var(--n-500); border-radius: var(--r-m); text-align: center; color: var(--n-700);
  transition: border-color 120ms, background-color 120ms;
}
.scan-drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--brass-900) 35%, transparent); }
.scan-drop > svg { width: 2.5rem; height: 2.5rem; fill: none; stroke: var(--n-600); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.scan-drop p { margin: 0; }
.scan-drop strong { color: var(--n-900); }
.scan-drop label { margin-top: 0.25rem; }
.scan-tips { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.35rem; font-size: var(--t-s); color: var(--muted); }
.scan-error { margin: 0; padding: 0.6rem 0.8rem; border: 1px solid color-mix(in srgb, var(--el-fire) 45%, var(--seam)); border-radius: var(--r-s); background: color-mix(in srgb, var(--el-fire) 8%, var(--ground)); color: var(--n-800); }
.scan-status { margin: 0; text-align: center; color: var(--n-700); }

.scan-shot { position: relative; margin: 0; justify-self: center; max-width: 100%; }
.scan-shot img { display: block; max-width: 100%; max-height: 60vh; border-radius: var(--r-s); }
.scan-shot.busy img { opacity: 0.55; }
.scan-shot svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scan-shot svg rect { fill: none; stroke: #6cc383; stroke-width: max(2px, 0.4%); vector-effect: non-scaling-stroke; }
.scan-shot svg .unsure rect { stroke: var(--accent); stroke-dasharray: 5 3; }
.scan-shot svg rect.tag { fill: #6cc383; stroke: none; }
.scan-shot svg .unsure rect.tag { fill: var(--accent); }
.scan-shot svg text { fill: var(--n-100); font: 700 1em var(--data); text-anchor: middle; }
.scan-shot svg .hl rect:not(.tag) { stroke: var(--n-900); stroke-width: 3px; }

.scan-result { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: start; }
.scan-result .scan-shot { justify-self: stretch; position: sticky; top: 1rem; }
.scan-result .scan-shot img { width: 100%; max-height: none; }
.scan-lead { margin: 0 0 0.6rem; color: var(--n-700); }
.scan-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.scan-row {
  display: grid; grid-template-columns: 1.5rem auto 2.5rem minmax(0, 1fr) auto; align-items: center; gap: 0.55rem;
  padding: 0.35rem 0.5rem; border-radius: var(--r-s); background: var(--ground); border: 1px solid transparent;
}
.scan-row.hl { border-color: var(--n-500); }
.scan-row:not(.on) .scan-icon, .scan-row:not(.on) .scan-what { opacity: 0.6; }
.scan-n { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: var(--r-s); background: var(--el-air); color: var(--n-100); font: 700 var(--t-xs)/1 var(--data); }
.scan-row.unsure .scan-n { background: var(--accent); }
.scan-row input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.scan-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; background: var(--n-200); border-radius: var(--r-s); }
.scan-icon img { width: 90%; height: 90%; object-fit: contain; }
.scan-what { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.5rem; min-width: 0; }
.scan-name { font-weight: 600; color: var(--n-900); overflow-wrap: anywhere; }
.scan-name .lvl, .scan-hint { font-size: var(--t-xs); font-weight: 500; color: var(--muted); }
.scan-flag { padding: 0.1rem 0.4rem; border-radius: var(--r-s); background: var(--brass-900); color: var(--n-900); font: 600 var(--t-xs)/1.3 var(--data); }
.scan-row select {
  min-height: 2.25rem; max-width: 100%; padding: 0.2rem 0.4rem;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 600 var(--t-s)/1.2 var(--data); color: var(--n-900);
}
.scan-what select { min-width: 0; flex: 1 1 12rem; }
/* Fußzeile klebt unten im Dialog, damit „Übernehmen“ auch bei langer Liste sichtbar bleibt */
.scan-foot {
  grid-column: 1 / -1; position: sticky; bottom: 0; z-index: 1;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem;
  margin: 0 -1rem -1rem; padding: 0.75rem 1rem; background: var(--panel); border-top: 1px solid var(--seam);
}
.scan-note { margin: 0 auto 0 0; font-size: var(--t-xs); color: var(--muted); }
.bd-tb:disabled { opacity: 0.45; cursor: default; }

@media (max-width: 760px) {
  .scan-result { grid-template-columns: minmax(0, 1fr); }
  .scan-result .scan-shot { position: static; }
  .scan-row { grid-template-columns: 1.5rem auto 2.5rem minmax(0, 1fr); }
  .scan-row > select { grid-column: 3 / -1; }
}
@media (prefers-reduced-motion: reduce) { .scan-drop { transition: none; } }

/* ---------- Berufs-XP-Rechner (#/xp, xpcalc.js) ----------
   Ganze Breite wie die Klassenseite: oben die Berufsleiste, darunter Beruf und Eingaben, dann der Levelpfad
   (das eine prägende Element: Start und Ziel in großen Ziffern, dazwischen die Etappen mit ihren Rezeptbildern),
   darunter links die Etappen, rechts die Einkaufsliste. Messing markiert Ziel, Wahl und eigene Änderungen. */
body.xp-mode > main.layout { display: none; }
.xpc { background: var(--panel); }
.xpc[hidden] { display: none; }
@media (min-width: 861px) {
  .xpc { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.xpc a {
  text-decoration-line: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 1px; text-underline-offset: 0.2em;
}
.xpc .br-strip a { text-decoration: none; }
/* Beruf ohne Symbol (Grundwert): Anfangsbuchstaben auf einer Platte in Symbolgröße */
.xp-strip-txt {
  display: grid; place-items: center; width: 2.6rem; height: 2.6rem;
  background: var(--n-250); border-radius: var(--r-m);
  font: 700 1.05rem/1 var(--display); color: var(--n-700);
}
.xp-main { max-width: 76rem; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 3rem) 4rem; }
.xp-main[aria-busy="true"] { opacity: 0.5; transition: opacity 120ms linear 200ms; }
.xp-fail { color: var(--neg); }

/* Kopf: Beruf links, Eingaben darunter in einer Zeile */
.xp-hero { display: grid; gap: 1.4rem; }
.xp-who { display: flex; align-items: center; gap: 1.1rem; }
.xp-emblem { flex: none; width: 4.5rem; height: 4.5rem; object-fit: contain; }
.xp-who h1 { margin: 0; font: 700 var(--t-name)/1 var(--display); color: var(--n-900); letter-spacing: -0.005em; }
.xp-sub { margin: 0.4rem 0 0; max-width: 62ch; color: var(--n-700); }
.xp-sub a { white-space: nowrap; }
.xp-form { display: flex; flex-wrap: wrap; align-items: end; gap: 0.8rem 1.1rem; }
.xp-field { display: grid; gap: 0.3rem; color: var(--n-700); font-size: var(--t-s); }
.xp-field .num { height: 2.75rem; --num-bg: var(--ground); --num-w: 3.25rem; }
.xp-field .num > input[type="number"] { font-size: 1.125rem; font-weight: 600; color: var(--n-900); }
.xp-goal {
  display: inline-flex; height: 2.75rem; padding: 3px;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m);
}
.xp-goal button {
  padding: 0 0.95rem; border: 0; border-radius: var(--r-s); background: none;
  color: var(--n-700); font-size: var(--t-s); cursor: pointer;
  transition: background-color 140ms var(--ease-out), color 140ms var(--ease-out);
}
.xp-goal button[aria-checked="true"] { background: var(--panel); color: var(--accent); font-weight: 600; }
@media (hover: hover) { .xp-goal button:not([aria-checked="true"]):hover { color: var(--n-900); } }
.xp-goal button:focus-visible { outline-offset: -2px; }
.xp-note {
  margin: 0; padding: 0.55rem 0.8rem; max-width: 70ch;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--seam)); border-radius: var(--r-s);
  background: color-mix(in srgb, var(--accent) 7%, var(--n-100));
  color: var(--n-700); font-size: var(--t-s);
}

/* Levelpfad */
.xp-path { margin-top: 2.4rem; }
.xp-ends {
  display: flex; justify-content: space-between; align-items: baseline;
  font: 700 var(--t-l)/1 var(--display); color: var(--n-900);
}
.xp-end:last-child { color: var(--accent); }
.xp-rail {
  position: relative; height: 3.6rem; margin-top: 0.4rem;
  background: var(--ground); border-radius: var(--r-m); box-shadow: inset 0 0 0 1px var(--seam);
}
.xp-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: color-mix(in srgb, var(--n-900) 14%, transparent); z-index: 3; pointer-events: none; }
.xp-tick span {
  position: absolute; top: calc(100% + 0.4rem); left: 0; transform: translateX(-50%);
  color: var(--muted); font-size: var(--t-xs); line-height: 1;
}
/* Jeder Abschnitt ist ein eigener Container: das Rezeptbild schrumpft mit der Breite, bis es nicht mehr passt */
.xp-seg {
  position: absolute; top: 0; bottom: 0; z-index: 2; container-type: inline-size;
  display: flex; align-items: center; justify-content: center; padding: 0; overflow: hidden;
  border: 0; border-left: 2px solid var(--ground);
  background: color-mix(in srgb, var(--accent) 30%, var(--n-200));
  cursor: pointer; transition: background-color 140ms var(--ease-out);
}
.xp-seg.alt { background: color-mix(in srgb, var(--accent) 17%, var(--n-200)); }
/* Von Hand gewählte Etappen: schräg gestreift */
.xp-seg.manual {
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--accent) 22%, transparent) 6px 8px);
}
.xp-seg:first-of-type { border-left: 0; border-radius: var(--r-m) 0 0 var(--r-m); }
.xp-seg:last-of-type { border-radius: 0 var(--r-m) var(--r-m) 0; }
.xp-seg:only-of-type { border-radius: var(--r-m); }
.xp-seg img {
  flex: none; width: min(2.5rem, 86cqi); height: auto; aspect-ratio: 1; object-fit: contain;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.55));
}
@container (min-width: 5rem) { .xp-seg img { margin-right: auto; margin-left: 0.4rem; } }
@container (max-width: 13px) { .xp-seg img { display: none; } }
@media (hover: hover) {
  .xp-seg:hover { background-color: color-mix(in srgb, var(--accent) 45%, var(--n-200)); }
}
.xp-seg:focus-visible { outline-offset: -2px; z-index: 4; }
.xp-stuck {
  position: absolute; top: 0; bottom: 0; z-index: 2; border-radius: 0 var(--r-m) var(--r-m) 0;
  background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--neg) 30%, transparent) 6px 8px);
}
.xp-summary {
  margin: 2.1rem 0 0; max-width: 60ch;
  font: 400 var(--t-l)/1.35 var(--display); color: var(--n-800);
}

/* Etappen und Einkaufsliste */
.xp-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(17rem, 21rem); gap: 1.5rem 3rem; align-items: start; margin-top: 2.5rem; }
.xp-col-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.3rem 1rem;
  padding-bottom: 0.35rem; border-bottom: 1px solid var(--n-400);
}
.xp-col-head h2 { margin: 0; font: 600 var(--t-l)/1.15 var(--display); color: var(--n-900); }
.xp-link {
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--n-700); font-size: var(--t-s);
  text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.2em;
}
@media (hover: hover) { .xp-link:hover { color: var(--n-900); } }
.xp-empty { margin: 0.8rem 0 0; color: var(--muted); list-style: none; }

.xp-stage-list { list-style: none; margin: 0; padding: 0; }
.xp-stage {
  display: grid; grid-template-columns: 4.75rem minmax(0, 1fr); column-gap: 1.1rem;
  padding: 1.1rem 0.4rem 1.1rem 0; border-bottom: 1px solid var(--seam);
  border-radius: var(--r-s); scroll-margin: 6rem;
}
.xp-range {
  grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem;
  margin: 0; font: 700 1.75rem/1 var(--display); color: var(--n-900);
}
.xp-range span[aria-hidden] { color: var(--accent); font-size: 1.1rem; transform: rotate(90deg); margin: 0.1rem 0 0 0.35rem; }
.xp-range b + span + b { color: var(--n-700); }
.xp-card { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) auto; column-gap: 1rem; align-items: start; }
.xp-plate { display: grid; place-items: center; width: 4.5rem; height: 4.5rem; background: var(--ground); border-radius: var(--r-s); }
.xp-plate img { width: 82%; height: 82%; object-fit: contain; }
.xp-stage.manual .xp-plate { box-shadow: inset 0 0 0 1px var(--accent); }
.xp-what p { margin: 0; }
.xp-name a { font-weight: 600; color: var(--n-900); text-decoration-color: transparent; }
@media (hover: hover) { .xp-name a:hover { text-decoration-color: var(--accent); } }
.xp-what .xp-meta { margin: 0.1rem 0 0.55rem; color: var(--muted); font-size: var(--t-s); }
.xp-own { color: var(--accent); }
.xp-ings { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.xp-ings a { position: relative; display: block; width: 2.75rem; height: 2.75rem; background: var(--ground); border-radius: var(--r-s); text-decoration: none; }
.xp-ings img { width: 100%; height: 100%; padding: 0.3rem; object-fit: contain; }
.xp-q {
  position: absolute; left: 0.2rem; top: 0.1rem;
  font: 700 0.78rem/1 var(--data); color: var(--n-900);
  text-shadow: 0 0 2px var(--ground), 0 1px 2px var(--ground), 0 0 4px var(--ground);
}
.xp-times { display: grid; justify-items: end; gap: 0.2rem; margin: 0; text-align: right; }
.xp-x { font: 700 2.4rem/0.9 var(--display); color: var(--n-900); }
.xp-x small { margin-left: 0.04em; font-size: 0.55em; color: var(--accent); }
.xp-per { color: var(--muted); font-size: var(--t-s); white-space: nowrap; }
.xp-alt { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-top: 0.8rem; }
.xp-alt label { min-width: 0; max-width: 100%; }
.xp-alt select {
  max-width: 100%; height: 2.25rem; padding: 0 0.5rem;
  background-color: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  color: var(--n-700); font-size: var(--t-s);
}
.xp-alt select:focus-visible { outline-offset: 1px; border-color: var(--accent); }
.xp-stage.flash { animation: xp-flash 1.2s var(--ease-out); }
@keyframes xp-flash { from { background: var(--mark); } to { background: transparent; } }

.xp-shop { position: sticky; top: 5rem; }
.xp-switch { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--n-700); font-size: var(--t-s); cursor: pointer; }
.xp-shop-sum { margin: 0.6rem 0 0.3rem; color: var(--muted); font-size: var(--t-s); }
.xp-shop-list { list-style: none; margin: 0; padding: 0; max-height: calc(100dvh - 13rem); overflow-y: auto; scrollbar-width: thin; }
.xp-shop-list a {
  display: grid; grid-template-columns: 2.1rem minmax(0, 1fr) auto; align-items: center; column-gap: 0.6rem;
  padding: 0.28rem 0.25rem 0.28rem 0; border-bottom: 1px solid var(--seam);
  color: var(--n-800); text-decoration: none;
}
@media (hover: hover) { .xp-shop-list a:hover { background: var(--n-250); } }
.xp-shop-ico { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; background: var(--ground); border-radius: var(--r-s); }
.xp-shop-ico img { width: 88%; height: 88%; object-fit: contain; }
.xp-shop-n { line-height: 1.25; overflow-wrap: break-word; }
.xp-shop-q { font-weight: 600; color: var(--n-900); font-variant-numeric: tabular-nums; }
#xp-shop-body[aria-busy="true"] { opacity: 0.6; }

@media (max-width: 960px) {
  .xp-cols { grid-template-columns: minmax(0, 1fr); }
  .xp-shop { position: static; }
  .xp-shop-list { max-height: none; }
}
@media (max-width: 640px) {
  .xp-main { padding-top: 1.25rem; }
  .xp-emblem { width: 3.5rem; height: 3.5rem; }
  .xp-form { gap: 0.7rem; }
  .xp-goal { width: 100%; }
  .xp-goal button { flex: 1 1 0; padding: 0 0.4rem; }
  .xp-stage { grid-template-columns: minmax(0, 1fr); row-gap: 0.6rem; }
  .xp-range { grid-row: auto; flex-direction: row; align-items: baseline; gap: 0.4rem; font-size: 1.4rem; }
  .xp-range span[aria-hidden] { transform: none; margin: 0; }
  .xp-card { grid-template-columns: 3.5rem minmax(0, 1fr); }
  .xp-plate { width: 3.5rem; height: 3.5rem; }
  .xp-times { grid-column: 2; display: flex; align-items: baseline; gap: 0.6rem; text-align: left; margin-top: 0.6rem; }
  .xp-x { font-size: 1.9rem; }
  .xp-alt { grid-column: 1; }
  .xp-tick span { display: none; }
  .xp-tick:nth-of-type(even) span { display: block; }
  .xp-summary { font-size: var(--t-m); margin-top: 1.9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .xp-stage.flash { animation: none; }
  .xp-seg, .xp-goal button { transition: none; }
}

/* ---------- Atelier (#/atelier, atelier.js) ----------
   Ganze Breite wie der XP-Rechner: oben die Listen als Reiter, darunter der Name der Liste (zum Umbenennen ein
   Feld, das wie die Überschrift aussieht), links was hergestellt wird, rechts die Ressourcen nach Herkunft mit
   Bestand / Bedarf. Messing markiert Fortschritt und die aktive Liste; Vollständiges tritt zurück. */
body.atelier-mode > main.layout { display: none; }
.atl { background: var(--panel); }
.atl[hidden] { display: none; }
@media (min-width: 861px) {
  .atl { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.atl a {
  text-decoration-line: underline; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-decoration-thickness: 1px; text-underline-offset: 0.2em;
}
.atl-main { max-width: 84rem; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 3rem) 4rem; }
.atl-hero h1 { margin: 0; font: 700 var(--t-name)/1 var(--display); color: var(--n-900); letter-spacing: -0.005em; }
.atl-sub { margin: 0.45rem 0 0; max-width: 64ch; color: var(--n-700); }
.atl-primary { border-color: var(--accent); color: var(--n-900); background: color-mix(in srgb, var(--accent) 14%, var(--ground)); }
@media (hover: hover) { .atl-primary:hover { background: color-mix(in srgb, var(--accent) 24%, var(--ground)); } }

/* Listen als Reiter; auf dem Handy waagrecht rollbar */
.atl-tabs { margin-top: 1.6rem; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--seam); }
.atl-tabs::-webkit-scrollbar { display: none; }
.atl-tabs ol { display: flex; align-items: stretch; gap: clamp(0.9rem, 2.5vw, 1.8rem); margin: 0; padding: 0; list-style: none; }
.atl-tabs li { flex: none; display: flex; }
.atl-tabs a {
  display: inline-flex; align-items: baseline; gap: 0.45rem; padding: 0.5rem 0 0.65rem;
  color: var(--muted); text-decoration: none; font-weight: 600;
  box-shadow: inset 0 -3px 0 transparent; transition: color 120ms ease, box-shadow 160ms var(--ease-out);
}
.atl-tabs a[aria-current="page"] { color: var(--n-900); box-shadow: inset 0 -3px 0 var(--accent); }
@media (hover: hover) { .atl-tabs a:not([aria-current]):hover { color: var(--n-800); } }
.atl-tab-n { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atl-tab-c {
  min-width: 1.5rem; padding: 0.05rem 0.35rem; border-radius: 99px; background: var(--ground);
  font-size: var(--t-xs); font-weight: 600; color: var(--n-700); text-align: center;
}
.atl-tabs a[aria-current="page"] .atl-tab-c { color: var(--accent); }
.atl-tab-c:empty { display: none; } /* Zahl noch nicht geladen oder unbekannt: kein leerer Balken */
.atl-tab-new {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.5rem 0 0.65rem; border: 0; background: none;
  color: var(--n-700); font-weight: 600; cursor: pointer;
}
.atl-tab-new svg { width: 0.95rem; height: 0.95rem; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }
@media (hover: hover) { .atl-tab-new:hover { color: var(--n-900); } }
.atl-tab-new:disabled { opacity: 0.45; cursor: default; }
.atl-tab-new:focus-visible, .atl-tabs a:focus-visible { outline-offset: -2px; }

/* Leere Seite */
.atl-empty { margin-top: 2.5rem; max-width: 52ch; }
.atl-empty-h { margin: 0 0 0.4rem; font: 600 var(--t-l)/1.2 var(--display); color: var(--n-900); }
.atl-empty p:not(.atl-empty-h) { margin: 0 0 1.2rem; color: var(--n-700); }

/* Kopf der Liste: Name als Feld in Überschriftgröße */
.atl-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1.5rem; margin-top: 1.6rem; }
.atl-name-wrap { position: relative; flex: 1 1 18rem; max-width: 36rem; display: flex; align-items: center; }
.atl-name {
  width: 100%; padding: 0.15rem 2.2rem 0.15rem 0.4rem; margin-left: -0.4rem;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-s);
  font: 600 var(--t-l)/1.2 var(--display); color: var(--n-900);
  transition: border-color 120ms ease, background-color 120ms ease;
}
@media (hover: hover) { .atl-name:hover { border-color: var(--seam); } }
.atl-name:focus { outline: none; border-color: var(--accent); background: var(--ground); }
.atl-name-pen {
  position: absolute; right: 0.6rem; width: 1.05rem; height: 1.05rem; pointer-events: none;
  fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round;
}
.atl-name:focus + .atl-name-pen { stroke: var(--accent); }
.atl-tools { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
.atl-danger { color: var(--neg); text-decoration-color: color-mix(in srgb, var(--neg) 60%, transparent); }
@media (hover: hover) { .atl-danger:hover { color: var(--neg); } }

/* Hinzufügen-Leiste (?add=…) */
.atl-addbar {
  display: grid; gap: 0.7rem; margin-top: 1.4rem; padding: 1rem 1.1rem;
  background: color-mix(in srgb, var(--accent) 8%, var(--ground));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--seam)); border-radius: var(--r-m);
  animation: atl-in 220ms var(--ease-out);
}
@keyframes atl-in { from { opacity: 0; transform: translateY(-4px); } }
.atl-addbar p { margin: 0; }
.atl-add-icons { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.atl-add-icons li { width: 2.5rem; height: 2.5rem; padding: 0.2rem; background: var(--ground); border-radius: var(--r-s); }
.atl-add-icons img { width: 100%; height: 100%; object-fit: contain; }
.atl-add-h { font-weight: 600; color: var(--n-900); }
.atl-add-form { display: flex; flex-wrap: wrap; align-items: end; gap: 0.7rem 1rem; }
.atl-add-form .num { height: 2.5rem; --num-bg: var(--ground); --num-w: 3rem; }
.atl-add-form select, .atl-add-form input[type="text"] {
  height: 2.5rem; min-width: 12rem; max-width: 100%; padding: 0 0.6rem;
  background: var(--ground); border: 1px solid var(--n-400); border-radius: var(--r-s); color: var(--n-900);
}
.atl-add-form select:focus-visible, .atl-add-form input[type="text"]:focus-visible { outline-offset: 1px; border-color: var(--accent); }
.atl-add-act { display: flex; gap: 0.5rem; }

/* Zwei Spalten */
.atl-cols { display: grid; grid-template-columns: minmax(18rem, 25rem) minmax(0, 1fr); gap: 2rem 3rem; align-items: start; margin-top: 1.6rem; }
.atl-cols[aria-busy="true"] { opacity: 0.6; transition: opacity 120ms linear 250ms; }
.atl-count { margin-left: auto; color: var(--muted); font: 600 var(--t-s)/1 var(--data); white-space: nowrap; }
.atl-none { margin: 0.8rem 0 0; color: var(--muted); list-style: none; }
.atl-hint { margin: 0.5rem 0 0.2rem; color: var(--muted); font-size: var(--t-s); }

/* Suche und Build-Auswahl */
.atl-find { position: relative; display: grid; gap: 0.5rem; margin-top: 0.8rem; }
.atl-q-field { position: relative; }
.atl-q-field svg {
  position: absolute; left: 0.7rem; top: 50%; width: 1.05rem; height: 1.05rem; transform: translateY(-50%);
  fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; pointer-events: none;
}
.atl-q-field input, .atl-build select {
  width: 100%; height: 2.6rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  color: var(--n-900);
}
.atl-q-field input { padding: 0 0.7rem 0 2.2rem; }
.atl-build select { padding: 0 0.6rem; color: var(--n-700); font-size: var(--t-s); }
.atl-q-field input:focus-visible, .atl-build select:focus-visible { outline-offset: 1px; border-color: var(--accent); }
.atl-hits {
  position: absolute; top: 2.85rem; left: 0; right: 0; z-index: 5; margin: 0; padding: 0.3rem; list-style: none;
  background: var(--n-250); border: 1px solid var(--n-400); border-radius: var(--r-m);
  box-shadow: 0 12px 28px rgb(0 0 0 / 0.45);
}
.atl-hits[hidden] { display: none; }
.atl-hits .atl-none { margin: 0; padding: 0.5rem 0.6rem; }
.atl-hits button {
  display: grid; grid-template-columns: 2.1rem minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 0.6rem;
  width: 100%; padding: 0.3rem 0.4rem; border: 0; border-radius: var(--r-s); background: none; text-align: left; cursor: pointer;
}
.atl-hits button:hover, .atl-hits button:focus-visible { background: var(--n-300); outline: none; }
.atl-hit-ico { grid-row: span 2; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; background: var(--ground); border-radius: var(--r-s); }
.atl-hit-ico img { width: 88%; height: 88%; object-fit: contain; }
.atl-hit-n { color: var(--n-900); font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atl-hit-m { color: var(--muted); font-size: var(--t-xs); }

/* Ziele (was hergestellt wird) und Ressourcen-Zeilen teilen sich das Raster: Bild, Name, Zahl, Knöpfe */
.atl-targets, .atl-rows { margin: 0.6rem 0 0; padding: 0; list-style: none; }
.atl-target, .atl-row {
  display: grid; align-items: center; column-gap: 0.7rem;
  padding: 0.45rem 0; border-bottom: 1px solid var(--seam);
}
.atl-target { grid-template-columns: 2.75rem minmax(0, 1fr) auto auto auto; }
.atl-row { grid-template-columns: 2.5rem minmax(0, 1fr) auto 4.6rem auto; }
.atl-ico { display: grid; place-items: center; aspect-ratio: 1; background: var(--ground); border-radius: var(--r-s); }
.atl-ico img { width: 86%; height: 86%; object-fit: contain; }
.atl-what { min-width: 0; }
.atl-what p { margin: 0.05rem 0 0; }
.atl-n { color: var(--n-900); font-weight: 600; line-height: 1.25; text-decoration-color: transparent !important; overflow-wrap: anywhere; }
@media (hover: hover) { .atl-n:hover { text-decoration-color: var(--accent) !important; } }
.atl-meta, .atl-from { color: var(--muted); font-size: var(--t-xs); line-height: 1.4; }
.atl-from a { color: var(--n-700); }
.atl-from .job { vertical-align: baseline; }
.atl-map { white-space: nowrap; }
.atl-qty { display: flex; align-items: center; gap: 0.3rem; color: var(--muted); }
.atl-qty .num { height: 2.1rem; --num-bg: var(--ground); --num-w: 2.6rem; }
.atl-qty input { font-weight: 600; color: var(--n-900); }
.atl-stock { display: flex; align-items: baseline; gap: 0.3rem; white-space: nowrap; }
.atl-stock input {
  width: 4.2rem; height: 2rem; padding: 0 0.4rem; text-align: right;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  font-weight: 600; color: var(--n-900); -moz-appearance: textfield; appearance: textfield;
}
.atl-stock input::-webkit-inner-spin-button, .atl-stock input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.atl-stock input::placeholder { color: var(--n-500); }
.atl-stock input:focus-visible { outline-offset: 1px; border-color: var(--accent); }
.atl-of { min-width: 6.5ch; color: var(--n-700); font-variant-numeric: tabular-nums; }
.atl-miss { color: var(--accent); font-size: var(--t-xs); font-weight: 600; text-align: right; white-space: nowrap; }
.atl-ok, .atl-rm {
  display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0;
  background: none; border: 1px solid var(--seam); border-radius: var(--r-s); color: var(--muted); cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms var(--ease-out);
}
.atl-ok svg, .atl-rm svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.atl-ok:active, .atl-rm:active { transform: scale(0.94); }
@media (hover: hover) {
  .atl-ok:hover { border-color: var(--accent); color: var(--n-900); }
  .atl-rm:hover { border-color: var(--neg); color: var(--neg); }
}
.atl-ok[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--accent); color: var(--accent); }
.atl-rm { border-color: transparent; }
/* Vollständig: tritt zurück, bleibt aber lesbar */
.atl-row.ok .atl-ico, .atl-target.done .atl-ico { opacity: 0.45; }
.atl-row.ok .atl-n, .atl-target.done .atl-n { color: var(--n-700); }
.atl-target.done .atl-n { text-decoration-line: line-through !important; text-decoration-color: var(--muted) !important; }
.atl-row.ok .atl-miss { color: var(--muted); font-weight: 400; }

.atl-mini-h { margin: 0 0 0.35rem; color: var(--n-700); font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.atl-jobs { margin-top: 1.4rem; }
.atl-jobs ul { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.atl-jobs li {
  padding: 0.25rem 0.55rem; background: var(--ground); border: 1px solid var(--seam); border-radius: 99px;
  font-size: var(--t-s); font-weight: 600; color: var(--n-900);
}
.atl-jobs li a.job { font-weight: 400; color: var(--n-800); }
.atl-jobs .note { margin: 0.45rem 0 0; font-size: var(--t-xs); }
.atl-inter .atl-hint { margin-bottom: 0; }

/* Ressourcen */
.atl-mode { margin-top: 0.9rem; }
.atl-sum { margin-top: 1.2rem; }
.atl-sum p { margin: 0; }
.atl-sum-big { font: 400 var(--t-l)/1.2 var(--display); color: var(--n-800); }
.atl-sum-big b { font-weight: 700; color: var(--n-900); }
.atl-sum-sub { margin-top: 0.2rem !important; color: var(--muted); font-size: var(--t-s); }
.atl-bar { display: block; height: 0.5rem; margin-top: 0.6rem; background: var(--ground); border-radius: 99px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--seam); }
.atl-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 260ms var(--ease-out); }
.atl-group { margin-top: 1.6rem; }
.atl-group h3 {
  display: flex; align-items: center; gap: 0.45rem; margin: 0; padding-bottom: 0.3rem; border-bottom: 1px solid var(--n-400);
  font: 600 var(--t-m)/1.2 var(--display); color: var(--n-900);
}
.atl-group h3 .ico { width: 1.35rem; height: 1.35rem; object-fit: contain; }
.atl-group .atl-rows { margin-top: 0; }
.atl-done-all { font: 400 var(--t-l)/1.3 var(--display); color: var(--accent); }

.atl-toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 30; max-width: min(36rem, calc(100vw - 2rem)); margin: 0;
  padding: 0.65rem 1rem; background: var(--n-300); border: 1px solid var(--n-400); border-radius: var(--r-m);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.5); color: var(--n-900); font-size: var(--t-s);
  opacity: 0; transform: translate(-50%, 0.5rem); pointer-events: none;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.atl-toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1020px) {
  .atl-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .atl-main { padding-top: 1.25rem; }
  .atl-row { grid-template-columns: 2.5rem minmax(0, 1fr) auto; row-gap: 0.4rem; }
  .atl-row .atl-stock { grid-column: 2; grid-row: 2; justify-self: start; }
  .atl-row .atl-miss { grid-column: 2; grid-row: 2; justify-self: end; align-self: center; }
  .atl-row .atl-ok { grid-column: 3; grid-row: 1 / span 2; }
  .atl-target { grid-template-columns: 2.5rem minmax(0, 1fr) auto auto; row-gap: 0.4rem; }
  .atl-target .atl-qty { grid-column: 2; }
  .atl-target .atl-ok { grid-column: 3; grid-row: 1 / span 2; }
  .atl-target .atl-rm { grid-column: 4; grid-row: 1 / span 2; }
  .atl-mode { width: 100%; }
  .atl-mode button { flex: 1 1 0; padding: 0 0.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .atl-addbar { animation: none; }
  .atl-toast, .atl-bar i, .atl-ok, .atl-rm, .atl-tabs a, .atl-name { transition: none; }
}

/* ---------- Markt #/markt (markt.js) ----------
   Seite im Rahmen des Ateliers (.atl, .atl-main, Reiter, Leere, Meldung): oben Titel mit „Eintrag erstellen“, darunter
   Reiter Angebote / Gesuche / Meine Einträge, eine Filterzeile und die Einträge als Zeilen: Symbol, Item mit Wurf und Exo,
   Preis in großen Ziffern (das Wichtigste beim Überfliegen), Anbieter, Aktionen. Messing nur für Preis-Kamas, Wahl und Fokus. */
body.market-mode > main.layout { display: none; }
.mk-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; }
.mk-new { gap: 0.45rem; }
.mk-new svg { width: 0.95rem; height: 0.95rem; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }
.mk-rule { margin: 0.9rem 0 0; max-width: 72ch; color: var(--muted); font-size: var(--t-xs); }

/* Filter */
.mk-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem 1rem; margin-top: 1.4rem; }
.mk-filters .xp-field { font-size: var(--t-xs); }
.mk-filters select, .mk-filters input[type="text"] {
  height: 2.6rem; padding: 0 0.6rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 500 var(--t-s)/1 var(--data); color: var(--n-900);
}
.mk-filters select:focus-visible, .mk-filters input:focus-visible { outline-offset: 1px; border-color: var(--accent); }
.mk-filters input[aria-invalid="true"], .mk-form input[aria-invalid="true"] { border-color: var(--el-fire); }
.mk-f-q { flex: 1 1 15rem; max-width: 24rem; }
.mk-f-server select { min-width: 11rem; }
.mk-f-max input { width: 8.5rem; }
.mk-f-exo { height: 2.6rem; }
.mk-chip { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.9rem; margin: 1rem 0 0; color: var(--n-700); font-size: var(--t-s); }

/* Einträge */
.mk-total { margin: 1.6rem 0 0; color: var(--muted); font-size: var(--t-s); }
.mk-rows { margin: 0.5rem 0 0; padding: 0; list-style: none; border-top: 1px solid var(--n-400); }
.mk-row {
  display: grid; grid-template-columns: 3rem minmax(0, 1.5fr) minmax(9rem, 0.75fr) minmax(10rem, 0.95fr) minmax(13.5rem, auto);
  grid-template-areas: "ico what price who acts" "ico detail detail detail detail";
  align-items: start; gap: 0 1.25rem; padding: 0.9rem 0; border-bottom: 1px solid var(--seam);
}
.mk-ico { grid-area: ico; }
.mk-what { grid-area: what; min-width: 0; }
.mk-price { grid-area: price; text-align: right; }
.mk-who { grid-area: who; min-width: 0; }
.mk-acts { grid-area: acts; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.4rem 0.6rem; }
.mk-detail { grid-area: detail; margin-top: 0.7rem; }
.mk-detail[hidden] { display: none; }
.mk-row p { margin: 0; }
.mk-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem; }
.mk-name .atl-n { font-size: var(--t-m); }
.mk-row .atl-meta { margin-top: 0.1rem; }
.mk-badge, .mk-kind {
  padding: 0.12rem 0.45rem 0.1rem; border-radius: 999px; font: 700 0.6875rem/1.1 var(--data);
  letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
}
.mk-kind { border: 1px solid var(--n-400); color: var(--n-700); }
.mk-badge-open { background: color-mix(in srgb, var(--el-air) 22%, transparent); color: var(--el-air); }
.mk-badge-reserved { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.mk-badge-expired, .mk-badge-done { background: var(--n-300); color: var(--n-700); }
.mk-expired .mk-ico, .mk-done .mk-ico, .mk-expired .mk-price, .mk-done .mk-price { opacity: 0.55; }
.mk-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem !important; }
.mk-tag {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.5rem; border-radius: var(--r-s);
  font: 600 var(--t-xs)/1.3 var(--data); white-space: nowrap; --ico: 1.05em;
}
.mk-q { background: var(--n-300); color: var(--n-900); }
.mk-exo { background: color-mix(in srgb, var(--stat-other) 20%, transparent); color: var(--n-900); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stat-other) 60%, transparent); }
.mk-note { margin-top: 0.4rem !important; color: var(--n-700); font-size: var(--t-s); white-space: pre-line; overflow-wrap: anywhere; }

.mk-p { font: 700 var(--t-l)/1.1 var(--data); color: var(--n-900); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mk-kama { display: inline-block; width: 0.95em; height: 0.95em; object-fit: contain; vertical-align: -0.1em; }
.mk-each { font: 500 var(--t-xs)/1 var(--data); color: var(--muted); }
.mk-sum { margin-top: 0.2rem !important; color: var(--muted); font-size: var(--t-xs); }
.mk-sum .mk-kama { width: 0.85em; height: 0.85em; }
.mk-ask { font: 600 var(--t-s)/1.3 var(--data); color: var(--n-700); white-space: normal; }

.mk-who { font-size: var(--t-s); color: var(--n-700); }
.mk-who-l { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.mk-who-l a { color: var(--n-900); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-who-l b, .mk-time b { color: var(--n-900); font-weight: 600; }
.mk-av { --av: 1.75rem; }
.mk-av.framed .av-in { inset: 15%; }
.mk-av:not(.framed) .av-in { background: var(--fill, var(--n-300)); }
.mk-time { margin-top: 0.2rem !important; color: var(--muted); font-size: var(--t-xs); }

.mk-whisper { gap: 0.4rem; border-color: var(--accent); }
.mk-whisper svg { width: 1rem; height: 1rem; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }
.mk-danger { color: var(--neg); }
.mk-acts .xp-link { font-size: var(--t-xs); }

/* Aufgeklappte Werte */
.mk-stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0 1.5rem;
  margin: 0; padding: 0.5rem 0.75rem; list-style: none; background: var(--ground); border-radius: var(--r-s);
}
.mk-stat { display: grid; grid-template-columns: minmax(0, 1fr) auto 4.5rem; align-items: baseline; gap: 0.6rem; padding: 0.25rem 0; font-size: var(--t-s); }
.mk-stat[data-el] .mk-stat-n { color: var(--el); }
.mk-stat-n { display: flex; align-items: center; gap: 0.4rem; min-width: 0; color: var(--n-700); --ico: 1.15em; }
.mk-stat b { font-variant-numeric: tabular-nums; color: var(--n-900); text-align: right; }
.mk-stat-r { color: var(--muted); font-size: var(--t-xs); text-align: right; }
.mk-stat.top b { color: var(--accent); }
.mk-stat.over b, .mk-stat.exo b { color: var(--stat-other); }
.mk-stat.exo .mk-stat-r { color: var(--stat-other); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

/* Formular */
.acct.mk-dlg { width: min(36rem, calc(100vw - 2rem)); }
.mk-form { gap: 1rem; }
.mk-kind-sw { width: 100%; }
.mk-kind-sw button { flex: 1 1 0; }
.mk-f-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; align-items: end; }
.mk-form .xp-field .num { height: 2.75rem; --num-bg: var(--ground); --num-w: 3rem; }
.mk-form .xp-field input[type="text"], .mk-form textarea, .mk-form select {
  width: 100%; padding: 0 0.65rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 500 var(--t-m)/1 var(--data); color: var(--n-900);
}
.mk-form .xp-field input[type="text"], .mk-form select { height: 2.75rem; }
.mk-form textarea { padding: 0.55rem 0.65rem; line-height: 1.4; resize: vertical; min-height: 3.6rem; }
.mk-form textarea:focus-visible, .mk-form select:focus-visible, .mk-form .xp-field input:focus-visible { outline-offset: 1px; border-color: var(--accent); }
.mk-form .acct-field input { width: 100%; }
.mk-form .acct-field .note { font-weight: 400; color: var(--muted); }
.mk-form .acct-hint { margin-top: -0.5rem; }
.mk-form .acct-hint .mk-kama { width: 0.9em; height: 0.9em; }
.mk-picked {
  display: grid; grid-template-columns: 2.75rem minmax(0, 1fr) auto; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.7rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
}
.mk-picked p { margin: 0; }
.mk-picked .atl-ico { background: var(--panel); }
.mk-f-item .atl-find { margin-top: 0.3rem; }
.mk-f-stats { margin: 0; padding: 0.4rem 0.8rem 0.8rem; border: 1px solid var(--seam); border-radius: var(--r-s); }
.mk-f-stats legend { padding: 0 0.3rem; }
.mk-f-stats .acct-hint { margin: 0.2rem 0 0.5rem; }
.mk-rolls li { grid-template-columns: minmax(0, 1fr) 6.5rem 5rem; }
.mk-rolls label { font-size: var(--t-s); --ico: 1.15em; }

.mk-f-qual { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 0.6rem 0 0; font: 700 var(--t-m)/1.2 var(--data); color: var(--accent); }
.mk-f-qual .xp-link { font: 400 var(--t-xs)/1 var(--data); }
.mk-f-exorow { margin-top: 0.8rem; grid-template-columns: minmax(0, 1fr) 9rem; }
.mk-f-act { display: flex; flex-wrap: wrap; gap: 0.5rem; }

@media (max-width: 1100px) {
  .mk-row {
    grid-template-columns: 3rem minmax(0, 1fr) auto;
    grid-template-areas: "ico what price" "ico who who" "ico acts acts" "ico detail detail";
    row-gap: 0.55rem;
  }
  .mk-acts { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .mk-row { grid-template-columns: 2.5rem minmax(0, 1fr); grid-template-areas: "ico what" "ico price" "ico who" "ico acts" "ico detail"; }
  .mk-price { text-align: left; }
  .mk-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem 0.75rem; }
  .mk-filters > * { max-width: none; min-width: 0; }
  .mk-f-q, .mk-f-server { grid-column: 1 / -1; }
  .mk-filters select, .mk-filters input[type="text"] { width: 100%; min-width: 0; }
  .mk-f-row { grid-template-columns: minmax(0, 1fr); }
  .mk-f-exorow { grid-template-columns: minmax(0, 1fr) 8rem; }
}

/* ---------- Build-Vergleich #/vergleich (compare.js) ----------
   Seite im Rahmen des Kampf-Simulators (.fight): oben vier Kästen mit den Einstellungen, darunter die Ergebnisse
   als Tabellen mit einer Spalte je Build. */
.cmp-setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; align-items: start; margin-bottom: 1.5rem; }
.cmp-field { display: grid; gap: 0.3rem; margin-bottom: 0.6rem; font-size: var(--t-xs); font-weight: 600; color: var(--n-700); }
.cmp-field select {
  width: 100%; min-height: 2.5rem; padding: 0 0.5rem; background: var(--ground); color: var(--text);
  border: 1px solid var(--seam); border-radius: var(--r-s); font-size: var(--t-s); font-weight: 500;
}
.cmp-builds { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
.cmp-build { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: 2.25rem; padding: 0 0.35rem; border-radius: var(--r-s); }
.cmp-build.on { background: var(--ground); }
.cmp-pick, .cmp-ref { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.cmp-pick { min-width: 0; font-weight: 600; color: var(--n-900); font-size: var(--t-s); }
.cmp-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-pick input, .cmp-ref input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); flex: none; }
.cmp-pick input:disabled + span { color: var(--muted); }
.cmp-ref { flex: none; font-size: var(--t-xs); color: var(--n-700); }
.cmp-box .note { margin: 0.4rem 0 0; font-size: var(--t-xs); }
.cmp-calc { display: grid; gap: 0.15rem; justify-items: start; }
.cmp-calc .ft-roll { margin-bottom: 0.35rem; }

.cmp-out { display: grid; gap: 1rem; }
.cmp-empty { margin: 0; padding: 1rem; color: var(--muted); }
.cmp-sec .cmp-note { margin: 0; padding-bottom: 0; font-size: var(--t-xs); color: var(--muted); }
.cmp-scroll { overflow-x: auto; }
.cmp-grid thead th { vertical-align: bottom; }
.cmp-grid thead th small, .cmp-dmg tbody th small { display: block; font-weight: 500; color: var(--muted); }
.cmp-grid thead th.ref { color: var(--accent); }
.cmp-grid td small { display: block; font-size: var(--t-xs); }
.cmp-grid td.up small, .cmp-grid td.down small { color: inherit; opacity: 0.85; }
.cmp-grid td.best { font-weight: 700; color: var(--n-900); }
.cmp-grid tr[data-el] th { color: var(--el); }
.cmp-group th { padding-top: 0.9rem; font: 600 var(--t-xs)/1.2 var(--data) !important; letter-spacing: 0.04em; text-transform: uppercase; color: var(--n-600) !important; }
.cmp-sum th, .cmp-sum td { font-weight: 700; }
.cmp-st, .cmp-sp { display: inline-flex; align-items: center; gap: 0.45rem; --ico: 1.2em; }
.cmp-sp img { width: 1.6rem; height: 1.6rem; border-radius: var(--r-s); flex: none; }
.cmp-stats tbody th small { min-width: 0; }

/* Schaden: Balken in der Zelle, eine Farbe (eine Reihe); die Zahl steht daneben */
.cmp-dmg .cmp-barcol { min-width: 14rem; text-align: left; }
.cmp-bar { display: inline-block; width: calc(100% - 4.5rem); max-width: 18rem; height: 0.55rem; margin-right: 0.6rem; vertical-align: middle;
  background: var(--ground); border-radius: 2px; overflow: hidden; }
.cmp-bar i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.cmp-dmg .cmp-barcol b { font: 700 var(--t-m)/1 var(--data); color: var(--n-900); font-variant-numeric: tabular-nums; }
.cmp-dmg .cmp-barcol small { display: block; margin-top: 0.15rem; color: var(--muted); font-size: var(--t-xs); }
.cmp-dmg td small { display: block; }

/* Items: Bild und Name; gleiche Plätze bei Bedarf eingeblendet */
.cmp-items td { text-align: left; white-space: normal; min-width: 11rem; vertical-align: top; }
.cmp-it { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--n-900); text-decoration: none !important; }
.cmp-it .plate { width: 2rem; height: 2rem; flex: none; }
.cmp-it small.bad { display: block; color: var(--el-fire); }
.cmp-item.none { color: var(--muted); }
.cmp-items tr.same td, .cmp-items tr.same th { opacity: 0.6; }

/* Einklappbare Abschnitte (Werte, effektive LP, Items): Kopf wie .bd-cap, rechts ein Pfeil */
.cmp-fold > summary { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; list-style: none; cursor: pointer; }
.cmp-fold > summary::-webkit-details-marker { display: none; }
.cmp-fold > summary h2 { margin: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
.cmp-fold > summary::after {
  content: ""; width: 0.45rem; height: 0.45rem; margin-right: 0.2rem; flex: none;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s var(--ease-out);
}
.cmp-fold[open] > summary::after { transform: rotate(45deg); }
.cmp-fold:not([open]) > summary { border-bottom: 0; }
.cmp-fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (hover: hover) { .cmp-fold > summary:hover { color: var(--n-800); } }
@media (prefers-reduced-motion: reduce) { .cmp-fold > summary::after { transition: none; } }

/* Ablauf im Build-Vergleich: Runde als Kopfzeile, darunter Buffs und Züge */
.cmp-flow .cmp-turn th, .cmp-flow .cmp-turn td { background: var(--ground); padding-top: 0.55rem; padding-bottom: 0.55rem; }
.cmp-flow .cmp-turn th { font: 600 var(--t-m)/1.2 var(--display); color: var(--n-900); }
.cmp-flow .cmp-turn td { font-weight: 700; color: var(--n-900); }
.cmp-flow .cmp-turn td.ref { color: var(--accent); }
.cmp-flow .cmp-turn td small { font-weight: 500; color: var(--muted); }
.cmp-flow .cmp-act th { padding-left: 1.25rem; font-weight: 500; }
.cmp-flow tbody th small { min-width: 0; }
.cmp-flow .cmp-sp img, .cmp-noimg { width: 1.6rem; height: 1.6rem; border-radius: var(--r-s); flex: none; }
.cmp-noimg { display: inline-block; }
.cmp-flow td.cmp-why { color: var(--el-fire); font-size: var(--t-xs); white-space: normal; min-width: 9rem; }
.cmp-flow td.cmp-miss { color: var(--muted); font-size: var(--t-xs); }
.cmp-buffs th { padding-left: 1.25rem; font-size: var(--t-xs); font-weight: 600 !important; color: var(--n-700) !important; }
.cmp-buffs td { vertical-align: top; }
.cmp-buffs ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; font-size: var(--t-xs); color: var(--n-700); white-space: normal; }

/* Buffs im Ablauf: Bild der Quelle (Zauber oder Item), Wirkung, Stapel; Quelle und Dauer im Tooltip */
.cmp-buffs ul { justify-items: end; gap: 0.25rem; }
.cmp-buff { display: inline-flex; align-items: center; gap: 0.35rem; cursor: help; }
.cmp-buff img { width: 1.15rem; height: 1.15rem; border-radius: 3px; flex: none; object-fit: contain; }
.cmp-buff b { font-weight: 700; color: var(--n-900); }
@media (hover: hover) { .cmp-buff:hover { color: var(--n-900); } }
/* Laufen und Gift: Symbole wie im Verlauf des Simulators */
.cmp-svg { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; flex: none; border-radius: var(--r-s); border: 1px solid var(--seam); }
.cmp-svg svg { width: 1rem; height: 1rem; fill: currentColor; }
.cmp-svg.move { color: var(--el-air); border-style: dashed; }
.cmp-svg.poison { color: var(--el-earth); }

/* Ablauf: Buffs in Reihenfolge. Zu Rundenbeginn, neue Buffs direkt unter dem auslösenden Zug, Rundenende */
.cmp-buffs.gained th { padding-left: 2.6rem; color: var(--accent) !important; font-weight: 500 !important; }
.cmp-buffs.gained th, .cmp-buffs.gained td { padding-top: 0.15rem; padding-bottom: 0.45rem; }
.cmp-flow tr.cmp-act:has(+ .cmp-buffs.gained) th, .cmp-flow tr.cmp-act:has(+ .cmp-buffs.gained) td { border-bottom-color: transparent; }
.cmp-buffs.end th { font-style: italic; }
.cmp-buff.gone { color: var(--muted); }
.cmp-buff.gone img { opacity: 0.5; filter: grayscale(0.6); }
/* „mit n Buffs“ am Schaden eines Zugs; welche es waren, steht im Tooltip */
.cmp-boost {
  display: inline-block; margin-top: 0.2rem; padding: 0.05rem 0.4rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
  font: 600 var(--t-xs)/1.4 var(--data); white-space: nowrap; cursor: help;
}
.cmp-tiplist { list-style: none; margin: 0.35rem 0; padding: 0; display: grid; gap: 0.35rem; }
.cmp-tiplist li { display: flex; align-items: center; gap: 0.5rem; }
.cmp-tiplist .plate { width: 1.8rem; height: 1.8rem; }
.cmp-tiplist small { display: block; color: var(--muted); font-size: var(--t-xs); }

/* Je Runde: vor der Runde angegriffen worden (Vulbis, Ocker, Purpur); Kampf-Simulator und Build-Vergleich */
.ft-hit { display: grid; gap: 0.35rem; margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--seam); }
.ft-hitl { margin: 0; font-size: var(--t-xs); font-weight: 600; color: var(--n-800); }
.ft-hitrow { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.ft-hitb {
  min-width: 2.5rem; min-height: 2rem; padding: 0 0.5rem; border: 1px solid var(--seam); border-radius: var(--r-s);
  background: var(--ground); color: var(--n-700); font: 600 var(--t-xs)/1 var(--data); cursor: pointer;
}
.ft-hitb[aria-pressed="true"] { background: var(--el-fire); border-color: var(--el-fire); color: var(--n-100); }
.ft-hitb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .ft-hitb:hover { border-color: var(--n-500); color: var(--n-900); } }
.ft-hit .note, .ft-hitnote { margin: 0; font-size: var(--t-xs); }

/* Build-Vergleich, Kasten „Rechnung“: Sonderwirkungen kurz, Einstellungen im Dialog */
.cmp-fxrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 0.75rem; width: 100%; padding: 0.35rem 0; }
.cmp-fxrow p { margin: 0 !important; display: grid; gap: 0.1rem; font-size: var(--t-s) !important; }
.cmp-fxrow span { font-weight: 600; color: var(--n-900); }
.cmp-fxrow b { font-weight: 500; font-size: var(--t-xs); color: var(--n-700); }

/* Dialog „Item-Sonderwirkungen“ (compare.js openFxDialog), im Rahmen des Resistenzen-Dialogs */
.fxd { width: min(44rem, calc(100vw - 2rem)); }
.fxd-body { display: grid; gap: 1.1rem; padding: 1rem; overflow: auto; overscroll-behavior: contain; }
.fxd-body h3 { margin: 0 0 0.4rem; font: 600 var(--t-m)/1.2 var(--display); color: var(--n-900); }
.fxd-body h3 .note { font: 500 var(--t-xs)/1 var(--data); color: var(--muted); margin-left: 0.4rem; }
.fxd-body > .note, .fxd-body section > .note { margin: 0 0 0.4rem; font-size: var(--t-xs); }
.fxd-list { list-style: none; margin: 0; padding: 0; display: grid; }
.fxd-item { display: grid; grid-template-columns: 1.1rem 2.25rem minmax(0, 1fr); align-items: start; gap: 0.6rem; padding: 0.55rem 0; border-top: 1px solid var(--seam); }
.fxd-item:first-child { border-top: 0; }
.fxd-item input[type="checkbox"] { margin: 0.65rem 0 0; width: 1rem; height: 1rem; accent-color: var(--accent); }
.fxd-img img { display: block; width: 2.25rem; height: 2.25rem; object-fit: contain; }
.fxd-txt { display: grid; gap: 0.15rem; font-size: var(--t-s); cursor: pointer; }
.fxd-txt .n { font-weight: 600; color: var(--n-900); }
.fxd-txt .sub { font-weight: 400; color: var(--n-700); }
.fxd-txt small { font-size: var(--t-xs); line-height: 1.4; color: var(--n-700); }
.fxd-txt small.fxd-who { color: var(--muted); }
.fxd-item.off .fxd-txt { cursor: default; }
.fxd-item.off .fxd-txt .n { color: var(--n-700); }
.fxd-item.off img { opacity: 0.5; filter: grayscale(0.7); }
.fxd-item input:disabled ~ .fxd-img img, .fxd-item input:disabled ~ .fxd-txt { opacity: 0.55; }
.fxd .ft-hit { margin-top: 0; padding-top: 0; border-top: 0; }
.cmp-calc .ft-delayrow { justify-self: stretch; }

/* ---------- Start-Seite #/ (home.js) ----------
   Arbeitsfläche statt Werbeseite: Suche oben, darunter Almanax und Stöbern links, Persönliches rechts,
   ganz unten das Verzeichnis aller Bereiche wie ein Inhaltsverzeichnis (Punktlinie bis zur Zahl).
   Unter 1100px eine Spalte in der Reihenfolge des Markups: Almanax, Persönliches, Stöbern, Verzeichnis. */
body.home-mode > main.layout { display: none; }
.home { background: var(--panel); }
.home[hidden] { display: none; }
@media (min-width: 861px) {
  .home { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.hm-main { max-width: 84rem; margin-inline: auto; padding: 2rem clamp(1rem, 4vw, 3.5rem) 4rem; }
.home a:focus-visible, .home button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s); }

.hm-title { margin: 0; font: 600 var(--t-name)/1.05 var(--display); color: var(--n-900); }
.hm-sub { margin: 0.35rem 0 0; max-width: 70ch; color: var(--n-700); text-wrap: pretty; }

/* Suche */
.hm-search { position: relative; margin-top: 1.5rem; }
.hm-field {
  display: flex; align-items: center; gap: 0.75rem; height: 3.5rem; padding: 0 1rem;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m);
  transition: border-color 120ms var(--ease-out);
}
.hm-field:hover { border-color: var(--n-400); }
.hm-field:focus-within { border-color: var(--accent); }
.hm-field svg { flex: none; width: 1.25rem; height: 1.25rem; fill: none; stroke: var(--n-600); stroke-width: 1.7; stroke-linecap: round; }
.hm-field input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none;
  font: 600 var(--t-l)/1 var(--data); color: var(--n-900);
}
.hm-field input::placeholder { color: var(--muted); font-weight: 400; }
/* Schmal: kleinere Schrift, damit der Platzhalter in allen fünf Sprachen ganz zu lesen ist (16px+ verhindert Zoom auf iOS) */
@media (max-width: 480px) {
  .hm-field { height: 3.25rem; gap: 0.6rem; padding: 0 0.85rem; }
  .hm-field input { font-size: var(--t-m); }
}
.hm-field input:focus { outline: none; }
.hm-field input::-webkit-search-cancel-button { display: none; }
.hm-kbd {
  flex: none; padding: 0.15rem 0.4rem; border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 600 var(--t-xs)/1.2 var(--data); color: var(--muted);
}
@media (pointer: coarse) { .hm-kbd { display: none; } }

.hm-drop {
  position: absolute; z-index: 20; top: calc(100% + 0.4rem); left: 0; right: 0;
  display: grid; grid-template-rows: minmax(0, 1fr) auto; max-height: min(65vh, 30rem);
  background: var(--ground); border: 1px solid var(--n-400); border-radius: var(--r-m);
  box-shadow: 0 14px 36px rgb(0 0 0 / 0.38);
  animation: hm-drop 160ms var(--ease-out);
}
:root[data-theme="light"] .hm-drop { box-shadow: 0 12px 30px rgb(16 19 21 / 0.14); }
.hm-drop[hidden] { display: none; }
@keyframes hm-drop { from { opacity: 0; transform: translateY(-4px); } }
.hm-results { list-style: none; margin: 0; padding: 0.35rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.hm-results li[role="option"] {
  display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: center;
  padding: 0.45rem 0.6rem; border-radius: var(--r-s); cursor: pointer;
}
.hm-results li[aria-selected="true"] { background: var(--n-250); box-shadow: inset 2px 0 0 var(--accent); }
@media (hover: hover) and (pointer: fine) { .hm-results li[role="option"]:hover { background: var(--n-250); } }
.hm-results img, .hm-ph { width: 2rem; height: 2rem; object-fit: contain; }
.hm-ph { display: block; border-radius: var(--r-s); background: var(--n-250); }
.hm-rn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900); }
.hm-rn small { display: block; overflow: hidden; text-overflow: ellipsis; font: 500 var(--t-xs)/1.3 var(--data); color: var(--muted); }
.hm-results button {
  padding: 0.3rem 0.6rem; border: 1px solid var(--seam); border-radius: var(--r-s); background: none;
  font: 600 var(--t-xs)/1 var(--data); color: var(--muted); cursor: pointer;
}
@media (hover: hover) and (pointer: fine) { .hm-results button:hover { color: var(--text); border-color: var(--accent); } }
.hm-empty { padding: 0.85rem 0.6rem; font-size: var(--t-s); color: var(--muted); }
.hm-hint { margin: 0; padding: 0.55rem 0.95rem; border-top: 1px solid var(--seam); font-size: var(--t-xs); color: var(--muted); }
@media (pointer: coarse) { .hm-hint { display: none; } }

/* Raster */
.hm-grid { display: grid; gap: 2.75rem; margin-top: 2.75rem; }
@media (min-width: 1100px) {
  .hm-grid {
    grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem); column-gap: clamp(2.5rem, 4vw, 4rem);
    grid-template-areas: "alma side" "news side" "browse side" "toc toc";
  }
  .hm-alma { grid-area: alma; }
  .hm-news { grid-area: news; }
  .hm-side { grid-area: side; }
  .hm-browse { grid-area: browse; }
  .hm-toc { grid-area: toc; }
}
.hm-side { display: grid; gap: 2.75rem; align-content: start; }
.hm-sh {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem;
  margin-bottom: 1rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--seam);
}
.hm-sh h2 { margin: 0; font: 600 var(--t-l)/1.2 var(--display); color: var(--n-900); }
.hm-date { margin: 0; font-size: var(--t-s); color: var(--n-700); }
.hm-link {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2rem; padding: 0; border: 0; background: none;
  font: 600 var(--t-s)/1 var(--data); color: var(--n-700); text-decoration: none; cursor: pointer;
  transition: color 120ms var(--ease-out);
}
.hm-link svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hm-reroll:active svg { transform: rotate(-60deg); transition: transform 160ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .hm-link:hover { color: var(--n-900); } }
.hm-sh .hm-link { margin-block: -0.5rem; } /* Trefferfläche behalten, ohne die Kopfzeile höher zu machen */
.hm-link[hidden] { display: none; }
.hm-note { margin: 0; font-size: var(--t-s); color: var(--muted); text-wrap: pretty; }
.hm-note a { color: var(--n-900); text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
.hm-browse .hm-note { margin: -0.4rem 0 1rem; }

/* Platzhalter beim Laden */
.hm-skel { display: block; border-radius: var(--r-m); background: var(--n-250); animation: hm-pulse 1.2s ease-in-out infinite alternate; }
.hm-skel-today { height: 8.5rem; }
.hm-skel-pick { aspect-ratio: 4 / 3; }
@keyframes hm-pulse { to { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .hm-skel, .hm-drop { animation: none; } }

/* Almanax */
.hm-label {
  margin: 0 0 0.45rem; font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.hm-today { display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 1fr); gap: 1.25rem 2.5rem; }
@media (max-width: 640px) { .hm-today { grid-template-columns: minmax(0, 1fr); } }
.hm-offer-item {
  display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); align-items: center; gap: 0.9rem; text-decoration: none;
}
.hm-offer-item img, .hm-offer-item .hm-ph {
  width: 4.5rem; height: 4.5rem; padding: 0.4rem; object-fit: contain; background: var(--ground); border-radius: var(--r-m);
}
.hm-offer-item .hm-qn { font: 600 var(--t-l)/1.2 var(--data); color: var(--n-900); text-wrap: balance; }
.hm-qty { color: var(--accent); font-weight: 700; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) {
  .hm-offer-item:hover .hm-qn, .hm-day-item:hover .hm-qn { text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
}
.hm-bname { margin: 0; font: 700 var(--t-l)/1.2 var(--data); color: var(--n-900); }
.hm-bdesc { margin: 0.35rem 0 0; max-width: 62ch; font-size: var(--t-s); color: var(--n-700); text-wrap: pretty; }
.hm-meridia { margin: 0.6rem 0 0; font: italic 400 var(--t-s)/1.4 var(--display); color: var(--muted); }
.hm-meridia span { color: var(--n-800); }
.hm-unknown { color: var(--muted); font-style: italic; }

.hm-days { width: 100%; margin-top: 1.5rem; border-collapse: collapse; font-size: var(--t-s); }
.hm-days tr { border-top: 1px solid var(--seam); }
.hm-days th, .hm-days td { padding: 0.45rem 0; text-align: left; vertical-align: middle; }
.hm-days th { width: 5.5rem; padding-right: 1rem; font-weight: 600; color: var(--n-800); white-space: nowrap; }
.hm-wd { display: inline-block; min-width: 1.9rem; color: var(--muted); }
.hm-days td + td { padding-left: 1.5rem; }
.hm-day-item { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; }
.hm-day-item img, .hm-day-item .hm-ph { width: 1.75rem; height: 1.75rem; object-fit: contain; }
.hm-day-item .hm-qn { font-weight: 600; color: var(--n-900); }
.hm-day-item .hm-qty { font-weight: 600; }
.hm-day-bonus { color: var(--n-700); }
@media (max-width: 640px) {
  .hm-days, .hm-days tbody { display: block; }
  .hm-days tr { display: grid; grid-template-columns: 5rem minmax(0, 1fr); padding: 0.4rem 0; }
  .hm-days th, .hm-days td { padding: 0.1rem 0; }
  .hm-days td + td { grid-column: 2; padding-left: 0; }
}

/* Neuigkeiten von dofus.com: Zeilen mit Vorschaubild (16:9), Datum und Kategorie, Titel, zwei Zeilen Anriss */
.hm-news[hidden] { display: none; }
.hm-sh .hm-link svg { width: 0.95rem; height: 0.95rem; }
.hm-news-note { margin: -0.4rem 0 0.9rem; }
.hm-newslist { list-style: none; margin: -0.5rem -0.5rem 0; padding: 0; display: grid; }
.hm-skel-news { height: 5.5rem; margin: 0.5rem; }
.hm-nrow {
  display: grid; grid-template-columns: 10rem minmax(0, 1fr); align-items: start; gap: 1rem;
  padding: 0.5rem; border-radius: var(--r-m); text-decoration: none; transition: background-color 120ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .hm-nrow:hover { background: var(--n-250); }
  .hm-nrow:hover .hm-ntitle { text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
}
.hm-nrow:active { background: var(--n-250); }
.hm-nimg { aspect-ratio: 16 / 9; overflow: hidden; background: var(--ground); border-radius: var(--r-s); }
.hm-nimg img { width: 100%; height: 100%; object-fit: cover; }
.hm-ntext { display: grid; gap: 0.15rem; min-width: 0; }
.hm-nmeta { font-size: var(--t-xs); color: var(--muted); }
.hm-ntitle { font: 600 var(--t-m)/1.25 var(--data); color: var(--n-900); text-wrap: balance; }
.hm-nsum {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  font-size: var(--t-s); color: var(--n-700);
}
@media (max-width: 640px) {
  .hm-nrow { grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0.75rem; }
  .hm-nsum { display: none; }
}

/* Persönliches: Zeilen mit Bild, Name und Art */
.hm-rows { list-style: none; margin: -0.3rem -0.5rem 0; padding: 0; display: grid; }
.hm-row {
  display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); align-items: center; gap: 0.75rem;
  min-height: 2.75rem; padding: 0.35rem 0.5rem; border-radius: var(--r-m); text-decoration: none;
  transition: background-color 120ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .hm-row:hover { background: var(--n-250); } }
.hm-row:active { background: var(--n-250); }
.hm-thumb { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; overflow: hidden; background: var(--ground); border-radius: var(--r-s); }
.hm-thumb img { width: 88%; height: 88%; object-fit: contain; }
.hm-thumb.hm-face img { width: 100%; height: 100%; object-fit: cover; }
.hm-rt { display: grid; min-width: 0; }
.hm-rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 var(--t-m)/1.25 var(--data); color: var(--n-900); }
.hm-rsub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-xs); color: var(--muted); }
.hm-row.hm-list { grid-template-columns: minmax(0, 1fr) auto; }

/* Stöbern */
.hm-picks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr)); gap: 1.25rem 1rem; }
@media (max-width: 480px) { .hm-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hm-picks[aria-busy="true"] .hm-pick { opacity: 0.5; }
.hm-pick { display: grid; gap: 0.2rem; text-decoration: none; transition: opacity 160ms var(--ease-out); }
.hm-pimg {
  display: grid; place-items: center; aspect-ratio: 4 / 3; margin-bottom: 0.45rem; overflow: hidden;
  background: var(--ground); border-radius: var(--r-m);
}
.hm-pimg img { width: 68%; height: 80%; object-fit: contain; transition: transform 220ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .hm-pick:hover .hm-pimg img { transform: scale(1.06); }
  .hm-pick:hover .hm-pname { text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
}
.hm-pname { font: 600 var(--t-m)/1.25 var(--data); color: var(--n-900); overflow-wrap: anywhere; }
.hm-pmeta { font-size: var(--t-xs); color: var(--muted); }

/* Verzeichnis */
.hm-toc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 1.75rem clamp(1.5rem, 3vw, 2.75rem); }
.hm-tg h3 { margin: 0 0 0.35rem; font: italic 400 1.1875rem/1.3 var(--display); color: var(--n-700); }
.hm-tg ul { list-style: none; margin: 0; padding: 0; }
.hm-tl { display: flex; align-items: baseline; gap: 0.45rem; padding: 0.3rem 0; text-decoration: none; color: var(--n-800); }
.hm-tn { font-weight: 600; color: var(--n-900); }
.hm-lead { flex: 1; min-width: 1rem; border-bottom: 1px dotted var(--n-400); transform: translateY(-0.3em); }
.hm-tc { min-width: 2.5ch; text-align: right; font-size: var(--t-s); color: var(--n-700); }
.hm-tool { display: grid; gap: 0.05rem; }
.hm-tnote { font-size: var(--t-xs); color: var(--muted); }
@media (hover: hover) and (pointer: fine) {
  .hm-tl:hover .hm-tn { text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
}

@media (max-width: 860px) {
  .hm-main { padding: 1.5rem 1rem 3rem; }
  .hm-grid { gap: 2.25rem; margin-top: 2rem; }
  .hm-side { gap: 2.25rem; }
}

/* ---------- Neuigkeiten #/news und #/news/<id> (news.js) ----------
   Liste: neueste Meldung groß (Bild links, Text rechts), darunter Zeilen wie auf der Start-Seite.
   Artikel: Lesebreite um 68 Zeichen, daneben ab 1100px „Weitere Neuigkeiten“, schmal darunter. */
body.news-mode > main.layout { display: none; }
.newspage { background: var(--panel); }
.newspage[hidden] { display: none; }
@media (min-width: 861px) {
  .newspage { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.nw-main { max-width: 78rem; margin-inline: auto; padding: 2rem clamp(1rem, 4vw, 3.5rem) 4rem; }
.newspage a:focus-visible, .newspage button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s); }
.newspage svg { width: 1rem; height: 1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.nw-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem 1.5rem; margin-bottom: 2rem; }
.nw-title { margin: 0; font: 600 var(--t-name)/1.05 var(--display); color: var(--n-900); text-wrap: balance; }
.nw-sub { margin: 0.35rem 0 0; color: var(--n-700); }
.nw-lang { margin: 0.35rem 0 0; font-size: var(--t-s); color: var(--muted); }
.nw-out, .nw-back, .nw-all {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.25rem;
  font: 600 var(--t-s)/1 var(--data); color: var(--n-700); text-decoration: none; transition: color 120ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .nw-out:hover, .nw-back:hover, .nw-all:hover { color: var(--n-900); } }
.nw-meta { font-size: var(--t-xs); color: var(--muted); }

/* Aufmacher */
.nw-lead {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: center; gap: 1.25rem 2.5rem;
  padding-bottom: 2rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--seam); text-decoration: none;
}
.nw-limg { aspect-ratio: 16 / 9; overflow: hidden; background: var(--ground); border-radius: var(--r-m); }
.nw-limg img { width: 100%; height: 100%; object-fit: cover; transition: transform 320ms var(--ease-out); }
.nw-ltext { display: grid; gap: 0.5rem; align-content: center; }
.nw-ltitle { font: 600 clamp(1.5rem, 1.1rem + 1.2vw, 2rem)/1.15 var(--display); color: var(--n-900); text-wrap: balance; }
.nw-lsum { color: var(--n-700); text-wrap: pretty; }
.nw-read { justify-self: start; margin-top: 0.25rem; font: 600 var(--t-s)/1 var(--data); color: var(--accent); }
@media (hover: hover) and (pointer: fine) {
  .nw-lead:hover .nw-limg img { transform: scale(1.025); }
  .nw-lead:hover .nw-ltitle { text-decoration: underline 1px var(--accent); text-underline-offset: 0.15em; }
}
@media (max-width: 760px) { .nw-lead { grid-template-columns: minmax(0, 1fr); } }

/* Zeilen */
.nw-list, .nw-mlist { list-style: none; margin: 0 -0.5rem; padding: 0; display: grid; }
.nw-row, .nw-mrow {
  display: grid; grid-template-columns: 13rem minmax(0, 1fr); align-items: start; gap: 1.25rem;
  padding: 0.6rem 0.5rem; border-radius: var(--r-m); text-decoration: none; transition: background-color 120ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .nw-row:hover, .nw-mrow:hover { background: var(--n-250); }
  .nw-row:hover .nw-rtitle, .nw-mrow:hover .nw-rtitle { text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
}
.nw-row:active, .nw-mrow:active { background: var(--n-250); }
.nw-img { aspect-ratio: 16 / 9; overflow: hidden; background: var(--ground); border-radius: var(--r-s); }
.nw-img img { width: 100%; height: 100%; object-fit: cover; }
.nw-rtext { display: grid; gap: 0.2rem; min-width: 0; }
.nw-rtitle { font: 600 var(--t-l)/1.2 var(--data); color: var(--n-900); text-wrap: balance; }
.nw-sum {
  max-width: 70ch; font-size: var(--t-s); color: var(--n-700);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
@media (max-width: 640px) {
  .nw-row { grid-template-columns: 7rem minmax(0, 1fr); gap: 0.85rem; }
  .nw-rtitle { font-size: var(--t-m); }
  .nw-sum { display: none; }
}
.nw-older {
  display: block; margin: 1.5rem auto 0; min-height: 2.5rem; padding: 0 1.25rem;
  background: none; border: 1px solid var(--seam); border-radius: var(--r-m);
  font: 600 var(--t-s)/1 var(--data); color: var(--n-800); cursor: pointer; transition: border-color 120ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .nw-older:hover { border-color: var(--accent); } }
.nw-older:disabled { opacity: 0.6; cursor: progress; }
.nw-credit { margin: 3rem 0 0; font-size: var(--t-xs); color: var(--muted); text-align: center; }

/* Artikel */
.nw-back { margin: -0.4rem 0 1.25rem; }
.nw-artgrid { display: grid; gap: 3rem; }
@media (min-width: 1100px) {
  .nw-artgrid { grid-template-columns: minmax(0, 46rem) minmax(16rem, 20rem); justify-content: space-between; column-gap: clamp(3rem, 6vw, 6rem); }
  .nw-more { position: sticky; top: 1.5rem; align-self: start; }
}
.nw-article { min-width: 0; }
.nw-ahead { margin-bottom: 1.75rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--seam); }
.nw-ahead .nw-meta { margin: 0 0 0.5rem; font-size: var(--t-s); }
.nw-atitle { margin: 0; font: 600 clamp(1.75rem, 1.2rem + 2vw, 2.625rem)/1.1 var(--display); color: var(--n-900); text-wrap: balance; }

/* Artikeltext von dofus.com (bereinigt in dofus_api/news.py: nur einfache Tags, Klasse .c = mittig) */
.nw-body { font-size: 1.125rem; line-height: 1.6; color: var(--n-800); overflow-wrap: break-word; }
.nw-body > * { max-width: 68ch; }
.nw-body p, .nw-body ul, .nw-body ol, .nw-body blockquote, .nw-body table, .nw-body figure { margin: 0 0 1.1em; }
.nw-body strong, .nw-body b { font-weight: 700; color: var(--n-900); }
.nw-body h2, .nw-body h3, .nw-body h4 { margin: 1.9em 0 0.6em; font-family: var(--display); font-weight: 600; line-height: 1.2; color: var(--n-900); text-wrap: balance; }
.nw-body h2 { font-size: 1.625rem; }
.nw-body h3 { font-size: 1.3125rem; }
.nw-body h4 { font-size: 1.125rem; }
.nw-body ul, .nw-body ol { padding-left: 1.4em; }
.nw-body li { margin-bottom: 0.35em; }
.nw-body li::marker { color: var(--accent); }
.nw-body a { color: var(--n-900); text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
@media (hover: hover) and (pointer: fine) { .nw-body a:hover { text-decoration-thickness: 2px; } }
.nw-body img { display: block; max-width: 100%; height: auto; margin: 1.6em auto; border-radius: var(--r-m); }
.nw-body div:has(> img:only-child) { max-width: none; }
.nw-body hr { max-width: none; margin: 2em 0; border: 0; border-top: 1px solid var(--seam); }
.nw-body blockquote { padding-left: 1em; border-left: 1px solid var(--n-400); color: var(--n-700); font-style: italic; }
.nw-body table { border-collapse: collapse; font-size: var(--t-s); }
.nw-body th, .nw-body td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--seam); text-align: left; }
.nw-body .c { text-align: center; margin-inline: auto; }
.nw-body em { color: inherit; }
.nw-src {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 1.5rem;
  margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--seam);
}
.nw-src p { margin: 0; font-size: var(--t-s); color: var(--muted); }

.nw-more h2 { margin: 0 0 0.75rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--seam); font: 600 var(--t-l)/1.2 var(--display); color: var(--n-900); }
.nw-mrow { grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0.85rem; padding: 0.5rem; }
.nw-mrow .nw-rtitle { font-size: var(--t-m); }
.nw-all { margin: 0.5rem 0 0 0.5rem; }

/* Laden und Fehler */
.nw-skel { display: block; border-radius: var(--r-m); background: var(--n-250); animation: hm-pulse 1.2s ease-in-out infinite alternate; }
.nw-skel-lead { aspect-ratio: 32 / 9; }
.nw-skel-art { height: 24rem; max-width: 46rem; }
.nw-skel-row { height: 4rem; margin: 0.5rem; }
@media (prefers-reduced-motion: reduce) { .nw-skel { animation: none; } }
.nw-fail { display: grid; justify-items: start; gap: 0.75rem; max-width: 40rem; padding: 2rem 0; }
.nw-fail .nw-title { font-size: var(--t-l); }
.nw-fail p { margin: 0; color: var(--n-700); }

@media (max-width: 860px) {
  .nw-main { padding: 1.5rem 1rem 3rem; }
  .nw-body { font-size: var(--t-m); }
}

/* ---------- Neu im Spiel: Schild an Einträgen (app.js markNew) und Seite #/neu (newin.js) ----------
   Das Schild ist eine schmale Messing-Kontur: fällt in Listen auf, ohne mit Elementfarben oder der Auswahl
   zu konkurrieren. Die Seite folgt den Neuigkeiten: Kopf, Zahlen je Bereich als Sprungmarken, dann je Bereich
   ein Raster aus Bild und Name; lange Bereiche zuerst gekürzt. */
.new-tag {
  display: inline-block; padding: 0.1em 0.45em; vertical-align: 0.12em;
  border: 1px solid var(--accent); border-radius: var(--r-s);
  font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.02em; color: var(--accent); white-space: nowrap;
}
.new-tag-s { padding: 0 0.35em; font-size: 0.6875rem; vertical-align: 0.15em; }

body.newin-mode > main.layout { display: none; }
.newpage { background: var(--panel); }
.newpage[hidden] { display: none; }
@media (min-width: 861px) {
  .newpage { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.nv-main { max-width: 84rem; margin-inline: auto; padding: 2rem clamp(1rem, 4vw, 3.5rem) 4rem; }
.newpage a:focus-visible, .newpage button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s); }
.nv-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem 1.5rem; margin-bottom: 1.5rem; }
.nv-title { margin: 0; font: 600 var(--t-name)/1.05 var(--display); color: var(--n-900); text-wrap: balance; }
.nv-head > div { flex: 1 1 20rem; min-width: 0; }
@media (prefers-reduced-motion: reduce) { .nv-skel { animation: none; } }
@media (max-width: 860px) { .nv-main { padding: 1.5rem 1rem 3rem; } }
.nv-lead, .nv-note { margin: 0.35rem 0 0; max-width: 70ch; color: var(--n-700); text-wrap: pretty; }
.nv-note { color: var(--muted); font-size: var(--t-s); }
.nv-beta { width: fit-content; max-width: 70ch; margin: 0.6rem 0 0; }
.nv-skel { height: 12rem; border-radius: var(--r-m); background: var(--n-250); animation: hm-pulse 1.2s ease-in-out infinite alternate; }

.nv-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.nv-tabs a {
  display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 0.8rem;
  border: 1px solid var(--seam); border-radius: var(--r-m);
  font: 600 var(--t-s)/1 var(--data); color: var(--n-700); text-decoration: none;
  transition: border-color 120ms var(--ease-out), color 120ms var(--ease-out);
}
.nv-tabs a[aria-current="page"] { border-color: var(--accent); color: var(--n-900); }
@media (hover: hover) and (pointer: fine) { .nv-tabs a:hover { color: var(--n-900); } }

.nv-sum { list-style: none; margin: 0 0 2rem; padding: 0 0 1.25rem; display: flex; flex-wrap: wrap; gap: 0.35rem 1.5rem; border-bottom: 1px solid var(--seam); }
.nv-sum a { display: inline-flex; align-items: baseline; gap: 0.35rem; min-height: 2rem; color: var(--n-700); text-decoration: none; }
.nv-sum b { font: 600 var(--t-l)/1 var(--data); color: var(--n-900); font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) { .nv-sum a:hover { color: var(--n-900); } }

.nv-group { margin-bottom: 2.25rem; scroll-margin-top: 1rem; }
.nv-group h2 { display: flex; align-items: baseline; gap: 0.5rem; margin: 0 0 0.75rem; font: 600 var(--t-l)/1.2 var(--display); color: var(--n-900); }
.nv-count { font: 600 var(--t-s)/1 var(--data); color: var(--muted); font-variant-numeric: tabular-nums; }
.nv-list { list-style: none; margin: 0 -0.4rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.15rem 0.75rem; }
.nv-list.nv-cut > li:nth-child(n + 25) { display: none; } /* SHOW in newin.js */
.nv-entry {
  display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); align-items: center; gap: 0.65rem;
  min-height: 3.25rem; padding: 0.3rem 0.4rem; border-radius: var(--r-m); color: inherit; text-decoration: none;
  transition: background-color 120ms var(--ease-out);
}
a.nv-entry:active { background: var(--n-250); }
@media (hover: hover) and (pointer: fine) { a.nv-entry:hover { background: var(--n-250); } a.nv-entry:hover .nv-name { text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; } }
.nv-entry img, .nv-ph { width: 2.5rem; height: 2.5rem; object-fit: contain; border-radius: var(--r-s); background: var(--ground); }
.nv-txt { display: grid; min-width: 0; }
.nv-name { font: 600 var(--t-m)/1.2 var(--data); color: var(--n-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-sub { font-size: var(--t-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nv-more {
  display: block; margin: 0.75rem 0 0; min-height: 2.5rem; padding: 0 1.1rem;
  background: none; border: 1px solid var(--seam); border-radius: var(--r-m);
  font: 600 var(--t-s)/1 var(--data); color: var(--n-800); cursor: pointer; transition: border-color 120ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .nv-more:hover { border-color: var(--accent); } }
.nv-removed-wrap { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--seam); scroll-margin-top: 1rem; }
.nv-rtitle { margin: 0; font: 600 var(--t-l)/1.2 var(--display); color: var(--n-900); }
.nv-removed-wrap > .nv-note { margin-bottom: 1.25rem; }
.nv-removed h2 { font-size: var(--t-m); }
.nv-removed .nv-name { color: var(--n-700); font-weight: 500; }
.nv-removed img { opacity: 0.6; filter: grayscale(0.6); }

/* Start-Seite: Kasten „Neu in 3.8“ */
.hm-new[hidden] { display: none; }
.hm-newin { list-style: none; margin: 0 0 0.5rem; padding: 0; display: grid; gap: 0.1rem; }
.hm-newin a { display: flex; align-items: baseline; gap: 0.45rem; min-height: 2rem; color: var(--n-700); text-decoration: none; }
.hm-newin b { min-width: 2.5ch; text-align: right; font: 600 var(--t-m)/1 var(--data); color: var(--n-900); font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) { .hm-newin a:hover { color: var(--n-900); } }

/* Patches der gewählten großen Version (newin.js): Version fett, darunter Datum und Zahlen */
.nv-patches { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: -0.25rem 0 1.5rem; }
.nv-patches a {
  display: grid; gap: 0.1rem; min-height: 2.75rem; padding: 0.35rem 0.7rem; align-content: center;
  border: 1px solid var(--seam); border-radius: var(--r-m); text-decoration: none; color: var(--n-700);
  transition: border-color 120ms var(--ease-out);
}
.nv-patches b { font: 600 var(--t-s)/1.1 var(--data); color: var(--n-900); font-variant-numeric: tabular-nums; }
.nv-patches span { font-size: var(--t-xs); line-height: 1.2; color: var(--muted); white-space: nowrap; }
.nv-patches a[aria-current="page"] { border-color: var(--accent); background: var(--n-250); }
@media (hover: hover) and (pointer: fine) { .nv-patches a:hover { border-color: var(--n-400); } }
.nv-source { margin: 3rem 0 0; max-width: 80ch; font-size: var(--t-xs); color: var(--muted); text-wrap: pretty; }

/* ---------- Konto: Discord/Google, E-Mail, Passwort vergessen (account.js) ---------- */
/* Hinweise: ruhiger Rahmen in der Hinweisfarbe statt Seitenbalken (wie .sim-try) */
.acct-notice, .nv-beta, .lg-lang {
  --tone: var(--accent);
  padding: 0.55rem 0.75rem;
  background: color-mix(in srgb, var(--tone) 7%, var(--ground));
  border: 1px solid color-mix(in srgb, var(--tone) 45%, var(--seam)); border-radius: var(--r-s);
  font-size: var(--t-s); line-height: 1.45; color: var(--n-900);
}
.acct-notice { margin: 0; }
.acct-notice.is-error { --tone: var(--el-fire); }
.acct-providers { display: grid; gap: 0.5rem; }
.acct-provider {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem; min-height: 2.75rem; padding: 0 0.85rem;
  background: var(--ground); border: 1px solid var(--n-400); border-radius: var(--r-s);
  font: 600 var(--t-s)/1 var(--data); color: var(--n-900); text-decoration: none;
  transition: border-color 120ms, transform 120ms var(--ease-out);
}
.acct-provider svg, .acct-method svg { width: 1.15rem; height: 1.15rem; flex: none; }
.acct-provider:active { transform: scale(0.98); }
@media (hover: hover) { .acct-provider:hover { border-color: var(--n-700); } }
.acct-or { display: flex; align-items: center; gap: 0.75rem; margin: 0; font-size: var(--t-xs); color: var(--muted); }
.acct-or::before, .acct-or::after { content: ""; flex: 1; border-top: 1px solid var(--seam); }
.acct-textbtn {
  justify-self: start; padding: 0.2rem 0; background: none; border: 0; cursor: pointer;
  font: 500 var(--t-s)/1.3 var(--data); color: var(--n-700); text-decoration: underline 1px var(--n-400); text-underline-offset: 0.2em;
}
@media (hover: hover) { .acct-textbtn:hover { color: var(--n-900); text-decoration-color: var(--accent); } }
.acct-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.acct-methods { display: grid; gap: 0.5rem; margin: 0 0 0.75rem; padding: 0; list-style: none; }
.acct-method { display: flex; align-items: center; gap: 0.6rem; min-height: 2.25rem; font-size: var(--t-s); color: var(--n-900); }
.acct-method > span { flex: 1; }
.acct-method .bd-btn { text-decoration: none; }

/* ---------- Impressum, Datenschutz (legal.js) und Fußzeile der Start-Seite ---------- */
body.legal-mode > main.layout { display: none; }
.legalpage { background: var(--panel); }
.legalpage[hidden] { display: none; }
@media (min-width: 861px) {
  .legalpage { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.lg-main { max-width: 46rem; margin-inline: auto; padding: 2rem clamp(1rem, 4vw, 3.5rem) 4rem; color: var(--n-800); line-height: 1.6; }
.lg-title { margin: 0 0 1rem; font: 600 var(--t-name)/1.05 var(--display); color: var(--n-900); text-wrap: balance; }
.lg-main h2 { margin: 2rem 0 0.5rem; font: 600 var(--t-l)/1.2 var(--display); color: var(--n-900); }
.lg-main p, .lg-main ul { margin: 0 0 0.75rem; max-width: 70ch; text-wrap: pretty; }
.lg-main ul { padding-left: 1.2rem; }
.lg-main li + li { margin-top: 0.35rem; }
.lg-main a { color: var(--n-900); text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
.lg-main code { font-size: 0.92em; }
.lg-note { color: var(--muted); font-size: var(--t-s); }
.lg-lang { width: fit-content; max-width: 70ch; margin-bottom: 1.5rem; }
.legalpage a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s); }

.acct-legal { color: var(--n-700); text-decoration: underline 1px var(--n-400); text-underline-offset: 0.2em; }
.nv-tabs a.nv-tab-beta { border-style: dashed; } /* Beta-Vorschau von der Beta-Seite */

/* ---------- Kolophon: Seitenende jeder Ansicht außer der Karte (footer.js) ----------
   Ein Band im Grund (wie Kopf und Register), damit jede Ansicht oben und unten eingefasst ist. Haarlinie statt
   Keilregel: Die Keilregel gibt es einmal je Seite, unter dem Kopf. footer.js misst die Inhaltsspalte der Ansicht
   und setzt --col-left/--col-w (Klasse .aligned), damit das Kolophon bündig unter ihrem Inhalt steht. */
.colophon {
  background: var(--ground);
  border-top: 1px solid var(--seam);
  color: var(--n-700);
  font-size: var(--t-s);
  line-height: 1.5;
}
.colophon[hidden] { display: none; }
.col-in { max-width: 84rem; margin-inline: auto; padding: 2.25rem clamp(1rem, 4vw, 3.5rem) 1.5rem; }
.colophon.aligned .col-in { box-sizing: content-box; width: var(--col-w); max-width: none; margin: 0 0 0 var(--col-left); padding-inline: 0; }
/* In der Leseseite: Band über die volle Breite bis zum unteren Rand, Inhalt bündig mit dem Eintrag */
.page > .colophon { margin: 4rem calc(-1 * var(--page-pad)) -4rem; }
/* Schmal unter der Liste */
.colophon.in-register { margin-top: 1.5rem; }
.colophon.in-register .col-in { padding-inline: 1rem; }

.colophon a { color: var(--n-800); text-decoration: underline 1px var(--n-400); text-underline-offset: 0.2em; }
@media (hover: hover) { .colophon a:hover { color: var(--n-900); text-decoration-color: var(--accent); } }

/* Kopf des Kolophons: Wortmarke links, Eigenschaftszeilen wie in einem Eintrag rechts */
.col-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem 3rem; align-items: start; }
.colophon .col-brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font: 600 1.375rem/1 var(--display); color: var(--n-900); text-decoration: none; white-space: nowrap;
}
.col-brand img { width: 2.25rem; height: 2.25rem; flex: none; }
.col-props { display: grid; gap: 0.3rem; margin: 0; max-width: 70ch; }
.col-props dt, .col-props dd { display: inline; margin: 0; }
.col-props dt { margin-right: 0.35em; font-weight: 700; color: var(--n-900); }
.col-props [hidden] { display: none; }
.col-num { font-variant-numeric: tabular-nums; color: var(--n-900); font-weight: 600; }

/* Verzeichnis: die fünf Gruppen der Kopfnavigation */
.col-dir {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 1.5rem;
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--seam);
}
.colophon.no-dir .col-dir { display: none; }
.col-gh { margin: 0 0 0.45rem; font: 600 var(--t-m)/1.2 var(--display); color: var(--n-900); }
.col-group ul { display: grid; gap: 0.1rem; margin: 0; padding: 0; list-style: none; }
.colophon .col-group a {
  display: inline-block; padding: 0.15rem 0;
  color: var(--n-700); text-decoration: none;
}
@media (hover: hover) { .colophon .col-group a:hover { color: var(--n-900); text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; } }

/* Grundzeile: Rechtliches links, Sprache und Design rechts */
.col-base {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem;
  margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--seam);
}
.col-legal { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-size: var(--t-xs); }
.colophon .col-legal a { color: var(--muted); }
.col-tools { display: flex; align-items: center; gap: 0.5rem; }
.col-lang select {
  height: 2.25rem; padding: 0 0.4rem;
  background-color: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s); color: var(--text);
}
.col-theme {
  display: inline-flex; align-items: center; gap: 0.45rem; height: 2.25rem; padding: 0 0.7rem 0 0.6rem;
  background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  font: 600 var(--t-s)/1 var(--data); color: var(--text); cursor: pointer;
  transition: border-color 120ms, transform 120ms var(--ease-out);
}
.col-theme svg { width: 1.05rem; height: 1.05rem; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.col-theme .theme-moon, [data-theme="light"] .col-theme .theme-sun { display: none; }
[data-theme="light"] .col-theme .theme-moon { display: block; }
.col-theme:active { transform: scale(0.97); }
@media (hover: hover) { .col-theme:hover, .col-lang select:hover { border-color: var(--n-400); } }
@media (prefers-reduced-motion: reduce) { .col-theme { transition: none; } .col-theme:active { transform: none; } }

/* Schmal hat die Leseseite unten 3rem statt 4rem Innenabstand */
@media (max-width: 860px) { .page > .colophon { margin-bottom: -3rem; } }
@media (max-width: 640px) {
  .col-top { grid-template-columns: minmax(0, 1fr); }
  .col-dir { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .colophon .col-group a { padding: 0.35rem 0; } /* Tippziele */
  .col-legal { gap: 0.25rem 1.5rem; }
  .colophon .col-legal a { display: inline-block; padding: 0.5rem 0; }
  .col-lang select, .col-theme { height: 2.75rem; }
}

/* ---------- Anmeldeablauf (account-dialog.js, account-page.js) ----------
   Dialog oben verankert, damit er beim Wechsel zwischen Anmelden und Registrieren nicht springt. Gefüllt ist nur der
   eine Hauptknopf je Formular; Fehler stehen am Feld. Tippziele mindestens 44px. */
.acct-auth, .acct-confirm { margin-block: min(8vh, 4rem) auto; }
.acct-auth .acct-body, .kp-auth .acct-body, .kp-form { display: grid; gap: 0.85rem; }
.acct-field > label { color: var(--n-700); }
.acct-field input[aria-invalid="true"] { border-color: var(--el-fire); }
.acct-ferr { margin: 0; color: var(--el-fire); font-size: var(--t-s); font-weight: 600; line-height: 1.35; }
.acct-ferr[hidden], .acct-error[hidden] { display: none; }
.acct-field .acct-hint { font-weight: 400; }
.acct-reveal input { width: 1.15rem; height: 1.15rem; margin: 0; }
.acct-submit { min-height: 2.75rem; }
.acct-submit:not(.acct-danger) { background: var(--accent); border-color: var(--accent); color: var(--n-100); }
@media (hover: hover) { .acct-submit:not(.acct-danger):hover { background: color-mix(in oklab, var(--accent) 86%, var(--n-900)); border-color: color-mix(in oklab, var(--accent) 86%, var(--n-900)); } }
.acct-submit[aria-disabled="true"], .kp-form [type="submit"][aria-disabled="true"] { opacity: 0.75; cursor: progress; }
.kontopage .acct-danger { border-color: var(--el-fire); color: var(--el-fire); }
.acct-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.4rem; margin: 0; font-size: var(--t-s); color: var(--n-700); }
/* Tippziele: auf Touch-Geräten und schmal mindestens 44px, am Desktop bleibt der Satz dicht */
@media (pointer: coarse), (max-width: 640px) {
  .acct .acct-close, .acct-reveal, .acct-auth .acct-textbtn, .kontopage .acct-textbtn { min-height: 2.75rem; }
  .acct-legal { display: inline-flex; align-items: center; min-height: 2.75rem; }
}
.acct-choice { justify-content: flex-end; }

/* Meldung unten am Fenster (toast in account-dialog.js) */
.acct-toast {
  position: fixed; left: 50%; bottom: 1.25rem; z-index: 1000;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem;
  max-width: min(34rem, calc(100vw - 2rem)); padding: 0.7rem 1rem;
  background: var(--panel); color: var(--n-900);
  border: 1px solid var(--n-400); border-radius: var(--r-m);
  box-shadow: 0 12px 28px rgb(0 0 0 / 0.4), 0 2px 6px rgb(0 0 0 / 0.3);
  font-size: var(--t-s); line-height: 1.4;
  opacity: 0; transform: translate(-50%, 0.75rem); pointer-events: none;
  transition: opacity 180ms var(--ease-out), transform 220ms var(--ease-out);
}
:root[data-theme="light"] .acct-toast { box-shadow: 0 12px 30px rgb(16 19 21 / 0.14); }
.acct-toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.acct-toast.is-error { border-color: color-mix(in srgb, var(--el-fire) 60%, var(--seam)); }
.acct-toast a { font-weight: 600; color: var(--n-900); text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .acct-toast { transition: none; } }

/* Menü am Kopfknopf (angemeldet), im Stil der Bereichs-Ausklapplisten */
.acct-menu { min-width: 13rem; }
.acct-menu-who { margin: 0 0 0.3rem; padding: 0.4rem 0.7rem 0.55rem; border-bottom: 1px solid var(--seam); font-size: var(--t-xs); color: var(--muted); }
.acct-menu-who strong { color: var(--n-900); font-weight: 600; }
.acct-menu hr { margin: 0.3rem 0; border: 0; border-top: 1px solid var(--seam); }
.acct-menu button {
  display: flex; align-items: center; width: 100%; min-height: 2.25rem; padding: 0 0.7rem;
  background: none; border: 0; border-radius: var(--r-s);
  font: 500 var(--t-m)/1 var(--data); color: var(--n-800); text-align: left; cursor: pointer; outline-offset: -2px;
}
.acct-menu button:active, .acct-menu a:active { background: var(--n-250); }
@media (hover: hover) { .acct-menu a:hover, .acct-menu button:hover { background: var(--n-250); color: var(--n-900); } }
@media (pointer: coarse) { .acct-menu a, .acct-menu button { min-height: 2.75rem; } }

/* Konto-Seite #/konto: aufgebaut wie ein Eintrag (Kopf, eine Keilregel, Eigenschaftszeilen, Abschnitte) */
.kontopage { background: var(--panel); }
.kontopage[hidden] { display: none; }
@media (min-width: 861px) {
  .kontopage { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.kp-main { max-width: 46rem; margin-inline: auto; padding: 2rem clamp(1rem, 4vw, 3.5rem) 4rem; }
.kp-head h1 { margin: 0; font: 600 var(--t-name)/1.05 var(--display); color: var(--n-900); text-wrap: balance; }
.kp-head .typeline b { font-weight: 600; color: var(--n-900); }
.kp-main .props a, .kp-main .acct-note a { color: var(--n-900); text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; }
.kp-main > .props { display: grid; gap: 0.2rem; }
.kp-notice, .kp-hint { margin-top: 1.25rem; }
.kp-hint { display: grid; gap: 0.6rem; }
.kp-hint p { margin: 0; }
.kp-hint .acct-row { align-items: center; gap: 0.25rem 1rem; }
.kp-notice:focus { outline: none; }
.kp-sec > .acct-note { margin-bottom: 0.75rem; }
.kp-form { max-width: 26rem; }
.kp-solo { margin-top: 1.25rem; }
details.kp-solo { max-width: 26rem; }
.kp-danger summary { color: var(--el-fire); }
.kp-danger[open] .kp-form { margin-top: 0.25rem; }
.kp-auth .acct-body { max-width: 26rem; padding: 0; }

/* ---------- Zucht (#/zucht, zucht.js) ----------
   Aufgebaut wie das Atelier: Kopf, Reiter (Planer | Gehege), darunter der Plan als Generationen-Treppe von unten
   nach oben. Messing markiert Ziel, Auswahl und Anzahlen. */
body.zucht-mode > main.layout { display: none; }
.zu { background: var(--panel); }
.zu[hidden] { display: none; }
@media (min-width: 861px) {
  .zu { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.zu a { color: var(--n-900); text-decoration: underline 1px color-mix(in srgb, var(--accent) 55%, transparent); text-underline-offset: 0.2em; }
.zu-wrap { max-width: 84rem; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 3rem) 4rem; }
.zu-hero h1 { margin: 0; font: 700 var(--t-name)/1 var(--display); color: var(--n-900); letter-spacing: -0.005em; }
.zu-sub { margin: 0.45rem 0 0; max-width: 64ch; color: var(--n-700); }
.zu-loading, .zu-error { margin-top: 1.6rem; color: var(--muted); }
.zu-error { color: var(--neg); }
.zu-hint { margin: 0.5rem 0 0; max-width: 72ch; color: var(--muted); font-size: var(--t-s); }
.zu-note { margin: 1rem 0 0; max-width: 64ch; }
.zu-primary { border-color: var(--accent); color: var(--n-900); background: color-mix(in srgb, var(--accent) 14%, var(--ground)); }
@media (hover: hover) { .zu-primary:hover { background: color-mix(in srgb, var(--accent) 24%, var(--ground)); } }

/* Reiter und Familien */
.zu-tabs { margin-top: 1.6rem; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--seam); }
.zu-tabs ol { display: flex; gap: clamp(0.9rem, 2.5vw, 1.8rem); margin: 0; padding: 0; list-style: none; }
.zu .zu-tabs a {
  display: inline-flex; align-items: baseline; gap: 0.45rem; padding: 0.5rem 0 0.65rem;
  color: var(--muted); text-decoration: none; font-weight: 600;
  box-shadow: inset 0 -3px 0 transparent; transition: color 120ms ease, box-shadow 160ms var(--ease-out);
}
.zu .zu-tabs a[aria-current="page"] { color: var(--n-900); box-shadow: inset 0 -3px 0 var(--accent); }
@media (hover: hover) { .zu .zu-tabs a:not([aria-current]):hover { color: var(--n-800); } }
.zu-tab-c {
  min-width: 1.5rem; padding: 0.05rem 0.35rem; border-radius: 99px; background: var(--ground);
  font-size: var(--t-xs); font-weight: 600; color: var(--n-700); text-align: center;
}
.zu-fams { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.4rem 0 0; padding: 0; list-style: none; }
.zu .zu-fams a {
  display: inline-flex; align-items: center; height: 2.25rem; padding: 0 0.85rem; border-radius: var(--r-s);
  background: var(--ground); color: var(--n-700); font-weight: 600; text-decoration: none;
}
.zu .zu-fams a[aria-current="true"] { background: color-mix(in srgb, var(--accent) 18%, var(--ground)); color: var(--n-900); box-shadow: inset 0 0 0 1px var(--accent); }
@media (hover: hover) { .zu .zu-fams a:not([aria-current]):hover { color: var(--n-900); } }

/* Zielauswahl: je Generation ein Raster aus Bildern */
.zu-pick { margin-top: 1.6rem; border-top: 1px solid var(--seam); padding-top: 0.9rem; }
.zu-pick > summary { cursor: pointer; font-weight: 600; color: var(--n-800); }
@media (hover: hover) { .zu-pick > summary:hover { color: var(--n-900); } }
.zu-gen { margin-top: 1.1rem; }
.zu-gen-h, .zu-stage h4 {
  display: flex; align-items: baseline; gap: 0.5rem; margin: 0 0 0.5rem;
  font: 600 var(--t-xs)/1 var(--data); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.zu-gen-n { font: 700 var(--t-l)/1 var(--display); letter-spacing: 0; color: var(--accent); }
.zu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: 0.4rem; }
.zu .zu-tile {
  position: relative; display: grid; justify-items: center; gap: 0.3rem; padding: 0.5rem 0.4rem 0.55rem;
  background: var(--ground); border: 1px solid transparent; border-radius: var(--r-m);
  color: var(--n-800); text-decoration: none; text-align: center;
  transition: border-color 120ms ease, background-color 120ms ease;
}
@media (hover: hover) { .zu .zu-tile:hover { border-color: var(--n-400); color: var(--n-900); } }
.zu .zu-tile[aria-current="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--ground)); color: var(--n-900); }
.zu-img { display: grid; place-items: center; width: 3.5rem; aspect-ratio: 1; }
.zu-img img { width: 100%; height: 100%; object-fit: contain; }
.zu-tn { font-size: var(--t-xs); line-height: 1.25; overflow-wrap: anywhere; }
.zu-own {
  position: absolute; top: 0.3rem; right: 0.3rem; min-width: 1.3rem; padding: 0.05rem 0.3rem; border-radius: 99px;
  background: var(--accent); color: var(--ground); font: 700 var(--t-xs)/1.2 var(--data); text-align: center;
}

/* Ziel und Kennzahlen */
.zu-goal { display: flex; align-items: center; gap: 1rem; margin-top: 1.6rem; }
.zu-goal-img { display: grid; place-items: center; flex: none; width: 5.5rem; aspect-ratio: 1; background: var(--ground); border-radius: var(--r-m); }
.zu-goal-img img { width: 88%; height: 88%; object-fit: contain; }
.zu-goal-k { margin: 0; font: 600 var(--t-xs)/1 var(--data); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.zu-goal h2 { margin: 0.25rem 0 0; font: 600 var(--t-l)/1.15 var(--display); }
.zu .zu-goal h2 a { text-decoration-color: transparent; }
@media (hover: hover) { .zu .zu-goal h2 a:hover { text-decoration-color: var(--accent); } }
.zu-goal-sub { margin: 0.25rem 0 0; font: italic 400 1.1875rem/1.3 var(--display); color: var(--n-700); }
.zu-stats { display: flex; flex-wrap: wrap; gap: 0.5rem 2.2rem; margin: 1.2rem 0 0; }
/* wie die Wertesegmente: Zahl oben, Beschriftung darunter */
.zu-stat { display: flex; flex-direction: column-reverse; }
.zu-stat dt { font: 600 var(--t-xs)/1 var(--data); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.zu-stat dd { margin: 0 0 0.35rem; font: 700 var(--t-l)/1 var(--display); color: var(--n-900); font-variant-numeric: tabular-nums; }
.zu-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.6rem; margin-top: 1.1rem; }
.zu-lv { display: flex; align-items: center; gap: 0.6rem; color: var(--n-700); }
.zu-lv .num { height: 2.25rem; --num-bg: var(--ground); --num-w: 3rem; }
.zu-check { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--n-700); cursor: pointer; }
.zu-check input { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }

/* Abschnitte, Fänge und Paarungs-Treppe */
.zu-sec { margin-top: 2rem; }
.zu-sec > h3 { margin: 0; font: 600 var(--t-l)/1.2 var(--display); color: var(--n-900); }
.zu-count { color: var(--muted); font: 600 var(--t-s)/1 var(--data); }
.zu-catches { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; margin: 0.8rem 0 0; padding: 0; list-style: none; }
.zu-catch { display: flex; align-items: center; gap: 0.5rem; }
.zu .zu-catch .zu-tile { grid-template-columns: 2.5rem auto; align-items: center; justify-items: start; padding: 0.3rem 0.7rem 0.3rem 0.3rem; text-align: left; }
.zu-catch .zu-img { width: 2.5rem; }
.zu-n { font: 700 var(--t-m)/1 var(--data); color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.zu-x { color: var(--muted); font-weight: 600; }
.zu-have { margin-left: 0.4rem; color: var(--muted); font-size: var(--t-xs); }
.zu-stages { margin: 0.6rem 0 0; padding: 0; list-style: none; }
.zu-stage { padding-top: 0.9rem; }
.zu-stage + .zu-stage { border-top: 1px solid var(--seam); margin-top: 0.6rem; }
.zu-steps { margin: 0; padding: 0; list-style: none; }
.zu-step {
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto; align-items: start; column-gap: 0.8rem;
  padding: 0.5rem 0;
}
.zu-step + .zu-step { border-top: 1px dashed var(--seam); }
.zu-step .zu-n { padding-top: 0.6rem; text-align: right; }
.zu-what { min-width: 0; }
.zu-what p { margin: 0; }
.zu-child { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; }
.zu .zu-child a, .zu .zu-par { display: inline-flex; align-items: center; gap: 0.4rem; }
.zu .zu-child a { font-weight: 600; text-decoration-color: transparent; }
.zu-child img { width: 2.25rem; height: 2.25rem; object-fit: contain; }
@media (hover: hover) { .zu .zu-child a:hover { text-decoration-color: var(--accent); } }
.zu .zu-from { margin-top: 0.15rem; color: var(--muted); font-size: var(--t-s); line-height: 1.6; }
.zu-from-k { margin-right: 0.1rem; }
.zu .zu-par { color: var(--n-700); vertical-align: middle; }
.zu-par img { width: 1.5rem; height: 1.5rem; object-fit: contain; }
.zu-times { margin: 0 0.2rem; color: var(--accent); font-weight: 700; }
.zu-recipe select {
  margin-top: 0.4rem; max-width: 100%; height: 2.25rem; padding: 0 0.5rem;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s); color: var(--n-800); font-size: var(--t-s);
}
.zu-recipe select:focus-visible { outline-offset: 1px; border-color: var(--accent); }
.zu-chance { padding-top: 0.6rem; color: var(--n-700); font: 600 var(--t-s)/1 var(--data); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Quellen der Chance */
.zu-src { margin-top: 2.5rem; padding-top: 0.9rem; border-top: 1px solid var(--seam); color: var(--n-700); font-size: var(--t-s); }
.zu-src > summary { cursor: pointer; font-weight: 600; color: var(--n-800); }
.zu-src p { max-width: 72ch; margin: 0.6rem 0; }
.zu-src ul { margin: 0; padding-left: 1.1rem; }
.zu-src li { margin: 0.2rem 0; }

/* Gehege: Formular, Zeilen, Paarungen */
.zu-add {
  margin-top: 1.6rem; padding: 1rem 1.1rem;
  background: color-mix(in srgb, var(--accent) 6%, var(--ground)); border: 1px solid var(--seam); border-radius: var(--r-m);
}
.zu-add-h { margin: 0 0 0.7rem; font-weight: 600; color: var(--n-900); }
.zu-add-f { display: flex; flex-wrap: wrap; align-items: end; gap: 0.7rem 1rem; }
.zu-add-f > label:not(.zu-check) { display: grid; gap: 0.3rem; color: var(--n-700); font-size: var(--t-s); }
.zu-add-f select, .zu-add-f input[type="text"] {
  height: 2.5rem; min-width: 12rem; max-width: 100%; padding: 0 0.6rem;
  background: var(--panel); border: 1px solid var(--n-400); border-radius: var(--r-s); color: var(--n-900);
}
.zu-add-f select { min-width: min(20rem, 100%); }
.zu-add-f .num { height: 2.5rem; --num-bg: var(--panel); --num-w: 3rem; }
.zu-add-f .zu-check { height: 2.5rem; }
.zu-sexes { display: flex; gap: 0.3rem; margin: 0; padding: 0; border: 0; }
.zu-sexes legend { padding: 0; margin-bottom: 0.3rem; color: var(--n-700); font-size: var(--t-s); }
.zu-sexes label { position: relative; }
.zu-sexes input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.zu-sexes label > span {
  display: inline-flex; align-items: center; height: 2.5rem; padding: 0 0.8rem; border-radius: var(--r-s);
  background: var(--panel); border: 1px solid var(--n-400); color: var(--n-700);
}
.zu-sexes input:checked + span { border-color: var(--accent); color: var(--n-900); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.zu-sexes input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.zu-empty { margin-top: 2.5rem; max-width: 52ch; }
.zu-empty-h { margin: 0 0 0.4rem; font: 600 var(--t-l)/1.2 var(--display); color: var(--n-900); }
.zu-empty p:not(.zu-empty-h) { margin: 0; color: var(--n-700); }
.zu-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 1fr); gap: 0 3rem; align-items: start; }
@media (max-width: 1100px) { .zu-cols { grid-template-columns: minmax(0, 1fr); } }
.zu-rows { margin: 0.6rem 0 0; padding: 0; list-style: none; }
.zu-row {
  display: grid; grid-template-columns: 2.75rem minmax(0, 1fr) auto auto auto auto auto; align-items: center; column-gap: 0.8rem;
  padding: 0.45rem 0; border-bottom: 1px solid var(--seam);
}
.zu-row .zu-img { width: 2.75rem; background: var(--ground); border-radius: var(--r-s); }
.zu-row .zu-img img { width: 88%; height: 88%; }
.zu .zu-rn { font-weight: 600; line-height: 1.25; text-decoration-color: transparent; overflow-wrap: anywhere; }
@media (hover: hover) { .zu .zu-rn:hover { text-decoration-color: var(--accent); } }
.zu-meta { color: var(--muted); font-size: var(--t-xs); }
.zu-own-name { color: var(--n-700); font-style: italic; }
.zu-sterile .zu-img, .zu-sterile .zu-rn { opacity: 0.55; }
.zu-sex {
  width: 2.25rem; height: 2.25rem; border-radius: var(--r-s); border: 1px solid var(--n-400); background: var(--ground);
  font-size: 1.05rem; font-weight: 700; cursor: pointer;
}
.zu-sex[data-sex="m"] { color: var(--el-water); }
.zu-sex[data-sex="f"] { color: var(--el-fire); }
@media (hover: hover) { .zu-sex:hover { border-color: var(--accent); } }
.zu-lvl input {
  width: 3.6rem; height: 2.25rem; padding: 0 0.4rem; text-align: right;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s); color: var(--n-900);
}
.zu-lvl input:focus-visible { outline-offset: 1px; border-color: var(--accent); }
.zu-del {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border: 0; border-radius: var(--r-s);
  background: none; color: var(--muted); cursor: pointer;
}
.zu-del svg { width: 0.9rem; height: 0.9rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
@media (hover: hover) { .zu-del:hover { color: var(--neg); background: var(--ground); } }
@media (max-width: 640px) {
  .zu-row { grid-template-columns: 2.75rem auto auto minmax(0, 1fr) auto; row-gap: 0.4rem; }
  .zu-row .zu-what { grid-column: 2 / -1; }
  .zu-row > .zu-sex { grid-column: 1; }
}
.zu-pairs { margin: 0.6rem 0 0; padding: 0; list-style: none; }
.zu-pair { padding: 0.55rem 0; border-bottom: 1px solid var(--seam); }
.zu-pair p { margin: 0; }
.zu-pp { color: var(--n-800); }
.zu .zu-po { margin-top: 0.15rem; color: var(--muted); font-size: var(--t-s); }
.zu-sexmark { color: var(--muted); }
.zu-goalpair { padding-inline: 0.6rem; border-radius: var(--r-s); background: color-mix(in srgb, var(--mark) 55%, transparent); }
.zu-tag {
  display: inline-flex; align-items: center; height: 1.3rem; padding: 0 0.45rem; margin-left: 0.2rem; border-radius: var(--r-s);
  background: color-mix(in srgb, var(--accent) 18%, var(--ground)); color: var(--n-900); font: 600 var(--t-xs)/1 var(--data);
}
.zu-clones { margin: 0.6rem 0 0; padding-left: 1.1rem; }
.zu-clones li { margin: 0.25rem 0; }
@media (prefers-reduced-motion: reduce) {
  .zu .zu-tabs a, .zu .zu-tile { transition: none; }
}
.zu-state select {
  height: 2.25rem; padding: 0 0.4rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  color: var(--n-800); font-size: var(--t-s);
}
.zu-state select:focus-visible { outline-offset: 1px; border-color: var(--accent); }
.zu-add-f select[name="state"] { min-width: 8rem; }
.zu-src-h { margin: 0.9rem 0 0.3rem !important; font-weight: 600; color: var(--n-800); }
.zu-src-links { margin-top: 0.6rem !important; }

/* Sammlung: Gesamtstand, Stand je Generation, Kacheln zum Abhaken */
.zu-csum { display: grid; grid-template-columns: minmax(14rem, 20rem) minmax(0, 1fr); gap: 1.2rem 3rem; align-items: start; margin-top: 1.6rem; }
@media (max-width: 760px) { .zu-csum { grid-template-columns: minmax(0, 1fr); } }
.zu-cbig { margin: 0 0 0.6rem; font: 700 var(--t-name)/1 var(--display); color: var(--n-900); font-variant-numeric: tabular-nums; }
.zu-cbig span { font-size: 0.55em; color: var(--muted); }
.zu-meter { display: block; height: 6px; border-radius: 99px; background: var(--ground); overflow: hidden; }
.zu-meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 240ms var(--ease-out); }
.zu-cgens { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.35rem 1rem; margin: 0; padding: 0; list-style: none; }
.zu-cgens button {
  display: grid; grid-template-columns: 1.8rem minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; width: 100%;
  padding: 0.35rem 0.4rem; border: 0; border-radius: var(--r-s); background: none; color: var(--n-700); cursor: pointer; text-align: left;
}
@media (hover: hover) { .zu-cgens button:hover { background: var(--ground); } }
.zu-cgens .zu-gen-n { font-size: var(--t-m); text-align: right; }
.zu-cnum { color: var(--muted); font: 600 var(--t-xs)/1 var(--data); font-variant-numeric: tabular-nums; white-space: nowrap; }
.zu-full .zu-cnum { color: var(--accent); }
.zu-copts { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 2rem; margin-top: 1.6rem; padding-top: 0.9rem; border-top: 1px solid var(--seam); }
.zu-copts .zu-hint { margin: 0; }
.zu-gen-h .zu-cnum { margin-left: 0.3rem; letter-spacing: 0; text-transform: none; }
.zu-cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.zu-ctile { position: relative; }
.zu-ctoggle {
  position: relative; display: grid; justify-items: center; gap: 0.3rem; width: 100%; height: 100%; padding: 0.5rem 0.4rem 0.55rem;
  background: var(--ground); border: 1px solid transparent; border-radius: var(--r-m); color: var(--muted); cursor: pointer; text-align: center;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}
.zu-ctoggle .zu-img { opacity: 0.45; filter: grayscale(0.7); transition: opacity 120ms ease, filter 120ms ease; }
.zu-own-yes .zu-ctoggle { border-color: color-mix(in srgb, var(--accent) 60%, var(--seam)); background: color-mix(in srgb, var(--accent) 10%, var(--ground)); color: var(--n-900); }
.zu-own-yes .zu-ctoggle .zu-img { opacity: 1; filter: none; }
.zu-ctoggle:disabled { cursor: default; }
@media (hover: hover) { .zu-ctoggle:not(:disabled):hover { border-color: var(--n-400); color: var(--n-900); } .zu-ctoggle:not(:disabled):hover .zu-img { opacity: 0.8; } }
.zu-ctoggle:active:not(:disabled) { transform: scale(0.97); }
.zu-cmark {
  position: absolute; top: 0.3rem; right: 0.3rem; display: grid; place-items: center; width: 1.25rem; height: 1.25rem;
  border-radius: 99px; border: 1px solid var(--n-400); background: var(--panel);
}
.zu-cmark svg { width: 0.8rem; height: 0.8rem; fill: none; stroke: var(--ground); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.zu-own-yes .zu-cmark { background: var(--accent); border-color: var(--accent); }
.zu-own-yes .zu-cmark svg { opacity: 1; }
.zu .zu-cplan {
  position: absolute; top: 0.3rem; left: 0.3rem; display: grid; place-items: center; width: 1.6rem; height: 1.6rem;
  border-radius: var(--r-s); color: var(--muted); text-decoration: none;
}
.zu-cplan svg { width: 0.95rem; height: 0.95rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .zu .zu-cplan:hover { color: var(--accent); background: var(--panel); } }
.zu-cplan:focus-visible { outline-offset: 0; }
@media (prefers-reduced-motion: reduce) {
  .zu-meter > span, .zu-ctoggle, .zu-ctoggle .zu-img { transition: none; }
  .zu-ctoggle:active:not(:disabled) { transform: none; }
}

/* Bilder aus dem Spiel: Geschlecht, Familien, Zucht-Bereiche; Zustände als Schilder wie im Spiel (senil = negativ) */
.zu-sexico { width: 1rem; height: 1rem; vertical-align: -0.15em; }
.zu-sexico { color: var(--n-800); }
.zu-sex .zu-sexico { width: 1.1rem; height: 1.1rem; }
.zu-sex[data-sex] { color: inherit; }
.zu-sexes span .zu-sexico { margin-right: 0.4rem; }
.zu-pp .zu-sexico { margin-right: 0.3rem; }
.zu .zu-fams a { gap: 0.45rem; }
.zu-famico { width: 1.25rem; height: 1.25rem; color: var(--muted); }
.zu .zu-fams a[aria-current="true"] .zu-famico { color: var(--accent); }
.zu-sec > h3.zu-h-art { display: flex; align-items: center; gap: 0.6rem; }
.zu-art { width: 2.4rem; height: 2.4rem; object-fit: contain; flex: none; }
.zu-empty .zu-art { width: 4.5rem; height: 4.5rem; margin-bottom: 0.6rem; }
.zu-state select { border-radius: 99px; padding: 0 0.7rem; font-weight: 600; }
.zu-state select.zu-st-fertile { border-color: var(--n-400); color: var(--n-900); }
.zu-state select.zu-st-sterile { color: var(--muted); }
.zu-state select.zu-st-senile { border-color: color-mix(in srgb, var(--neg) 60%, var(--seam)); color: var(--neg); background: color-mix(in srgb, var(--neg) 10%, var(--ground)); }
@media (forced-colors: active) { .zu-sexico, .zu-famico { forced-color-adjust: none; background: CanvasText; } }

/* Reittier-Auswahl mit Suche (Gehege-Formular) */
.zu-mpick { position: relative; display: grid; gap: 0.3rem; color: var(--n-700); font-size: var(--t-s); flex: 1 1 18rem; max-width: 24rem; }
.zu-mq-field { position: relative; }
.zu-mq-field input[type="text"] {
  width: 100%; height: 2.5rem; padding: 0 2rem 0 2.9rem; min-width: 0;
  background: var(--panel); border: 1px solid var(--n-400); border-radius: var(--r-s); color: var(--n-900); font-size: var(--t-m);
}
.zu-mq-field input[type="text"]:focus-visible { outline-offset: 1px; border-color: var(--accent); }
.zu-mq-img { position: absolute; left: 0.35rem; top: 50%; width: 2.1rem; height: 2.1rem; transform: translateY(-50%); pointer-events: none; }
.zu-mq-img img { width: 100%; height: 100%; object-fit: contain; }
.zu-mq-chev { position: absolute; right: 0.6rem; top: 50%; width: 1rem; height: 1rem; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.zu-mpick:has([aria-expanded="true"]) .zu-mq-chev { transform: translateY(-50%) rotate(180deg); }
.zu-mlist {
  position: absolute; top: calc(100% + 0.3rem); left: 0; right: 0; z-index: 6; max-height: min(24rem, 60vh); overflow-y: auto;
  margin: 0; padding: 0 0.3rem 0.3rem; list-style: none; overscroll-behavior: contain; scrollbar-width: thin;
  background: var(--n-250); border: 1px solid var(--n-400); border-radius: var(--r-m); box-shadow: 0 12px 28px rgb(0 0 0 / 0.35);
}
.zu-mlist[hidden] { display: none; }
.zu-mgrp {
  position: sticky; top: 0; z-index: 1; padding: 0.55rem 0.4rem 0.3rem; background: var(--n-250);
  font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
}
.zu-mlist [role="option"] {
  display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); align-items: center; gap: 0.6rem;
  padding: 0.2rem 0.4rem; border-radius: var(--r-s); color: var(--n-800); cursor: pointer;
}
.zu-mlist [role="option"].is-active { background: var(--n-300); color: var(--n-900); }
.zu-mlist [role="option"][aria-selected="true"] { box-shadow: inset 2px 0 0 var(--accent); font-weight: 600; color: var(--n-900); }
@media (hover: hover) { .zu-mlist [role="option"]:hover { background: var(--n-300); } }
.zu-mo-img { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; }
.zu-mo-img img { width: 100%; height: 100%; object-fit: contain; }
.zu-mo-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zu-mnone { padding: 0.7rem 0.5rem 0.4rem; color: var(--muted); }
@media (pointer: coarse) { .zu-mlist [role="option"] { min-height: 2.75rem; } }
@media (forced-colors: active) { .zu-mlist [role="option"].is-active { outline: 2px solid Highlight; } }

/* ---------- Stammbaum (Zuchtplaner, zuchtgraph.js) ----------
   Der Graph liegt auf Graphit-Grund wie eine Bildmulde, die Karten eine Höhenstufe darüber auf Leseseiten-Ton. Linien
   sind Haarlinien; nur der gewählte Weg ist Messing. Auswahl und Ziel tragen Messing-Ringe, keine Schatten.
   Überfahren dämpft alles außerhalb der Abstammung. Die eine Bewegung: Wählt man ein anderes Elternpaar, zeichnet
   sich der neue Weg nach (stroke-dashoffset, 480ms ease-out); bei reduzierter Bewegung entfällt sie. */
.zg-seg { display: inline-flex; gap: 0.3rem; }
.zg-seg button, .zg-zoom button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; height: 2rem; padding: 0 0.7rem;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-s);
  color: var(--n-700); font: 500 var(--t-s)/1 var(--data); cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease, transform 120ms var(--ease-out);
}
.zg-seg button[aria-pressed="true"] { background: var(--mark); border-color: var(--accent); color: var(--n-900); }
@media (hover: hover) { .zg-seg button:not([aria-pressed="true"]):hover, .zg-zoom button:hover { border-color: var(--n-400); color: var(--n-900); } }
.zg-seg button:active, .zg-zoom button:active { transform: scale(0.97); }
.zg-zoom { display: inline-flex; gap: 0.3rem; }
.zg-zoom button { padding: 0 0.55rem; min-width: 2rem; }
.zg-zoom svg { width: 0.9rem; height: 0.9rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
@media (pointer: coarse) { .zg-seg button, .zg-zoom button { height: 2.75rem; min-width: 2.75rem; } }
.zu-views { margin-top: 1.4rem; }

.zg-sec { margin-top: 1rem; }
.zg-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; }
.zg-sec > .zu-hint { margin-top: 0.6rem; }
.zg-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 21rem); gap: 1rem; align-items: start; margin-top: 0.8rem; }
@media (max-width: 1000px) { .zg-wrap { grid-template-columns: minmax(0, 1fr); } }
.zg-scroll {
  overflow: auto; max-height: min(72vh, 52rem); overscroll-behavior: contain;
  background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m);
  scrollbar-width: thin; scrollbar-color: var(--tick) transparent;
}
.zg-scroll:focus { outline: none; }
@media (max-width: 860px) { .zg-scroll { max-height: 62vh; } }
svg.zg { display: block; }

.zg-colh { fill: var(--muted); font: 600 12px var(--data); letter-spacing: 0.06em; text-transform: uppercase; }
.zg-e { fill: none; stroke: var(--n-400); stroke-width: 1.25; opacity: 0.6; transition: opacity 140ms var(--ease-out); }
.zg-e.is-chosen { stroke: var(--n-500); opacity: 0.85; }
.zg-e.is-plan { stroke: var(--accent); stroke-width: 2; opacity: 1; }
.zg-j { fill: var(--n-500); stroke: var(--ground); stroke-width: 2; transition: opacity 140ms var(--ease-out), fill 120ms ease; }
.zg-j.is-plan { fill: var(--accent); }
.zg-j.is-alt { fill: var(--ground); stroke: var(--n-500); stroke-width: 1.5; cursor: pointer; }
@media (hover: hover) { .zg-j.is-alt:hover { fill: var(--mark); stroke: var(--accent); } }
.zg-j:focus { outline: none; }
.zg-j.is-alt:focus-visible { fill: var(--mark); stroke: var(--accent); stroke-width: 2.5; }

.zg-n { cursor: pointer; transition: opacity 140ms var(--ease-out); }
.zg-n:focus { outline: none; }
.zg-card { fill: var(--panel); stroke: var(--seam); stroke-width: 1; transition: stroke 120ms ease, fill 120ms ease; }
.zg-n:not(.is-plan) { opacity: 0.66; }
.zg-n.is-plan .zg-card { stroke: var(--n-400); }
.zg-n.is-target .zg-card { stroke: var(--accent); stroke-width: 1.5; }
.zg-n.is-sel .zg-card { fill: var(--mark); stroke: var(--accent); stroke-width: 2; }
@media (hover: hover) { .zg-n:hover .zg-card { stroke: var(--accent); } }
.zg-n:focus-visible .zg-card { stroke: var(--accent); stroke-width: 2.5; }
.zg-name { fill: var(--n-900); font: 600 13.5px var(--data); }
.zg-sub { fill: var(--n-700); font: 500 12px var(--data); font-variant-numeric: lining-nums tabular-nums; }
.zg-own { fill: var(--n-700); }

/* Abstammung hervorheben: alles andere tritt zurück */
svg.zg.is-focus .zg-n:not(.is-hl) { opacity: 0.2; }
svg.zg.is-focus .zg-e:not(.is-hl) { opacity: 0.07; }
svg.zg.is-focus .zg-j:not(.is-hl) { opacity: 0.2; }
svg.zg.is-focus .zg-n.is-hl { opacity: 1; }
svg.zg.is-focus .zg-e.is-hl:not(.is-plan) { stroke: var(--n-700); opacity: 1; }

/* Die eine Bewegung: neuer Weg zeichnet sich nach */
svg.zg.zg-draw .zg-e.is-plan { stroke-dasharray: 1; animation: zg-draw 480ms var(--ease-out) both; }
@keyframes zg-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  svg.zg.zg-draw .zg-e.is-plan { animation: none; stroke-dasharray: none; }
  .zg-n, .zg-e, .zg-j, .zg-seg button, .zg-zoom button { transition: none; }
}
@media (forced-colors: active) {
  .zg-card { stroke: CanvasText; }
  .zg-e.is-plan, .zg-j.is-plan { stroke: Highlight; fill: Highlight; }
  .zg-n.is-sel .zg-card, .zg-n:focus-visible .zg-card { stroke: Highlight; }
}

/* Einzelheiten neben dem Graph */
.zg-side {
  padding: 0.9rem 1rem 1rem; background: var(--ground); border: 1px solid var(--seam); border-radius: var(--r-m);
  font-size: var(--t-s);
}
@media (min-width: 1001px) { .zg-side { position: sticky; top: 1rem; max-height: min(72vh, 52rem); overflow-y: auto; scrollbar-width: thin; } }
.zg-side > .zu-hint:only-child { margin: 0; }
.zg-sh { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; align-items: center; gap: 0.7rem; }
.zg-simg { display: grid; place-items: center; width: 3rem; height: 3rem; background: var(--panel); border-radius: var(--r-s); }
.zg-simg img { width: 88%; height: 88%; object-fit: contain; }
.zg-sh h4 { margin: 0; font: 600 var(--t-m)/1.2 var(--display); color: var(--n-900); overflow-wrap: anywhere; }
.zg-sh .zu-hint { margin: 0.15rem 0 0; font-size: var(--t-xs); }
.zg-close {
  display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: var(--r-s);
  background: none; color: var(--muted); cursor: pointer;
}
.zg-close svg { width: 0.9rem; height: 0.9rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
@media (hover: hover) { .zg-close:hover { color: var(--n-900); background: var(--panel); } }
@media (pointer: coarse) { .zg-close { width: 2.75rem; height: 2.75rem; } }
.zg-links { margin: 0.7rem 0 0; }
.zg-side h5 {
  margin: 1.1rem 0 0.3rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--seam);
  font: 600 var(--t-xs)/1.2 var(--data); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.zg-list { margin: 0; padding: 0; list-style: none; }
.zg-list li {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.2rem 0.6rem;
  padding: 0.4rem 0 0.4rem 0.5rem; border-bottom: 1px solid var(--seam); color: var(--n-800);
}
.zg-list li.is-chosen { box-shadow: inset 2px 0 0 var(--accent); }
.zg-list a { color: var(--n-900); text-decoration-color: var(--n-400); }
@media (hover: hover) { .zg-list a:hover { text-decoration-color: var(--accent); } }
.zg-pct { color: var(--muted); font-weight: 600; white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.zg-tag {
  display: inline-flex; align-items: center; height: 1.4rem; padding: 0 0.45rem; border-radius: var(--r-s);
  background: var(--mark); color: var(--n-900); font: 600 var(--t-xs)/1 var(--data);
}
.zg-take {
  height: 1.75rem; padding: 0 0.55rem; background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r-s);
  color: var(--n-700); font: 500 var(--t-xs)/1 var(--data); cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, transform 120ms var(--ease-out);
}
@media (hover: hover) { .zg-take:hover { border-color: var(--accent); color: var(--n-900); } }
.zg-take:active { transform: scale(0.97); }
@media (pointer: coarse) { .zg-take { height: 2.75rem; } }

/* Elternpaare in den Einzelheiten: je Elternteil eine Zeile mit Bild, Chance und Wahl darunter */
.zg-list li.zg-pair, .zg-list li.zg-prod { display: grid; gap: 0.35rem; padding: 0.5rem 0 0.55rem 0.6rem; }
.zg-pp { display: grid; grid-template-columns: 1rem minmax(0, 1fr); align-items: center; gap: 0.2rem 0.3rem; }
.zg-pp > .zg-par:first-child { grid-column: 2; }
.zg-x { color: var(--accent); font-weight: 700; text-align: center; line-height: 1; }
.zg-list .zg-par {
  display: grid; grid-template-columns: 1.9rem minmax(0, 1fr); align-items: center; gap: 0.5rem; min-width: 0;
  color: var(--n-900); text-decoration: none; border-radius: var(--r-s);
}
.zg-par img, .zg-noimg { width: 1.9rem; height: 1.9rem; object-fit: contain; }
.zg-par span { line-height: 1.25; text-decoration: underline 1px var(--n-400); text-underline-offset: 0.2em; }
@media (hover: hover) { .zg-list .zg-par:hover span { text-decoration-color: var(--accent); } }
.zg-pmeta { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding-left: 1.3rem; }
@media (hover: hover) { .zg-list li.zg-pair:hover { background: color-mix(in srgb, var(--panel) 70%, transparent); } }
/* „Ergibt mit“: Generation rechts neben dem Ergebnis statt in eigener Zeile */
.zg-list li.zg-prod { grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 0.5rem; }
.zg-prod .zg-pmeta { padding: 0 0 0.35rem; }

/* Stammbaum als ganze Seite: modales <dialog> über die volle Fläche, Kopf auf Graphit-Grund, darunter der Graph mit den
   Einzelheiten in voller Höhe. Öffnet mit kurzem Einblenden (nicht bei reduzierter Bewegung). */
.zu-views { margin: 1.4rem 0 0; }
.zg-open {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 2.5rem; padding: 0 0.9rem 0 0.75rem;
  background: var(--ground); border: 1px solid var(--n-400); border-radius: var(--r-s);
  color: var(--n-900); font: 600 var(--t-s)/1 var(--data); cursor: pointer;
  transition: border-color 120ms ease, transform 120ms var(--ease-out);
}
@media (hover: hover) { .zg-open:hover { border-color: var(--accent); } }
.zg-open:active { transform: scale(0.97); }
.zg-ico { width: 1.05rem; height: 1.05rem; fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linejoin: round; }
@media (pointer: coarse) { .zg-open { height: 2.75rem; } }

.zg-dialog {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--panel); color: var(--text);
}
.zg-dialog[open] {
  display: flex; flex-direction: column;
  opacity: 1; transition: opacity 180ms var(--ease-out);
  @starting-style { opacity: 0; }
}
.zg-dialog::backdrop { background: var(--ground); }
html:has(.zg-dialog[open]) { overflow: hidden; }
.zg-dhead {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.9rem;
  padding: 0.7rem clamp(1rem, 3vw, 2rem); background: var(--ground); border-bottom: 1px solid var(--seam);
}
.zg-dimg { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; background: var(--panel); border-radius: var(--r-s); }
.zg-dimg img { width: 88%; height: 88%; object-fit: contain; }
.zg-dtitle h2 { margin: 0; font: 600 var(--t-l)/1.15 var(--display); color: var(--n-900); overflow-wrap: anywhere; }
.zg-dtitle p { margin: 0.2rem 0 0; color: var(--n-700); font-size: var(--t-s); font-variant-numeric: lining-nums tabular-nums; }
.zg-dclose {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 1px solid var(--seam); border-radius: var(--r-s);
  background: var(--panel); color: var(--n-800); cursor: pointer; transition: border-color 120ms ease, transform 120ms var(--ease-out);
}
.zg-dclose svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
@media (hover: hover) { .zg-dclose:hover { border-color: var(--accent); color: var(--n-900); } }
.zg-dclose:active { transform: scale(0.97); }
.zg-dbody { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0; padding: 0.8rem clamp(1rem, 3vw, 2rem) 1rem; }
.zg-dbody .zg-wrap { flex: 1; min-height: 0; margin-top: 0.6rem; align-items: stretch; }
.zg-dbody .zg-scroll { max-height: none; height: 100%; }
.zg-dbody .zg-side { position: static; max-height: none; height: 100%; overflow-y: auto; }
@media (max-width: 1000px) {
  .zg-dbody .zg-wrap { grid-template-rows: minmax(0, 1fr) minmax(0, 38%); }
}
@media (max-width: 640px) {
  .zg-dbody > .zu-hint { display: none; } /* auf dem Handy zählt jede Zeile Höhe */
  .zg-dtitle h2 { font-size: var(--t-m); }
}
@media (prefers-reduced-motion: reduce) { .zg-dialog[open], .zg-open, .zg-dclose { transition: none; } }
/* Kleiner Baum (z. B. nur der gewählte Weg) mittig in der Fläche; margin: auto zentriert, ohne bei Überbreite den
   Anfang abzuschneiden (anders als justify-content: center) */
.zg-scroll { display: flex; }
.zg-scroll > svg.zg { flex: none; margin: auto; }

/* ---------- Entfernte Einträge (removed.js): Schild, Hinweis auf der Detailseite, Schalter über der Liste ---------- */
.gone-tag {
  display: inline-block; padding: 0.1em 0.45em; border: 1px solid var(--n-400); border-radius: var(--r-s);
  font: 600 var(--t-xs)/1.3 var(--data); color: var(--n-700); background: var(--ground); vertical-align: 0.1em;
  white-space: nowrap;
}
.gone-tag-s { padding: 0 0.35em; font-size: 0.6875rem; vertical-align: 0.15em; }
.gone-tag.gone-season { border-style: dashed; }
.gone-note {
  margin: 0 0 0.25rem; padding: 0.65rem 0.9rem; border-left: 3px solid var(--n-400);
  background: var(--ground); color: var(--n-800); font-size: var(--t-s); line-height: 1.5;
}
.gone-note b { color: var(--n-900); }
.gone-note.gone-season { border-left-style: dashed; }
.gone-toggle { display: inline-flex; align-items: center; gap: 0.4rem; font-size: var(--t-xs); color: var(--n-700); cursor: pointer; white-space: nowrap; }
.gone-hint { margin-left: 0.25rem; padding: 0; background: none; border: 0; font: inherit; color: var(--n-900); text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; cursor: pointer; }
