:root {
  --bg: #17130f;
  --bg2: #211b15;
  --card: #2a221a;
  --card2: #33291f;
  --line: #4a3c2d;
  --text: #efe4d0;
  --muted: #b3a38a;
  --accent: #d4a24c;
  --accent-ink: #1b140c;
  --danger: #d0604f;
  --ok: #7fb069;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --font: -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, "Liberation Sans", sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4ecdd; --bg2: #ebe0cb; --card: #fffaf0; --card2: #f6eddc; --line: #d8c7a8;
    --text: #2b2117; --muted: #7a6852; --accent: #9c6a1c; --accent-ink: #fff;
    --shadow: 0 4px 18px rgba(80, 50, 10, .12); color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4ecdd; --bg2: #ebe0cb; --card: #fffaf0; --card2: #f6eddc; --line: #d8c7a8;
  --text: #2b2117; --muted: #7a6852; --accent: #9c6a1c; --accent-ink: #fff;
  --shadow: 0 4px 18px rgba(80, 50, 10, .12); color-scheme: light;
}

/* Testinstanz (INSTANCE=test): kühles Blau statt Tavernen-Gold, damit man sie nicht mit Live verwechselt */
:root[data-instance="test"] {
  --bg: #0f1822; --bg2: #14212e; --card: #1a2a39; --card2: #203446; --line: #2f4b63;
  --text: #e2edf5; --muted: #9db3c6; --accent: #4fb3d9; --accent-ink: #061722;
}
@media (prefers-color-scheme: light) {
  :root[data-instance="test"]:not([data-theme="dark"]) {
    --bg: #e4eef6; --bg2: #d5e4ef; --card: #f7fbff; --card2: #e8f2f9; --line: #b3cbdd;
    --text: #13232f; --muted: #536e83; --accent: #1f6f9c; --accent-ink: #fff;
  }
}
:root[data-instance="test"][data-theme="light"] {
  --bg: #e4eef6; --bg2: #d5e4ef; --card: #f7fbff; --card2: #e8f2f9; --line: #b3cbdd;
  --text: #13232f; --muted: #536e83; --accent: #1f6f9c; --accent-ink: #fff;
}
:root[data-instance="test"] body { border-top: 4px solid var(--accent); }

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; }
body { min-height: 100vh; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0 0 .6em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: .8rem; }
.hidden { display: none; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--accent); }
.brand-short { display: none; }
.topbar .crumb { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mode-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex-shrink: 0; }
.mode-switch button { border: 0; background: transparent; color: var(--muted); padding: .35rem .75rem; font: inherit; font-size: .85rem; cursor: pointer; }
.mode-switch button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 2.6rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 200px; padding: .4rem; z-index: 30; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: .55rem .7rem; border-radius: 8px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--card2); }

main { max-width: 1200px; margin: 0 auto; padding: 1.2rem 1rem 4rem; }

/* Controls */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-size: .95rem; padding: .55rem 1rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card2); color: var(--text); text-decoration: none;
  min-height: 40px;
}
button:hover, .btn:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.danger { color: var(--danger); }
.ghost { background: transparent; }
.icon-btn { padding: .35rem .6rem; min-height: 34px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; padding: .55rem .7rem; width: 100%; min-height: 40px;
}
textarea { min-height: 90px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 0; }
label.field { display: block; }
label.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.badge { display: inline-block; font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.Regelwerk { color: #e7c16f; border-color: #8a6a2a; }
.badge.Quellband { color: #8cc0e8; border-color: #3e6a8c; }
.badge.Abenteuer { color: #e88c7c; border-color: #8c4a3e; }
.badge.ok { color: var(--ok); }
.badge.err { color: var(--danger); }

.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: .7rem 1rem; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; max-width: calc(100vw - 2rem); }
.toast.error { border-left-color: var(--danger); }

/* Auth */
.auth-wrap { max-width: 420px; margin: 8vh auto; }
.auth-wrap h1 { text-align: center; font-size: 2rem; }

/* Systems */
.systems { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.system-card { position: relative; overflow: hidden; cursor: pointer; text-decoration: none; color: var(--text); min-height: 150px; display: flex; flex-direction: column; transition: transform .15s; }
.system-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.system-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--sys); }
.system-card h2 { margin-top: .3rem; }
.system-card .counts { margin-top: auto; display: flex; gap: .35rem; flex-wrap: wrap; }

/* Tabs */
.tabs { display: flex; gap: .3rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 0 -1rem 1.2rem; padding: 0 1rem; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; color: var(--muted); white-space: nowrap; padding: .7rem .9rem; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.sys-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; }
.sys-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--sys); flex-shrink: 0; }

/* Library */
.filters { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.chip { border-radius: 999px; padding: .3rem .8rem; min-height: 34px; font-size: .9rem; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; }
.doc { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.doc .cover { aspect-ratio: 3 / 4; background: var(--bg2) center / cover no-repeat; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); font-family: var(--serif); font-size: 2rem; }
.doc .body { padding: .6rem .7rem .7rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.doc .title { font-weight: 600; line-height: 1.25; word-break: break-word; }
.doc .actions { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: auto; }
.doc .actions button, .doc .actions a { padding: .3rem .55rem; min-height: 32px; font-size: .85rem; }
.upload { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.upload.drag { border-color: var(--accent); background: var(--card2); }
.progress { height: 6px; background: var(--bg2); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width .2s; }

/* Markdown */
.md { line-height: 1.6; overflow-wrap: anywhere; }
.md h1, .md h2, .md h3 { margin-top: 1.2em; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; margin: .8em 0; }
.md th, .md td { border: 1px solid var(--line); padding: .35rem .6rem; text-align: left; vertical-align: top; }
.md th { background: var(--card2); }
.md code { background: var(--bg2); padding: .1em .35em; border-radius: 4px; }
.md blockquote { border-left: 3px solid var(--accent); margin: .5em 0; padding: .2em .9em; color: var(--muted); }
.md p:first-child { margin-top: 0; }

/* Chat */
/* Höhe setzt fitChat() aus dem sichtbaren Bereich (inkl. Handy-Tastatur); Fallback über dvh */
.chat { display: flex; flex-direction: column; height: var(--chat-h, calc(100dvh - 210px)); min-height: 160px; }
body.chat-open main { padding-bottom: .5rem; }
/* Wenig Höhe (z.B. Handy mit offener Tastatur): Kopfbereich ausblenden, damit Verlauf und Eingabe Platz haben */
body.chat-compact .sys-head, body.chat-compact .tabs, body.chat-compact .chat-hide-compact { display: none !important; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .8rem; padding: .2rem .1rem 1rem; }
.msg { max-width: 88%; padding: .7rem .9rem; border-radius: 14px; border: 1px solid var(--line); }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.msg .plain { white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--card); }
.msg .tools { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .4rem; }
.chat-input { display: flex; gap: .5rem; padding: .6rem 0 env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: var(--bg); }
.chat-input textarea { min-height: 46px; height: 46px; max-height: 160px; }
.typing::after { content: "▍"; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* NPC */
.npc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; align-items: start; }
.npc h3 { margin-bottom: .1rem; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .35rem; margin: .4rem 0; }
.kv div { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: .25rem .45rem; text-align: center; }
.kv b { display: block; font-size: 1.05rem; }
.kv span { font-size: .72rem; color: var(--muted); }
.hp { display: flex; align-items: center; gap: .4rem; margin: .5rem 0; }
.hp .bar { flex: 1; height: 10px; background: var(--bg2); border-radius: 5px; overflow: hidden; border: 1px solid var(--line); }
.hp .bar > div { height: 100%; background: var(--ok); transition: width .2s; }
.hp .bar.low > div { background: var(--danger); }
.npc ul { margin: .3rem 0; padding-left: 1.2rem; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: .7rem 0 .2rem; }
.status-log { font-size: .85rem; color: var(--muted); }
.status-log div::before { content: "🔎 "; }

/* Character sheet */
.sheet-section { margin-bottom: 1rem; }
.sheet-section h3 { border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
.sheet-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; }
.sheet-fields .wide { grid-column: 1 / -1; }
.sheet-table { width: 100%; border-collapse: collapse; }
.sheet-table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 500; padding: .2rem; }
.sheet-table td { padding: .15rem; }
.sheet-table input { min-height: 34px; padding: .3rem .45rem; }
.table-wrap { overflow-x: auto; }

/* Reader */
.reader { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--rbg, #fbf6ec); color: var(--rfg, #2b2117); }
.reader[data-rtheme="dark"] { --rbg: #121212; --rfg: #ddd; }
.reader[data-rtheme="sepia"] { --rbg: #f1e3c6; --rfg: #3d2e1c; }
.reader[data-rtheme="light"] { --rbg: #ffffff; --rfg: #1a1a1a; }
.reader-bar { display: flex; align-items: center; gap: .4rem; padding: .4rem .6rem; border-bottom: 1px solid rgba(128,128,128,.3); }
.reader-bar button, .reader-bar a { background: transparent; color: inherit; border-color: rgba(128,128,128,.35); padding: .3rem .6rem; min-height: 36px; }
.reader-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--serif); }
.reader-view { flex: 1; position: relative; min-height: 0; }
#epub-area { position: absolute; inset: 0 2.6rem; }
.reader-nav { position: absolute; top: 0; bottom: 0; width: 2.6rem; display: flex; align-items: center; justify-content: center; background: transparent; border: 0; color: inherit; opacity: .45; font-size: 1.6rem; border-radius: 0; }
.reader-nav:hover { opacity: 1; }
.reader-nav.prev { left: 0; } .reader-nav.next { right: 0; }
.reader-foot { padding: .3rem .8rem; font-size: .8rem; opacity: .7; display: flex; gap: .6rem; }
.toc { position: absolute; top: 0; left: 0; bottom: 0; width: min(340px, 90vw); background: var(--rbg); border-right: 1px solid rgba(128,128,128,.35); overflow-y: auto; z-index: 5; padding: .5rem; box-shadow: var(--shadow); }
.toc a { display: block; padding: .45rem .5rem; color: inherit; text-decoration: none; border-radius: 6px; font-size: .92rem; }
.toc a:hover { background: rgba(128,128,128,.15); }
.toc a.sub { padding-left: 1.4rem; font-size: .85rem; opacity: .85; }
.pdf-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #555; }

/* Tables (admin) */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: .8rem; color: var(--muted); font-weight: 500; }
.table select { min-height: 34px; padding: .25rem .4rem; width: auto; }

.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

@media (max-width: 700px) {
  main { padding: 1rem 1rem 4rem; }
  h1 { font-size: 1.4rem; }
  .topbar { padding: .5rem .75rem; gap: .5rem; }
  .topbar .crumb { display: none; }
  .brand-long { display: none; }
  .brand-short { display: inline; }
  .docs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .7rem; }
  .msg { max-width: 94%; }
  .chat .row.small { font-size: .78rem; }
  #epub-area { inset: 0 .5rem; }
  .reader-nav { display: none; }
  .hide-mobile { display: none !important; }
  .table .hide-mobile { display: none; }
  .npc-grid { grid-template-columns: 1fr; }
}

/* Kampagnen-Wechsler */
.camp-switch { width: auto; max-width: 220px; min-height: 36px; padding: .3rem .5rem; font-size: .9rem; }
details summary { padding: .3rem 0; }
@media (max-width: 700px) { .camp-switch { max-width: 130px; } }

/* ===== Wrath & Glory: Charakterbogen ===== */
.wg fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.wg .card.wg-head { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem; margin-bottom: .8rem; border: 1px solid var(--line); }
.wg-portrait { position: relative; width: 120px; flex-shrink: 0; aspect-ratio: 4 / 5; border-radius: 10px; overflow: hidden; background: var(--bg2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.wg-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wg-portrait-empty { font-size: 2.6rem; color: var(--muted); }
.wg-portrait-actions { position: absolute; right: 4px; bottom: 4px; display: flex; gap: 4px; }
.wg-portrait-actions .icon-btn { min-height: 30px; padding: .2rem .45rem; background: color-mix(in srgb, var(--card) 85%, transparent); }
.wg-portrait-lg { width: 200px; flex-direction: column; aspect-ratio: auto; min-height: 250px; padding-bottom: .5rem; }
.wg-portrait-lg img { height: 230px; }
.wg-ident { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.wg-name { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; padding: .3rem .5rem; }
.wg-sub { color: var(--muted); }
.wg-badges { gap: .3rem; }
.wg-kw > span { margin-bottom: .1rem !important; }
.wg-kw input { font-size: .85rem; letter-spacing: .02em; min-height: 34px; padding: .3rem .5rem; }
.wg-xp { text-align: center; min-width: 110px; display: flex; flex-direction: column; align-items: center; padding: .4rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.wg-xp b { font-size: 2rem; font-family: var(--serif); color: var(--accent); line-height: 1.1; }
.wg-xp span { font-size: .8rem; }
.wg .neg, .wg-wiz .neg, .wg-xpbar.neg b { color: var(--danger) !important; }
.wg-toolbar { margin-bottom: .8rem; }
.wg-note { margin-bottom: .8rem; font-size: .9rem; border-left: 4px solid var(--accent); }
.wg-issues { margin-bottom: .8rem; font-size: .9rem; color: var(--danger); border-left: 4px solid var(--danger); }
.wg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .8rem; align-items: start; }
.wg-card h3 { border-bottom: 1px solid var(--line); padding-bottom: .3rem; margin-bottom: .5rem; }
.wg-wide { grid-column: 1 / -1; }
.wg-skills { grid-row: span 2; }
.wg-table { width: 100%; border-collapse: collapse; }
.wg-table th { font-size: .75rem; color: var(--muted); font-weight: 500; text-align: left; padding: .15rem .25rem; }
.wg-table td { padding: .15rem .25rem; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); vertical-align: middle; }
.wg-table tr.has td:first-child { font-weight: 600; }
.wg-table small { font-size: .72rem; }
.wg-val input { width: 58px; min-height: 32px; padding: .2rem .35rem; text-align: center; }
.wg-total { font-weight: 700; font-size: 1.05rem; text-align: center; color: var(--accent); }
.wg-die { min-height: 30px; padding: .1rem .35rem; }
.wg-stepper { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.wg-stepper button { min-height: 30px; min-width: 30px; padding: 0 .4rem; border-radius: 8px; }
.wg-stepper b { min-width: 1.8em; text-align: center; }
.wg-trait { display: flex; align-items: center; gap: .5rem; padding: .2rem 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.wg-trait span { flex: 1; }
.wg-trait b { min-width: 2em; text-align: right; font-size: 1.1rem; }
.wg-mod { width: 54px !important; min-height: 28px !important; padding: .1rem .3rem !important; font-size: .8rem; text-align: center; opacity: .75; }
.wg-track { margin-bottom: .6rem; }
.wg-counters { display: grid; gap: .3rem; margin: .4rem 0; }
.wg-counters > div { display: flex; align-items: center; justify-content: space-between; }
.wg-roll input { width: 70px; }
.wg-short { min-height: 60px; margin-top: .3rem; }
.wg-gear input { min-width: 0; }
.wg-gear .wg-xs { width: 64px; }
.wg-gear .wg-s { width: 100px; }
.wg-bg { margin: .45rem 0; }
.wg-bg input[type="radio"] { margin: 0; }
.wg-bonus-sel { width: auto; min-height: 30px; padding: .15rem .4rem; font-size: .85rem; }
.wg-look { margin-top: .4rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.wg-xpgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .5rem; margin-bottom: .4rem; }
.wg-xpgrid > div { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: .3rem .5rem; display: flex; flex-direction: column; }
.wg-xpgrid > div span { font-size: .8rem; color: var(--muted); }
.wg-xpgrid > div b { font-size: 1.3rem; }
.wg-asc { background: var(--card2); margin-bottom: .6rem; }
.wg-log td { font-size: .9rem; }
.wg-log .pos { color: var(--ok); font-weight: 600; }

/* Assistent */
.modal.wg-wiz { max-width: 920px; display: flex; flex-direction: column; padding: 0; max-height: 92vh; overflow: hidden; }
.wg-wiz-head { padding: 1rem 1rem .5rem; border-bottom: 1px solid var(--line); }
.wg-wiz-body { padding: 1rem; overflow-y: auto; flex: 1; }
.wg-wiz-foot { padding: .7rem 1rem; border-top: 1px solid var(--line); }
.wg-steps { display: flex; gap: .3rem; overflow-x: auto; margin-top: .6rem; scrollbar-width: none; }
.wg-steps .chip { white-space: nowrap; font-size: .85rem; }
.wg-xpbar { padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); white-space: nowrap; }
.wg-xpbar b { color: var(--accent); font-size: 1.1rem; }
.wg-tiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.wg-archs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem; }
.wg-pick { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; text-align: left; padding: .7rem; min-height: 0; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); }
.wg-pick.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.wg-pick b { font-family: var(--serif); font-size: 1.05rem; }
.wg-pick small { color: var(--muted); }
.wg-custom { grid-column: 1 / -1; }
.wg-detail { background: var(--card2); box-shadow: none; }
.wg-wiztable td { padding: .3rem .25rem; }
.wg-talents { max-height: 46vh; overflow-y: auto; margin-top: .4rem; display: flex; flex-direction: column; gap: .3rem; }
.wg-talent { flex-shrink: 0; justify-content: space-between; text-align: left; min-height: 0; padding: .4rem .6rem; }
.wg-talent > span:first-child { display: flex; flex-direction: column; }
.wg-talent small { font-size: .75rem; }
.wg-chosen input { min-height: 32px; padding: .2rem .4rem; }
.wg-lookgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.wg-final { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: flex-start; }

/* Würfel */
.wg-dice { display: flex; flex-wrap: wrap; gap: .35rem; }
.wg-d { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); font-weight: 700; color: var(--muted); }
.wg-d.ic { color: var(--text); border-color: var(--accent); }
.wg-d.ex { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.wg-d.wrath { outline: 2px solid var(--danger); outline-offset: 1px; }

@media (max-width: 700px) {
  .wg .card.wg-head { flex-wrap: wrap; }
  .wg-portrait { width: 96px; }
  .wg-ident { min-width: 180px; }
  .wg-xp { flex-direction: row; gap: .4rem; width: 100%; justify-content: center; }
  .wg-xp b { font-size: 1.4rem; }
  .wg-grid { grid-template-columns: 1fr; }
  .wg-skills { grid-row: auto; }
  .modal.wg-wiz { max-height: 100vh; height: 100%; border-radius: 0; }
  .wg-wiz-foot { flex-wrap: wrap; }
  .wg-portrait-lg { width: 100%; }
}

/* ===== Wrath & Glory: Druck (A4 / A5) ===== */
.wg-print { display: none; }
@media print {
  html.wg-printing, html.wg-printing body { background: #fff !important; color: #000 !important; }
  html.wg-printing body > *:not(.wg-print) { display: none !important; }
  html.wg-printing .wg-print { display: block; color: #000; font-family: Georgia, "Times New Roman", serif; font-size: 8.6pt; line-height: 1.25; }
  html.wg-a5 .wg-print { font-size: 7.2pt; }
  .wg-print * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .wg-print h1 { font-size: 18pt; margin: 0 0 1mm; }
  .wg-print h2 { font-size: 9.5pt; text-transform: uppercase; letter-spacing: .08em; margin: 2.5mm 0 1mm; padding: .6mm 1.5mm; background: #222; color: #fff; }
  .wg-print section > h2:first-child { margin-top: 0; }
  .wg-print p { margin: .6mm 0; }
  .wg-print table { width: 100%; border-collapse: collapse; }
  .wg-print th { font-size: .85em; text-align: left; font-weight: normal; color: #444; border-bottom: .3mm solid #000; }
  .wg-print td { border-bottom: .2mm solid #bbb; padding: .5mm 1mm; }
  .wg-print td:not(:first-child) { text-align: center; width: 9mm; }
  .wg-print .wgp-lines td { text-align: left; width: auto; height: 5mm; }
  .wgp-head { display: flex; gap: 4mm; align-items: flex-start; border-bottom: .6mm solid #000; padding-bottom: 2mm; margin-bottom: 3mm; }
  .wgp-head img { width: 30mm; height: 37mm; object-fit: cover; border: .3mm solid #000; }
  html.wg-a5 .wgp-head img { width: 22mm; height: 27mm; }
  .wgp-id { flex: 1; }
  .wgp-title { font-size: .8em; text-transform: uppercase; letter-spacing: .15em; color: #555; }
  .wgp-kw { font-size: .85em; text-transform: uppercase; letter-spacing: .04em; margin-top: 1mm; }
  .wgp-boxes { display: grid; grid-template-columns: repeat(2, 18mm); gap: 1.5mm; }
  .wgp-boxes div, .wgp-small-boxes div { border: .3mm solid #000; text-align: center; padding: .6mm; }
  .wgp-boxes span, .wgp-small-boxes span { display: block; font-size: .75em; color: #444; }
  .wgp-boxes b { font-size: 12pt; }
  .wgp-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 3mm 4mm; }
  html.wg-a5 .wgp-grid { grid-template-columns: 1fr 1fr; gap: 2mm 3mm; }
  .wgp-grid section { break-inside: avoid; }
  .wgp-wide { grid-column: 1 / -1; }
  .wgp-track { margin-bottom: 1.5mm; }
  .wgp-track > div { display: flex; flex-wrap: wrap; gap: .8mm; margin-top: .5mm; }
  .wgp-track i { width: 3.6mm; height: 3.6mm; border: .3mm solid #000; display: inline-block; }
  .wgp-small-boxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5mm; margin-top: 1.5mm; }
  .wgp-small-boxes b { display: block; height: 6mm; font-size: 11pt; }
  .wgp-pre { white-space: pre-wrap; }
  .wg-print small { font-size: .8em; color: #444; }
}

/* Gesperrte Abenteuer laufender Kampagnen */
.doc.locked { opacity: .7; }
.doc.locked .cover { filter: grayscale(1) contrast(.85); opacity: .55; cursor: not-allowed; }
.doc.locked .title { color: var(--muted); }

/* ---------- Der Eine Ring (2. Edition) ---------- */
.tor-pts { flex-direction: row; gap: .8rem; min-width: 0; }
.tor-pts > div { display: flex; flex-direction: column; align-items: center; }
.tor-pts span { max-width: 90px; text-align: center; line-height: 1.15; }
.tor-conds { gap: .35rem; }
.tor-cond { font-size: .8rem; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; }
.tor-cond input { margin: 0; }
.tor-cond.on { color: var(--accent-ink); background: var(--danger); border-color: var(--danger); }
.tor-skillcols { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem 1.2rem; }
.tor-skill { display: flex; align-items: center; gap: .4rem; padding: .15rem 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.tor-skill.has .tor-sname { font-weight: 600; }
.tor-sname { flex: 1; min-width: 0; }
.tor-fav { min-height: 26px; min-width: 26px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 1.05rem; }
.tor-fav.on { color: var(--accent); }
.tor-dia { color: var(--accent); letter-spacing: .05em; font-size: .8rem; white-space: nowrap; }
.tor-num { width: 46px !important; min-height: 28px !important; padding: .1rem .25rem !important; text-align: center; }
.tor-x { min-height: 0; padding: 0 .2rem; border: 0; background: none; color: inherit; font-size: .75rem; }
.tor .wg-gear select { min-width: 110px; }
.tor-wiz .wg-talent.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.tor-feat { font-size: 1.05rem; }
.wg-d.tor-off { opacity: .35; text-decoration: line-through; }
@media (max-width: 720px) {
  .tor-skillcols { grid-template-columns: 1fr; }
  .tor-dia { display: none; }
}
@media print {
  .tor-print .torp-dia { letter-spacing: .05em; width: auto !important; text-align: right !important; }
  .tor-print .wgp-small-boxes div { min-height: 9mm; }
}

.instance-badge { margin-left: .5rem; padding: .1rem .55rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 700; letter-spacing: .1em; }
.modal.release-notes { max-width: 720px; max-height: 88vh; overflow-y: auto; }
.release-notes .md h2 { margin-top: 1.2em; padding-bottom: .2em; border-bottom: 1px solid var(--line); }
.feedback-row { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.doc .cover { position: relative; }
.doc .cover-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.6rem .7rem .7rem; font-family: var(--serif); font-size: 1.15rem; font-weight: 700; line-height: 1.2; color: #fff; text-align: center; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); background: linear-gradient(transparent, rgba(0, 0, 0, .75)); word-break: break-word; }
.cover-preview { width: 120px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 8px; }
.cover-preview .cover-title { font-size: .85rem; padding: 1rem .4rem .4rem; }

/* ---------- D&D 5e ---------- */
.dnd-quick { gap: .35rem; }
.dnd-quick button.tor-cond { min-height: 0; cursor: pointer; }
.dnd-level b { font-size: 2.2rem; }
.dnd-abs { display: grid; grid-template-columns: repeat(6, 1fr); gap: .5rem; }
.dnd-ab { display: flex; flex-direction: column; align-items: center; padding: .4rem .2rem .55rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); position: relative; }
.dnd-ab-name { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; }
.dnd-ab-mod { font-family: var(--serif); font-size: 1.8rem; font-weight: 700; border: 0; background: none; padding: 0 .4rem; min-height: 0; line-height: 1.15; color: var(--text); }
.dnd-ab-mod:hover { color: var(--accent); }
.dnd-ab-score { position: absolute; bottom: -.6rem; min-width: 2.2em; text-align: center; font-size: .8rem; font-weight: 600; padding: 0 .4rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.dnd-edit input { width: 64px !important; }
.dnd-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.dnd-stats > div, .dnd-stats > button { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .35rem .2rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); min-height: 0; color: var(--text); }
.dnd-stats span { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; }
.dnd-stats b { font-size: 1.35rem; font-family: var(--serif); }
.dnd-stats small { font-size: .7rem; color: var(--muted); }
.dnd-stats-sm { grid-template-columns: repeat(3, minmax(90px, 1fr)); flex: 1; }
.dnd-big-in { width: 64px !important; text-align: center; font-size: 1.2rem; min-height: 34px !important; }
.dnd-hp { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; text-align: center; margin-bottom: .3rem; }
.dnd-hp span { display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dnd-hp b { font-size: 1.6rem; font-family: var(--serif); }
.dnd-hpctl { margin: .45rem 0; gap: .3rem; }
.dnd-hpctl input { width: 80px; min-height: 32px; }
.dnd-hpctl .icon-btn { min-height: 32px; }
.dnd-death { display: inline-flex; align-items: center; gap: .2rem; }
.dnd-death input { margin: 0; }
.dnd-death .dnd-fail { accent-color: var(--danger); }
.dnd-row { display: flex; align-items: center; gap: .4rem; padding: .1rem 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.dnd-row.has .tor-sname { font-weight: 600; }
.dnd-abshort { width: 2.4em; font-size: .7rem; }
.dnd-bonus { min-height: 26px; min-width: 44px; padding: .05rem .4rem; font-weight: 700; border-radius: 8px; }
.dnd-saves { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.dnd-skills { grid-row: span 2; }
.dnd-tabs { gap: .3rem; margin-bottom: .7rem; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.dnd-tabs .chip { white-space: nowrap; }
.dnd-attacks td { vertical-align: middle; }
.dnd-own input, .dnd-own select { min-height: 32px; }
.dnd-slots { display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.dnd-slots > div { display: flex; flex-direction: column; gap: .1rem; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); }
.dnd-slots span:first-child { font-size: .75rem; color: var(--muted); }
.dnd-slots input { margin: 0 .1rem; width: 16px; height: 16px; }
.dnd-spell input { min-height: 32px; }
.dnd-inv input, .dnd-inv select { min-height: 30px; }
.dnd-inv tr.has td:nth-child(2) input { font-weight: 600; }
.dnd-coins { gap: .4rem; }
.dnd-coins .field { width: 110px; }
.dnd-feature { padding: .3rem 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.dnd-result { font-family: var(--serif); font-size: 2rem; font-weight: 700; color: var(--accent); align-self: center; margin-left: .3rem; }
@media (max-width: 720px) {
  .dnd-abs { grid-template-columns: repeat(3, 1fr); row-gap: 1rem; }
  .dnd-stats { grid-template-columns: repeat(2, 1fr); }
  .dnd-skills { grid-row: auto; }
}
@media print {
  .dnd-print .dndp-abs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2mm; margin: 2mm 0 3mm; }
  .dnd-print .dndp-abs div { border: .4mm solid #222; border-radius: 2mm; text-align: center; padding: 1mm; }
  .dnd-print .dndp-abs span { display: block; font-size: 6.5pt; text-transform: uppercase; letter-spacing: .05em; }
  .dnd-print .dndp-abs b { display: block; font-size: 14pt; }
  .dnd-print .dndp-abs small { font-size: 8pt; }
}
.dnd .wg-counters > div { gap: .4rem; min-width: 0; }
.dnd .wg-counters select { max-width: 150px; min-width: 0; }
.dnd-grid > .card { min-width: 0; }
.dnd .wg-chosen .wg-xs { width: 64px; min-height: 32px; }
.session-active { border-left: 4px solid var(--accent); }
.session-entry .md p:first-child { margin-top: 0; }
.gm-notes { background: var(--bg2); border: 1px dashed var(--line); border-radius: 8px; padding: .4rem .7rem; }
.gm-notes summary { cursor: pointer; font-size: .9rem; color: var(--muted); }

/* ---------- Reisen ---------- */
.journey-row { display: flex; align-items: center; gap: .6rem; padding: .55rem .4rem; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); cursor: pointer; flex-wrap: wrap; }
.journey-row:hover { background: var(--bg2); }
.journey-map input { min-height: 34px; }
.err-text { color: var(--danger); }
.journey-head { gap: .6rem; margin-bottom: .6rem; flex-wrap: wrap; }
.journey-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: .8rem; align-items: start; }
.journey-mapbox { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.journey-tools { gap: .3rem; }
.journey-tools .icon-btn { min-height: 34px; }
.journey-view { position: relative; height: min(70vh, 720px); overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); touch-action: none; user-select: none; cursor: grab; }
.journey-view.tool-draw { cursor: crosshair; }
.journey-view.tool-calib { cursor: copy; }
.journey-layer { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.journey-layer img { width: 100%; height: 100%; display: block; pointer-events: none; }
.journey-layer svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.journey-layer .seg { fill: none; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; filter: drop-shadow(0 0 1.5px #fff); }
.journey-layer .seg.hard { stroke-dasharray: 12 8; }
.journey-layer .seg.road { stroke-width: 9; }
.journey-layer .seg.sel { stroke-width: 10; filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 2px #000); }
.journey-layer .seg.drawing { opacity: .8; }
.journey-layer .pin { stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.journey-layer .pin.start { fill: #2e9d4b; } .journey-layer .pin.end { fill: #d0453b; }
.journey-layer .pin.company { fill: #f2c230; stroke: #000; } .journey-layer .pin.calib { fill: #fff; stroke: #000; }
.journey-legend { gap: .7rem; color: var(--muted); }
.journey-legend i { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: .25rem; }
.journey-legend i.hard { background: repeating-linear-gradient(90deg, var(--muted) 0 5px, transparent 5px 8px); }
.journey-legend i.road { height: 6px; background: var(--muted); }
.journey-seg { background: var(--card2); box-shadow: none; }
.journey-hero { padding: .35rem 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.journey-hero .chip { font-size: .8rem; padding: .15rem .55rem; }
.journey-event { padding: .5rem .7rem; border-left: 4px solid var(--accent); background: var(--card2); border-radius: 8px; }
.journey-fatigue { display: flex; flex-direction: column; gap: .1rem; color: var(--muted); }
.journey-manual { background: var(--bg2); padding: .3rem .5rem; border-radius: 8px; }
.journey-req { padding: .4rem 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.journey-log { padding: .25rem 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 40%, transparent); }
.journey-in-session { background: var(--card2); box-shadow: none; }
@media (max-width: 900px) {
  .journey-grid { grid-template-columns: 1fr; }
  .journey-view { height: 60vh; }
}
.nowrap { flex-wrap: nowrap !important; }
.map-gm-pair { background: var(--card2); box-shadow: none; }
.char-meta { margin-bottom: .8rem; gap: .5rem; padding: .55rem .8rem; flex-wrap: wrap; }
.char-meta.dead { background: var(--bg2); border-color: var(--line); }
.char-meta.dead ~ * { filter: grayscale(.6); }
.dead-row td { color: var(--muted); }

/* ============ Startseite als Mediathek (1.6) ============ */
main.wide { max-width: none; padding: 0 0 4rem; }
.home { --gut: clamp(16px, 4vw, 56px); }
.topbar { transition: background .25s, border-color .25s; }
.topbar.over { background: linear-gradient(color-mix(in srgb, var(--bg) 70%, transparent), transparent); border-bottom-color: transparent; background-clip: padding-box; backdrop-filter: none; }

.hero { position: relative; min-height: min(76vh, 660px); display: flex; align-items: flex-end; overflow: hidden; margin-top: -58px; }
.hero-bg { position: absolute; inset: -20px; background-size: cover; background-position: center 20%; filter: blur(3px) saturate(1.1); }
.hero-bg::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 88%, transparent) 34%, color-mix(in srgb, var(--bg) 45%, transparent) 64%, color-mix(in srgb, var(--bg) 20%, transparent) 100%),
              linear-gradient(0deg, var(--bg) 0%, transparent 45%); }
.hero-art { position: absolute; right: var(--gut); bottom: 56px; width: min(24vw, 290px); aspect-ratio: 2 / 3; border-radius: 10px;
  background-size: cover; background-position: center; box-shadow: 0 30px 60px rgba(0,0,0,.55); transform: rotate(2deg); }
.hero-inner { position: relative; padding: 110px var(--gut) 48px; max-width: 780px; }
.hero-empty { min-height: 340px; }
.kicker { display: inline-flex; flex-wrap: wrap; gap: .45rem; align-items: center; font-size: .8rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #e5484d; box-shadow: 0 0 0 4px rgba(229,72,77,.25); }
.hero h1 { font-size: clamp(2.1rem, 5.6vw, 4.2rem); line-height: 1.04; margin: .7rem 0 .8rem; letter-spacing: -.01em; }
.hero-meta { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; color: var(--muted); }
.hero-meta b { color: var(--text); font-weight: 600; }
.hero-desc { color: var(--muted); max-width: 620px; line-height: 1.5; }
.lastlog { display: block; margin-top: 1.2rem; padding: .85rem 1rem; border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--text) 7%, transparent); max-width: 620px; color: var(--text); text-decoration: none; }
.lastlog:hover { background: color-mix(in srgb, var(--text) 11%, transparent); }
.lastlog .d { font-size: .8rem; font-weight: 700; color: var(--accent); }
.lastlog .t { font-weight: 700; margin: .2rem 0; }
.lastlog p { margin: 0; color: var(--muted); line-height: 1.45; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }
.hero-actions .btn, .hero-actions button { border-radius: 999px; padding: .6rem 1.3rem; font-weight: 700; }
.btn.glass { background: color-mix(in srgb, var(--text) 13%, transparent); border-color: transparent; backdrop-filter: blur(6px); }
.party { display: flex; align-items: center; gap: .75rem; margin-top: 1.3rem; color: var(--muted); font-size: .9rem; }
.party .faces { display: flex; }
.party .faces span { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--bg); margin-left: -8px; color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.party .faces span:first-child { margin-left: 0; }

.shelf-row { padding: 1.4rem 0 .2rem; }
.rowhead { display: flex; align-items: baseline; gap: .8rem; padding: 0 var(--gut); margin-bottom: .6rem; flex-wrap: wrap; }
.rowhead h2 { font-family: var(--font); font-weight: 700; font-size: clamp(1.15rem, 2vw, 1.45rem); margin: 0; letter-spacing: -.01em; }
.rowhead h2 a { color: var(--text); text-decoration: none; }
.rowhead .sub { color: var(--muted); font-size: .9rem; }
.rowhead .more { margin-left: auto; font-size: .9rem; font-weight: 600; color: var(--accent); white-space: nowrap; text-decoration: none;
  background: none; border: 0; padding: 0; min-height: 0; }
.rowhead .tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .15rem .5rem;
  border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.shelf { position: relative; }
.track { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px var(--gut) 16px;
  scroll-padding: 0 var(--gut); scrollbar-width: none; }
.track::-webkit-scrollbar { display: none; }
.shelf-arrow { position: absolute; top: 6px; bottom: 16px; z-index: 2; width: calc(var(--gut) - 4px); min-width: 36px; padding: 0;
  border: 0; border-radius: 0; background: color-mix(in srgb, var(--bg) 80%, transparent); font-size: 1.8rem; opacity: 0; transition: opacity .2s; }
.shelf:hover .shelf-arrow { opacity: 1; }
.shelf-arrow.l { left: 0; } .shelf-arrow.r { right: 0; }
@media (hover: none) { .shelf-arrow { display: none; } }

.camp-tile { flex: 0 0 clamp(250px, 30vw, 390px); scroll-snap-align: start; aspect-ratio: 16 / 9; position: relative; overflow: hidden;
  border-radius: 12px; border: 0; padding: 0; text-align: left; background: var(--card2); color: #fff; min-height: 0; display: block; }
.camp-tile .img { position: absolute; inset: 0; background-size: cover; background-position: center 25%; transition: transform .35s;
  background-color: var(--sys); }
.camp-tile:hover .img { transform: scale(1.05); }
.camp-tile .shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.88) 8%, rgba(0,0,0,0) 70%); }
.camp-tile .txt { position: absolute; left: 14px; right: 14px; bottom: 12px; }
.camp-tile .sys { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: color-mix(in srgb, var(--sys) 55%, #fff); }
.camp-tile .name { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; margin: .1rem 0 .2rem; line-height: 1.15; }
.camp-tile .when { font-size: .82rem; color: #ddd; }
.camp-tile.cur { box-shadow: 0 0 0 3px var(--accent); }
.camp-tile.archived { filter: grayscale(.7); opacity: .8; }
.camp-tile.new { display: grid; place-items: center; background: transparent; border: 2px dashed var(--line); color: var(--muted); font-weight: 700; }
.tile-badge { position: absolute; top: 10px; left: 10px; font-size: .68rem; font-weight: 800; padding: .2rem .5rem; border-radius: 6px;
  background: rgba(0,0,0,.65); text-transform: uppercase; letter-spacing: .05em; }
.tile-badge.live { background: #e5484d; }

.book-tile { flex: 0 0 clamp(124px, 13vw, 168px); scroll-snap-align: start; background: none; border: 0; padding: 0; text-align: left;
  display: block; min-height: 0; color: var(--text); text-decoration: none; }
.book-tile .cv { aspect-ratio: 2 / 3; border-radius: 8px; overflow: hidden; position: relative; background: var(--card2);
  box-shadow: 0 8px 20px rgba(0,0,0,.35); transition: transform .25s, box-shadow .25s; }
.book-tile:hover .cv, .book-tile:focus-visible .cv { transform: translateY(-4px) scale(1.03); box-shadow: 0 16px 30px rgba(0,0,0,.5); }
.book-tile img, .book-detail img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.cv .ph { position: absolute; inset: 0; padding: 14px 12px; display: flex; flex-direction: column; justify-content: space-between;
  font-family: var(--serif); font-weight: 700; font-size: .95rem; line-height: 1.2; color: #fff;
  background: linear-gradient(160deg, var(--sys, var(--accent)), #1a140e 85%); }
.cv .ph small { font-family: var(--font); font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.book-tile .cat { position: absolute; z-index: 2; left: 6px; top: 6px; font-size: .62rem; font-weight: 700; padding: .15rem .4rem;
  border-radius: 4px; background: rgba(0,0,0,.7); color: #fff; }
.book-tile .cat.Abenteuer { background: #7a2e2e; }
.book-tile .cover-title { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 1.4rem .6rem .5rem; color: #fff;
  font-family: var(--serif); font-weight: 700; font-size: .9rem; background: linear-gradient(0deg, rgba(0,0,0,.85), transparent); }
.book-tile .t { font-size: .82rem; font-weight: 600; margin-top: .5rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.book-tile .prog { height: 3px; background: color-mix(in srgb, var(--text) 18%, transparent); border-radius: 2px; margin-top: .35rem; }
.book-tile .prog i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.book-tile.locked .cv { filter: grayscale(.8) brightness(.7); }
.empty-tile .ph { font-family: var(--font); font-size: .85rem; justify-content: center; text-align: center; background: transparent;
  border: 2px dashed var(--line); border-radius: 8px; color: var(--muted); }

.lib-head { padding: 2rem var(--gut) .2rem; border-top: 1px solid var(--line); margin-top: 1.2rem; }
.lib-head h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); margin: 0 0 .2rem; }
.lib-head p { margin: 0 0 1rem; }
.lib-head .chips { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.lib-head .chip { font-weight: 600; }
.lib-head .chip .n { opacity: .6; font-weight: 500; margin-left: .3rem; }
.chip-sep { width: 1px; height: 22px; background: var(--line); margin: 0 .3rem; }
.lib-search { flex: 1 1 200px; max-width: 300px; margin-left: auto; border-radius: 999px; }

.book-detail { max-width: 700px; display: grid; grid-template-columns: 210px 1fr; gap: 1.4rem; position: relative; }
.book-detail .cv { aspect-ratio: 2 / 3; border-radius: 8px; overflow: hidden; position: relative; }
.book-detail h2 { margin: .4rem 0 .5rem; }
.book-detail .close { position: absolute; top: .4rem; right: .4rem; }

@media (max-width: 820px) {
  .hero-art { display: none; }
  .hero-inner { padding-top: 200px; }
  .hero-bg { filter: none; background-position: center 15%; }
  .hero-bg::after { background: linear-gradient(0deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 88%, transparent) 50%, color-mix(in srgb, var(--bg) 6%, transparent) 88%); }
  .lib-search { max-width: none; margin-left: 0; }
  .chip-sep { display: none; }
}
@media (max-width: 560px) { .book-detail { grid-template-columns: 1fr; } .book-detail .cv { max-width: 150px; } }

/* Logo: W20 in der Akzentfarbe (Testinstanz blau) */
.logo { width: 1.55em; height: 1.55em; vertical-align: -.38em; color: var(--accent); flex-shrink: 0; }
.brand { display: inline-flex; align-items: center; gap: .4rem; }
.brand .logo { vertical-align: 0; }
.brand-title .logo { width: 1.3em; height: 1.3em; vertical-align: -.25em; }

/* Charakter-Übersicht (1.6) */
.chars-page { max-width: 1200px; }
.chars-page .chips { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.chars-page .chip .n { opacity: .6; margin-left: .3rem; }
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.char-tile { display: block; padding: 0; border: 0; background: none; text-align: left; color: var(--text); min-height: 0; }
.char-tile .pic { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 20px rgba(0,0,0,.3);
  background: linear-gradient(160deg, var(--sys, var(--accent)), #1a140e 90%); transition: transform .25s, box-shadow .25s; }
.char-tile:hover .pic, .char-tile:focus-visible .pic { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(0,0,0,.45); }
.char-tile .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.char-tile .initial { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 4rem;
  font-weight: 700; color: rgba(255,255,255,.85); }
.char-tile .tile-badge { z-index: 2; color: #fff; text-transform: none; letter-spacing: 0; }
.char-tile .tile-badge.vis { left: auto; right: 8px; top: auto; bottom: 8px; }
.char-tile .info { padding: .5rem .1rem 0; }
.char-tile .name { font-weight: 700; font-size: 1rem; }
.char-tile .camp { color: var(--accent); margin-top: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-tile.dead .pic { filter: grayscale(1) brightness(.75); }
.char-tile.dead .name { color: var(--muted); }
/* Kacheln sind Buttons: Inhalt oben ausrichten statt senkrecht zu zentrieren */
.book-tile, .char-tile { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 0; }

/* App und Offline-Lesen (1.7) */
.offline-bar { position: sticky; top: 54px; z-index: 19; background: #6b4f1d; color: #fff; text-align: center; font-size: .85rem; padding: .35rem 1rem; }
.offline-job { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 70; width: min(560px, calc(100vw - 32px));
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .5rem .8rem .7rem; }
.offline-job .row { flex-wrap: nowrap; } .offline-job .row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.offline-dot { position: absolute; z-index: 2; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: .75rem; font-weight: 700; background: var(--ok); color: #10200a; }
.book-tile.unavail .cv { filter: grayscale(1) brightness(.55); }
button.offline-on { color: var(--ok); border-color: var(--ok); }
