:root {
    color-scheme: dark;
    --bg: #0b0b0d;
    --panel: #151518;
    --border: #303036;
    --border-soft: #25252a;
    --text: #ece9e4;
    --muted: #9c9995;
    --accent: #8f1d24;
    --accent-hover: #a92630;
    --danger: #c4666d;
    --input: #101013;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(143,29,36,.13), transparent 30rem), var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(11,11,13,.94);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}
.header-inner, .layout, .site-footer > div {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
}
.header-inner {
    min-height: 76px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
}
.brand {
    justify-self: start;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.header-spacer { justify-self: end; width: 1px; height: 1px; }
.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid #70252b;
    background: #261115;
    color: #f4dfe0;
    font-family: Georgia, serif;
    font-weight: 700;
}
.brand strong, .brand small { display: block; }
.brand small { margin-top: 3px; color: var(--muted); font-size: .75rem; }

.main-nav {
    justify-self: center;
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}
.main-nav a {
    padding: 10px 12px;
    border-radius: 7px;
    color: #bdb9b4;
    text-decoration: none;
    font-size: .86rem;
}
.main-nav a:hover, .main-nav a.active { background: #1d1d21; color: #fff; }

.layout { padding: 32px 0 48px; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 24px;
    margin-bottom: 20px;
}
.page-head h1 {
    margin: 5px 0 7px;
    font: 500 clamp(1.8rem, 3vw, 2.65rem)/1.05 Georgia, serif;
}
.page-head p {
    margin: 0;
    max-width: 780px;
    color: var(--muted);
    line-height: 1.55;
}
.eyebrow {
    color: #c06a70;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.panel {
    margin-bottom: 20px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(25,25,29,.98), rgba(19,19,22,.98));
}
.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}
.panel-heading h2 { margin: 4px 0 0; font-size: 1.08rem; }

.button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    border: 1px solid #38383e;
    border-radius: 7px;
    background: #202024;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}
.button:hover { border-color: #55545c; }
.button-primary { border-color: #7b2930; background: var(--accent); }
.button-primary:hover { background: var(--accent-hover); }

.toggle {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 0 9px;
    border: 1px solid #3a3a40;
    border-radius: 999px;
    background: #202024;
    color: #aaa6a2;
    font-size: .72rem;
    cursor: pointer;
}
.toggle.on { border-color: #446b55; color: #bdd9c6; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.nested-grid { gap: 10px; }

.form-panel label > span,
.full-field > span,
.mini-field > span {
    display: block;
    margin-bottom: 7px;
    color: #c7c2bd;
    font-size: .8rem;
}
input, select, textarea {
    width: 100%;
    border: 1px solid #36363c;
    border-radius: 7px;
    background: var(--input);
    color: var(--text);
    outline: none;
}
input, select { min-height: 42px; padding: 0 11px; }
textarea { padding: 11px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    border-color: #7e383e;
    box-shadow: 0 0 0 3px rgba(143,29,36,.12);
}
.field-help {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: .74rem;
    line-height: 1.4;
}
.full-field { display: block; margin-top: 16px; }
.checkbox-line {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}
.checkbox-line input { width: 18px; height: 18px; }
.checkbox-line span { margin: 0 !important; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

.section-title { margin: 26px 0 12px; }
.section-title h2 { margin: 0 0 4px; font-size: 1rem; }
.section-title p { margin: 0; color: var(--muted); font-size: .82rem; }

.book-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}
.book-option {
    display: flex;
    gap: 11px;
    padding: 13px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: #111114;
    cursor: pointer;
}
.book-option:hover { border-color: #4e3438; }
.book-option input { width: 18px; height: 18px; flex: 0 0 auto; }
.book-option strong, .book-option small { display: block; }
.book-option small { margin-top: 4px; color: var(--muted); }

.rule-type-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0,1fr));
    gap: 9px;
    margin-bottom: 20px;
}
.rule-type-card {
    padding: 14px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #131316;
    text-decoration: none;
}
.rule-type-card.active, .rule-type-card:hover {
    border-color: #6e353a;
    background: #191417;
}
.rule-type-card strong, .rule-type-card span { display: block; }
.rule-type-card strong { font: 500 1.4rem/1 Georgia, serif; }
.rule-type-card span { margin-top: 6px; color: var(--muted); font-size: .75rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
    vertical-align: middle;
}
th {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
}
td { font-size: .88rem; }
tr:last-child td { border-bottom: 0; }
.actions { white-space: nowrap; text-align: right; }
.actions a, .link-button {
    color: #d6b1b3;
    text-decoration: none;
    font-size: .82rem;
}
.link-button {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}
.link-button.danger { color: var(--danger); }
.inline-form { display: inline; margin-left: 10px; }

.system-row td { padding-top: 0; color: #c9c4be; line-height: 1.5; }
.system-label { color: #c56e75; font-weight: 700; }

.lineage-fields {
    margin-top: 20px;
    padding: 18px;
    border: 1px solid #3a2d31;
    border-radius: 10px;
    background: #141013;
}

.compact-check-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.compact-check {
    display: flex !important;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border: 1px solid #2c2c31;
    border-radius: 7px;
    background: #111114;
}
.compact-check input { width: 18px; height: 18px; }
.compact-check span { margin: 0 !important; }

.rule-selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.rule-selection-lower { margin-top: 14px; }
.rule-select-panel {
    padding: 16px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: #111114;
}
.rule-select-panel h3 { margin: 0 0 12px; font-size: .95rem; }
.mini-field { display: block; margin-top: 10px; }

.rule-option-list { display: grid; gap: 8px; }
.wide-options {
    grid-template-columns: repeat(2, minmax(0,1fr));
}
.rule-choice {
    display: flex !important;
    gap: 10px;
    padding: 10px;
    border: 1px solid #29292e;
    border-radius: 7px;
    background: #151518;
}
.rule-choice input { width: 18px; height: 18px; flex: 0 0 auto; }
.rule-choice > span { margin: 0 !important; }
.rule-choice strong, .rule-choice em, .rule-choice small { display: block; }
.rule-choice em {
    margin-top: 3px;
    color: #8e8a86;
    font-size: .7rem;
    font-style: normal;
}
.rule-choice small {
    margin-top: 5px;
    color: #b5b0aa;
    line-height: 1.4;
}
.rule-choice.clan-discipline {
    border-color: #6d4b2f;
    background: #19150f;
}
.clan-marker {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 6px;
    border: 1px solid #805e36;
    border-radius: 999px;
    color: #d7b987;
    font-size: .62rem;
    font-weight: 600;
}

.rule-points {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    margin-left: 5px;
    padding: 0 5px;
    border: 1px solid #62393d;
    border-radius: 999px;
    color: #ddb7ba;
    font-size: .68rem;
}

.rules-loading {
    padding: 16px;
    border: 1px dashed #3c3c42;
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
}

.rule-detail-box {
    margin-top: 10px;
    padding: 11px;
    border: 1px solid #2b2b30;
    border-radius: 7px;
}
.rule-detail-box strong, .rule-detail-box em { display: block; }
.rule-detail-box em {
    margin-top: 4px;
    color: var(--muted);
    font-size: .72rem;
    font-style: normal;
}
.rule-detail-box p { margin: 8px 0 0; color: #c6c1bb; line-height: 1.45; }

.rating-groups {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 12px;
}
.rating-group {
    padding: 14px;
    border: 1px solid var(--border-soft);
    border-radius: 9px;
    background: #111114;
}
.rating-group h3 {
    margin: 0 0 10px;
    font-size: .88rem;
}
.rating-list { display: grid; gap: 7px; }
.rating-row {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) 68px;
    align-items: center;
    gap: 10px;
    padding: 8px 9px;
    border: 1px solid #29292e;
    border-radius: 7px;
    background: #151518;
}
.rating-row > span { margin: 0 !important; }
.rating-row strong, .rating-row small { display: block; }
.rating-row small { margin-top: 3px; color: var(--muted); font-size: .67rem; }
.rating-row select { min-height: 34px; }

.preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.preview-grid > div, .preview-section {
    padding: 14px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: #111114;
}
.preview-grid span, .preview-section > span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
}
.preview-section { margin-top: 12px; }
.preview-rule + .preview-rule { margin-top: 12px; }
.preview-rule small { display: block; margin-top: 4px; color: var(--muted); }
.preview-rule p { margin: 6px 0 0; color: #c7c2bd; line-height: 1.5; }

.preview-rating-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.preview-rating-grid > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 9px;
    border-bottom: 1px solid #27272c;
}
.preview-rating-grid b { letter-spacing: .08em; color: #c78c91; }

.notice {
    margin-bottom: 18px;
    padding: 13px 15px;
    border: 1px solid #3d3d43;
    border-radius: 8px;
    background: #17171a;
}
.notice-success { border-color: #3d6a50; }
.notice-error { border-color: #7a343a; }
.error-list { margin: 8px 0 0 18px; padding: 0; }

.empty-state { padding: 35px 15px; text-align: center; }
.empty-state h2 { margin: 0 0 7px; }
.empty-state p {
    max-width: 680px;
    margin: 0 auto 18px;
    color: var(--muted);
    line-height: 1.55;
}

.privacy-note { margin: 16px 0 0; color: #8eb89b; font-size: .8rem; }
.muted { color: var(--muted); }
code { color: #c9a6a8; font-size: .85em; }
.site-footer { padding: 20px 0 36px; color: #716e6b; font-size: .74rem; }

@media (max-width: 1080px) {
    .rule-type-grid { grid-template-columns: repeat(4, 1fr); }
    .rating-groups { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
    .header-inner {
        grid-template-columns: 1fr;
        justify-items: center;
        padding: 14px 0;
    }
    .brand, .header-spacer, .main-nav { justify-self: center; }
    .header-spacer { display: none; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .preview-grid, .preview-rating-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
    .header-inner, .layout, .site-footer > div {
        width: min(100% - 20px, 1240px);
    }
    .main-nav { width: 100%; }
    .main-nav a { padding: 8px 9px; }
    .form-grid,
    .book-grid,
    .rule-selection-grid,
    .rating-groups,
    .wide-options,
    .compact-check-grid,
    .preview-grid,
    .preview-rating-grid,
    .rule-type-grid {
        grid-template-columns: 1fr;
    }
    .panel { padding: 17px; }
}
@media print {
    .site-header,
    .site-footer,
    .page-head,
    #character-form,
    .notice,
    .character-preview .button {
        display: none !important;
    }
    body { background: #fff; color: #000; }
    .layout { width: 100%; padding: 0; }
    .character-preview { border: 0; background: #fff; color: #000; }
    .preview-grid > div, .preview-section { border-color: #bbb; background: #fff; }
}


/* Phase 4.1: persönliche Regelwerksbibliothek */
.book-not-owned {
    opacity: .62;
}

.library-button {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid #4a4a51;
    border-radius: 999px;
    background: #18181c;
    color: #c6c1bc;
    cursor: pointer;
    font-size: .74rem;
}

.library-button:hover {
    border-color: #6b4a4f;
    color: #fff;
}

.library-button.added {
    border-color: #446b55;
    background: #152019;
    color: #bdd9c6;
}

/* BEGIN V20 PHASE5 CHARACTER CREATION */
/* Phase 6: gemeinsame Punktreihen, optionale Blutpunkte, Vorzuege/Schwaechen */
.layout { width:min(1520px,calc(100% - 32px)); }
.phase5-head { align-items:center; }
.phase5-rule-chip { border:1px solid #5d3035; background:#1d1215; color:#d8a9ad; border-radius:999px; padding:9px 13px; font-size:.78rem; font-weight:700; }
.phase5-form { display:block; }
.phase5-workspace { display:grid; grid-template-columns:minmax(0,1fr) 320px; gap:20px; align-items:start; }
.phase5-main { min-width:0; }
.phase5-panel { overflow:visible; }
.compact-title { margin-top:22px; }
.lineage-grid,.phase5-derived-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.lineage-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }

.priority-column-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:12px; }
.priority-column { display:flex; flex-direction:column; gap:7px; min-width:0; padding:12px; border:1px solid var(--border-soft); border-radius:9px; background:#111114; }
.priority-column > strong { color:#d8a9ad; font-size:.92rem; }
.priority-column > span { min-height:2.2em; color:var(--muted); font-size:.74rem; line-height:1.45; }
.priority-column select { width:100%; min-width:0; }

.phase5-rating-groups { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.phase5-rating-group { border:1px solid var(--border-soft); border-radius:10px; background:#111114; padding:12px; min-width:0; }
.phase5-rating-group h3 { margin:0 0 10px; font-size:.9rem; color:#d8a9ad; }
.phase5-rating-list { display:grid; gap:7px; }
.phase5-rating-row { display:grid; grid-template-columns:minmax(180px,1fr) minmax(210px,300px) 32px; align-items:center; gap:9px; min-height:62px; padding:9px 10px; border:1px solid var(--border-soft); border-radius:8px; background:#111114; min-width:0; }
.phase5-form:not(.freebie-mode) .phase5-rating-row { grid-template-columns:minmax(180px,1fr) minmax(210px,300px) 32px; }
.phase5-rating-row.clan-discipline-row { border-color:#65373b; box-shadow:inset 3px 0 0 #8f1d24; }
.phase5-rating-row.outclan-discipline-row { border-color:#474047; background:#131316; }
.rating-name { min-width:0; display:flex; flex-direction:column; gap:2px; }
.rating-name strong { overflow-wrap:anywhere; }
.rating-name small { color:var(--muted); font-size:.68rem; line-height:1.3; overflow-wrap:anywhere; }

.rating-track-block { min-width:0; display:flex; flex-direction:column; gap:5px; }
.rating-track-block > small { font-size:.62rem; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }

.rating-select-native { position:absolute !important; left:-9999px !important; width:1px; height:1px; opacity:0; pointer-events:none; }

.dot-track { display:flex; align-items:center; gap:4px; min-height:32px; flex-wrap:nowrap; }
.dot-track.is-disabled { opacity:.58; }
.dot-button { appearance:none; border:0; background:transparent; color:#806d70; padding:0; margin:0; line-height:1; font-size:1.18rem; cursor:pointer; min-width:18px; min-height:18px; }
.dot-button:hover:not(:disabled),
.dot-button:focus-visible:not(:disabled) { color:#e2c7c9; transform:translateY(-1px); outline:none; }
.dot-button.is-filled { color:#e2c7c9; }
.dot-button:disabled { cursor:not-allowed; color:#50484b; transform:none; }

.phase5-form:not(.freebie-mode) .freebie-only { display:none!important; }
.phase5-form.freebie-mode .creation-rating,
.phase5-form.freebie-mode .attribute-priority,
.phase5-form.freebie-mode .ability-priority,
.phase5-form.freebie-mode #ruleset-select,
.phase5-form.freebie-mode .rulebook-checkbox,
.phase5-form.freebie-mode #lineage-select,
.phase5-form.freebie-mode #origin-lineage-select,
.phase5-form.freebie-mode #nature-select,
.phase5-form.freebie-mode #demeanor-select,
.phase5-form.freebie-mode [name="virtue_mode"],
.phase5-form.freebie-mode [name^="discipline_choice["] { pointer-events:none; opacity:.62; }

.morality-path-field { display:block; margin-bottom:15px; padding:12px; border:1px solid var(--border-soft); border-radius:9px; background:#111114; }
.morality-path-field > span { display:block; margin-bottom:7px; color:#d8a9ad; font-weight:650; }
.morality-path-field > small { display:block; margin-top:7px; color:var(--muted); line-height:1.45; }
.lineage-choice-box label { display:flex; align-items:center; gap:7px; padding:9px 11px; border:1px solid var(--border-soft); border-radius:8px; background:#111114; }
.lineage-choice-box { margin-top:12px; padding:12px; border:1px solid #5d3035; border-radius:9px; background:#171014; }
.lineage-choice-box > strong { display:block; margin-bottom:9px; }
.lineage-choice-box > div { display:flex; flex-wrap:wrap; gap:8px; }
.dice-line { display:flex; gap:7px; }
.dice-line input { min-width:0; }

.derived-card { padding:12px; border:1px solid var(--border-soft); border-radius:9px; background:#111114; display:flex; flex-direction:column; justify-content:center; gap:5px; }
.derived-card > span { color:var(--muted); font-size:.7rem; text-transform:uppercase; letter-spacing:.05em; }
.derived-card > strong { font:500 1.45rem/1.1 Georgia,serif; color:#e2c7c9; }
.derived-card > small { color:var(--muted); line-height:1.35; }
.mode-switch-box { margin-top:16px; padding:15px; border:1px solid #5d3035; border-radius:10px; background:#171014; display:flex; align-items:center; justify-content:space-between; gap:18px; }
.mode-switch-box strong { display:block; margin-bottom:4px; }
.mode-switch-box p { margin:0; color:var(--muted); font-size:.8rem; line-height:1.45; }
.mode-switch-box button:disabled { opacity:.45; cursor:not-allowed; }
.freebie-panel { border-color:#6a4a2f; box-shadow:inset 4px 0 0 #8d6437; }
.freebie-panel .panel-heading { align-items:flex-start; }

.phase5-budget { position:sticky; top:96px; border:1px solid #4b3033; border-radius:13px; background:linear-gradient(180deg,#171316,#101012); padding:20px; box-shadow:0 18px 40px rgba(0,0,0,.22); }
.phase5-budget h2 { margin:5px 0 18px; font:500 1.48rem/1.1 Georgia,serif; }
.budget-block { margin-bottom:12px; padding-bottom:10px; border-bottom:1px solid var(--border-soft); }
.budget-block > strong { display:block; margin-bottom:7px; color:#d6c5c6; font-size:.94rem; }
.budget-line { display:flex; justify-content:space-between; gap:10px; padding:5px 0; font-size:.88rem; }
.budget-line.mini { font-size:.79rem; padding:3px 0; }
.budget-line.big { font-size:1.02rem; }
.phase5-budget .ok { color:#82c99c; }
.phase5-budget .bad { color:#df7a82; }
.phase5-budget hr { border:0; border-top:1px solid var(--border); margin:10px 0; }
.budget-note { margin:15px 0 0; color:var(--muted); font-size:.8rem; line-height:1.5; }
.phase5-preview { border-color:#4b6b58; }
.phase5-derived-grid { margin-top:16px; }

@media (max-width:1280px) {
    .layout { width:min(100% - 24px,1280px); }
    .phase5-workspace { grid-template-columns:1fr; }
    .phase5-budget { position:static; order:-1; }
}
@media (max-width:1050px) {
    .priority-column-grid,.phase5-rating-groups { grid-template-columns:1fr; }
    .phase5-rating-row,
    .phase5-form:not(.freebie-mode) .phase5-rating-row,
    .phase5-rating-row:not(:has(.rating-remove-button)) { grid-template-columns:1fr; }
    .final-rating { justify-content:flex-start; }
}
@media (max-width:760px) {
    .lineage-grid,.phase5-derived-grid { grid-template-columns:1fr; }
    .mode-switch-box { flex-direction:column; align-items:stretch; }
}
@media print {
    .phase5-form,.phase5-head .phase5-rule-chip,.site-header,.site-footer { display:none!important; }
    .phase5-preview { border:0; box-shadow:none; }
}
/* END V20 PHASE5 CHARACTER CREATION */
/* Phase 5.4 Eingabelimits */
.dot-button:disabled {
    opacity:.34;
}
.priority-column select:focus {
    border-color:#8f1d24;
}


/* Phase 5.5 - eine gemeinsame Punktreihe */
.phase5-rating-row:not(:has(.rating-remove-button)) {
    grid-template-columns:minmax(180px,1fr) minmax(210px,300px);
}
.combined-rating-wrap {
    align-items:flex-start;
}
.dot-button.is-regular-filled {
    color:#e2c7c9;
}
.dot-button.is-freebie-filled {
    color:#d89a57;
    text-shadow:0 0 8px rgba(216,154,87,.18);
}
.freebie-mode .dot-button.is-freebie-filled {
    color:#e3a45f;
}
.rating-remove-button {
    appearance:none;
    width:28px;
    height:28px;
    border:1px solid #514246;
    border-radius:50%;
    background:#171316;
    color:#a99599;
    cursor:pointer;
    font-size:1.05rem;
    line-height:1;
}
.rating-remove-button:hover {
    border-color:#8f1d24;
    color:#f0d7da;
}
.compact-add-control {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:10px;
    align-items:center;
    margin-bottom:12px;
    padding:12px;
    border:1px solid var(--border-soft);
    border-radius:9px;
    background:#111114;
}
.compact-add-control select {
    min-width:0;
}
.compact-selected-list:empty {
    display:none;
}
.compact-empty-note {
    margin:4px 0 0;
    color:var(--muted);
    font-size:.78rem;
}


/* Phase 6 - Menschlichkeit/Pfad und Willenskraft als Punktreihen */
.final-trait-list {
    display:grid;
    gap:10px;
    margin-top:14px;
}
.derived-rating-row {
    display:grid;
    grid-template-columns:minmax(220px,1fr) minmax(280px,420px);
    align-items:center;
    gap:14px;
    padding:12px 14px;
    border:1px solid var(--border-soft);
    border-radius:9px;
    background:#111114;
}
.derived-dot-track {
    display:flex;
    align-items:center;
    gap:5px;
    flex-wrap:nowrap;
}
.derived-dot-button {
    appearance:none;
    border:0;
    background:transparent;
    padding:0;
    margin:0;
    min-width:19px;
    min-height:19px;
    font-size:1.22rem;
    line-height:1;
    color:#50484b;
    cursor:pointer;
}
.derived-dot-button.is-regular-filled {
    color:#e2c7c9;
}
.derived-dot-button.is-freebie-filled {
    color:#e3a45f;
    text-shadow:0 0 8px rgba(216,154,87,.18);
}
.derived-dot-button:disabled {
    cursor:not-allowed;
    opacity:.55;
}
.phase5-form:not(.freebie-mode) .derived-dot-button.is-regular-filled {
    opacity:1;
}
.optional-blood-field {
    display:block;
    padding:12px 14px;
    border:1px solid var(--border-soft);
    border-radius:9px;
    background:#111114;
}
.optional-blood-field > span {
    display:block;
    margin-bottom:7px;
    color:#d8a9ad;
    font-weight:650;
}
.optional-blood-field > span small {
    color:var(--muted);
    font-weight:500;
}
.optional-blood-field > small {
    display:block;
    margin-top:7px;
    color:var(--muted);
    line-height:1.4;
}
.freebie-mode-note {
    margin:0 0 16px;
    padding:12px 14px;
    border:1px solid #6a4a2f;
    border-radius:9px;
    background:#17130f;
}
.freebie-mode-note strong {
    display:block;
    margin-bottom:4px;
}
.freebie-mode-note span {
    color:var(--muted);
    font-size:.82rem;
    line-height:1.45;
}

/* Phase 6 - kompakte Vorzuege und Schwaechen */
.phase6-traits {
    align-items:start;
}
.trait-selected-list {
    display:grid;
    gap:9px;
}
.trait-card {
    padding:11px 12px;
    border:1px solid var(--border-soft);
    border-radius:9px;
    background:#111114;
}
.trait-card-head {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
}
.trait-card-head > div {
    min-width:0;
}
.trait-card-head strong {
    display:block;
    margin-bottom:3px;
}
.trait-card-head small {
    color:var(--muted);
    font-size:.72rem;
    line-height:1.35;
}
.trait-point-choice {
    display:flex;
    align-items:center;
    gap:9px;
    margin-top:9px;
}
.trait-point-choice > span {
    color:var(--muted);
    font-size:.75rem;
}
.trait-point-choice select {
    width:auto;
    min-width:82px;
}
.trait-requirement {
    margin:9px 0 0;
    color:#d5c0a8;
    font-size:.76rem;
    line-height:1.45;
}
.trait-system {
    margin-top:9px;
}
.trait-system summary {
    cursor:pointer;
    color:#d8a9ad;
    font-size:.76rem;
}
.trait-system p {
    margin:8px 0 0;
    color:var(--muted);
    font-size:.76rem;
    line-height:1.5;
}
.preview-dots {
    letter-spacing:.08em;
    white-space:nowrap;
    font-family:Georgia,serif;
}

@media (max-width:900px) {
    .derived-rating-row {
        grid-template-columns:1fr;
    }
    .derived-dot-track {
        flex-wrap:wrap;
    }
}
@media (max-width:680px) {
    .compact-add-control {
        grid-template-columns:1fr;
    }
    .dice-line {
        flex-wrap:wrap;
    }
}


/* Phase 6.1 - Vorzüge und Schwächen nach Kategorien */
.trait-category-section {
    margin-top:14px;
    padding-top:12px;
    border-top:1px solid var(--border-soft);
}
.trait-category-section:first-child {
    margin-top:0;
    padding-top:0;
    border-top:0;
}
.trait-category-section > h4 {
    margin:0 0 9px;
    color:#d8a9ad;
    font:600 .9rem/1.2 Georgia,serif;
    letter-spacing:.02em;
}
.trait-category-list {
    display:grid;
    gap:9px;
}
.trait-add-control select optgroup {
    font-weight:700;
}
.trait-add-control select option {
    font-weight:400;
}


/* Phase 6.2 - getrennte Regelsysteme */
.dark-ages-shell { max-width:920px; margin:0 auto; }

/* BEGIN V20DA PHASE7 */
/* Phase 7.1: Dark-Ages-Editor im gleichen Aufbau wie der V20-Editor */

.da-editor { width:100%; }
.da-static-book { cursor:default; }
.da-static-book:hover { border-color:var(--border-soft); }

.da-loading {
    padding:28px;
    text-align:center;
    color:var(--muted);
}
.da-loading.error { color:var(--danger); }

.da-hidden-budget { display:none!important; }

.da-origin {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:12px;
}
.da-origin label {
    display:block;
}
.da-origin label > span {
    display:block;
    margin-bottom:7px;
    color:#d8a9ad;
    font-weight:650;
}
.da-origin select { width:100%; }

.da-weakness {
    margin-top:14px;
    padding:12px 14px;
    border:1px solid #5a3034;
    border-radius:9px;
    background:#1b1113;
}
.da-weakness strong { color:#e2b3b7; }
.da-weakness p {
    margin:6px 0 4px;
    line-height:1.48;
    font-size:.84rem;
}
.da-weakness small { color:var(--muted); }

.da-three {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:12px;
}
.da-trait-col {
    min-width:0;
}
.da-col-head.priority-column {
    margin:-12px -12px 12px;
    border:0;
    border-bottom:1px solid var(--border-soft);
    border-radius:10px 10px 0 0;
}
.da-col-head.priority-column strong {
    color:#d8a9ad;
    font-size:.92rem;
}
.da-priority {
    width:100%;
    min-width:0;
}

.da-rating-list {
    display:grid;
    gap:7px;
}
.da-rating-row.phase5-rating-row {
    grid-template-columns:minmax(150px,1fr) minmax(120px,auto) 32px;
    min-height:48px;
    padding:8px 10px;
}
.da-rating-row.phase5-rating-row:not(:has(.da-remove)) {
    grid-template-columns:minmax(150px,1fr) minmax(120px,auto);
}
.da-rating-name {
    font-size:.82rem;
    overflow-wrap:anywhere;
}
.da-dots {
    display:flex;
    align-items:center;
    gap:4px;
    white-space:nowrap;
}
.da-dot {
    appearance:none;
    border:0;
    background:transparent;
    padding:0;
    margin:0;
    width:19px;
    height:19px;
    line-height:1;
    color:#50484b;
    cursor:pointer;
    font-size:0;
}
.da-dot::before {
    content:'●';
    font-size:1.16rem;
}
.da-dot.is-base { color:#756f70; }
.da-dot.is-regular { color:#e2c7c9; }
.da-dot.is-freebie {
    color:#e3a45f;
    text-shadow:0 0 8px rgba(216,154,87,.18);
}
.da-dot:disabled {
    cursor:not-allowed;
    opacity:.32;
}
.da-dots-10 {
    flex-wrap:nowrap;
}

.da-remove {
    appearance:none;
    width:28px;
    height:28px;
    border:1px solid #514246;
    border-radius:50%;
    background:#171316;
    color:#a99599;
    cursor:pointer;
    font-size:1.05rem;
    line-height:1;
}
.da-remove:hover {
    border-color:#8f1d24;
    color:#f0d7da;
}

.da-blood-buttons {
    margin-top:8px;
}
.da-blood-buttons .button {
    padding:7px 10px;
    font-size:.76rem;
}

.da-editor:not(.freebie-mode) .freebie-only {
    display:none!important;
}
.da-editor.freebie-mode #da-lineage,
.da-editor.freebie-mode #da-way,
.da-editor.freebie-mode #da-origin-clan,
.da-editor.freebie-mode #da-origin-disc-1,
.da-editor.freebie-mode #da-origin-disc-2,
.da-editor.freebie-mode .da-priority {
    pointer-events:none;
    opacity:.62;
}

.da-summary .budget-block {
    margin-bottom:12px;
    padding-bottom:10px;
    border-bottom:1px solid var(--border-soft);
}

@media (max-width:1050px) {
    .da-three {
        grid-template-columns:1fr;
    }
    .da-rating-row.phase5-rating-row,
    .da-rating-row.phase5-rating-row:not(:has(.da-remove)) {
        grid-template-columns:1fr;
    }
}

@media (max-width:760px) {
    .da-origin {
        grid-template-columns:1fr;
    }
}

@media print {
    .site-header,
    .site-footer,
    .page-head,
    .da-summary,
    #da-freebie-start,
    #da-freebie-leave,
    #da-reset,
    .compact-add-control,
    .da-remove {
        display:none!important;
    }
    .layout { width:100%!important; }
    .phase5-workspace { display:block!important; }
    .panel {
        box-shadow:none!important;
        border-color:#bbb!important;
    }
    .da-dot { color:#ccc!important; }
    .da-dot.is-base,
    .da-dot.is-regular { color:#222!important; }
    .da-dot.is-freebie {
        color:#666!important;
        text-shadow:none!important;
    }
}
/* END V20DA PHASE7 */

/* BEGIN V20DA PHASE7.4 V20 DOT DISPLAY */

/* Exakt dieselben Zeilenmasse wie der V20-Editor. */
.da-editor .da-rating-row.phase5-rating-row {
    display:grid;
    grid-template-columns:minmax(180px,1fr) minmax(210px,300px) 32px;
    align-items:center;
    gap:9px;
    min-height:62px;
    padding:9px 10px;
    border:1px solid var(--border-soft);
    border-radius:8px;
    background:#111114;
    min-width:0;
}

.da-editor .da-rating-row.phase5-rating-row:not(:has(.rating-remove-button)) {
    grid-template-columns:minmax(180px,1fr) minmax(210px,300px);
}

.da-editor .rating-name {
    min-width:0;
    display:flex;
    flex-direction:column;
    gap:2px;
}

.da-editor .rating-name strong {
    overflow-wrap:anywhere;
}

.da-editor .rating-track-block {
    min-width:0;
    display:flex;
    flex-direction:column;
    gap:5px;
}

.da-editor .combined-rating-wrap {
    align-items:flex-start;
}

.da-editor .dot-track {
    display:flex;
    align-items:center;
    gap:4px;
    min-height:32px;
    flex-wrap:nowrap;
}

.da-editor .dot-button {
    appearance:none;
    border:0;
    background:transparent;
    color:#806d70;
    padding:0;
    margin:0;
    line-height:1;
    font-size:1.18rem;
    cursor:pointer;
    min-width:18px;
    min-height:18px;
}

.da-editor .dot-button:hover:not(:disabled),
.da-editor .dot-button:focus-visible:not(:disabled) {
    color:#e2c7c9;
    transform:translateY(-1px);
    outline:none;
}

.da-editor .dot-button.is-filled,
.da-editor .dot-button.is-regular-filled {
    color:#e2c7c9;
}

.da-editor .dot-button.is-freebie-filled {
    color:#d89a57;
    text-shadow:0 0 8px rgba(216,154,87,.18);
}

.da-editor.freebie-mode .dot-button.is-freebie-filled {
    color:#e3a45f;
}

.da-editor .dot-button:disabled {
    cursor:not-allowed;
    color:#50484b;
    opacity:.34;
    transform:none;
}

.da-editor .derived-dot-track {
    display:flex;
    align-items:center;
    gap:5px;
    flex-wrap:nowrap;
}

.da-editor .derived-dot-button {
    appearance:none;
    border:0;
    background:transparent;
    padding:0;
    margin:0;
    min-width:19px;
    min-height:19px;
    font-size:1.22rem;
    line-height:1;
    color:#50484b;
    cursor:pointer;
}

.da-editor .derived-dot-button.is-regular-filled {
    color:#e2c7c9;
}

.da-editor .derived-dot-button.is-freebie-filled {
    color:#e3a45f;
    text-shadow:0 0 8px rgba(216,154,87,.18);
}

.da-editor .derived-dot-button:disabled {
    cursor:not-allowed;
    opacity:.55;
}

.da-editor #da-origin {
    margin:0 0 14px;
}

@media (max-width:1050px) {
    .da-editor .da-rating-row.phase5-rating-row,
    .da-editor .da-rating-row.phase5-rating-row:not(:has(.rating-remove-button)) {
        grid-template-columns:1fr;
    }
}

@media (max-width:900px) {
    .da-editor .derived-dot-track {
        flex-wrap:wrap;
    }
}

/* END V20DA PHASE7.4 V20 DOT DISPLAY */

/* BEGIN V20DA PHASE8 MERITS FLAWS */
.da-editor .phase6-traits {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:14px;
    align-items:start;
}
.da-editor .phase6-traits > section {
    min-width:0;
}
.da-editor .trait-selected-list {
    display:grid;
    gap:9px;
}
.da-editor .trait-card {
    padding:11px 12px;
    border:1px solid var(--border-soft);
    border-radius:9px;
    background:#111114;
}
.da-editor .trait-card-head {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
}
.da-editor .trait-card-head > div {
    min-width:0;
}
.da-editor .trait-card-head strong {
    display:block;
    margin-bottom:3px;
}
.da-editor .trait-card-head small {
    color:var(--muted);
    font-size:.72rem;
    line-height:1.35;
}
.da-editor .trait-point-choice {
    display:flex;
    align-items:center;
    gap:9px;
    margin-top:9px;
}
.da-editor .trait-point-choice > span {
    color:var(--muted);
    font-size:.75rem;
}
.da-editor .trait-point-choice select {
    width:auto;
    min-width:82px;
}
.da-editor .trait-requirement {
    margin:9px 0 0;
    color:#d5c0a8;
    font-size:.76rem;
    line-height:1.45;
}
.da-editor .trait-system {
    margin-top:9px;
}
.da-editor .trait-system summary {
    cursor:pointer;
    color:#d8a9ad;
    font-size:.76rem;
}
.da-editor .trait-system p {
    margin:8px 0 0;
    color:var(--muted);
    font-size:.76rem;
    line-height:1.5;
}
.da-editor .trait-category-section {
    margin-top:14px;
    padding-top:12px;
    border-top:1px solid var(--border-soft);
}
.da-editor .trait-category-section:first-child {
    margin-top:0;
    padding-top:0;
    border-top:0;
}
.da-editor .trait-category-section > h4 {
    margin:0 0 9px;
    color:#d8a9ad;
    font:600 .9rem/1.2 Georgia,serif;
    letter-spacing:.02em;
}
.da-editor .trait-category-list {
    display:grid;
    gap:9px;
}
.da-editor .compact-empty-note {
    margin:8px 0 0;
    color:var(--muted);
    font-size:.78rem;
}
@media (max-width:900px) {
    .da-editor .phase6-traits {
        grid-template-columns:1fr;
    }
}
/* END V20DA PHASE8 MERITS FLAWS */

/* BEGIN PHASE9 OPTIONAL RULEBOOKS */
.optional-rulebook-grid {
    margin-top:8px;
}
.optional-book-option {
    cursor:pointer;
}
.optional-book-option input {
    flex:0 0 auto;
    margin-top:2px;
}
.optional-book-option:has(input:checked) {
    border-color:#744047;
    background:#1a1214;
}
.optional-book-option:has(input:checked) strong {
    color:#e2c7c9;
}
.required-book-option {
    cursor:default;
}
/* END PHASE9 OPTIONAL RULEBOOKS */

/* BEGIN V20 PHASE9 OPTIONAL RULEBOOKS */
.optional-rulebook-grid {
    margin-top:8px;
}
.optional-book-option {
    cursor:pointer;
}
.optional-book-option input {
    flex:0 0 auto;
    margin-top:2px;
}
.optional-book-option:has(input:checked) {
    border-color:#744047;
    background:#1a1214;
}
.optional-book-option:has(input:checked) strong {
    color:#e2c7c9;
}
.required-book-option {
    cursor:default;
}
/* END V20 PHASE9 OPTIONAL RULEBOOKS */

/* V20 OZ HEADER ICON V1 */
.brand-mark {
    box-sizing: border-box;
    overflow: hidden;
    border-color: #70252b;
    background: #050505 url('/favicon.ico?v=2.18') center / cover no-repeat;
    color: transparent !important;
    font-size: 0 !important;
    text-shadow: none !important;
}
