/* Damage calculator. Blue side / red side frame the two champions; damage colors follow
   the game's convention (physical orange, magic violet, true dark); magenta marks anything
   the user edited by hand. */

:root {
  --paper: #eef1f5;
  --panel: #ffffff;
  --ink: #16203a;
  --muted: #5e687b;
  --rule: #d6dce5;
  --soft: #f5f7fa;
  --blue-side: #2d6cdf;
  --red-side: #d2433a;
  --physical: #e07b1f;
  --magic: #7b4fd9;
  --true: #3d4352;
  --edited: #c21b7a;
  --alive: #2f9e6e;
  --shield: #b9c2cf;
  --font: 'Barlow Semi Condensed', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'Barlow', system-ui, sans-serif;
  --radius: 6px;
  --slot-bg: #e3e8ef;
  color-scheme: light;
}

/* Dark theme: follows the system unless the user picked light, or picked dark explicitly. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #121826; --panel: #1a2233; --ink: #e6eaf2; --muted: #94a0b5; --rule: #2c3649; --soft: #222b3d;
    --blue-side: #5b8ef0; --red-side: #ef6a60; --physical: #f09040; --magic: #9c7bf0; --true: #c9ced8;
    --edited: #e85aa8; --alive: #3fb884; --shield: #5c677a; --slot-bg: #222b3d; color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #121826; --panel: #1a2233; --ink: #e6eaf2; --muted: #94a0b5; --rule: #2c3649; --soft: #222b3d;
  --blue-side: #5b8ef0; --red-side: #ef6a60; --physical: #f09040; --magic: #9c7bf0; --true: #c9ced8;
  --edited: #e85aa8; --alive: #3fb884; --shield: #5c677a; --slot-bg: #222b3d; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 var(--font-body);
}
h1, h2, h3, h4 { font-family: var(--font); margin: 0; line-height: 1.15; }
.num, b, .hit-num, input[type='number'] { font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue-side); outline-offset: 2px; }

/* ───── Top bar ───── */
.topbar {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; justify-content: space-between;
  padding: 14px 20px 10px;
}
.brand { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-controls { display: flex; flex-wrap: wrap; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.field > span { font-family: var(--font); font-weight: 500; }
.field.inline select, .field.inline input { min-width: 90px; }
.field.grow { flex: 1; min-width: 0; }
select, input[type='number'], input:not([type]), input[list] {
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel);
  padding: 5px 8px; min-height: 32px; color: var(--ink); width: 100%;
}
input[type='range'] { width: 100%; accent-color: var(--ink); }

/* ───── Combo bar (the target's health) ───── */
.combo {
  position: sticky; top: 0; z-index: 5;
  background: var(--paper);
  padding: 8px 20px 12px;
  border-bottom: 1px solid var(--rule);
}
.combo-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin-bottom: 8px; }
.target { display: flex; align-items: center; gap: 10px; }
.target strong { font-family: var(--font); font-size: 18px; display: block; }
.target .num { color: var(--muted); font-size: 13px; }
.shield-note { color: var(--muted); font-size: 13px; }
.verdict { margin: 0; font-family: var(--font); font-size: 22px; font-weight: 600; }
.verdict.kill { color: var(--red-side); }
.verdict span { font-size: 15px; font-weight: 500; color: var(--muted); }
.combo-total { margin-left: auto; font-family: var(--font); color: var(--muted); }
.combo-total b { color: var(--ink); font-size: 20px; }
.combo-empty { margin: 0; color: var(--muted); }
.bar {
  display: flex; height: 28px; border-radius: 4px; overflow: hidden;
  background: linear-gradient(var(--alive), var(--alive));
  box-shadow: inset 0 0 0 1px rgba(22, 32, 58, 0.15);
}
.bar .shield { background: var(--shield); }
.bar .seg { border-right: 2px solid var(--paper); min-width: 2px; }
.seg.type-physical, .swatch.type-physical, .type-physical > .swatch { background: var(--physical); }
.seg.type-magic, .swatch.type-magic, .type-magic > .swatch { background: var(--magic); }
.seg.type-true, .swatch.type-true, .type-true > .swatch { background: var(--true); }
.combo-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; counter-reset: c; }
.combo-list li {
  counter-increment: c; display: flex; align-items: center; gap: 4px;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 999px; padding: 1px 4px 1px 10px; font-size: 13px;
}
.combo-list li::before { content: counter(c); font-family: var(--font); font-weight: 700; color: var(--muted); margin-right: 2px; }
.combo .ghost { margin-top: 6px; }

/* ───── Board ───── */
.board {
  display: grid; gap: 16px; padding: 16px 20px 40px;
  grid-template-columns: minmax(270px, 330px) minmax(0, 1fr) minmax(270px, 330px);
  align-items: start;
}
.side { background: var(--panel); border-radius: var(--radius); padding: 14px; border-top: 4px solid; }
.side-a { border-top-color: var(--blue-side); }
.side-b { border-top-color: var(--red-side); }
.side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.side-head h2 { font-size: 20px; }
.side-a .side-head h2 { color: var(--blue-side); }
.side-b .side-head h2 { color: var(--red-side); }
.champ-row { display: flex; align-items: end; gap: 10px; margin-bottom: 10px; }
.portrait { width: 52px; height: 52px; border-radius: var(--radius); background: var(--soft); flex: none; }
.portrait.small { width: 40px; height: 40px; }
.row { display: flex; gap: 12px; margin-bottom: 6px; }
.row .field b { color: var(--ink); }

.block { border-top: 1px solid var(--rule); padding: 10px 0 4px; margin-top: 6px; }
.block > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.block > summary::-webkit-details-marker { display: none; }
.block > summary::after { content: '+'; margin-left: auto; color: var(--muted); font-weight: 600; }
.block[open] > summary::after { content: '−'; }
h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.block > summary h3 { margin: 0; }
.block[open] > summary { margin-bottom: 8px; }
.sub { font-family: var(--font); font-size: 13px; color: var(--muted); display: block; margin: 6px 0 2px; }
.hint, .note { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }

.ranks { display: flex; gap: 8px; }
.rank { display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: var(--font); font-weight: 600; flex: 1; }
.rank select { text-align: center; }

.items { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 4px; }
.items li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.items li span { flex: 1; }
.icon { width: 26px; height: 26px; border-radius: 4px; background: var(--soft); flex: none; }

.runes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rune-col { display: flex; flex-direction: column; gap: 5px; }
.buffs { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.check.small { font-size: 13px; }
.dragons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 8px; align-items: end; }
.dragons .sub { grid-column: 1 / -1; }
.drake { display: flex; flex-direction: column; font-size: 12.5px; color: var(--muted); gap: 2px; }

.x {
  border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1;
  width: 22px; height: 22px; border-radius: 50%;
}
.x:hover { background: var(--soft); color: var(--ink); }
.ghost {
  border: 1px solid var(--rule); background: var(--panel); border-radius: var(--radius); padding: 3px 10px; cursor: pointer;
  font-family: var(--font); font-weight: 500;
}
.ghost:hover { border-color: var(--ink); }

/* Stats: edited values are marked in magenta */
.stats { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats th { text-align: left; font-weight: 500; color: var(--muted); padding: 3px 6px 3px 0; line-height: 1.2; }
.stats td { padding: 2px 0; }
.stats { table-layout: fixed; }
.stats th { width: 44%; white-space: normal; }
.stats td:nth-child(2) { width: 84px; position: relative; }
.stats input { min-height: 28px; padding: 3px 6px; text-align: right; }
.stats .unit { position: absolute; right: -12px; top: 7px; font-size: 12px; color: var(--muted); }
.stats .parts { padding-left: 16px; white-space: nowrap; }
.split { font-size: 12px; color: var(--muted); }
.stats tr.edited th { color: var(--edited); font-weight: 600; }
.stats tr.edited input { border-color: var(--edited); box-shadow: inset 3px 0 0 var(--edited); }

/* Effects */
.effect { padding: 8px 0; border-top: 1px dashed var(--rule); }
.effect.off strong { color: var(--muted); }
.effect-head { display: flex; align-items: center; gap: 8px; }
.effect-opts { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 6px 0 0 24px; }
.opt { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.opt input { width: 70px; min-height: 26px; padding: 2px 6px; }
.effect .note { margin: 4px 0 0 24px; }
.tag { font-size: 11.5px; border-radius: 999px; padding: 0 8px; background: var(--soft); color: var(--muted); border: 1px solid var(--rule); }
.tag.needsData { color: var(--red-side); border-color: currentColor; }
.values { margin: 4px 0 0 24px; font-size: 13px; }
.values summary { cursor: pointer; color: var(--muted); }
.value-grid { display: grid; gap: 4px; margin-top: 4px; }
.value { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 4px; padding-left: 8px; border-left: 3px solid var(--alive); }
.value input { width: 70px; min-height: 24px; padding: 1px 5px; }
.value.origin-default { border-left-color: var(--physical); }
.value.origin-user { border-left-color: var(--edited); }
.value span { color: var(--muted); }

/* ───── Results ───── */
.results { min-width: 0; }
.results > h2 { font-size: 20px; margin: 2px 0 10px; }
.group { background: var(--panel); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.group > h3 { margin-bottom: 4px; }
.ability { padding: 6px 0; border-top: 1px solid var(--rule); }
.ability:first-of-type { border-top: 0; }
.ability h4 { font-size: 16px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.ability h4 small { font-weight: 400; color: var(--muted); font-size: 13px; }
.ability.muted p { margin: 0; color: var(--muted); font-size: 13px; }
.slot {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 4px;
  background: var(--ink); color: var(--panel); font-size: 13px; font-weight: 700;
}

.hit {
  display: grid; grid-template-columns: 6px minmax(0, 1fr) auto 60px auto; align-items: center; gap: 4px 12px;
  padding: 6px 0;
}
.hit .swatch { width: 6px; align-self: stretch; border-radius: 3px; }
.hit-name { display: flex; flex-direction: column; min-width: 0; }
.hit-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit-name small { color: var(--muted); font-size: 12.5px; }
.hit-num { text-align: right; display: flex; flex-direction: column; }
.hit-num b { font-family: var(--font); font-size: 22px; font-weight: 700; line-height: 1; }
.hit-num small { color: var(--muted); font-size: 12px; }
.hit-pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.hit-combo { display: flex; align-items: center; gap: 4px; }
.hit-combo button {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--rule); background: var(--panel); cursor: pointer; font-weight: 700;
}
.hit-combo button:hover { border-color: var(--ink); }
.hit.inactive { opacity: 0.55; }
.warn {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; margin-left: 4px;
  background: var(--physical); color: #fff; font-size: 11px; font-weight: 700; cursor: help; vertical-align: 1px;
}
.hit-name > span:first-child { display: inline-flex; align-items: center; gap: 4px; }
.steps { grid-column: 2 / -1; font-size: 13px; color: var(--muted); }
.steps summary { cursor: pointer; width: fit-content; }
.steps ol { margin: 4px 0 0; padding-left: 18px; }
.steps b { color: var(--ink); }
.aa-summary { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.aa-summary b { color: var(--ink); font-size: 16px; }
.onhit { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.onhit li { display: flex; align-items: center; gap: 6px; }
.onhit .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.empty, .status { color: var(--muted); padding: 0 20px; }

/* ───── Small screens ───── */
@media (max-width: 1100px) {
  .board { grid-template-columns: 1fr 1fr; }
  .results { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 680px) {
  .topbar, .combo, .board { padding-left: 12px; padding-right: 12px; }
  .board { grid-template-columns: 1fr; }
  .results { order: 2; }
  .side-b { order: 3; }
  .hit { grid-template-columns: 6px minmax(0, 1fr) auto auto; }
  .hit-pct { display: none; }
  .runes { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

.ability-inputs { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 2px 0 4px 30px; }
.tag.notLearned { font-style: italic; }

/* ───── Compact side summary ───── */
.theme-btn { min-height: 32px; min-width: 70px; }
.hp-inputs { display: flex; align-items: center; gap: 6px; }
.hp-inputs input[type='number'] { width: 72px; flex: none; min-height: 26px; padding: 2px 6px; }
.ranks { margin: 4px 0 10px; }
.loadout { display: grid; gap: 6px; padding: 8px 0; border-top: 1px solid var(--rule); }
.item-slots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.item-slot {
  position: relative; aspect-ratio: 1; border-radius: 4px; background: var(--slot-bg); border: 1px solid var(--rule);
  padding: 0; overflow: hidden; cursor: pointer; display: grid; place-items: center;
}
.item-slot.empty { cursor: default; border-style: dashed; }
.item-slot:not(.empty):hover::after {
  content: '×'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 18px;
}
.item-icon { width: 100%; height: 100%; position: absolute; inset: 0; }
.item-fallback, .rune-fallback { font-family: var(--font); font-size: 12px; color: var(--muted); }
.item-add { min-height: 28px; }
.rune-summary {
  display: flex; align-items: center; gap: 3px; flex-wrap: wrap; border: 0; background: none; padding: 2px 0; cursor: pointer; text-align: left;
}
.rune { position: relative; display: grid; place-items: center; border-radius: 50%; background: var(--slot-bg); overflow: hidden; }
.rune.keystone { width: 34px; height: 34px; }
.rune.minor { width: 22px; height: 22px; }
.rune.shard { width: 16px; height: 16px; }
.rune-icon { position: absolute; inset: 0; width: 100%; height: 100%; }
.rune-gap { width: 6px; }
.stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 10px; padding: 8px 0 4px; border-top: 1px solid var(--rule);
}
.stat { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; padding: 1px 0; }
.stat span { color: var(--muted); }
.stat b { font-family: var(--font); font-size: 15px; }
.stat.edited span, .stat.edited b { color: var(--edited); }

/* ───── Ability info ───── */
.info { margin: 2px 0 4px 30px; font-size: 13px; }
.info > summary { cursor: pointer; color: var(--muted); width: fit-content; }
.info .tooltip, .info .ability-note { margin: 6px 0 0; max-width: 72ch; line-height: 1.45; }
.info .ability-note { border-left: 3px solid var(--blue-side); padding-left: 8px; }
.info .tooltip { color: var(--ink); }

/* ───── Combo reorder ───── */
.combo-list li { cursor: grab; }
.combo-list li.dragging { opacity: 0.5; }
.nudge { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 15px; line-height: 1; }
.nudge:disabled { opacity: 0.3; cursor: default; }
.nudge:hover:not(:disabled) { color: var(--ink); }

/* ───── Report ───── */
.primary {
  background: var(--blue-side); color: #fff; border: 0; border-radius: var(--radius);
  padding: 7px 14px; font-family: var(--font); font-weight: 600; cursor: pointer;
}
.primary:hover { filter: brightness(1.08); }
body.report-open { overflow: hidden; }
.report {
  position: fixed; inset: 0; z-index: 50; overflow: auto; background: var(--paper);
  /* chart series: reference categorical slots 1–4 (blue, orange, aqua, yellow), validated adjacent */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .report { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; }
}
:root[data-theme='dark'] .report { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; }
.rp-toolbar {
  position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--rule);
}
.rp-hint { color: var(--muted); font-size: 13px; }
.rp-close { margin-left: auto; }
.rp-page {
  max-width: 860px; margin: 20px auto 60px; padding: 32px 36px; background: var(--panel);
  border-radius: var(--radius); border: 1px solid var(--rule);
}
.rp-head { border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 18px; }
.rp-head h1 { font-size: 28px; }
.rp-head p { margin: 4px 0 0; color: var(--muted); }
.rp-block { margin: 0 0 26px; }
.rp-sides, .rp-chart { break-inside: avoid; }
.rp-block h2 { font-size: 19px; margin-bottom: 8px; }
.rp-sub { margin: -2px 0 8px; color: var(--muted); font-size: 13px; }
.rp-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rp-side { border-top: 3px solid var(--blue-side); padding-top: 10px; min-width: 0; }
.rp-side.red { border-top-color: var(--red-side); }
.rp-champ { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.rp-champ h3 { font-size: 18px; }
.rp-champ span { color: var(--muted); font-size: 13px; }
.rp-list { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0 0 8px; font-size: 13px; }
.rp-list dt { color: var(--muted); }
.rp-list dd { margin: 0; }
.rp-stats { width: 100%; border-collapse: collapse; font-size: 13px; }
.rp-stats th { text-align: left; color: var(--muted); font-weight: 500; padding: 2px 4px 2px 0; }
.rp-stats td { text-align: right; padding: 2px 10px 2px 0; font-variant-numeric: tabular-nums; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rp-table th, .rp-table td { padding: 5px 8px; border-bottom: 1px solid var(--rule); text-align: left; }
.rp-table th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.rp-table .n { text-align: right; font-variant-numeric: tabular-nums; }
.rp-table tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
.rp-table.compact { margin-top: 6px; font-size: 12.5px; }
.rp-verdict { margin: 0 0 8px; font-family: var(--font); font-size: 17px; }
.rp-verdict.kill { color: var(--alive); font-weight: 700; }
.swatch-inline { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--physical); }
.swatch-inline.type-magic { background: var(--magic); }
.swatch-inline.type-true { background: var(--true); }
.rp-controls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px; margin-bottom: 10px; background: var(--soft); border-radius: var(--radius); font-size: 13px; }
.rp-controls select, .rp-controls input { padding: 4px 6px; border: 1px solid var(--rule); border-radius: 4px; background: var(--panel); }
.rp-variants { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.rp-variant { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rp-variant input { min-width: 200px; }
.rp-variant .x { border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--muted); }
.rp-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; margin-bottom: 4px; }
.sw { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; background: var(--s1); }
.sw.s2 { background: var(--s2); } .sw.s3 { background: var(--s3); } .sw.s4 { background: var(--s4); }
.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; font-family: var(--font-body); }
.chart-svg .grid { stroke: var(--rule); stroke-width: 1; }
.chart-svg .axis { stroke: var(--muted); stroke-width: 1; }
.chart-svg .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-svg .axis-label { fill: var(--muted); font-size: 12px; }
.chart-svg .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke: var(--s1); }
.chart-svg .s2.ln { stroke: var(--s2); } .chart-svg .s3.ln { stroke: var(--s3); } .chart-svg .s4.ln { stroke: var(--s4); }
.chart-svg .pt { fill: var(--s1); stroke: var(--panel); stroke-width: 2; }
.chart-svg .pt.s2 { fill: var(--s2); } .chart-svg .pt.s3 { fill: var(--s3); } .chart-svg .pt.s4 { fill: var(--s4); }
.chart-svg .dot { fill: var(--s1); } .chart-svg .dot.s2 { fill: var(--s2); } .chart-svg .dot.s3 { fill: var(--s3); } .chart-svg .dot.s4 { fill: var(--s4); }
.chart-svg .end-label { fill: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-svg .marker { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart-svg .crosshair { stroke: var(--muted); stroke-width: 1; }
.chart-svg .hit-area { fill: transparent; }
.chart-tip {
  position: absolute; top: 8px; pointer-events: none; background: var(--panel); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 6px 9px; font-size: 12.5px; box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
  display: flex; flex-direction: column; gap: 2px; min-width: 170px;
}
.chart-tip span { display: flex; align-items: center; gap: 4px; }
.chart-tip span b { margin-left: auto; padding-left: 10px; }
.rp-notes textarea { width: 100%; padding: 8px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); resize: vertical; }
.rp-foot { color: var(--muted); font-size: 12px; border-top: 1px solid var(--rule); padding-top: 8px; }
.print-only { display: none; }
@media (max-width: 680px) {
  .rp-page { padding: 18px 16px; margin: 10px 8px 40px; }
  .rp-sides { grid-template-columns: 1fr; }
  .rp-table.compact { font-size: 11.5px; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  :root, :root[data-theme='dark'] {
    --paper: #fff; --panel: #fff; --ink: #16203a; --muted: #5e687b; --rule: #d6dce5; --soft: #f5f7fa;
    --blue-side: #2d6cdf; --red-side: #d2433a; --physical: #e07b1f; --magic: #7b4fd9; --true: #3d4352; --alive: #2f9e6e;
    color-scheme: light;
  }
  .report, :root[data-theme='dark'] .report { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; }
  body.report-open > :not(.report) { display: none !important; }
  body.report-open { overflow: visible; }
  .report { position: static; overflow: visible; }
  .no-print, .chart-tip, .chart-svg .hover { display: none !important; }
  .print-only { display: block; }
  .rp-page { max-width: none; margin: 0; padding: 0; border: 0; }
  .rp-sides, .rp-chart { break-inside: avoid; }
  .rp-table tr { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.chart-tip[hidden] { display: none; }
.rp-controls label { display: flex; align-items: center; gap: 6px; }
.rp-controls label select { max-width: 280px; }
.rp-variants { align-items: flex-start; }
.rp-table td:nth-child(2) { white-space: nowrap; }
.rp-table th::first-letter { text-transform: uppercase; }
.rp-stats td { white-space: nowrap; }
.rp-stats th { white-space: nowrap; }
.rp-controls label { white-space: nowrap; }
.rp-variant select, .rp-variant input { width: auto; flex: 0 1 auto; }
.rp-variant select { max-width: 260px; }

/* ───── Report: credit, sections, builds, gold ───── */
.rp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.rp-brand { text-align: right; font-family: var(--font); font-weight: 700; font-size: 15px; white-space: nowrap; }
.rp-brand span { font-weight: 500; color: var(--muted); font-size: 13px; }
.rp-foot a { color: inherit; }
.rp-sections { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 13px; color: var(--muted); }
.rp-sections .check { color: var(--ink); }
.rp-off { opacity: 0.35; }
.rp-build-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; padding: 10px; background: var(--soft); border-radius: var(--radius); font-size: 13px; }
.rp-build-editor > .ghost { align-self: flex-start; }
.rp-build { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.rp-build input, .rp-build select { padding: 4px 6px; border: 1px solid var(--rule); border-radius: 4px; background: var(--panel); width: auto; }
.rp-build-name { width: 150px !important; font-weight: 600; }
.rp-build label { display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.rp-build .x { border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--muted); margin-left: auto; }
.rp-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chip { border: 1px solid var(--rule); background: var(--panel); border-radius: 999px; padding: 2px 9px; font-size: 12.5px; cursor: pointer; }
.chip:hover { border-color: var(--red-side); }
.rp-items-small { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.delta { color: var(--muted); font-size: 11.5px; }
.rp-gold-head { font-size: 15px; margin: 10px 0 4px; }
.rp-path, .rp-path-cell { color: var(--muted); font-size: 12px; }
.rp-path-cell { white-space: normal; }
.rp-table.compact td:nth-child(2) { white-space: nowrap; }
.muted { color: var(--muted); }
@media print {
  .rp-off, .rp-empty-print { display: none !important; }
  .rp-builds .rp-build-editor { display: none; }
}

/* ───── Credit and patch status (main page) ───── */
.credit { font-family: var(--font); font-size: 14px; color: var(--muted); margin-top: 2px; }
.credit a { color: var(--ink); font-weight: 600; text-decoration: none; }
.credit a:hover { text-decoration: underline; }
.patch-status { font-size: 12.5px; color: var(--muted); margin-top: 3px; max-width: 360px; }
.patch-status.new { color: var(--red-side); font-weight: 600; }
.site-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 16px 28px; }
.site-foot a { color: inherit; }
.gold-panel { font-size: 13px; }
.gold-panel table { width: 100%; border-collapse: collapse; }
.gold-panel td { padding: 3px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.gold-panel td.n { text-align: right; white-space: nowrap; padding-left: 8px; font-variant-numeric: tabular-nums; }
.gold-panel .path { display: block; color: var(--muted); font-size: 11.5px; }
.gold-sum { display: flex; justify-content: space-between; margin: 4px 0 6px; font-weight: 600; }
#patch { width: auto; min-width: 130px; align-self: flex-start; }
.patch-status { max-width: 230px; }

/* ───── Healing and shields (preview) ───── */
.sustain-group { --heal: #1f9d6b; --shieldc: #2a78d6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .sustain-group { --heal: #34c48b; --shieldc: #5b9cf0; } }
:root[data-theme='dark'] .sustain-group { --heal: #34c48b; --shieldc: #5b9cf0; }
.hit.sustain .swatch { background: var(--heal); }
.hit.sustain.shield .swatch { background: var(--shieldc); }
.hit.sustain.heal .hit-num b { color: var(--heal); }
.hit.sustain.shield .hit-num b { color: var(--shieldc); }
.sustain-opts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 6px; font-size: 13px; }
.sustain-factors { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; font-size: 12.5px; }
.chip-static { border: 1px solid var(--rule); border-radius: 999px; padding: 2px 9px; }
.chip-static.good { border-color: var(--heal); }
.chip-static.bad { border-color: var(--red-side); }
.preview-tag { font-family: var(--font-body); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--edited); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 6px; vertical-align: middle; }
.disclaimer { display: inline-block; margin-top: 4px; font-size: 12px; }

/* ───── Damage breakdown ───── */
.steps ol { padding-left: 18px; margin: 6px 0 2px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.5; }
.steps li small { color: var(--muted); }
.bd-h { font-family: var(--font); font-weight: 600; margin-right: 4px; }
.bd-op { color: var(--muted); margin: 0 2px; }
.bd-final { border-top: 1px solid var(--rule); padding-top: 4px; }
.bonus-hp { display: block; font-size: 11px; font-weight: 500; color: var(--muted); line-height: 1; }
