/* Dark theme (Konto › Design), same palette as the DDM (OrbisGui/webapp/static/legacy-dark.css).
   Only overrides app.css under html[data-theme="dark"]: parchment becomes dark leather,
   the wine-red header, seals, wooden tabs and potion pouch keep their look.
   --wine is text and accent colour almost everywhere, so it turns gold here; the few
   places that fill a surface with it use --wine-fill instead. */
html[data-theme="dark"] {
  color-scheme: dark;
  --wine: #e0bf78;
  --wine-soft: #b58a43;
  --wine-fill: #6a2f38;
  --ink: #e8dcc6;
  --muted: #b3a089;
  --edge: #5a4632;
  --paper: #241b19;
  --paper-light: #2b211e;
  --field: #18120f;
  --ok: #9cbf6a;
  --warn: #e0a948;
  --danger: #ec8b7f;
  --panel: #2a201dd9;
  --raised: #33271f;
  --line-soft: #3d3027;
  --selected: #4a3524;
}
html[data-theme="dark"] body { background: linear-gradient(#0d0907e6, #0d0907e6), url("/img/wood.jpg") center / 420px auto, #120d0b; }
html[data-theme="dark"] ::selection { background: #7d5a2c; color: #fff4dc; }

/* Shell and surfaces */
html[data-theme="dark"] .view {
  background: linear-gradient(#1e1715f2, #1e1715f2), url("/img/parchment.jpg") center / cover, var(--paper);
  border-color: #6b4f2c; box-shadow: 0 0 0 4px #0b0806, 0 0 0 5px #6b4f2c, 0 16px 32px #000000a0;
}
html[data-theme="dark"] .card { background: var(--panel); box-shadow: inset 0 0 0 1px #ffffff08, 0 1px 3px #00000040; }
html[data-theme="dark"] .music-row { background: var(--raised); border-color: var(--edge); }
html[data-theme="dark"] .music-row.used { background: #292725; border-color: #5b554a; }
html[data-theme="dark"] .music-row.used .music-details > summary strong { color: #b3a994; }
html[data-theme="dark"] .music-used-label { color: #c2b7a4; }
html[data-theme="dark"] :is(.campaign-tile, .character-card, a.party-card):hover { box-shadow: 0 0 0 1px var(--gold), 0 6px 16px #00000066; }
html[data-theme="dark"] .campaign-join { background: #2a201d99; }
html[data-theme="dark"] .campaign-join:hover { box-shadow: inset 0 0 0 1px #ffffff08, 0 1px 3px #00000040; }
html[data-theme="dark"] .join-seal { color: var(--wine); background: var(--raised); }
html[data-theme="dark"] :is(.stat, .race-stat, .race-meta > span, .gear-piece, .submission .card, .panel .session-notes, .activity-card, .version-bar) {
  background: var(--raised); border-color: var(--edge); box-shadow: none;
}
html[data-theme="dark"] .gear-piece.empty { background: transparent; }
html[data-theme="dark"] .figure-stage { background: radial-gradient(ellipse at 50% 42%, #4a3a2e 0, var(--raised) 60%, #241b19 100%); border-color: var(--edge); }
html[data-theme="dark"] .sticky-budget { background: #241b19f2; box-shadow: 0 4px 10px #00000066; }
html[data-theme="dark"] :is(.banner, .info-pop, .sheet-note, .bag-bill, .bag-compare-side, .item-menu) { background: var(--raised); }
html[data-theme="dark"] .bag-compare-side:last-child { background: var(--selected); }
html[data-theme="dark"] .warnings { background: #3a2c18; border-color: #8a6524; }
html[data-theme="dark"] .party-panel { background: linear-gradient(#3a2a22e6, var(--panel) 5rem); }
html[data-theme="dark"] .city-head { background: linear-gradient(105deg, #33271fe8, #4a3524dd); }
html[data-theme="dark"] .city-purse { background: var(--raised); box-shadow: 0 6px 20px #0006; }
html[data-theme="dark"] .orbis-map-details { background: var(--raised); }
html[data-theme="dark"] .campaign-location { background: linear-gradient(100deg, #3a3026, var(--panel) 65%); }
html[data-theme="dark"] .back-icon:hover, html[data-theme="dark"] .back-icon:focus-visible { background: var(--raised); }
html[data-theme="dark"] .danger-zone { border-color: #7a3a33; }
html[data-theme="dark"] .toast { box-shadow: 0 6px 24px #000000a0; }
html[data-theme="dark"] .sheet { box-shadow: 0 -10px 40px #000000a0; }
html[data-theme="dark"] .sheet::backdrop { background: #000000b0; }

/* Controls */
html[data-theme="dark"] :is(button.secondary, .button.secondary, .give-all) { background: var(--raised); }
html[data-theme="dark"] :is(input, select, textarea) { border-color: #6b5238; }
html[data-theme="dark"] :is(input, textarea)::placeholder { color: #8c7a63; opacity: 1; }
html[data-theme="dark"] select option { color: var(--ink); background: var(--paper-light); }
html[data-theme="dark"] :is(select, input):disabled { background: #221a16; }
html[data-theme="dark"] .editor-head .title-input:disabled { background: transparent; }
html[data-theme="dark"] .stepper, html[data-theme="dark"] .level-picker { border-color: #6b5238; }
html[data-theme="dark"] .stepper button { background: var(--raised); }
html[data-theme="dark"] .stepper button:hover:not(:disabled) { background: #46352a; }
html[data-theme="dark"] .level-picker button { background: var(--raised); border-left-color: var(--edge); }
html[data-theme="dark"] .level-picker button:hover:not(:disabled) { background: #46352a; }
html[data-theme="dark"] .level-picker button.selected { color: #fff1d1; background: var(--wine-fill); }
html[data-theme="dark"] .level-picker button.selected:first-child { color: var(--muted); background: #3d3027; }
html[data-theme="dark"] .give-amount-control button:disabled { color: #6b5a47; }
html[data-theme="dark"] .tabs { border-bottom-color: #6b4f2c; }
html[data-theme="dark"] .tabs button.active { background: linear-gradient(#3a2c22, var(--paper)); border-color: #8a6a3a; box-shadow: inset 0 3px #b58a43; }
html[data-theme="dark"] .campaign-tabs button { background: var(--raised); box-shadow: inset 0 1px #ffffff0d; }
html[data-theme="dark"] .campaign-tabs button.active { background: linear-gradient(#743d44, #52242c); border-color: #8a4a52; }
html[data-theme="dark"] .armour-type, html[data-theme="dark"] .weapon-art { background: var(--raised); }
html[data-theme="dark"] .armour-type.selected { background: var(--selected); }
html[data-theme="dark"] .weapon-art { box-shadow: inset 0 0 12px #00000066; }
html[data-theme="dark"] .weapon-art.placeholder, html[data-theme="dark"] .portrait.placeholder { color: #7a6448; }
html[data-theme="dark"] .portrait { background: var(--raised); border-color: #6b4f2c; }
html[data-theme="dark"] :is(.portrait.avatar, .give-avatar) { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--gold); }

/* Badges, chips, info buttons */
html[data-theme="dark"] :is(.badge, .chip) { background: #3d3027; border-color: #6b5238; color: var(--ink); }
html[data-theme="dark"] .level-badge { background: var(--wine-fill); border-color: #8a4a52; color: #f6dda1; }
html[data-theme="dark"] button.info::before, html[data-theme="dark"] .info-glyph { background: var(--raised); }
html[data-theme="dark"] button.info[aria-expanded=true]::before,
html[data-theme="dark"] .row-label[aria-expanded=true] .info-glyph { background: var(--wine-fill); border-color: var(--gold); }
html[data-theme="dark"] .row-label[aria-expanded=true] .info-glyph { color: #fff1d1; }

/* Places that fill with wine red keep it */
html[data-theme="dark"] :is(.potion-bag-icon, .armour-total, .activity-count, .give-avatar) { background: var(--wine-fill); }
html[data-theme="dark"] .give-choice:has(input:checked) .give-check { background: var(--wine-fill); border-color: var(--gold); }
html[data-theme="dark"] .bag-option.selected .bag-price { color: #fff1d1; background: var(--wine-fill); }

/* Meters */
html[data-theme="dark"] .meter { background: #1a1310; border-color: #4a3a2c; }
html[data-theme="dark"] .meter-mark { box-shadow: 0 0 0 1px var(--paper); }
html[data-theme="dark"] .progress li { border-top-color: #5a4632; }

/* Potion bag, races, selections */
html[data-theme="dark"] .potion-bag { border-color: #6b4f2c; background: linear-gradient(145deg, #33271f, #2a201d); }
html[data-theme="dark"] .bag-option { background: #ffffff08; border-color: #6b5238; }
html[data-theme="dark"] .bag-option:hover { box-shadow: 0 5px 14px #00000066; }
html[data-theme="dark"] .bag-option.selected { background: linear-gradient(160deg, #4a3524, #3a2a1e); }
html[data-theme="dark"] .bag-price { background: #3d3027; }
html[data-theme="dark"] .bag-slots span { background: #ffffff10; border-color: #7a6448; }
html[data-theme="dark"] :is(.bag-option.selected .bag-slots span, .bag-compare-side:last-child .bag-slots span, .bag-slots span.filled) { background: var(--wine-soft); }
html[data-theme="dark"] .race { background: var(--panel); box-shadow: inset 0 0 0 1px #ffffff08; }
html[data-theme="dark"] .race.selected { background: var(--selected); box-shadow: 0 0 0 2px var(--wine), 0 4px 14px #00000066; }
html[data-theme="dark"] .race-lore { background: var(--selected); box-shadow: 0 4px 14px #00000066; }
html[data-theme="dark"] .give-choice { background: var(--raised); }
html[data-theme="dark"] .give-choice:has(input:checked) { background: var(--selected); }
html[data-theme="dark"] .activity-icon { background: var(--paper); }

/* Konto › Design */
.theme-picker { display: flex; flex-wrap: wrap; gap: .5rem; }
.theme-picker button { flex: 1 1 8rem; }
.theme-picker button[aria-pressed=false] { background: #fbf1da; color: var(--wine); border-color: var(--gold); box-shadow: none; }
html[data-theme="dark"] .theme-picker button[aria-pressed=false] { background: var(--raised); }
html[data-theme="dark"] .item-menu button:hover, html[data-theme="dark"] .item-menu button:focus-visible { background: #ffffff14; }
html[data-theme="dark"] .codex-tree a:hover { background: #ffffff14; }
html[data-theme="dark"] .codex-bookmark[aria-pressed=true] { color: #e0bf78; }
html[data-theme="dark"] .codex-presented { background: var(--raised); }

/* Codex workspace: the GM Codex's dark sheets. */
html[data-theme="dark"] .codex-mode .view.codex-screen { background: none; }
html[data-theme="dark"] .codex-mode .codex-workspace > .card, html[data-theme="dark"] .codex-mode .codex-main { background: var(--panel); }
html[data-theme="dark"] .codex-mode .codex-workspace button.secondary { background: var(--raised); }
@media (max-width: 720px) { html[data-theme="dark"] .codex-mode .codex-workspace > .codex-side { background: var(--paper-light); } }
