body {
  font-family: Arial, sans-serif;
  background: #f3f0eb;
  margin: 0;
  padding: 20px;
}

.topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

button {
  padding: 8px 12px;
  cursor: pointer;
}

.player {
  background: white;
  padding: 16px;
  margin-bottom: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.player-header {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card {
  width: 220px;
  box-sizing: border-box;
  background: #d98c3f;
  color: white;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.card h3 {
  margin: 0 0 4px 0;
  font-size: 15px;
}

.card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
}

.card button {
  align-self: flex-start;
  padding: 4px 10px;
}

/* Konflikt: Initiativekarte und Initiativewerte, beide gleich hoch */
.conflict-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 12px;
}

.conflict-card {
  background: #5a7896;
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  width: 420px;
  font-size: 13px;
}

.conflict-card h2 {
  margin: 0 0 8px 0;
  font-size: 19px;
}

.conflict-init {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.conflict-line {
  margin-top: 4px;
}

.initiative-box {
  background: white;
  color: black;
  padding: 10px 14px;
  border-radius: 10px;
  width: 200px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
}

.initiative-box h2 {
  margin: 0;
  font-size: 19px;
}

.initiative-values {
  display: flex;
  justify-content: space-around;
  flex-grow: 1;
  align-items: center;
}

.initiative-values > div {
  text-align: center;
}

.initiative-value {
  font-size: 26px;
  margin: 4px 0;
}

.initiative-values button {
  padding: 2px 10px;
}

#discardPile .card {
  background: #a55f22;
}

/* Reiter */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
}

.tabs button {
  border: 1px solid #d8cfc0;
  border-bottom: none;
  background: #e8e1d5;
  border-radius: 10px 10px 0 0;
  padding: 8px 16px;
  font-size: 15px;
}

.tabs button.on {
  background: white;
  font-weight: bold;
}

.tab-panel {
  background: white;
  border: 1px solid #d8cfc0;
  border-radius: 0 10px 10px 10px;
  padding: 16px;
}

.tab-panel[hidden] {
  display: none;
}

#tabCards {
  background: transparent;
}

/* Whiteboard */
#tabBoard {
  padding: 0;
  overflow: hidden;
}

.wb-wrap { display: flex; flex-direction: column; }
.wb-tools { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px 8px; border-bottom: 1px solid #d8cfc0; background: #faf7f1; }
.wbt { min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid #cfc5b4; background: white; font-size: 15px; padding: 0 6px; }
.wbt.on { background: #5a7896; color: white; border-color: #5a7896; }
.wbt:disabled { opacity: .35; cursor: not-allowed; }
.wbc { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cfc5b4; background: var(--c); padding: 0; }
.wbc.on { outline: 2px solid #5a7896; outline-offset: 1px; }
.wbc.custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); position: relative; overflow: hidden; display: inline-block; cursor: pointer; }
.wbc.custom input { opacity: 0; position: absolute; inset: 0; cursor: pointer; padding: 0; }
.wbw { width: auto; padding: 4px 6px; font-size: 12px; }
.wb-sep { width: 1px; height: 22px; background: #cfc5b4; margin: 0 4px; }
.wb-scroll { overflow: auto; max-height: calc(100vh - 200px); padding: 8px; }
#wb { display: block; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 8px; min-width: 100%; cursor: crosshair; }
#wb[data-tool=select] { cursor: default; }
#wb[data-tool=erase] { cursor: not-allowed; }
.wb-bg { fill: #fbf7ef; }
.wbo .hit { fill: none; stroke: transparent; pointer-events: stroke; }
.wbo .hit.filled { pointer-events: all; fill: transparent; }
.wbo text { pointer-events: all; }
#wb[data-tool=select] .wbo { cursor: move; }
#wb[data-tool=erase] .wbo:hover { opacity: .5; }
.wb-text { font-family: Georgia, "Times New Roman", serif; font-weight: 700; user-select: none; }
.wb-selbox { fill: none; stroke: #5a7896; stroke-width: 2; stroke-dasharray: 6 5; pointer-events: none; }
.wb-h { fill: #d4a017; stroke: #222; stroke-width: 2; pointer-events: all; touch-action: none; }
.wb-h[data-h=nw], .wb-h[data-h=se] { cursor: nwse-resize; }
.wb-h[data-h=ne], .wb-h[data-h=sw] { cursor: nesw-resize; }
#wb[data-tool=select] .tok { cursor: grab; }
.tok-ini { fill: #fff; font-family: Georgia, serif; font-weight: bold; font-size: 30px; pointer-events: none; }
.tok-name { fill: #222; font-weight: 700; font-size: 15px; paint-order: stroke; stroke: #fffc; stroke-width: 4px; pointer-events: none; }
.tok-badge { fill: #222; font-size: 14px; font-weight: bold; pointer-events: none; }

/* Layout mit Würfelleiste */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

/* Würfel */
.dice-panel {
  background: white;
  border: 1px solid #d8cfc0;
  border-radius: 10px;
  padding: 12px 14px;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.dice-panel h2 { margin: 0 0 8px; font-size: 20px; }
#diceForm label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; }
#diceForm input:not([type=checkbox]), #diceForm select { display: block; width: 100%; box-sizing: border-box; padding: 6px; font-size: 14px; margin-top: 2px; }
#diceForm label.chk { display: flex; align-items: center; gap: 6px; padding-top: 18px; }
.dice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dice-go { width: 100%; margin: 6px 0; padding: 10px; font-size: 16px; font-weight: bold; background: #5a7896; color: white; border: none; border-radius: 8px; }
.dice-free { display: flex; flex-wrap: wrap; gap: 4px; }
.dice-free button { padding: 4px 8px; font-size: 12px; }
.dice-log-head { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; border-top: 1px solid #e4dccd; padding-top: 8px; }
.dice-log-head h3 { margin: 0; font-size: 16px; }
.small-btn { padding: 2px 8px; font-size: 12px; }
#diceLog { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.roll { border: 1px solid #e4dccd; border-radius: 8px; padding: 8px; font-size: 14px; background: #fbf7ef; }
.roll.is-doom { border-color: #9b1b30; background: #f8e7e9; }
.roll.flash { animation: rollflash 1.2s ease-out; }
@keyframes rollflash { 0% { box-shadow: 0 0 0 3px #d4a017; } 100% { box-shadow: 0 0 0 0 transparent; } }
.roll-head { margin-bottom: 4px; }
.dice-line { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 4px 0; }
.die { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 30px; height: 34px; padding: 0 3px; border-radius: 6px; background: white; border: 2px solid #5a7896; font-weight: bold; font-size: 15px; line-height: 1; }
.die small { font-size: 9px; font-weight: normal; color: #777; }
.die.max { border-color: #d4a017; background: #fff6d8; }
.die.heka { border-style: dashed; }
.die.neg { border-color: #9b1b30; color: #9b1b30; }
.neg-label { font-size: 12px; color: #9b1b30; margin-left: 4px; }
.verdict { margin-top: 4px; }
.verdict.ok { color: #2f5d1e; }
.verdict.fail { color: #7a4a10; }
.verdict.doom { color: #9b1b30; font-weight: bold; }
.small { font-size: 12px; }
.mute { color: #666; }
.heka-btn { margin-top: 6px; padding: 4px 10px; font-size: 13px; background: #6b3fa0; color: white; border: none; border-radius: 6px; }

/* Gruppe (Charakterleiste über den Reitern) */
.party { background: white; border: 1px solid #d8cfc0; border-radius: 10px; padding: 8px 10px; margin-bottom: 12px; }
.party-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.party-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pm { display: flex; align-items: center; gap: 8px; text-align: left; background: #fbf7ef; border: 1px solid #e4dccd; border-radius: 10px; padding: 6px 10px; min-width: 190px; font: inherit; }
.pm.sel { border-color: #5a7896; box-shadow: 0 0 0 2px #5a789633; }
.pm.me .pm-txt b::after { content: " (du)"; font-weight: normal; color: #888; font-size: 12px; }
.pm-av, .cs-av { flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--c, #5a7896); color: white; display: inline-flex; align-items: center; justify-content: center; font-family: Georgia, serif; font-weight: bold; border: 2px solid #d4a017; box-sizing: border-box; }
.cs-av { width: 76px; height: 76px; font-size: 26px; }
.pm-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pm-txt small { color: #666; }
.pm-bars { display: flex; flex-direction: column; gap: 2px; width: 120px; }
.cbar { display: block; height: 5px; border-radius: 3px; background: #e4dccd; overflow: hidden; }
.cbar i { display: block; height: 100%; }
.cbar.corpus i { background: #9b1b30; }
.cbar.stamina i { background: #3f6f8f; }
.warn { color: #a0620a; }
.bad { color: #9b1b30; font-weight: bold; }

/* Charakterbögen */
#tabChars { background: #fffdf9; }
.cs-tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.cs-tabs button:not(.small-btn) { border: 1px solid #d8cfc0; background: #f3eee5; border-radius: 16px; padding: 4px 12px; }
.cs-tabs button.on { background: #5a7896; color: white; border-color: #5a7896; }
.cs-empty { padding: 20px; text-align: center; }
.csheet { display: flex; flex-direction: column; gap: 12px; }
.cs-head { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.cs-head h2 { margin: 0; font-family: Georgia, serif; }
.cs-head p { margin: 2px 0; }
.grow { flex: 1; min-width: 200px; }
.cs-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.cs-block { border: 1px solid #e4dccd; border-radius: 10px; padding: 10px 12px; background: white; }
.cs-block h3 { margin: 0 0 8px; font-size: 16px; font-family: Georgia, serif; }
.cs-block h3 small { font-family: Arial, sans-serif; font-size: 13px; margin-left: 8px; }
.cs-block p { margin: 4px 0; }
.cs-block summary { cursor: pointer; font-weight: bold; }
.cs-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sv { display: flex; justify-content: space-between; align-items: center; gap: 6px; width: 100%; text-align: left; background: #fbf7ef; border: 1px solid #e4dccd; border-radius: 8px; padding: 6px 8px; font: inherit; }
.sv:hover { border-color: #5a7896; background: #eef3f8; }
.cs-grid .sv { flex-direction: column; align-items: center; }
.cs-grid .sv small { font-size: 11px; color: #666; }
.cs-grid .sv b { font-size: 20px; }
.cs-grid.el .sv { background: #f5ecd7; }
.cs-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cs-list { display: flex; flex-direction: column; gap: 4px; }
.cs-ul { margin: 4px 0; padding-left: 20px; }
.trk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0; }
.tl { width: 120px; font-weight: bold; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.boxes { display: flex; flex-wrap: wrap; gap: 3px; }
.box { width: 20px; height: 20px; padding: 0; border: 2px solid #9b1b30; border-radius: 4px; background: white; }
.boxes.stamina .box { border-color: #3f6f8f; }
.boxes.m3 .box { border-color: #b8590b; }
.boxes.m6 .box { border-color: #5e0f1d; }
.box.on { background: repeating-linear-gradient(45deg, #9b1b30 0 4px, #c9566a 4px 8px); }
.boxes.stamina .box.on { background: repeating-linear-gradient(45deg, #3f6f8f 0 4px, #7aa2bf 4px 8px); }
.box:disabled { cursor: default; }
.pmb button { padding: 2px 8px; }
.rv { font-size: 13px; color: #555; }
.mini { width: 48px; padding: 2px 4px; }
.pre { white-space: pre-wrap; margin-top: 6px; }
.dice-panel.picked { animation: rollflash 1.2s ease-out; }
#charToast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); background: #222; color: white; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; max-width: 90vw; }
#charToast.show { opacity: 1; transform: translateX(-50%); }
@media (max-width: 760px) {
  .cs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-two { grid-template-columns: 1fr; }
  .pm { min-width: 0; flex: 1 1 100%; }
}

/* Kompakter Bogen: Attribute bei den Fertigkeiten, Elemente bei den Talenten */
.cs-two { align-items: start; }
.cs-chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-bottom: 8px; }
.cs-chips .sv { flex-direction: column; align-items: center; gap: 0; padding: 3px 2px; line-height: 1.15; }
.cs-chips .sv span { font-size: 10.5px; color: #666; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-chips .sv b { font-size: 17px; }
.cs-chips.el .sv { background: #f5ecd7; }
.cs-with { margin: 2px 0 6px !important; }
.cs-with select { font-size: 12px; padding: 1px 2px; }
.cs-list.sk, .cs-list.tal { display: grid; gap: 3px 6px; }
.cs-list.sk { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cs-list.tal { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.cs-list .sv { padding: 3px 6px; font-size: 13px; line-height: 1.2; border-radius: 6px; }
.cs-list .sv b { flex: none; }
.cs-list.tal .sv small { font-size: 11px; }
@media (max-width: 760px) { .cs-chips .sv span { white-space: normal; hyphens: auto; -webkit-hyphens: auto; font-size: 9.5px; overflow-wrap: anywhere; } }

/* Gesamtergebnis und Erfolge hervorheben */
.bigres { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin-top: 6px; }
.big-pre { width: 100%; font-size: 12px; color: #666; }
.big { flex: 1; min-width: 90px; display: flex; flex-direction: column; align-items: center; padding: 4px 8px; border-radius: 8px; background: white; border: 2px solid #5a7896; }
.big span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #666; }
.big b { font-size: 34px; line-height: 1.1; font-family: Georgia, serif; }
.big.ok { border-color: #2f5d1e; color: #2f5d1e; }
.big.fail { border-color: #a5702a; color: #7a4a10; }
.big.doom { border-color: #9b1b30; color: #9b1b30; }

/* Fertigkeiten: nach Attribut sortiert, spaltenweise untereinander */
.cs-list.sk { display: block; columns: 2; column-gap: 6px; }
.cs-list.sk .sv { break-inside: avoid; margin-bottom: 3px; }

/* Talente: Lupe vergrößert die Box auf volle Breite mit allen Werten und Beschreibung */
.cs-block h3 .lupe { float: right; font-size: 13px; line-height: 1; padding: 3px 7px; border: 1px solid #d8cfc0; border-radius: 6px; background: #f3eee5; cursor: pointer; }
.cs-block h3 .lupe:hover, .cs-block h3 .lupe[aria-pressed="true"] { border-color: #5a7896; background: #eef3f8; }
.cs-block.cs-big { grid-column: 1 / -1; }
.tal-big { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.tcard { border: 1px solid #e4dccd; border-radius: 8px; padding: 6px 8px; background: #fffdf8; display: flex; flex-direction: column; gap: 4px; }
.tcard .sv { padding: 4px 8px; }
.tcard .sv .tn { font-size: 14px; }
.tmeta { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; margin: 0; font-size: 12px; }
.tmeta dt { color: #666; }
.tmeta dd { margin: 0; }
.tdesc { margin: 0 !important; font-size: 13px; line-height: 1.35; }
@media (max-width: 760px) { .tal-big { grid-template-columns: 1fr; } }

.site-link { color: #6b4a1e; text-decoration: none; font-size: 0.95rem; margin-left: auto; }
.site-link:hover { text-decoration: underline; }
