/* Chroniken der Runde – dunkles Lederbraun, Pergament, Siegelrot und Messing */
:root {
  --bg: #16120f;
  --bg-2: #201a15;
  --panel: #2a221b;
  --panel-2: #33291f;
  --line: #4a3c2e;
  --text: #ece2cf;
  --muted: #a8977c;
  --brass: #c9a24a;
  --brass-dim: #8c7133;
  --blood: #a8322a;
  --blood-light: #d0544a;
  --green: #7f9a5a;
  --parchment: #efe3c8;
  --ink: #2b2118;
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--sans);
  background-image: radial-gradient(ellipse at top, #2a1f17 0%, var(--bg) 60%);
  background-attachment: fixed; min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--brass); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; color: var(--brass); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }

/* ---------- Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top));
  background: rgba(22, 18, 15, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; color: var(--parchment); text-decoration: none; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.brand svg { width: 26px; height: 26px; color: var(--brass); }
.nav { display: flex; gap: .25rem; margin-left: auto; overflow-x: auto; }
.nav a { color: var(--muted); text-decoration: none; padding: .4rem .7rem; border-radius: 999px; white-space: nowrap; font-size: .95rem; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--bg); background: var(--brass); }
@media (max-width: 560px) {
  .brand span { display: none; }
  .nav { margin-left: 0; flex: 1; justify-content: space-between; }
  .nav a { padding: .4rem .55rem; font-size: .9rem; }
}

.app { max-width: 1120px; margin: 0 auto; padding: 1.2rem 1rem 6rem; }

/* ---------- Bausteine */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  font: inherit; font-size: .95rem; padding: .55rem 1rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); text-decoration: none;
  min-height: 40px;
}
.btn:hover { border-color: var(--brass-dim); }
.btn.primary { background: var(--blood); border-color: var(--blood); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--blood-light); }
.btn.ghost { background: transparent; }
.btn.small { padding: .25rem .6rem; min-height: 32px; font-size: .85rem; }
.btn.danger { color: var(--blood-light); }
.btn[disabled] { opacity: .5; cursor: default; }
.iconbtn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: .3rem; border-radius: 6px; font-size: 1rem; line-height: 1; min-width: 32px; min-height: 32px; }
.iconbtn:hover { color: var(--text); background: var(--panel-2); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: .75rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.spacer { flex: 1; }

label.field { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 1rem; color: var(--text); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 7px; padding: .5rem .6rem; width: 100%; min-height: 40px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brass-dim); outline-offset: 0; border-color: var(--brass-dim); }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input[type=number] { text-align: center; -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { opacity: .4; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--blood); }
input:read-only, textarea:read-only, select:disabled { background: transparent; border-color: transparent; color: var(--text); opacity: 1; }
.readonly-text { white-space: pre-wrap; padding: .5rem 0; }
.readonly-text:empty::before { content: '—'; color: var(--muted); }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.badge.malus { color: var(--blood-light); border-color: #5a2a24; }
.badge.bonus { color: var(--green); border-color: #3d4a2c; }
.badge.gold { color: var(--brass); border-color: var(--brass-dim); }

/* ---------- Anmeldung */
.auth { max-width: 420px; margin: 2rem auto; }
.auth .tabs { margin-bottom: 1rem; }
.auth form { display: grid; gap: .8rem; }
.error { color: var(--blood-light); font-size: .9rem; min-height: 1.2em; }

/* ---------- Charakterliste */
.list-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.list-head h1 { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.card {
  display: block; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--brass-dim); }
.card .portrait { aspect-ratio: 4 / 3; background: var(--bg-2) center/cover no-repeat; display: grid; place-items: center; color: var(--line); }
.card .portrait svg { width: 56px; height: 56px; }
.card .body { padding: .75rem .9rem .9rem; }
.card h3 { margin: 0 0 .15rem; font-size: 1.15rem; }
.card.retired { opacity: .55; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- Charakterbogen */
.sheet-head { display: grid; grid-template-columns: 140px 1fr; gap: 1.2rem; align-items: start; margin-bottom: 1rem; }
.sheet-head .portrait { width: 140px; aspect-ratio: 3 / 4; border-radius: var(--radius); background: var(--bg-2) center/cover no-repeat; border: 2px solid var(--brass-dim); display: grid; place-items: center; color: var(--line); }
.sheet-head .portrait svg { width: 48px; }
.sheet-head h1 { margin-bottom: .2rem; }
.sheet-head .sub { color: var(--muted); }
@media (max-width: 560px) {
  .sheet-head { grid-template-columns: 88px 1fr; gap: .9rem; }
  .sheet-head .portrait { width: 88px; }
  h1 { font-size: 1.45rem; }
}

.tabs { display: flex; gap: .3rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 1rem; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: .95rem; padding: .6rem .8rem; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button.active { color: var(--brass); border-bottom-color: var(--brass); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem;
  text-align: left; color: var(--text); font: inherit; cursor: pointer; position: relative;
}
.stat:hover { border-color: var(--brass-dim); }
.stat .label { font-size: .8rem; color: var(--muted); }
.stat .value { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; line-height: 1.15; }
.stat .value small { font-size: .9rem; color: var(--muted); font-family: var(--sans); font-weight: 400; }
.stat .hint { position: absolute; top: .5rem; right: .6rem; color: var(--brass-dim); font-size: .8rem; }

.attr-strip { display: grid; grid-template-columns: repeat(10, 1fr); gap: .4rem; }
@media (max-width: 720px) { .attr-strip { grid-template-columns: repeat(5, 1fr); } }
.attr {
  background: var(--parchment); color: var(--ink); border-radius: 8px; padding: .45rem .2rem .35rem; text-align: center;
  border: 0; font: inherit; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.attr .k { font-size: .75rem; font-weight: 700; letter-spacing: .05em; color: #6b5233; }
.attr .v { font-family: var(--serif); font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.attr .b { font-size: .72rem; color: #6b5233; }
.attr.modded .v { color: var(--blood); }

/* Tabellen */
.table-wrap { overflow-x: auto; margin: 0 -.2rem; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: .45rem .4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: center; }
td.total { font-family: var(--serif); font-size: 1.2rem; font-weight: 700; text-align: center; color: var(--parchment); }
td.total.modded { color: var(--blood-light); }
td input[type=number] { width: 64px; padding: .35rem .2rem; min-height: 36px; }
td input[type=text], td select { min-height: 36px; padding: .35rem .5rem; }
tr.unusable td { opacity: .5; }
.stepper { display: inline-flex; align-items: center; gap: .15rem; }
.stepper button { width: 30px; height: 36px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 1.1rem; }

/* Responsive Attributtabelle: auf schmalen Bildschirmen als Karten */
@media (max-width: 720px) {
  table.cardtable thead { display: none; }
  table.cardtable, table.cardtable tbody, table.cardtable tr, table.cardtable td { display: block; width: 100%; }
  table.cardtable tr { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; margin-bottom: .6rem; display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .8rem; }
  table.cardtable td { border: 0; padding: .2rem 0; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
  table.cardtable td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; }
  table.cardtable td.full { grid-column: 1 / -1; }
  table.cardtable td.full::before { content: none; }
  table.cardtable td.total { justify-content: space-between; }
}

.mods .mod { display: grid; grid-template-columns: auto 120px 1fr 170px 80px auto; gap: .5rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.mods .mod .note { grid-column: 2 / -1; }
.mods .mod.inactive { opacity: .5; }
@media (max-width: 760px) {
  .mods .mod { grid-template-columns: auto 1fr 1fr auto; }
  .mods .mod .lbl { grid-column: 2 / -1; order: -1; }
  .mods .mod .note { grid-column: 1 / -1; }
}

.conditions { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.cond { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); }
.cond.on { border-color: #6a2b24; background: #2e1a16; }
.cond .name { flex: 1; cursor: help; }
.cond .count { min-width: 1.4em; text-align: center; font-weight: 700; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; }
.gallery figure { margin: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.gallery figure.is-portrait { border-color: var(--brass); }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; cursor: zoom-in; }
.gallery figcaption { padding: .45rem; display: grid; gap: .35rem; font-size: .9rem; }

.talent { display: grid; grid-template-columns: 1fr 80px auto; gap: .5rem; align-items: start; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.talent textarea { grid-column: 1 / -1; min-height: 60px; }

/* Speicherleiste */
.savebar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem .55rem 1rem; border-radius: 999px;
  background: #1d1712; border: 1px solid var(--brass-dim); box-shadow: var(--shadow); max-width: calc(100% - 1.5rem);
}
.savebar[hidden] { display: none; }
#savebar-text { font-size: .9rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Dialog */
.modal { border: 1px solid var(--brass-dim); border-radius: 14px; background: var(--panel); color: var(--text); padding: 0; width: min(560px, calc(100% - 1.5rem)); max-height: 85vh; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(0,0,0,.6); }
.modal .inner { padding: 1.2rem 1.3rem; }
.modal .formula { background: var(--bg-2); border-left: 3px solid var(--brass); padding: .6rem .8rem; border-radius: 0 6px 6px 0; font-size: .92rem; margin-bottom: .9rem; }
.breakdown { width: 100%; margin: .4rem 0 1rem; }
.breakdown td { border-bottom: 1px dashed var(--line); }
.breakdown td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.breakdown tr.sum td { border-bottom: 0; border-top: 2px solid var(--brass-dim); font-family: var(--serif); font-size: 1.15rem; color: var(--brass); }
.breakdown tr.mod td:first-child { color: var(--blood-light); }
.modal img.full { width: 100%; display: block; }

.toast { position: fixed; top: 4.5rem; left: 50%; transform: translateX(-50%) translateY(-10px); background: var(--parchment); color: var(--ink); padding: .55rem 1rem; border-radius: 8px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s; z-index: 50; font-weight: 600; max-width: calc(100% - 2rem); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--blood); color: #fff; }

/* Regeln & Kampagne */
.rule { border-left: 3px solid var(--brass-dim); padding-left: 1rem; margin-bottom: 1.4rem; }
.rule .formula { font-family: var(--serif); color: var(--parchment); background: var(--bg-2); padding: .5rem .7rem; border-radius: 6px; margin: .4rem 0 .6rem; }
.toc { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.entry { border-bottom: 1px solid var(--line); padding: 1rem 0; }
.entry:last-child { border-bottom: 0; }
.entry .meta { color: var(--muted); font-size: .85rem; margin-bottom: .4rem; }
.entry .text { white-space: pre-wrap; }
.footer-note { color: var(--muted); font-size: .8rem; text-align: center; margin-top: 2rem; }
.stepper input[type=number] { width: 64px; min-height: 36px; padding: .35rem .2rem; }
.stepper input[type=number]::-webkit-inner-spin-button, .stepper input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stat .label { padding-right: 1rem; }
@media (max-width: 720px) {
  table.cardtable tr { grid-template-columns: repeat(3, 1fr); gap: .3rem .6rem; }
  table.cardtable td { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: .15rem; }
  table.cardtable td.full { flex-direction: row; align-items: center; }
  table.cardtable td.total { justify-content: flex-start; font-size: 1.35rem; }
  table.cardtable td .row { flex-wrap: nowrap; }
  table.cardtable td input[type=number] { width: 56px; }
}
.ingame .row.between { flex-wrap: nowrap; }
.ingame .row.between > span:first-child { flex: 1; min-width: 0; }
@media (max-width: 720px) {
  table.cardtable td, table.cardtable td.num { text-align: left; white-space: nowrap; }
  table.cardtable td::before { font-family: var(--sans); font-weight: 400; font-size: .78rem; color: var(--muted); white-space: nowrap; }
  table.cardtable td.num:last-child:not([data-label]) { flex-direction: row; justify-content: flex-end; align-items: center; }
}

/* Verderbnis-Warnung */
.corr-banner { display: flex; gap: .8rem; align-items: center; padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; cursor: pointer; border: 1px solid; }
.corr-banner .icon { font-size: 1.6rem; line-height: 1; }
.corr-banner.corr-nah { background: #2e2715; border-color: #6b5520; color: #e8c86a; }
.corr-banner.corr-grenze { background: #35180f; border-color: #8a3a1e; color: #f0a070; }
.corr-banner.corr-ueber { background: linear-gradient(90deg, #3d0d10, #2a0a1e); border-color: #c0303a; color: #ffd6d6; animation: corr-pulse 2.2s ease-in-out infinite; }
.corr-banner.corr-ueber .icon { color: #ff6b6b; }
@keyframes corr-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(192, 48, 58, .0); } 50% { box-shadow: 0 0 18px 2px rgba(192, 48, 58, .55); } }
.stat.corr-nah { border-color: #6b5520; }
.stat.corr-grenze { border-color: #8a3a1e; background: #2f1a12; }
.stat.corr-ueber { border-color: #c0303a; background: #3a1014; animation: corr-pulse 2.2s ease-in-out infinite; }
.stat.corr-ueber .value, .stat.corr-grenze .value { color: #ff8a80; }
.card.card-corr { border-color: #c0303a; box-shadow: 0 0 14px rgba(192, 48, 58, .35); }
@media (prefers-reduced-motion: reduce) { .corr-banner.corr-ueber, .stat.corr-ueber { animation: none; } }

/* Spielleitung */
.tabs a.tablink { color: var(--muted); text-decoration: none; padding: .6rem .8rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.tablink.active { color: var(--brass); border-bottom-color: var(--brass); }
.gm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.gm-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; display: grid; gap: .45rem; align-content: start; }
.gm-card header { display: grid; grid-template-columns: 48px 1fr auto; gap: .7rem; align-items: center; margin-bottom: .3rem; }
.gm-portrait { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-2) center/cover no-repeat; border: 2px solid var(--brass-dim); display: grid; place-items: center; color: var(--line); }
.gm-portrait svg { width: 26px; }
.gm-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--parchment); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-init { font-family: var(--serif); font-weight: 700; color: var(--brass); background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: .2rem .5rem; }
.gm-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .15rem 0; }
.gm-val { min-width: 4.2rem; text-align: center; font-family: var(--serif); font-size: 1.2rem; }
.gm-val small { font-family: var(--sans); font-size: .8rem; color: var(--muted); font-weight: 400; }
.gm-row.gm-low .gm-val { color: #f0a070; }
.gm-row.gm-crit .gm-val { color: var(--blood-light); }
.gm-row.gm-corr-grenze .gm-val { color: #f0a070; }
.gm-row.gm-corr-ueber { background: #3a1014; border-radius: 6px; padding-left: .4rem; }
.gm-row.gm-corr-ueber .gm-val { color: #ff8a80; }
.gm-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin: .2rem 0; }
.gm-card details summary { cursor: pointer; color: var(--muted); padding: .2rem 0; }
.gm-card textarea { min-height: 70px; margin-top: .3rem; }
.gm-conds { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; margin-top: .4rem; }
.gm-conds .cond { padding: .2rem .4rem; font-size: .88rem; }
.gm-panel { border-color: var(--brass-dim); }
.gm-card { min-width: 0; overflow: hidden; }
.gm-conds { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.gm-conds .cond { min-width: 0; gap: .2rem; }
.gm-conds .cond .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.gm-conds .iconbtn { min-width: 26px; padding: .2rem; }

/* Kampagnen-Umschalter & Import */
.campaign-switch select { min-height: 34px; padding: .25rem 1.8rem .25rem .6rem; font-size: .9rem; background-color: var(--panel); border-color: var(--brass-dim); max-width: 220px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
pre.code { background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: .6rem .8rem; overflow-x: auto; font-size: .82rem; white-space: pre; }
code { font-size: .88em; background: var(--bg-2); padding: .05rem .3rem; border-radius: 4px; }
@media (max-width: 560px) { .campaign-switch { order: 3; width: 100%; } .campaign-switch select { max-width: none; width: 100%; } }
@media (max-width: 560px) {
  .nav { flex-wrap: wrap; justify-content: flex-start; overflow: visible; gap: .2rem; }
  .nav a { padding: .35rem .55rem; font-size: .88rem; }
}

/* Archiv */
.archive-banner { display: flex; gap: .8rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; background: #23242a; border: 1px solid #4a4d5a; color: #d8dbe6; }
.archive-banner .icon { font-size: 1.5rem; line-height: 1; }
.archive-banner a { color: #b8c4ff; }
.is-archived form, .is-archived [data-gm="step"], .is-archived [data-gm="cond"], .is-archived [data-gm="refill"], .is-archived [data-gm="note-edit"], .is-archived [data-gm="note-del"], .is-archived details.panel { display: none !important; }
.is-archived textarea[data-gmnote] { pointer-events: none; opacity: .7; }
label.row { flex-wrap: nowrap; align-items: flex-start; }
label.row > input[type=checkbox] { flex: none; margin-top: .1rem; }

/* Karten */
body.map-mode .app { max-width: none; padding: .6rem .6rem 0; }
.map-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.map-title { font-family: var(--serif); font-size: 1.15rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn { background: var(--panel-2); color: var(--text); border: 0; border-right: 1px solid var(--line); padding: .4rem .7rem; font: inherit; font-size: .9rem; cursor: pointer; min-height: 36px; }
.seg-btn:last-child { border-right: 0; }
.seg-btn.active { background: var(--brass); color: var(--bg); font-weight: 600; }
.map-share { gap: .35rem; }
.map-stage { position: relative; overflow: hidden; height: calc(100dvh - 175px); min-height: 320px; background: #0d0b09; border: 1px solid var(--line); border-radius: var(--radius); touch-action: none; user-select: none; -webkit-user-select: none; }
.map-stage.mode-move { cursor: grab; }
.map-stage.mode-move:active { cursor: grabbing; }
.map-stage.mode-point { cursor: crosshair; }
.map-stage.mode-marker { cursor: crosshair; }
.map-layer { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.map-layer.animate { transition: transform .4s ease; }
.map-layer img { display: block; width: 100%; height: 100%; pointer-events: none; }
.map-overlay { position: absolute; inset: 0; }
.map-marker { position: absolute; transform: translate(-50%, -100%) scale(var(--inv, 1)); transform-origin: 50% 100%; background: none; border: 0; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.map-marker svg { width: 28px; height: 36px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
.map-marker span { position: absolute; top: 100%; white-space: nowrap; background: rgba(22,18,15,.88); color: var(--parchment); font-size: 12px; padding: 1px 6px; border-radius: 4px; margin-top: 2px; }
.map-marker.gm-only svg { opacity: .65; }
.map-marker.gm-only span::before { content: '🔒 '; }
.gm-pointer { position: absolute; transform: scale(var(--inv, 1)); transform-origin: 0 0; pointer-events: none; transition: left .08s linear, top .08s linear; z-index: 5; }
.gm-pointer svg { width: 30px; height: 30px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.7)); }
.gm-pointer span { position: absolute; left: 24px; top: 22px; background: #d0544a; color: #fff; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.map-ping { position: absolute; transform: translate(-50%, -50%) scale(var(--inv, 1)); pointer-events: none; z-index: 4; }
.map-ping .ring { position: absolute; left: -30px; top: -30px; width: 60px; height: 60px; border-radius: 50%; border: 4px solid #ffcf5a; animation: ping 1.3s ease-out 2; }
.map-ping .ring.r2 { animation-delay: .35s; }
.map-ping b { position: absolute; top: 34px; left: 0; transform: translateX(-50%); color: #ffcf5a; font-size: 12px; text-shadow: 0 1px 3px #000; white-space: nowrap; }
@keyframes ping { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.map-msg { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.6); z-index: 10; }
.map-hint { margin: .4rem .2rem; }
.map-card .portrait { display: block; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: inline-block; width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 3px solid transparent; cursor: pointer; }
.swatch input:checked + span { border-color: var(--text); }
.swatch input:focus-visible + span { outline: 2px solid var(--brass); }
@media (max-width: 560px) { .map-stage { height: calc(100dvh - 235px); } .map-title { width: 100%; order: -1; } }
[hidden] { display: none !important; }

/* Geheimnisse */
.lock-toggle { display: inline-flex; gap: .3rem; align-items: center; font-size: .8rem; color: var(--muted); white-space: nowrap; cursor: pointer; }
.lock-toggle input { width: 16px; height: 16px; }
.field.is-secret textarea { border-color: #4b3f6b; background: #1d1824; }
.field.is-secret .lock-toggle { color: #c5b3ff; }
.badge.secret { color: #c5b3ff; border-color: #4b3f6b; }
.secret-hidden { padding: .55rem .7rem; border: 1px dashed #4b3f6b; border-radius: 7px; color: #a99bd0; font-size: .9rem; }
.secret-panel { border-color: #4b3f6b; }

/* Geldbörse */
.purse-total { font-family: var(--serif); font-size: 1.8rem; font-weight: 700; color: var(--brass); }
.money-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.coins { display: flex; gap: .4rem; }
.field.coin { width: 78px; }
.field.coin input { text-align: center; }
.seg label.seg-btn { display: inline-flex; align-items: center; cursor: pointer; }
.seg label.seg-btn:has(input:checked) { background: var(--brass); color: var(--bg); font-weight: 600; }
.field.coin input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Statistik */
.stats-wide { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stat-static { cursor: default; }
.stat-static .value small { font-size: .85rem; }
.records { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .7rem; }
.record { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); color: var(--text); text-decoration: none; }
.record:hover { border-color: var(--brass-dim); }
.record .ricon { font-size: 1.5rem; line-height: 1.2; }
.bars { display: grid; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 180px) 1fr auto; gap: .7rem; align-items: center; }
.bar-name { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--bg-2); border-radius: 4px; height: 14px; overflow: hidden; }
.bar { height: 100%; background: var(--brass); border-radius: 4px; }
.bar.bar-corr { background: var(--blood-light); }
.bar-val { font-variant-numeric: tabular-nums; font-size: .9rem; white-space: nowrap; }
.stat-table td a { color: var(--parchment); text-decoration: none; }
.retired-row td { opacity: .6; }
.corr-txt-ueber { color: #ff8a80; font-weight: 700; }
.corr-txt-grenze { color: #f0a070; font-weight: 600; }
@media (max-width: 560px) { .bar-row { grid-template-columns: 90px 1fr; } .bar-val { grid-column: 2; font-size: .8rem; margin-top: -.3rem; } }
@media (max-width: 560px) { .stats-wide { grid-template-columns: 1fr 1fr; gap: .5rem; } .stats-wide .stat .value { font-size: 1.35rem; } .stats-wide .stat { padding: .6rem; } }

/* Druckansicht */
body.print-mode { background: #5a5048; }
body.print-mode .app { max-width: 210mm; }
.print-tools { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.print-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .3rem .8rem; margin: .8rem 0; }
@media print {
  body, body.print-mode { background: #fff !important; padding: 0; }
  .topbar, .savebar, .toast, .no-print, .modal { display: none !important; }
  .app, body.print-mode .app { padding: 0 !important; max-width: none !important; }
}
@media screen and (max-width: 720px) { #print-area { overflow-x: auto; } #print-area .ps { min-width: 680px; } }

/* PDF-Import */
.pdf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .7rem; margin-top: .6rem; }
.pdf-page { display: grid; gap: .35rem; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); font-size: .85rem; }
.pdf-page canvas { width: 100%; height: auto; background: #fff; border-radius: 4px; min-height: 80px; }
.pdf-page input[type=text] { min-height: 34px; padding: .3rem .5rem; font-size: .85rem; }

/* Admin */
.admin-users { display: grid; gap: .7rem; }
.admin-user { border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; background: var(--bg-2); }
.admin-user.me { border-color: var(--brass-dim); }
.au-head { display: flex; justify-content: space-between; gap: .8rem; flex-wrap: wrap; align-items: flex-start; }
.pw-box { font-size: 1.4rem; font-family: ui-monospace, monospace; background: var(--bg-2); padding: .6rem; border-radius: 6px; user-select: all; }

/* Werte-Sperre */
.lock-note { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; padding: .55rem .8rem; margin-bottom: 1rem; border: 1px dashed var(--brass-dim); border-radius: 8px; color: var(--muted); font-size: .9rem; }
.btn.unlocked { border-color: var(--brass); color: var(--brass); }
input[type=number]:read-only::-webkit-inner-spin-button, input[type=number]:read-only::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } input[type=number]:read-only { -moz-appearance: textfield; }

/* Grundwerte */
.base-grant { border: 1px dashed var(--line); border-radius: 8px; padding: .6rem .8rem; margin-bottom: 1rem; }
.base-grant.on { border-color: var(--brass); background: rgba(201, 162, 74, .06); }
.base-mark { color: var(--brass); font-weight: 700; margin-left: 1px; cursor: help; }
input.base-changed { border-color: var(--brass); color: var(--brass); }

/* ---- Ausrüstungstabellen (Waffen, Rüstung, Gegenstände) */
.geartable td input[type=text] { width: 100%; min-width: 0; }
.geartable td input.gname { font-weight: 600; min-width: 150px; }
.geartable td input.gmid { min-width: 105px; }
.geartable td input.gwide { min-width: 170px; }
.geartable td input[type=number] { width: 56px; }
.geartable tr.gempty td { text-align: center; padding: 1rem; }
.gdmg { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.gchk { display: inline-flex; align-items: center; gap: .25rem; cursor: pointer; white-space: nowrap; font-size: .9rem; }
.gchk input { width: 20px; height: 20px; min-height: 0; accent-color: var(--blood-light); }
.gloc .gchk input { width: 22px; height: 22px; }
.loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; }
.loc-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; display: grid; gap: .35rem; min-width: 0; }
.loc-vals { display: flex; justify-content: space-between; font-size: .95rem; }
.loc-vals strong { font-family: var(--serif); font-size: 1.3rem; color: var(--parchment); }
.loc-prot strong { color: var(--gold, #d8b25a); }
.loc-pieces { min-height: 1em; overflow-wrap: anywhere; }
.enc-sum { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-bottom: .6rem; }
.enc-sum strong { font-family: var(--serif); font-size: 1.15rem; }
.enc-total { margin-left: auto; }
.enc-warn { margin: .7rem 0 0; padding: .55rem .8rem; border-radius: var(--radius); border: 1px solid var(--line); }
.enc-warn.enc-l0 { color: var(--muted); }
.enc-warn.enc-l1 { background: #2e2715; border-color: #6b5520; color: #e8c86a; }
.enc-warn.enc-l2 { background: #35180f; border-color: #8a3a1e; color: #f0a070; }
.enc-warn.enc-l3 { background: #3d0d10; border-color: #c0303a; color: #ffd6d6; }
@media (max-width: 720px) {
  table.geartable tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  table.geartable td { min-width: 0; }
  table.geartable td input[type=text], table.geartable td select { width: 100%; }
  table.geartable td { flex-direction: column; align-items: flex-start; gap: .15rem; }
  table.geartable td.gloc { align-items: center; }
  table.geartable td input.gname, table.geartable td input.gmid, table.geartable td input.gwide, table.geartable td select { min-width: 0; }
  table.geartable td:last-child:empty { display: none; }
  table.geartable td:last-child { grid-column: 1 / -1; align-items: flex-end; }
  .enc-total { margin-left: 0; }
}
.gpreset { width: auto; max-width: 190px; min-height: 34px; padding: .3rem .5rem; }
.geartable td select { min-width: 72px; }
.geartable th, .geartable td { padding-left: .3rem; padding-right: .3rem; }
.loc-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); }
.loc-card .stepper input[type=number] { width: 44px; }
@media (min-width: 721px) {
  .geartable td input.gname { min-width: 140px; }
  .geartable td input.gmid { min-width: 90px; }
  .geartable td input.gwide { min-width: 110px; }
}
.loc-card > .row.between { flex-wrap: wrap; gap: 0 .5rem; }
.loc-vals { flex-wrap: wrap; gap: 0 .6rem; }
.loc-card .stepper button { width: 26px; height: 32px; }
.loc-card .stepper input[type=number] { width: 40px; min-height: 32px; }
.loc-dmg { display: flex; align-items: center; justify-content: space-between; gap: .3rem; }
@media (max-width: 720px) { .gdmg input[type=number] { width: 46px; } }
