/* Structural styles only. The color palette lives in themes.css (loaded
   first) as CSS variables — this file never hard-codes a theme color, so
   swapping themes is a single data-theme attribute change on <html>. */
* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  background: var(--chrome);
  color: var(--grid-fg);
  font: 13px/1.4 var(--display);
}
h1 { font-size: 18px; margin: 0; color: var(--gold); font-weight: 600; letter-spacing: .02em; }
h1 small { color: var(--ink-dim); font-size: 11px; font-weight: normal; }

/* ---- top toolbar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 9px 16px; background: var(--panel-dark);
  border-bottom: 2px solid var(--gold-border); position: sticky; top: 0; z-index: 10;
}
.toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.theme-pick { display: flex; align-items: center; gap: 5px; margin-left: auto;
              font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--gold); }
.theme-pick select { font-size: 12px; }
.toolbar .sep { width: 1px; height: 22px; background: var(--gold-dim); margin: 0 4px; }
.field-check { flex-direction: row !important; align-items: center; gap: 6px; }
.field-check input { width: auto; }
.mathlink { color: var(--gold); font-size: 11px; text-decoration: none; border-bottom: 1px dotted var(--gold); }
.mathlink:hover { color: var(--gold-bright); }

/* ---- top-level tabs (EHP / Effects), LoL notebook-tab look ---- */
.tabs { display: flex; gap: 4px; }
.tab {
  background: var(--sband); color: #fff; border: 1px solid var(--gold-border);
  border-bottom: none; border-radius: 4px 4px 0 0; padding: 6px 16px;
  font-family: var(--display); font-weight: bold; font-size: 13px;
}
.tab:hover { background: var(--tab-lit); }
.tab.active { background: var(--tab-lit); border-color: var(--gold-bright); }

/* ---- form controls: dark value wells + parchment buttons ---- */
button, select, input {
  background: var(--entry-dark); color: #fff;
  border: 1px solid var(--gold-border); border-radius: 3px;
  padding: 4px 7px; font: inherit; font-size: 12px;
}
select { color: var(--field); }
option { background: var(--menu-bg); color: var(--menu-fg); }
optgroup { background: var(--menu-bg); color: var(--menu-fg-dim); font-style: italic; }

/* every NUMERIC value + input uses the monospace stack (--mono); item text
   inputs stay in the display font so item names read naturally. */
input[type=number], .num, .txt, .level, .sg-inp,
.calc-val b, .calc-val i, .readout .stat b, .bs-cell b, .bs-cell span,
.be-chip i, .be-chip span, .fx-per, .fxc-val b, .fxc-foot b, .fxc-cd,
.fx-total b, .fx-tip-row b, .fx-tip-total b, .fx-durbox b, .card-num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
/* Fixed product font roles: prose/controls use Plex Sans, headings use Cinzel,
   and numeric readouts use Plex Mono. */
h1 { font-family: var(--font-title); }
.band, .calc-head, .scen-title, .fx-knob-title, .fxc-name {
  font-family: var(--font-head);
  font-weight: 600;
}
button, select, input, option, optgroup, .tab, .fx-cat, .fx-toggle, .item-input {
  font-family: var(--font-ui);
}
/* tiny uppercase captions / micro-labels */
.field > span, .readout .stat i, .sg-lbl, .bs-cell b, .runes-label, .fx-label,
.calc-lbl, .basestats summary, .runes summary, .fx-durbox span, .theme-pick {
  font-family: var(--font-label);
}
input:focus, select:focus { border-color: var(--gold-bright); outline: none; }

/* strip number spinners: the up/down arrows crowded out small boxes (HP etc.),
   so numbers now use the full width (comfortably 4+ characters). */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

button {
  background: var(--inset); color: var(--ink); cursor: pointer;
  border-color: var(--gold-border); font-family: var(--display); font-weight: bold;
}
button:hover { background: var(--field); border-color: var(--gold-bright); }
button:active { background: var(--gold-border); color: var(--field); }
button.blue { background: var(--sband); color: #fff; }
button.blue:hover { background: var(--tab-lit); }

/* ---- page layout: champions (wide) left, graphs + calc on the right ---- */
.layout {
  max-width: none; margin: 0; padding: 12px;
  display: flex; flex-direction: row; align-items: flex-start; gap: 12px;
}
.col-left { flex: 2.4 1 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.col-right {
  flex: 1 1 380px; min-width: 340px; max-width: 480px;
  display: flex; flex-direction: column; gap: 12px;
  position: sticky; top: 62px;
}
@media (max-width: 1100px) {
  .layout { flex-direction: column; }
  .col-left, .col-right { flex-basis: auto; width: 100%; max-width: none; }
  .col-right { position: static; }
}
/* full-width band under the two-column layout (Effects section) */
.fullwidth { padding: 0 12px 12px; }

/* ---- section (brown band + dark gold-edged body), ports theme.Section ---- */
.section { display: flex; flex-direction: column; }
.section > .band {
  background: var(--band); color: var(--band-fg);
  font-family: var(--font-head); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 4px 10px;
}
.section > .band-gap { height: 4px; background: var(--chrome); }
.section > .body {
  background: var(--row-a); border: 1px solid var(--gold-border);
  padding: 10px;
}

/* ---- scenario panel: labeled blocks in a responsive grid ---- */
.scenario { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 16px; }
.scen-block { display: flex; flex-direction: column; gap: 4px; }
.scen-title {
  font-size: 10px; color: var(--gold-bright); text-transform: uppercase;
  letter-spacing: .06em; border-bottom: 1px solid var(--gold-dim); padding-bottom: 2px;
}
.scen-group { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 2px; font-size: 10px;
         color: var(--gold); text-transform: uppercase; letter-spacing: .03em; }
.field span { white-space: nowrap; }
.num { width: 4.6em; }
.txt { width: 5em; }
.soul-line { grid-column: 1 / -1; font-size: 11px; color: var(--gold); margin-top: 2px; }
.soul-line b { color: var(--gold-bright); }
.soul-line .dim { color: var(--dim); }

/* ---- graphs: two paper plots stacked in the right column, kept small ---- */
.graph-body { display: flex; flex-direction: column; gap: 10px; }
.chart {
  width: 100%; min-width: 0; display: block;
  background: var(--panel-dark); border: 1px solid var(--gold-border); border-radius: 3px;
}
#cv-breakeven { height: 260px; }
#cv-bars, #cv-bars2 { height: 150px; }

/* break-even crossings listed under the line graph (the two champs + value) */
.be-list { display: flex; flex-wrap: wrap; gap: 5px; }
.be-list:empty { display: none; }
.be-none { color: var(--dim); font-size: 11px; }
.be-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px;
  background: var(--row-b); border: 1px solid var(--gold-border); border-radius: 10px; padding: 2px 8px;
}
.be-chip i {
  font-style: normal; color: var(--field); background: var(--gold-border);
  border-radius: 50%; width: 14px; height: 14px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 9px;
}
.be-chip b { color: var(--gold-bright); font-weight: bold; }
.be-chip span { color: #fff; font-variant-numeric: tabular-nums; }

/* ---- calc breakdown: parchment cards (serif), matching the rest of the UI ---- */
/* scroll the cards within the sticky right column so nothing is ever hidden;
   height tracks the viewport (minus the sticky offset) instead of a fixed cap. */
#calc-panel { max-height: calc(100vh - 96px); overflow-y: auto; padding-right: 4px; }
.calc { display: flex; flex-direction: column; gap: 8px; }
.calc-empty { color: var(--dim); font-size: 12px; padding: 6px 2px; }
.calc-card { background: var(--row-b); border: 1px solid var(--gold-border); border-radius: 4px; overflow: hidden; }
.calc-head {
  background: var(--band); color: var(--band-fg);
  font-family: var(--font-head); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; padding: 4px 10px;
}
.calc-rows { display: flex; flex-direction: column; }
.calc-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 3px 10px; border-top: 1px solid var(--gold-dim);
}
.calc-rows > .calc-row:first-child { border-top: none; }
.calc-lbl { color: var(--gold); font-size: 12px; flex: 0 0 auto; }
.calc-val { display: flex; align-items: baseline; gap: 6px; text-align: right; min-width: 0; }
.calc-val b { color: #fff; font-variant-numeric: tabular-nums; font-size: 13px; }
.calc-val i { color: var(--dim); font-style: normal; font-size: 11px; }
/* item / rune rows wrap their (long) note cleanly under a gold label */
.calc-row-wrap { flex-direction: column; align-items: stretch; gap: 2px; }
.calc-row-wrap .calc-lbl { color: var(--gold-bright); font-size: 11px; }
.calc-note { color: var(--grid-fg); font-size: 11px; line-height: 1.4; word-break: break-word; overflow-wrap: anywhere; }

/* ---- champion cards laid out as a responsive grid ---- */
/* auto-fit (not auto-fill) so cards stretch to fill the column at any count,
   1–8, with no trailing empty tracks. */
#rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.champ-row.selected { border-color: var(--gold-bright); box-shadow: 0 0 0 1px var(--gold-bright); }
/* numbered card badge + per-card reset */
.card-num {
  flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gold-border); color: var(--field);
  border-radius: 3px; font-family: var(--display); font-weight: bold; font-size: 12px;
}
.card-reset { color: var(--gold); background: var(--inset); border-color: var(--gold-border); padding: 2px 7px; }
.card-reset:hover { background: var(--field); border-color: var(--gold-bright); }

/* ---- Effects tab ---- */
.fx-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.fx-cats { display: flex; flex-wrap: wrap; gap: 4px; }
.fx-cat {
  background: var(--sband); color: #fff; border: 1px solid var(--gold-border);
  border-radius: 3px; padding: 5px 14px; font-family: var(--display); font-weight: bold;
}
.fx-cat:hover { background: var(--tab-lit); }
.fx-cat.active { background: var(--tab-lit); border-color: var(--gold-bright); }
.fx-ctl-grid { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; }
.fx-slider-wrap { display: flex; align-items: center; gap: 8px; }
.fx-slider { width: 160px; }
.fx-slider-wrap b { color: #fff; min-width: 3em; }

.fx-hint, .fx-empty { color: var(--dim); font-size: 12px; margin-bottom: 8px; }
.fx-empty { padding: 16px; background: var(--row-b); border: 1px dashed var(--gold-dim); border-radius: 4px; }

/* context line: which champion's stats drive the scalings */
.fx-context { margin: 2px 0 4px; }
.fx-context-note { font-size: 12px; color: var(--grid-fg); }
.fx-context-note b { color: var(--gold-bright); }

/* palette items already on the selected champion's build */
.fx-item.equipped { border-color: var(--gold-bright); }
.fx-inbuild { font-size: 9px; text-transform: uppercase; letter-spacing: .03em;
              color: var(--chrome); background: var(--gold); padding: 1px 4px; border-radius: 3px; }
.item-icon.extra { border-style: dashed; }
.fx-extra-row td:first-child { color: var(--gold-bright); }

/* palette: clickable item chips with icon + name + kind */
.fx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.fx-item {
  display: flex; align-items: center; gap: 6px; text-align: left;
  background: var(--row-b); border: 1px solid var(--gold-border); border-radius: 4px;
  padding: 4px 6px; color: var(--grid-fg); font-family: var(--display); font-weight: normal;
}
.fx-item:hover { border-color: var(--gold-bright); }
.fx-item.on { background: var(--panel-dark); border-color: var(--gold-bright); box-shadow: 0 0 0 1px var(--gold-bright) inset; }
.fx-item-name { flex: 1 1 auto; min-width: 0; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-kind { font-size: 9px; text-transform: uppercase; padding: 1px 4px; border-radius: 3px; letter-spacing: .03em; }
.fx-kind.heal { background: #234a23; color: #8fe08f; }
.fx-kind.shield { background: #1c4444; color: #7fd0d0; }
.fx-kind.regen { background: #3a3418; color: #e0cf7a; }

/* results */
.fx-result { margin-top: 14px; }
.fx-selected-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.fx-label { font-size: 10px; color: var(--gold); text-transform: uppercase; letter-spacing: .04em; }
.fx-selected { display: flex; flex-wrap: wrap; gap: 4px; }
.fx-selected .item-icon { width: 30px; height: 30px; }

.fx-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 12px; }
.fx-table th, .fx-table td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--gold-dim); }
.fx-table th { color: var(--gold); font-size: 10px; text-transform: uppercase; letter-spacing: .03em; }
.fx-table td { color: var(--grid-fg); font-variant-numeric: tabular-nums; }
.fx-table .fx-when { color: var(--dim); font-size: 11px; }

.fx-totals { display: flex; flex-wrap: wrap; gap: 10px; }
.fx-total {
  display: flex; flex-direction: column; gap: 2px; align-items: center;
  background: var(--row-b); border: 1px solid var(--gold-border); border-radius: 4px;
  padding: 8px 16px; min-width: 120px;
}
.fx-total b { font-size: 18px; color: #fff; font-variant-numeric: tabular-nums; }
.fx-total i { font-size: 10px; color: var(--gold); font-style: normal; text-transform: uppercase; letter-spacing: .03em; }
.fx-total.big { border-color: var(--gold-bright); }
.fx-total.big b { color: var(--gold-bright); }
.fx-foot { margin-top: 10px; color: var(--dim); font-size: 11px; line-height: 1.5; }
.champ-row {
  display: flex; background: var(--row-a);
  border: 1px solid var(--gold-border); border-radius: 3px; overflow: hidden;
}
.card-stripe { flex: 0 0 8px; cursor: pointer; align-self: stretch; }
.card-body { flex: 1 1 auto; min-width: 0; padding: 8px 10px; }

.row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.champ-icon { width: 34px; height: 34px; border-radius: 3px; border: 1px solid var(--gold-border); background: var(--panel-dark); }
.champ-sel { font-weight: bold; flex: 1 1 auto; min-width: 0; }
.row-head .lv { color: var(--gold); font-size: 11px; }
.row-head .level { width: 3.6em; }
.remove { color: var(--field); background: var(--red); border-color: var(--gold-border); padding: 2px 8px; }
.remove:hover { background: #b8514d; }
.color-hidden { width: 0; height: 0; padding: 0; border: 0; visibility: hidden; position: absolute; }

.items { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; margin-bottom: 6px; }
.item-sel { width: 100%; min-width: 0; }

/* typeable item combobox: input + custom parchment "scroll" dropdown ------- */
.combo { position: relative; width: 100%; min-width: 0; }
.combo .item-input { width: 100%; }
.combo-pop {
  position: fixed; z-index: 60; max-height: 340px; overflow-y: auto;
  background: var(--menu-bg); color: var(--menu-fg);
  border: 1px solid var(--gold-border); border-radius: 5px;
  box-shadow: 0 8px 26px rgba(0,0,0,.55); padding: 4px; min-width: 190px;
  font-family: var(--font-ui);
}
.combo-group {
  font-size: 9px; letter-spacing: .09em; text-transform: uppercase; font-style: italic;
  color: var(--menu-fg-dim); padding: 6px 8px 2px; position: sticky; top: 0;
  background: var(--menu-bg);
}
.combo-opt {
  padding: 3px 10px; font-size: 12px; color: var(--menu-fg);
  cursor: pointer; border-radius: 3px; white-space: nowrap;
}
.combo-opt:hover, .combo-opt.active { background: var(--tab-lit); color: #fff; }
.combo-opt.sel { color: var(--gold-bright); font-weight: bold; }
.combo-clear { color: var(--dim); font-style: italic; border-bottom: 1px solid var(--gold-dim); margin-bottom: 2px; }
.combo-empty { padding: 6px 10px; font-size: 11px; color: var(--dim); font-style: italic; }

.item-icons { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 8px; }
.item-icons:empty { display: none; }
.item-icon { width: 26px; height: 26px; border-radius: 3px; border: 1px solid var(--gold-border); background: var(--panel-dark); }

.amps { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 8px; }

.conditional { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin-bottom: 8px; }
.conditional:empty { display: none; }
.check { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--grid-fg); }
.check input { padding: 0; }

/* ---- runes (collapsible) ---- */
.runes { margin-bottom: 8px; border-top: 1px solid var(--gold-dim); padding-top: 6px; }
.runes summary { cursor: pointer; color: var(--gold); font-size: 11px;
                 text-transform: uppercase; letter-spacing: .04em; }
.runes-body { padding: 8px 0 2px; display: flex; flex-direction: column; gap: 6px; }
.runes-label { font-size: 10px; color: var(--gold); text-transform: uppercase; letter-spacing: .04em; }
.shard-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rune-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px 10px; }
.rune-stacks { display: flex; flex-wrap: wrap; gap: 8px; }
.rune-stacks:empty { display: none; }

/* ---- live stat readout: a real grid (gold hairlines between cells) ---- */
.readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 1px; background: var(--gold-border);
  border: 1px solid var(--gold-border); border-radius: 3px; overflow: hidden;
}
.readout .stat {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: var(--row-b); padding: 3px 4px;
}
.readout .stat b { font-size: 13px; color: #fff; font-variant-numeric: tabular-nums; font-family: var(--display); }
.readout .stat i { font-size: 9px; color: var(--gold); font-style: normal; text-transform: uppercase; letter-spacing: .02em; }

/* ---- editable stat grid (ported from champ_row.py STAT_GRID_FIELDS) ---- */
.statgrid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--gold-border); border: 1px solid var(--gold-border);
  border-radius: 3px; overflow: hidden; margin-bottom: 8px;
}
.sg-cell { display: flex; align-items: center; gap: 4px; background: var(--row-b); padding: 2px 5px; }
.sg-lbl { font-size: 9px; color: var(--gold); text-transform: uppercase; letter-spacing: .02em; flex: 0 0 auto; min-width: 2.4em; }
.sg-inp { width: 100%; min-width: 0; font-size: 11px; padding: 2px 3px; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .statgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- base-statistics reveal (ported from ui/base_stats.py) ---- */
.basestats { margin-top: 6px; border-top: 1px solid var(--gold-dim); padding-top: 4px; }
.basestats summary { cursor: pointer; color: var(--gold); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.bs-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 6px;
           background: var(--gold-border); border: 1px solid var(--gold-border); border-radius: 3px; overflow: hidden; }
.bs-cell { display: flex; justify-content: space-between; gap: 8px; background: var(--row-b); padding: 2px 8px; font-size: 11px; }
.bs-cell b { color: var(--gold); font-weight: bold; }
.bs-cell span { color: #fff; font-variant-numeric: tabular-nums; }

/* ---- effects additions: toggles, Customize knobs, hover popover, total ---- */
.fx-ally-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
input.fx-count { width: 4.2em; padding: 2px 4px; }
.fx-grand { margin-top: 14px; border-top: 1px solid var(--gold-dim); padding-top: 12px; }

/* toggle buttons (ally enchanters, summoners) */
.fx-toggle {
  background: var(--row-b); color: var(--grid-fg); border: 1px solid var(--gold-border);
  border-radius: 3px; padding: 4px 12px; font-family: var(--display); font-weight: bold; font-size: 12px;
}
.fx-toggle:hover { border-color: var(--gold-bright); }
.fx-toggle.active { background: var(--tab-lit); color: #fff; border-color: var(--gold-bright); }

/* Customize tab */
.fx-customize { display: flex; flex-direction: column; gap: 4px; }
.fx-knob-title { font-size: 10px; color: var(--gold-bright); text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
.fx-knobs { margin-top: 4px; }
.fx-knob-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; margin-top: 6px; }
.fx-knob { display: flex; align-items: center; gap: 8px; background: var(--row-b);
  border: 1px solid var(--gold-border); border-radius: 4px; padding: 5px 8px; }
.fx-knob-lbl { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.fx-knob-lbl b { color: var(--grid-fg); font-size: 12px; }
.fx-knob-lbl i { color: var(--dim); font-style: normal; font-size: 10px; }

/* per-proc hover popover on the Items palette */
.fx-tip {
  position: fixed; z-index: 50; max-width: 260px; pointer-events: none;
  background: var(--panel-dark); border: 1px solid var(--gold-bright); border-radius: 5px;
  padding: 6px 8px; box-shadow: 0 4px 14px rgba(0,0,0,.5); font-size: 11px;
}
.fx-tip-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.fx-tip-head b { color: var(--gold-bright); font-size: 12px; }
.fx-tip-row { display: flex; justify-content: space-between; gap: 12px; color: var(--grid-fg); }
.fx-tip-row b { color: #fff; font-variant-numeric: tabular-nums; }
.fx-tip-total { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px;
  padding-top: 4px; border-top: 1px solid var(--gold-dim); color: var(--gold); text-transform: uppercase; font-size: 10px; letter-spacing: .04em; }
.fx-tip-total b { color: var(--gold-bright); font-variant-numeric: tabular-nums; font-size: 12px; }
.fx-tip-desc { color: var(--grid-fg); line-height: 1.4; }
/* per-proc values in the result tables are hoverable for their term breakdown */
.fx-per.fx-hoverable { cursor: help; text-decoration: underline dotted var(--gold); text-underline-offset: 2px; }
.fx-per.fx-hoverable:hover { color: var(--gold-bright); }

/* ---- Effects: tab bar with inline fight-length + full-width card grid ---- */
.fx-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.fx-bar .fx-cats { margin-bottom: 0; }
.fx-durbox { display: flex; align-items: center; gap: 8px; margin-left: auto;
  font-size: 10px; color: var(--gold); text-transform: uppercase; letter-spacing: .04em; }
.fx-durbox b { color: var(--gold-bright); font-variant-numeric: tabular-nums; min-width: 2.4em; }
.fx-durbox .fx-slider { width: 180px; }

.fxc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.fxc-grid-wide { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.fxc {
  background: var(--row-b); border: 1px solid var(--gold-border); border-radius: 4px;
  padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; min-width: 0;
}
.fxc.dim { opacity: .55; }
.fxc-head { display: flex; align-items: center; gap: 7px; min-width: 0; }
.fxc-name { color: var(--gold-bright); font-size: 12px; overflow-wrap: anywhere; }
.fxc-slot { font-style: normal; font-size: 10px; font-weight: bold; color: var(--field);
  background: var(--slot); border-radius: 3px; padding: 1px 6px; flex: 0 0 auto; }
.fxc-cd { margin-left: auto; font-size: 10px; color: var(--dim); flex: 0 0 auto; }
.fxc-desc { font-size: 10.5px; line-height: 1.45; color: var(--dim); overflow-wrap: anywhere; }
.fxc-val { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--grid-fg); }
.fxc-val b { color: #fff; font-variant-numeric: tabular-nums; }
.fxc-note { font-size: 10px; color: var(--dim); }
.fxc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-top: 1px solid var(--gold-dim); padding-top: 4px; margin-top: auto;
  font-size: 10px; color: var(--dim); }
.fxc-foot b { color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.fx-target { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 6px 0; }
.fx-target-inline { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); border-top: 1px dashed var(--gold-dim); padding-top: 5px; }
.fx-ally-sel { max-width: 220px; }
/* full ally champion cards inside the Allies tab */
.fx-ally-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; margin-top: 8px; }
.fx-ally-cards .champ-row { margin: 0; }

/* ---- blue theme: amber text on the blue buttons, gold on hover ---- */
:root[data-theme="blue"] button,
:root[data-theme="blue"] .fx-cat,
:root[data-theme="blue"] .tab { color: var(--gold); }
:root[data-theme="blue"] button:hover,
:root[data-theme="blue"] .fx-cat:hover,
:root[data-theme="blue"] .tab:hover {
  color: var(--gold-bright); background: var(--tab-lit); border-color: var(--gold-bright);
}

/* ---- garden theme: active tab is orange (--tab-lit), so its text goes dark
   like the orange band's, instead of the default white ---- */
:root[data-theme="garden"] .tab.active,
:root[data-theme="garden"] .fx-cat.active,
:root[data-theme="garden"] .fx-toggle.active { color: var(--band-fg); }

/* ---- top-level Defensive / Offensive page tabs ---- */
.page-tabs { display: inline-flex; gap: 3px; margin-left: 6px; }
.page-tab {
  background: var(--sband); color: var(--gold); border: 1px solid var(--gold-border);
  border-radius: 4px 4px 0 0; padding: 5px 16px; font-family: var(--font-head);
  font-weight: bold; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
}
.page-tab.active { background: var(--tab-lit); color: #fff; border-color: var(--gold-bright); }

/* ---- Offensive (DPS) page ---- */
.dps-layout { display: flex; flex-direction: row; gap: 12px; align-items: flex-start;
  max-width: none; margin: 0; padding: 12px; }
.dps-left { flex: 2.2 1 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.dps-right { flex: 1 1 420px; min-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.dps-add-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.dps-add { flex: 1 1 auto; min-width: 0; }
.dps-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
#cv-dps-curve { height: 280px; }
#cv-dps-bars { height: 200px; }

.dps-targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.dps-target { background: var(--row-b); border: 1px solid var(--gold-border); border-radius: 4px; padding: 8px 10px; }
.dps-target-head { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.dps-target-name { flex: 1 1 auto; min-width: 0; font-weight: bold; color: var(--gold-bright); }
.dps-target-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.dps-target-add { align-self: start; }

.dps-breakdown { display: flex; flex-direction: column; gap: 8px; }
.dps-break-note { font-size: 11px; color: var(--dim); line-height: 1.4; }
.dps-break-card { background: var(--row-b); border: 1px solid var(--gold-border); border-radius: 4px; padding: 8px 10px; }
.dps-break-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--gold-dim); padding-bottom: 3px; margin-bottom: 4px; }
.dps-break-head b { font-size: 13px; }
.dps-break-total { color: var(--gold-bright); font-family: var(--mono); font-weight: bold; }
.dps-break-stats { font-size: 10.5px; color: var(--dim); font-family: var(--mono); margin-bottom: 4px; }
.dps-break-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--grid-fg); }
.dps-break-row span { flex: 1 1 auto; min-width: 0; }
.dps-break-row i { font-style: normal; font-size: 9px; color: var(--gold); text-transform: uppercase; }
.dps-break-row b { font-family: var(--mono); color: #fff; }

/* ---- compact responsive Offensive layout ---- */
.dps-compact {
  flex-direction: column; align-items: stretch; width: 100%; min-width: 0;
  padding: clamp(6px, .65vw, 12px); gap: clamp(8px, .65vw, 12px);
}
.dps-inputs {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: clamp(8px, .65vw, 12px); align-items: stretch; width: 100%; min-width: 0;
}
.dps-inputs > .section { min-width: 0; }
.dps-inputs > .section > .body { flex: 1 1 auto; min-width: 0; }
.dps-output {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(8px, .65vw, 12px); align-items: start; width: 100%; min-width: 0;
}
.dps-output > .section { min-width: 0; }
.dps-out-right { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
/* Keep champion fields readable; the grid adds/removes columns as room changes. */
.dps-compact .section > .body { padding: clamp(6px, .5vw, 9px); }
.dps-compact .dps-cards,
.dps-compact .dps-targets {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 295px), 1fr));
  gap: clamp(6px, .5vw, 10px);
}
.dps-compact .fxc-grid-wide {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 6px;
}
.dps-compact #cv-dps-curve { height: 200px; }
.dps-compact #cv-dps-bars { height: 150px; }
.dps-compact .sim-log { max-height: 300px; overflow-y: auto; }

@media (max-width: 1180px) {
  .dps-layout { flex-direction: column; }
  .dps-left, .dps-right { width: 100%; min-width: 0; }
  .dps-inputs, .dps-output { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding: 7px 10px; }
  .toolbar { flex: 1 1 100%; }
  .theme-pick { margin-left: 0; }
  .dps-add-bar { flex-wrap: wrap; }
  .dps-add-bar select { flex: 1 1 240px; }
  .dps-compact #cv-dps-curve { height: 180px; }
  .dps-compact #cv-dps-bars { height: 140px; }
}

@media (max-width: 560px) {
  .dps-compact .dps-cards,
  .dps-compact .dps-targets,
  .dps-compact .fxc-grid-wide { grid-template-columns: minmax(0, 1fr); }
  .dps-break-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .dps-break-total { overflow-wrap: anywhere; }
}

@media (max-width: 420px) {
  h1 { flex: 1 1 100%; }
  .page-tabs { margin-left: 0; }
  .page-tab { padding-inline: 10px; }
  .theme-pick { flex: 1 1 100%; }
  .theme-pick select { flex: 1 1 auto; min-width: 0; }
  .dps-add-bar { flex-direction: column; }
  .dps-add-bar select, .dps-add-bar button { width: 100%; flex-basis: auto; }
}

/* ---- kill sim (Offensive tab) ---- */
.sim-results { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.sim-toggles { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 11.5px; }
.sim-toggles b { font-size: 12px; }
.sim-toggle { display: inline-flex; align-items: center; gap: 4px; color: var(--grid-fg); cursor: pointer; }
.sim-toggle input { accent-color: var(--band); }
#cv-sim-timeline { width: 100%; height: 240px; }

/* ---- kill-sim sequencer ---- */
.sim-seq { display: flex; flex-wrap: wrap; gap: 4px; }
.sim-seq-btn { font-size: 11px; padding: 2px 10px; }
.sim-seq-clear { opacity: 0.75; }
.sim-chip { font-size: 11px; padding: 2px 9px; border-radius: 10px;
  background: var(--slot, var(--row-b)); border: 1px solid var(--gold-border);
  color: var(--gold-bright, var(--ink)); cursor: pointer; }
.sim-chip:hover { text-decoration: line-through; }
.sim-num { width: 52px; }
.sim-log { display: flex; flex-direction: column; gap: 2px; max-height: 340px;
  overflow-y: auto; border: 1px solid var(--gold-dim); border-radius: 4px;
  padding: 6px 8px; background: var(--row-a); }
.sim-log-row { font-size: 11px; }
.sim-log-t { flex: 0 0 52px; color: var(--dim); }
.sim-log-hp { flex: 0 0 72px; text-align: right; color: var(--dim); }
.sim-log .mono, .sim-log-t, .sim-log-hp { font-family: var(--mono); }

/* ---- combat sim v3: ability cards + console ---- */
.sim-abilities { margin-top: 6px; }
.sim-form-heading {
  grid-column: 1 / -1; padding: 5px 8px 3px;
  border-bottom: 1px solid var(--gold-border); color: var(--gold-bright);
  font: 600 12px/1.3 var(--font-head); letter-spacing: .06em;
  text-transform: uppercase;
}
.sim-abilities .fxc-name { font-size: 13px; letter-spacing: .01em; }
.sim-abilities .fxc-desc {
  margin: 4px 0 6px; color: var(--grid-fg); font: 11.5px/1.55 var(--font-ui);
}
.sim-abilities .fxc-val { font-family: var(--font-ui); }
.fxc-add { margin-left: auto; flex: 0 0 auto; }
.dps-targets .champ-row { cursor: pointer; }
.dps-cards .champ-row { cursor: pointer; }
.dps-cards .card-num, .dps-targets .card-num { min-width: 34px; font-size: 10px; }

/* Combo console: stronger type hierarchy and aligned damage columns. */
.sim-results { font-family: var(--font-ui); gap: 10px; }
.combo-matchup-card, .combo-result-card { padding: 10px 12px; }
.combo-matchup-head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 8px;
  padding-bottom: 7px; border-bottom: 1px solid var(--gold-dim);
  font: 15px/1.3 var(--font-head);
}
.combo-matchup-head > span { color: var(--dim); font: 10px var(--font-label); text-transform: uppercase; }
.combo-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 7px; padding-top: 8px; }
.combo-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.combo-fact > span, .combo-defense-control > span {
  color: var(--gold); font: 9px var(--font-label); text-transform: uppercase; letter-spacing: .05em;
}
.combo-fact > b { color: var(--grid-fg); font-size: 11px; overflow-wrap: anywhere; }
.combo-sequence {
  display: flex; flex-direction: column; gap: 6px; padding: 9px 10px;
  background: var(--row-b); border: 1px solid var(--gold-dim); border-radius: 4px;
}
.combo-sequence-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.combo-sequence-head b { color: var(--gold-bright); font: 12px var(--font-head); }
.combo-sequence-head span, .combo-sequence-empty { color: var(--dim); font-size: 10.5px; }
.combo-defense-control { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.combo-result-meta { color: var(--grid-fg); font: 11px/1.5 var(--font-ui); }
.combo-result-card .dps-break-total { color: var(--gold-bright); font-size: 12px; }
.sim-log { gap: 0; padding: 0; }
.sim-log-head, .sim-log-row {
  display: grid; grid-template-columns: 38px minmax(130px, 1fr) 70px minmax(120px, max-content) 78px;
  align-items: center; gap: 8px; width: 100%;
}
.sim-log-head {
  position: sticky; top: 0; z-index: 1; padding: 5px 8px;
  background: var(--panel-dark); color: var(--gold);
  border-bottom: 1px solid var(--gold-border); font: 9px var(--font-label);
  text-transform: uppercase; letter-spacing: .04em;
}
.sim-log-row { padding: 5px 8px; border-bottom: 1px solid var(--gold-dim); font-size: 11px; }
.sim-log-row:last-child { border-bottom: 0; }
.sim-log-label { min-width: 0; color: var(--grid-fg); font-weight: 600; overflow-wrap: anywhere; }
.sim-log-type { justify-self: start; }
.sim-log-damage { justify-self: end; color: #fff; font-family: var(--mono); white-space: nowrap; }
.sim-log-hp { justify-self: end; color: var(--gold-bright); white-space: nowrap; }
.combo-method-note {
  display: flex; flex-direction: column; gap: 4px; padding: 9px 10px;
  background: var(--row-b); border-left: 3px solid var(--gold-border);
  color: var(--grid-fg); font: 10.5px/1.5 var(--font-ui);
}
.combo-method-note b { color: var(--gold-bright); font: 11px var(--font-head); }
.combo-method-note span { display: block; }

@media (max-width: 600px) {
  .sim-log-head { display: none; }
  .sim-log-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    grid-template-areas: "number label hp" ". type damage";
    gap: 3px 8px; padding-block: 7px;
  }
  .sim-log-t { grid-area: number; }
  .sim-log-label { grid-area: label; }
  .sim-log-type { grid-area: type; }
  .sim-log-damage { grid-area: damage; }
  .sim-log-hp { grid-area: hp; }
}
