:root {
  --bg: #16130f; --surface: #211c16; --surface-2: #2a241c; --surface-3: #342c22; --border: #3d3428;
  --text: #ece4d4; --muted-solid: #a89b85; --accent: #c9a24a; --accent-ink: #1a140a;
  --danger: #d0533c; --ok: #5a9e6a; --info: #5b8fbf; --radius: 12px; --top: 56px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; background-image: radial-gradient(1200px 600px at 80% -10%, #2a2215 0%, transparent 60%); background-attachment: fixed; }
body.modal-open { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
h2 { font-size: 1.35rem; margin-top: 1.4em; }
code { background: var(--surface-3); padding: .1em .35em; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted-solid); } .small { font-size: .85em; } .block { display: block; } .center { text-align: center; } .grow { flex: 1; } .nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Kopfzeile ---------- */
.topbar { position: sticky; top: 0; z-index: 1000; height: var(--top); display: flex; align-items: center; gap: 1rem; padding: 0 1rem;
  padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right));
  background: rgba(22, 19, 15, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: .5rem; color: var(--text); font-family: var(--serif); font-size: 1.2rem; font-weight: 600; text-decoration: none !important; }
.brand-icon { font-size: 1.3rem; }
#nav { margin-left: auto; display: flex; gap: .25rem; align-items: center; }
#nav a { color: var(--text); padding: .45rem .75rem; border-radius: 8px; text-decoration: none; }
#nav a:hover { background: var(--surface-2); }
.navtoggle { display: none; margin-left: auto; background: none; border: 1px solid var(--border); color: var(--text); font-size: 1.2rem; border-radius: 8px; padding: .3rem .65rem; cursor: pointer; }

/* ---------- Layout ---------- */
#app { min-height: calc(100dvh - var(--top)); }
#app.full { height: calc(100dvh - var(--top)); overflow: hidden; }
.page { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.page.narrow { max-width: 820px; } .page.wide { max-width: 1400px; }
.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: space-between; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; color: var(--muted-solid); font-size: .9rem; margin-bottom: .75rem; }
.crumbs span { opacity: .6; }
.loading, .empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted-solid); }
.empty.big { font-size: 1.2rem; line-height: 2; } .empty.small { padding: 1rem; font-size: .9rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.toolbar input[type=search] { flex: 1; min-width: 180px; }
.row-end, .btn-row { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.inline { display: flex; gap: .5rem; align-items: center; }
.inline > input, .inline > select { flex: 1; min-width: 0; }
.label-row { display: flex; align-items: center; gap: .4rem; margin-bottom: .35rem; flex-wrap: wrap; }
.label-row label { margin: 0; }

/* ---------- Karten (Cards) ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; }
a.card { color: inherit; text-decoration: none; display: block; transition: transform .15s, border-color .15s; }
a.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card.pad, .pad { padding: 1.1rem 1.2rem; }
.card-body { padding: .9rem 1rem; }
.card-body h3 { margin: 0 0 .25rem; font-size: 1.15rem; }
.cover { height: 150px; background: var(--surface-3) center / cover no-repeat; }
.cover.tall { height: 240px; }
.empty-cover { display: grid; place-items: center; font-size: 3rem; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 .5rem; min-height: 2.6em; }
.meta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; font-size: .85rem; color: var(--muted-solid); }
.hero-map .card-body { display: flex; justify-content: space-between; gap: 1rem; }
.stat-list { display: flex; flex-direction: column; margin-bottom: .5rem; }
.stat-list a { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.stat-list a:hover strong { color: var(--accent); }
.danger-zone { border-color: #5a2a20; }

/* ---------- Badges, Chips ---------- */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem; border-radius: 99px; font-size: .78rem; background: var(--surface-3); color: var(--text); border: 1px solid var(--border); white-space: nowrap; }
.badge.pub { background: #1f3326; border-color: #2f5a3a; color: #a9dbb4; }
.badge.secret { background: #3a2020; border-color: #6b3030; color: #f0b1a6; margin-bottom: .4rem; }
.badge.cat-world { border-color: #4a6a8a; } .badge.cat-region { border-color: #5a7a4a; } .badge.cat-city { border-color: #8a6a3a; }
.badge.cat-dungeon { border-color: #6a4a7a; } .badge.cat-building { border-color: #8a4a3a; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; text-decoration: none !important; }
.chip:hover { border-color: var(--accent); }
.chip.active { background: #3a2f18; border-color: var(--accent); }
.chip small { color: var(--muted-solid); }
.chip button { background: none; border: 0; color: var(--muted-solid); cursor: pointer; padding: 0 0 0 .2rem; font-size: .9rem; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; margin-bottom: .5rem; }
.tabs a { padding: .6rem .9rem; color: var(--muted-solid); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--text); border-color: var(--accent); }

/* ---------- Listen ---------- */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list.compact { background: none; border: 0; }
.list-item { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none !important; background: none; border-left: 0; border-right: 0; border-top: 0; font: inherit; text-align: left; width: 100%; cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover, button.list-item:hover { background: var(--surface-2); }
.avatar { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-3) center / cover; flex-shrink: 0; }
.avatar.icon { display: grid; place-items: center; font-size: 1.25rem; }
.map-tree { display: flex; flex-direction: column; gap: .5rem; }
.map-row { display: flex; align-items: center; gap: .9rem; padding: .55rem .8rem; margin-left: calc(var(--d, 0) * 1.6rem); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none !important; position: relative; }
.map-row:hover { border-color: var(--accent); }
.map-row[style*="--d:1"]::before, .map-row[style*="--d:2"]::before, .map-row[style*="--d:3"]::before, .map-row[style*="--d:4"]::before, .map-row[style*="--d:5"]::before { content: "↳"; position: absolute; left: -1.2rem; color: var(--muted-solid); }
.map-row .thumb { width: 72px; height: 52px; border-radius: 8px; background: var(--surface-3) center / cover; flex-shrink: 0; }
.chev { color: var(--muted-solid); font-size: 1.4rem; }

/* ---------- Formulare ---------- */
input, select, textarea { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 9px; padding: .6rem .75rem; font: inherit; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); flex-shrink: 0; }
input[type=color] { width: 44px; height: 36px; padding: 2px; }
input[type=file] { padding: .45rem; }
textarea.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 14px; line-height: 1.5; }
.field { margin-bottom: 1rem; }
.field > label, fieldset legend { display: block; margin-bottom: .35rem; font-weight: 600; font-size: .9rem; }
.field small { display: block; color: var(--muted-solid); margin-top: .3rem; font-size: .8rem; }
.field.check label { display: flex; gap: .55rem; align-items: center; font-weight: 400; cursor: pointer; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem 0; margin: 0 0 1rem; }
.form-narrow { max-width: 760px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; min-height: 40px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--danger); border-color: #6b3020; }
.btn.small { padding: .35rem .7rem; font-size: .85rem; min-height: 34px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: none; border: 1px solid transparent; color: var(--muted-solid); font-size: 1rem; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; flex-shrink: 0; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* ---------- Anmeldung ---------- */
.auth-wrap { min-height: calc(100dvh - var(--top)); display: grid; place-items: center; padding: 1rem; }
.auth { width: 100%; max-width: 400px; padding: 2rem 1.6rem; }
.auth h1 { text-align: center; }
.auth-logo { font-size: 2.6rem; text-align: center; }

/* ---------- Modale ---------- */
.modal-ov { position: fixed; inset: 0; z-index: 3000; background: rgba(8, 6, 4, .7); display: flex; align-items: center; justify-content: center; padding: 1rem; animation: fade .15s; }
.modal { width: 100%; max-width: 520px; max-height: calc(100dvh - 2rem); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-content { overflow: auto; display: flex; flex-direction: column; min-height: 0; }
.mform { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-body { padding: 1rem 1.1rem; overflow: auto; }
.modal-foot { display: flex; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--border); flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); }
@keyframes fade { from { opacity: 0; } }
.icon-grid { display: flex; flex-wrap: wrap; gap: .35rem; }
.icon-opt { width: 40px; height: 40px; font-size: 1.25rem; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; }
.icon-opt.active { border-color: var(--accent); background: #3a2f18; }
.icon-custom { width: 64px !important; text-align: center; font-size: 1.2rem; padding: .35rem; }
.color-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; background: var(--c); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 2px var(--accent); }
.linked { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.art-results { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.art-opt { background: var(--surface-2); border: 1px dashed var(--border); color: var(--text); border-radius: 8px; padding: .3rem .6rem; font: inherit; font-size: .88rem; cursor: pointer; }
.art-opt:hover { border-color: var(--accent); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; z-index: 5000; bottom: max(1rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; width: min(420px, calc(100% - 2rem)); pointer-events: none; }
.toast { padding: .75rem 1rem; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border); box-shadow: 0 8px 30px rgba(0, 0, 0, .5); animation: fade .2s; pointer-events: auto; }
.toast.error { border-color: var(--danger); background: #3a1d17; } .toast.ok { border-color: var(--ok); }
.bar { height: 6px; background: var(--surface); border-radius: 99px; overflow: hidden; margin-top: .45rem; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- Kartenansicht ---------- */
.mapview { height: 100%; display: flex; flex-direction: column; }
.map-bar { display: flex; align-items: center; gap: .6rem; padding: .45rem .8rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.map-bar .crumbs { margin: 0; flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.map-actions { display: flex; gap: .35rem; flex-shrink: 0; }
.map-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
#leaflet { flex: 1; background: #0f0d0a; }
.mapview.adding #leaflet { cursor: crosshair; }
.pin-panel { width: 320px; display: none; flex-direction: column; border-left: 1px solid var(--border); background: var(--surface); overflow: hidden; }
.mapview.list-open .pin-panel { display: flex; }
.panel-head { display: flex; gap: .4rem; padding: .6rem; border-bottom: 1px solid var(--border); }
.sub-maps { display: flex; flex-wrap: wrap; gap: .35rem; padding: .6rem; border-bottom: 1px solid var(--border); }
.sub-maps .muted { width: 100%; }
#pinList { overflow: auto; padding: .4rem; flex: 1; }
.pin-group > .muted { padding: .5rem .5rem .2rem; text-transform: uppercase; letter-spacing: .05em; font-size: .72rem; }
.pin-item { display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: .45rem .5rem; border-radius: 8px; font: inherit; cursor: pointer; }
.pin-item:hover { background: var(--surface-2); }
.pin-item small { display: block; color: var(--muted-solid); font-size: .78rem; }
.pin-item .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 35%, var(--surface-2)); border: 2px solid var(--c); flex-shrink: 0; font-size: .9rem; }
.map-hint, .map-status { position: absolute; z-index: 800; left: 50%; transform: translateX(-50%); background: var(--surface-3); border: 1px solid var(--accent); border-radius: 99px; padding: .45rem .5rem .45rem 1rem; display: flex; align-items: center; gap: .6rem; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); max-width: calc(100% - 2rem); font-size: .9rem; }
.map-hint { top: .8rem; } .map-status { bottom: 1rem; padding-right: 1rem; border-color: var(--border); }

/* Leaflet-Anpassungen */
.leaflet-container { font: inherit; background: #0f0d0a; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
.leaflet-popup-content { margin: .9rem 1rem; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted-solid); }
.leaflet-bar a { background: var(--surface); color: var(--text); border-color: var(--border) !important; }
.leaflet-bar a:hover { background: var(--surface-3); }
.ws-pin { background: none; border: 0; }
.ws-pin .pin { width: 36px; height: 36px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 2px solid #fff6; box-shadow: 0 3px 10px rgba(0, 0, 0, .55); display: grid; place-items: center; transition: transform .12s; }
.ws-pin .pin span { transform: rotate(45deg); font-size: 17px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
.ws-pin:hover .pin { transform: rotate(-45deg) scale(1.12); }
.ws-pin .pin.portal { border: 3px solid var(--accent); }
.ws-pin .pin.secret { opacity: .75; border-style: dashed; }
.pin-popup h4 { margin: 0; font-size: 1.05rem; }
.pp-head { display: flex; gap: .6rem; align-items: center; margin-bottom: .5rem; }
.pp-icon { font-size: 1.6rem; }
.pin-popup .md { margin: .3rem 0 .6rem; max-height: 180px; overflow: auto; }
.pin-popup .enter { margin: .4rem 0; color: var(--accent-ink) !important; }
.pp-links { display: flex; flex-direction: column; gap: .25rem; margin: .4rem 0; }
.pp-links a { display: flex; gap: .5rem; align-items: center; padding: .35rem .5rem; border-radius: 8px; background: var(--surface-2); color: var(--text); text-decoration: none; }
.pp-links a:hover { background: var(--surface-3); }
.pp-links small { display: block; color: var(--muted-solid); }
.pin-popup [data-edit] { margin-top: .4rem; }

/* ---------- Artikel ---------- */
.article-img { width: 100%; max-height: 420px; object-fit: cover; display: block; }
.article-body { padding: 1.3rem 1.4rem; }
.article-head { margin-bottom: 1rem; }
.article-head h1 { margin: .5rem 0 .2rem; }
.tagline { color: var(--accent); font-family: var(--serif); font-style: italic; margin: 0; font-size: 1.1rem; }
.refs { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: .4rem; }
.refs h4 { width: 100%; margin: 0 0 .3rem; }
.img-edit { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.img-edit img { max-width: 160px; max-height: 110px; border-radius: 8px; display: block; }
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md table { border-collapse: collapse; width: 100%; margin: .8rem 0; font-size: .92rem; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: .35rem .6rem; text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); }
.md blockquote { border-left: 3px solid var(--accent); margin: .8rem 0; padding: .2rem 1rem; color: var(--muted-solid); }
.md img { max-width: 100%; }
.md h2, .md h3 { margin-top: 1.2em; }

/* ---------- Regelwerk-Browser ---------- */
.rb { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 1rem; align-items: start; }
.rb-side { padding: .7rem; display: flex; flex-direction: column; gap: .5rem; position: sticky; top: calc(var(--top) + 1rem); max-height: calc(100dvh - var(--top) - 2rem); margin: 0; }
.rb-list { overflow: auto; flex: 1; min-height: 120px; display: flex; flex-direction: column; }
.rb-item { text-align: left; background: none; border: 0; border-radius: 7px; color: var(--text); padding: .4rem .55rem; font: inherit; cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; }
.rb-item:hover { background: var(--surface-2); }
.rb-item.active { background: #3a2f18; }
.rb-item small { color: var(--muted-solid); font-size: .75rem; white-space: nowrap; }
.rb-detail { min-height: 300px; margin: 0; }
.rb-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.rb-head h2 { margin: .4rem 0 0; }
.srd-box { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.srd-box > div { flex: 1; min-width: 240px; }
.srd-box h3 { margin: 0 0 .3rem; }
.license { margin-top: 1rem; color: var(--muted-solid); }

/* ---------- Tabelle ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .65rem .9rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-solid); }
.table select { width: auto; padding: .35rem .5rem; }

/* ---------- Responsiv ---------- */
@media (max-width: 900px) {
  .two-col, .rb { grid-template-columns: 1fr; }
  .rb-side { position: static; max-height: 50vh; }
  .pin-panel { position: absolute; z-index: 900; left: 0; right: 0; bottom: 0; width: auto; max-height: 60%; border-left: 0; border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .5); }
}
@media (max-width: 720px) {
  .navtoggle { display: block; }
  #nav { display: none; position: absolute; top: var(--top); left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--border); padding: .5rem; gap: 0; }
  body.nav-open #nav { display: flex; }
  #nav a { padding: .8rem 1rem; }
  .page { padding: 1rem .8rem 3rem; }
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  .hide-sm { display: none; }
  .map-row { margin-left: calc(var(--d, 0) * .9rem); }
  .map-row .thumb { width: 56px; height: 44px; }
  .modal-ov { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { max-width: none; border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .modal-foot .btn { flex: 1; } .modal-foot .grow { display: none; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
  .article-body { padding: 1rem; }
}

/* ---------- Pin-Popup: Karte & Wiki ---------- */
.pp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin: .5rem 0; }
.pp-actions .btn:only-child { grid-column: 1 / -1; }
.pin-popup .pp-actions .enter { margin: 0; }
.btn.wiki { background: #23303d; border-color: #3d5a75; color: #cfe3f5 !important; }
.btn.wiki:hover { border-color: #6f9cc4; }
.pp-sub { margin-top: .5rem; text-transform: uppercase; letter-spacing: .05em; font-size: .7rem; }
.btn-row.start { justify-content: flex-start; margin-bottom: 1rem; }

/* ---------- Steckbrief ---------- */
.article-main { display: flow-root; }
.infobox { float: right; width: min(300px, 100%); margin: 0 0 1rem 1.2rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: .8rem 1rem; }
.infobox h4 { margin: 0 0 .5rem; color: var(--accent); font-size: .95rem; text-transform: uppercase; letter-spacing: .06em; }
.infobox dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .35rem .8rem; font-size: .9rem; }
.infobox dt { color: var(--muted-solid); }
.infobox dd { margin: 0; }
.infobox dd p { margin: 0; }
.facts-edit { display: flex; flex-direction: column; gap: .4rem; }
.fact-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: .4rem; align-items: center; }
.fact-row input { padding: .45rem .6rem; }

/* ---------- Bücher ---------- */
.book-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.4rem 1.1rem; padding: .5rem 0 1rem; }
.book { color: var(--text); text-decoration: none !important; display: flex; flex-direction: column; gap: .5rem; }
.book-cover { aspect-ratio: 2 / 3; border-radius: 3px 10px 10px 3px; position: relative; overflow: hidden;
  background: radial-gradient(120% 80% at 30% 20%, color-mix(in srgb, var(--bc) 85%, #fff 15%), var(--bc) 55%, color-mix(in srgb, var(--bc) 60%, #000 40%));
  box-shadow: inset 6px 0 0 rgba(0, 0, 0, .25), inset 9px 0 0 rgba(255, 255, 255, .06), 0 8px 18px rgba(0, 0, 0, .55); transition: transform .18s; }
.book-cover.has-img { background-size: cover; background-position: center; }
.book-cover::after { content: ""; position: absolute; inset: 10px 10px 10px 18px; border: 1px solid rgba(201, 162, 74, .45); border-radius: 2px 6px 6px 2px; pointer-events: none; }
.book-cover.has-img::after { display: none; }
.book:hover .book-cover { transform: translateY(-4px) rotate(-1deg); }
.book-title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 1.2rem 1rem 1rem 1.5rem; gap: .4rem; }
.book-title span { font-family: var(--serif); font-weight: 700; color: #e9c977; font-size: 1.05rem; line-height: 1.2; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); overflow-wrap: anywhere; }
.book-title small { color: #e9c977b0; font-family: var(--serif); font-style: italic; font-size: .78rem; }
.book-cover.big .book-title span { font-size: 1.6rem; } .book-cover.big .book-title small { font-size: 1rem; }
.book-cap strong { display: block; line-height: 1.3; }
.book-view { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 1rem; align-items: start; }
.book-toc { position: sticky; top: calc(var(--top) + 1rem); max-height: calc(100dvh - var(--top) - 2rem); display: flex; flex-direction: column; margin: 0; }
.toc-head { display: flex; gap: .7rem; align-items: center; padding: .8rem; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none !important; }
.toc-head img { width: 44px; height: 64px; object-fit: cover; border-radius: 2px 6px 6px 2px; }
.toc-head small { display: block; color: var(--muted-solid); font-size: .8rem; }
.mini-cover { width: 44px; height: 64px; border-radius: 2px 6px 6px 2px; background: var(--bc); display: grid; place-items: center; flex-shrink: 0; box-shadow: inset 4px 0 0 rgba(0, 0, 0, .3); }
.toc { overflow: auto; padding: .4rem; flex: 1; }
.toc-toggle { display: none !important; margin: .5rem .8rem 0; width: auto !important; }
.toc-item { display: flex; gap: .5rem; padding: .35rem .5rem .35rem calc(.5rem + var(--d, 0) * 1rem); border-radius: 7px; color: var(--text); text-decoration: none !important; font-size: .93rem; line-height: 1.35; }
.toc-item:hover { background: var(--surface-2); }
.toc-item.active { background: #3a2f18; color: var(--accent); }
.toc-item .num, .page-title .num { color: var(--accent); font-variant-numeric: tabular-nums; opacity: .8; }
.toc.flat { padding: 0; }
.toc-actions { padding: .6rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: .4rem; }
.book-page { margin: 0; padding: 1.6rem 2rem 1.2rem; min-height: 60vh; background: linear-gradient(180deg, #241e17, #201b15); }
.title-page { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 2rem; align-items: start; }
.title-page h1 { margin-top: 0; }
.page-top { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; margin-bottom: .6rem; }
.page-title { font-size: clamp(1.5rem, 3vw, 2.2rem); border-bottom: 1px solid var(--border); padding-bottom: .5rem; }
.book-md { font-family: var(--serif); font-size: 1.08rem; line-height: 1.75; max-width: 72ch; }
.book-md h1, .book-md h2, .book-md h3 { color: var(--accent); }
.book-md > p:first-of-type::first-letter { float: left; font-size: 3.2em; line-height: .9; padding: .08em .1em 0 0; color: var(--accent); font-weight: 700; }
.subpages { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.pager { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.pager .btn { white-space: normal; text-align: left; max-width: 48%; }

@media (max-width: 900px) {
  .book-view { grid-template-columns: 1fr; }
  .book-toc { position: static; max-height: none; }
  .toc-toggle { display: inline-flex !important; }
  .book-toc .toc { display: none; max-height: 50vh; }
  .book-toc .toc.open { display: block; }
  .title-page { grid-template-columns: 1fr; }
  .title-page .book-cover { max-width: 200px; margin: 0 auto; }
  .book-page { padding: 1.1rem 1rem; }
}
@media (max-width: 720px) {
  .infobox { float: none; width: 100%; margin: 0 0 1rem; }
  .book-shelf { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .pager .btn { max-width: 100%; flex: 1; }
}

/* ---------- Verwaltung: Steckbrief-Felder ---------- */
.fact-cfg { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem; align-items: start; }
.fact-type { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: .2rem .8rem; }
.fact-type[open] { padding-bottom: .7rem; }
.fact-type summary { cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; padding: .5rem 0; list-style: none; }
.fact-type summary::-webkit-details-marker { display: none; }
.fact-type textarea { margin: .3rem 0 .5rem; font-size: 14px; }

/* ---------- Bilder im Text ---------- */
.md img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: .8rem auto; }
.md img.img-left { float: left; max-width: 45%; margin: .3rem 1.2rem .8rem 0; }
.md img.img-right { float: right; max-width: 45%; margin: .3rem 0 .8rem 1.2rem; }
.md img.img-small { max-width: 260px; }
.md img.img-wide { width: 100%; }
.md::after { content: ""; display: block; clear: both; }
@media (max-width: 720px) { .md img.img-left, .md img.img-right { float: none; max-width: 100%; margin: .8rem auto; } }

/* ---------- Infobox mit Bild (nicht beschnitten) ---------- */
.infobox-img { display: block; margin: -.8rem -1rem .8rem; background: #0f0d0a; border-radius: 10px 10px 0 0; overflow: hidden; }
.infobox-img img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.infobox-img:only-child { margin-bottom: -.8rem; border-radius: 10px; }

/* ---------- WYSIWYG-Editor ---------- */
.rte { position: relative; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.rte:focus-within { border-color: var(--accent); }
.rte-bar { position: sticky; top: var(--top); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; padding: .35rem; border-bottom: 1px solid var(--border); background: var(--surface-3); border-radius: 10px 10px 0 0; }
.modal .rte-bar { top: 0; }
.rte-bar button { min-width: 32px; height: 32px; padding: 0 .45rem; border: 1px solid transparent; border-radius: 7px; background: none; color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
.rte-bar button:hover { background: var(--surface-2); border-color: var(--border); }
.rte-bar button.on { background: #3a2f18; border-color: var(--accent); color: var(--accent); }
.rte-bar select { width: auto; padding: .25rem .4rem; font-size: .88rem; height: 32px; }
.rte-sep { width: 1px; height: 20px; background: var(--border); margin: 0 .2rem; }
.rte-tbl { display: inline-flex; align-items: center; gap: .15rem; }
.rte-tbl[hidden] { display: none; }
.rte-tbl button { font-size: .78rem; }
.rte-area { min-height: 200px; padding: .9rem 1rem; outline: none; line-height: 1.65; cursor: text; }
.rte-area:empty::before { content: attr(data-ph); color: var(--muted-solid); }
.rte-area img { cursor: pointer; }
.rte-area img.rte-sel { outline: 3px solid var(--accent); outline-offset: 2px; }
.rte-area table td, .rte-area table th { min-width: 60px; }
.rte-source { border: 0; border-radius: 0 0 10px 10px; min-height: 200px; resize: vertical; }
.rte-imgbar { position: absolute; z-index: 6; display: flex; flex-wrap: wrap; gap: .2rem; padding: .25rem; background: var(--surface); border: 1px solid var(--accent); border-radius: 9px; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
.rte-imgbar button { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: .25rem .5rem; font: inherit; font-size: .8rem; cursor: pointer; }
.rte-imgbar button:hover { border-color: var(--accent); }
.book-ed .rte-area { font-family: var(--serif); font-size: 1.05rem; }
.rte-area img { max-height: 420px; width: auto; }

/* ---------- Eigene Symbole ---------- */
.ico { width: 1.15em; height: 1.15em; vertical-align: -.2em; display: inline-block; }
.avatar.icon .ico { width: 1.5rem; height: 1.5rem; }

/* ---------- Logo ---------- */
.brand-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; }
.brand-icon img { max-width: 34px; max-height: 34px; object-fit: contain; }
.auth-logo-img { max-width: 110px; max-height: 110px; object-fit: contain; }
.brand-edit { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.logo-prev { width: 110px; height: 110px; border-radius: 14px; border: 1px dashed var(--border); background: var(--surface-2); display: grid; place-items: center; font-size: 3rem; flex-shrink: 0; }
.logo-prev img { max-width: 96px; max-height: 96px; object-fit: contain; }

/* ---------- Lightbox ---------- */
.md img:not(.rte-area img), .infobox-img, .book-cover.big.has-img { cursor: zoom-in; }
.rte-area img { cursor: pointer; }
.lightbox { position: fixed; inset: 0; z-index: 6000; background: rgba(6, 5, 3, .94); display: flex; flex-direction: column; animation: fade .15s; }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 3.2rem 3.5rem .5rem; overflow: auto; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .7); cursor: zoom-in; user-select: none; }
.lightbox.zoom .lb-stage { display: block; padding: 0; }
.lightbox.zoom .lb-stage img { max-width: none; max-height: none; cursor: zoom-out; border-radius: 0; margin: auto; display: block; }
.lb-bar { display: flex; gap: 1rem; align-items: center; justify-content: center; padding: .6rem 1rem max(.8rem, env(safe-area-inset-bottom)); color: var(--muted-solid); font-size: .9rem; }
.lb-bar a { color: var(--text); }
.lb-btn { position: absolute; z-index: 2; border: 0; background: rgba(40, 34, 26, .8); color: #fff; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.lb-btn:hover { background: rgba(201, 162, 74, .85); color: #1a140a; }
.lb-close { top: .8rem; right: .8rem; width: 42px; height: 42px; font-size: 1.2rem; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 2rem; line-height: 1; }
.lb-prev { left: .6rem; } .lb-next { right: .6rem; }
@media (max-width: 720px) { .lb-stage { padding: 3.2rem .4rem .4rem; } .lb-prev, .lb-next { top: auto; bottom: 3.5rem; transform: none; } }
