:root {
  --bg: #0b0f17;
  --bg2: #111725;
  --panel: #151c2b;
  --panel2: #1b2436;
  --line: #2a3550;
  --text: #e6e9f0;
  --muted: #a3adc4;
  --gold: #d9b25f;
  --gold2: #f3d88f;
  --good: #3ecf6e;
  --ok: #f0a030;
  --bad: #e5484d;
  --empty: #4b5670;
  --accent: #6aa8ff;
  --radius: 10px;
  color-scheme: dark;
}
* { scrollbar-color: #3a4766 transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a4766; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, sans-serif; }
body { background: radial-gradient(1200px 600px at 50% -200px, #1d2a48 0%, transparent 70%), var(--bg); min-height: 100vh; }
h2, h3 { font-family: Cinzel, Georgia, serif; color: var(--gold2); letter-spacing: .02em; margin: 0 0 10px; }
h2 { font-size: 16px; } h3 { font-size: 13px; margin-top: 18px; }
button, input, select { font: inherit; color: inherit; }
.hint { color: var(--muted); font-size: 13px; }
[hidden] { display: none !important; }

/* Kopfzeile */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(#121a2b, #0e1422); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .brand-logo { width: auto; height: 60px; border-radius: 8px; box-shadow: 0 0 0 1px #2a3550, 0 4px 14px rgba(0,0,0,.45); }
.brand-aries { color: #e9eef8; letter-spacing: .04em; }
.brand-title { font-family: Cinzel, serif; font-weight: 700; color: var(--gold2); font-size: 17px; }
.brand-sub { color: var(--muted); font-size: 12.5px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--gold); }
.btn-gold { background: linear-gradient(#e4c272, #b98c35); color: #1a1405; border-color: #b98c35; font-weight: 600; }
.btn-gold:hover { filter: brightness(1.08); }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; }

/* Layout */
.layout { display: grid; grid-template-columns: 300px minmax(440px, 1fr) 430px; grid-template-areas: "style doll editor" "style plan editor"; grid-template-rows: auto 1fr; align-items: start; gap: 14px; padding: 14px; max-width: 1680px; margin: 0 auto; }
#editor, #planPanel, .doll-wrap { scroll-margin-top: 80px; }
#stylePanel { grid-area: style; } .doll-wrap { grid-area: doll; } #editor { grid-area: editor; } #planPanel { grid-area: plan; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.split { display: grid; grid-template-columns: 1fr; gap: 22px; }
@media (max-width: 1250px) { .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "doll editor" "style plan"; grid-template-rows: auto auto; } }
@media (max-width: 820px) { .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "doll" "editor" "plan" "style"; padding: 10px 16px; } .actions .btn { padding: 6px 9px; font-size: 13px; } .brand-sub { display: none; } .topbar { position: static; } .split { grid-template-columns: 1fr; } .topbar { padding: 10px 16px; } }

/* Regler */
.class-badge { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 8px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--line); cursor: pointer; }
.class-badge img { width: 40px; height: 40px; }
.class-badge b { font-family: Cinzel, serif; color: var(--gold2); }
.slider { margin: 10px 0 12px; }
.slider .lbl { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.slider .ttl { font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
input[type=range] { width: 100%; accent-color: var(--gold); }
.weights { display: grid; gap: 4px; }
.weights .w { display: grid; grid-template-columns: 1fr 90px; align-items: center; gap: 8px; font-size: 13px; }
.weights .w .b { height: 6px; background: var(--bg2); border-radius: 3px; overflow: hidden; }
.weights .w .b i { display: block; height: 100%; background: linear-gradient(90deg, #8a6a2a, var(--gold2)); }
.settings { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.settings summary { cursor: pointer; color: var(--gold2); }
.settings label { display: block; margin: 10px 0; font-size: 13px; }
.settings select { width: 100%; margin-top: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 5px; }

/* Ausrüstungsansicht */
.doll-wrap { background: linear-gradient(180deg, #121a2c, #0d1320); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.doll-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.doll-title { font-family: Cinzel, serif; font-size: 18px; color: var(--gold2); }
.calc { color: var(--muted); font-size: 13px; }
.calc.busy::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-right: 6px; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .2; } }
.score { position: relative; width: 58px; height: 58px; flex: none; }
.score svg { transform: rotate(-90deg); width: 58px; height: 58px; }
.score circle { fill: none; stroke-width: 3.2; }
.score .track { stroke: var(--line); }
.score .bar { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .4s, stroke .4s; }
.score span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.doll { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "l p r" "w w w" "a a a"; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 7px; }
.col-left { grid-area: l; } .col-right { grid-area: r; }
.portrait { grid-area: p; position: relative; border-radius: 10px; overflow: hidden; background: radial-gradient(circle at 50% 35%, #26314d, #0b0f17 70%); border: 1px solid var(--line); min-height: 380px; display: flex; align-items: flex-end; justify-content: center; }
.portrait img.char { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.portrait img.emblem { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); width: 58%; max-width: 220px; opacity: .9; filter: drop-shadow(0 8px 30px rgba(217,178,95,.25)); }
.portrait .cap { position: relative; width: 100%; padding: 30px 12px 10px; background: linear-gradient(transparent, rgba(5,8,14,.92)); text-align: center; }
.portrait .cap b { display: block; font-family: Cinzel, serif; font-size: 17px; color: var(--gold2); }
.portrait .cap span { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }
.row-weapons { grid-area: w; } .row-arcana { grid-area: a; }
.slot { position: relative; width: 54px; height: 54px; border-radius: 8px; background: #0a0e16 center/70% no-repeat; border: 1px solid #2f3a55; cursor: pointer; padding: 0; transition: transform .1s, border-color .15s, box-shadow .15s; }
.slot:hover { transform: translateY(-1px); border-color: var(--gold); }
.slot.sel { border-color: var(--gold2); box-shadow: 0 0 0 2px rgba(243,216,143,.35); }
.slot.empty { opacity: .75; }
.slot img.icon { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); object-fit: contain; border-radius: 6px; }
.slot .ench { position: absolute; right: 2px; top: 1px; font-size: 11.5px; font-weight: 700; color: #fff; text-shadow: 0 0 3px #000, 0 0 2px #000; }
.slot .st { position: absolute; left: 3px; bottom: 3px; width: 9px; height: 9px; border-radius: 50%; border: 1px solid #000; }
.slot .nm { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); font-size: 9.5px; color: var(--muted); white-space: nowrap; margin-top: 1px; pointer-events: none; display: none; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.good { background: var(--good); } .ok { background: var(--ok); } .bad { background: var(--bad); } .empty { background: var(--empty); }
.legend { display: flex; gap: 14px; justify-content: center; margin-top: 12px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
@media (max-width: 520px) { .slot { width: 46px; height: 46px; } .portrait { min-height: 300px; } }

/* Slot-Editor */
.item-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.item-head .slot { width: 62px; height: 62px; cursor: default; flex: none; }
.item-head .nm { font-weight: 700; font-size: 15px; }
.item-head .sub { color: var(--muted); font-size: 13px; }
.ctrl-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.ctrl-row label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.num { width: 64px; background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.sel-in { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; max-width: 100%; }
.mainstats { background: var(--bg2); border-radius: 8px; padding: 8px 10px; margin: 8px 0 12px; font-size: 13px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.mainstats .v { text-align: right; font-variant-numeric: tabular-nums; }
.mainstats .plus { color: var(--good); }
.lines h3 { display: flex; justify-content: space-between; align-items: baseline; }
.line { display: grid; grid-template-columns: 4px 1fr 70px 26px; gap: 6px 8px; align-items: center; padding: 7px 8px 7px 0; border-radius: 8px; margin-bottom: 6px; background: var(--bg2); }
.line .bar { grid-row: 1 / span 3; align-self: stretch; border-radius: 4px 0 0 4px; }
.line.good { background: color-mix(in srgb, var(--good) 9%, var(--bg2)); } .line.good .bar { background: var(--good); }
.line.ok { background: color-mix(in srgb, var(--ok) 10%, var(--bg2)); } .line.ok .bar { background: var(--ok); }
.line.bad { background: color-mix(in srgb, var(--bad) 11%, var(--bg2)); } .line.bad .bar { background: var(--bad); }
.line.empty .bar, .line.open .bar { background: var(--empty); }

.status-txt.open, .status-txt.empty { background: none; color: var(--muted); }
.line select, .line input { width: 100%; }
.line .info select { width: auto; padding: 2px 4px; font-size: 12.5px; }
.line .lock { color: var(--muted); display: grid; place-items: center; }
.line .lock.on { color: var(--gold2); }
.line .lock { background: none; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; height: 28px; padding: 0; }
.line .lock.on { border-color: var(--gold); background: rgba(217,178,95,.15); }
.line .info { grid-column: 2 / span 3; font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.line .roll { width: 70px; height: 5px; background: #0a0e16; border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle; }
.line .roll i { display: block; height: 100%; background: var(--accent); }
.line .sugg { grid-column: 2 / span 3; font-size: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid #3a4766; background: var(--panel2); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; color: var(--text); }
.chip:hover { border-color: var(--gold); }
.chip.best { border-color: var(--good); color: #bff3cf; }
.status-txt.good { background: none; color: var(--good); } .status-txt.ok { background: none; color: var(--ok); } .status-txt.bad { background: none; color: var(--bad); }

/* Fahrplan + Summen */
.plan { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.plan li { background: var(--bg2); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; }
.plan li .row1 { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; }
.plan li .row1 > span:first-child { line-height: 1.5; }
@media (max-width: 520px) { .plan li .row1 { grid-template-columns: 1fr; } .plan li .row1 > .flex { justify-content: flex-end; } }
.plan .from { color: #f3a3a5; } .plan .to { color: #a9f0c1; }
.plan .gain { color: var(--gold2); font-weight: 600; white-space: nowrap; }
.totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 20px; font-size: 13px; }
.totals div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed #2b3754; padding: 3px 0; }
.totals b { white-space: nowrap; }
.totals b { font-variant-numeric: tabular-nums; }

/* Dialoge */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 60px); }
dialog::backdrop { background: rgba(3,5,10,.72); backdrop-filter: blur(2px); }
.modal-body { padding: 18px; overflow: auto; max-height: calc(100vh - 60px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.modal-head h2 { margin: 0; }
.close { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.field { width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list { display: grid; gap: 6px; margin-top: 12px; }
.list .it { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; background: var(--bg2); border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; cursor: pointer; text-align: left; width: 100%; }
.list .it:hover { border-color: var(--gold); }
.list .it img { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; background: #0a0e16; }
.list .it .t { font-weight: 600; }
.list .it .s { color: var(--muted); font-size: 13px; }
.fit { font-size: 12.5px; color: var(--gold2); white-space: nowrap; }
.tag { font-size: 11.5px; padding: 1px 6px; border-radius: 4px; background: #24304a; color: var(--muted); margin-left: 6px; }

/* Assistent */
.wiz { text-align: center; }
.wiz .step { color: var(--muted); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.wiz h2 { font-size: 22px; margin: 6px 0 6px; }
.wiz p { color: var(--muted); max-width: 560px; margin: 0 auto 18px; }
.classes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 600px) { .classes { grid-template-columns: repeat(2, 1fr); } }
.classes button { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 6px; cursor: pointer; }
.classes button:hover, .classes button.on { border-color: var(--gold); background: #1f2940; }
.classes img { width: 72px; height: 72px; display: block; margin: 0 auto 6px; }
.classes b { font-family: Cinzel, serif; color: var(--gold2); }
.big-slider { max-width: 560px; margin: 0 auto; }
.big-slider .lbl { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.big-slider input { height: 28px; }
.preview { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 18px auto 4px; max-width: 600px; }
.preview .chip { cursor: default; }
.wiz-nav { display: flex; justify-content: space-between; margin-top: 22px; gap: 10px; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--gold); }

.loading { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; color: var(--muted); }
.spinner { width: 42px; height: 42px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(80px); background: #1f2940; border: 1px solid var(--gold); padding: 9px 16px; border-radius: 8px; transition: transform .25s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { transform: translateX(-50%) translateY(0); }
.foot { color: #8f9ab2; font-size: 12.5px; text-align: center; padding: 18px; }

/* Spielstil ableiten */
#fitBtn { margin: 4px 0 6px; }
.fit-table { display: grid; gap: 12px; margin: 14px 0; }
.fit-table .fr { display: grid; grid-template-columns: 200px 1fr 80px; gap: 12px; align-items: center; }
.fit-table .ft { font-weight: 600; font-size: 13px; }
.fit-table .fb .lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.fit-table .track { position: relative; display: block; height: 6px; background: var(--bg2); border-radius: 3px; margin-top: 4px; }
.fit-table .track i { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; transform: translate(-50%, -50%); }
.fit-table .track .old { background: var(--muted); opacity: .7; }
.fit-table .track .new { background: var(--gold2); box-shadow: 0 0 0 2px #0b0f17; }
.fit-table .fv { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
@media (max-width: 600px) { .fit-table .fr { grid-template-columns: 1fr 70px; } .fit-table .fb { grid-column: 1 / -1; grid-row: 2; } }

/* Spielertyp */
.type-btn { margin-left: auto; white-space: nowrap; }
@media (max-width: 520px) { .doll-head { flex-wrap: wrap; } .type-btn { margin-left: 0; width: 100%; } }
.type-head { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.type-head p { margin: 4px 0 0; }
.type-score { font: 700 34px/1 Cinzel, serif; min-width: 92px; text-align: center; padding: 10px 6px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.type-score small { font-size: 16px; }
.type-score.good { color: var(--good); background: var(--bg2); } .type-score.ok { color: var(--ok); background: var(--bg2); } .type-score.bad { color: var(--bad); background: var(--bg2); }
.type-desc { margin: 10px 0 4px; padding-left: 20px; display: grid; gap: 3px; }
.type-desc li::marker { color: var(--gold); }

/* Skills auf Ausrüstung */
.sk-head { margin: 12px 0 6px; font-weight: 600; font-size: 13px; color: var(--gold2); }
.sk-head .hint { font-weight: 400; }
.line.skill { grid-template-columns: 34px 1fr 78px 28px; padding: 7px 8px; background: color-mix(in srgb, #6aa8ff 8%, var(--bg2)); }
.line.skill .sk-icon { width: 34px; height: 34px; border-radius: 6px; background: #0a0e16; grid-row: 1 / span 3; align-self: start; }
.line.skill .sk-lv { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.line.skill .sk-lv .num { width: 48px; }
.line.skill .info, .line.skill .sugg { grid-column: 2 / span 3; }
#addSkill { margin: 2px 0 8px; }
