/* Raid Heatmap — healer performance analysis
   Surface is held at #0b0e13: the sequential ramp and the class-ink variants
   were contrast-checked against it. */

:root {
  --bg: #0b0e13;
  --surface-1: #10161f;
  --surface-2: #141c27;
  --surface-3: #1a2431;
  --line: #22303f;
  --line-soft: #1a2430;
  --fg: #e8edf4;
  --fg-dim: #9fb0c4;
  --fg-mute: #6a7b90;
  --accent: #3987e5;
  --accent-hi: #5598e7;
  --error: #d03b3b;
  --radius: 10px;
  --gap: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 24px 40px;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; }

header { padding: 22px 0 14px; }

.app-title {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--fg);
}

h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-mute);
}

code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

.hidden { display: none !important; }

.note { color: var(--fg-dim); font-size: 13px; }
.status { color: var(--fg-dim); font-size: 13px; margin-top: 10px; min-height: 1.2em; }
.error {
  margin-top: 10px; padding: 10px 12px; border-radius: var(--radius);
  background: rgba(208, 59, 59, .14); border: 1px solid rgba(208, 59, 59, .45); color: #ffd7d7;
}

/* ---------- panels & form ---------- */

.panel {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 0 0 14px;
}

.url-form { display: flex; gap: 10px; align-items: center; }
.url-form label {
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--fg-mute); white-space: nowrap;
}
.url-form input {
  flex: 1; padding: 10px 12px; font: inherit; font-size: 14px;
  background: var(--surface-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.url-form input::placeholder { color: var(--fg-mute); }
.url-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(57, 135, 229, .22); }

button, .btn-primary, .btn-ghost { font: inherit; }

.url-form button, .btn-primary {
  padding: 10px 16px; background: var(--accent); color: #fff;
  border: 1px solid var(--accent); border-radius: var(--radius);
  font-weight: 600; cursor: pointer;
}
.url-form button:hover, .btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn-primary[disabled] { opacity: .4; cursor: not-allowed; }

.btn-ghost {
  display: inline-block; text-align: center; padding: 9px 14px;
  background: var(--surface-3); color: var(--fg);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-weight: 600; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); }

/* ---------- report bar ---------- */

.report-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--gap); }
.stat {
  display: flex; align-items: baseline; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 7px 12px;
}
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-mute); }
.stat strong { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat code { color: var(--fg); }

/* ---------- controls ---------- */

.controls {
  display: grid; grid-template-columns: minmax(320px, 1.05fr) minmax(280px, 1fr);
  gap: var(--gap); align-items: start; margin-bottom: 18px;
}
.control-card {
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 14px; display: grid; gap: 10px; align-content: start;
}
.control-side { display: grid; gap: var(--gap); align-content: start; }
.control-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.control-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.control-card .note { margin: 0; }

.select-wrap { position: relative; display: grid; gap: 6px; }
.styled-select {
  appearance: none; -webkit-appearance: none;
  padding: 10px 34px 10px 12px; font: inherit; font-size: 14px;
  background: var(--surface-3); color: var(--fg);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-weight: 500; cursor: pointer;
}
.styled-select:focus { outline: none; border-color: var(--accent); }
.styled-select:disabled { opacity: .45; cursor: not-allowed; }
.select-wrap::after {
  content: '▾'; position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%); color: var(--fg-mute); pointer-events: none;
}

/* Chrome paints a multi-select listbox from the OS theme unless the options
   themselves are coloured. */
.fight-select { font-size: 13.5px; line-height: 1.4; padding: 6px; }
.fight-select, .fight-select optgroup { background-color: var(--surface-3); color: var(--fg); }
.fight-select option { background-color: var(--surface-3); color: var(--fg); padding: 5px 8px; border-radius: 4px; }
.fight-select option:checked { background: #17395f linear-gradient(0deg, #17395f, #17395f); color: #fff; font-weight: 600; }
.styled-select optgroup { background: var(--surface-2); color: var(--fg-mute); font-style: normal; font-weight: 600; }

/* ---------- chips ---------- */

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--surface-3); color: var(--fg-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 550;
  cursor: pointer; transition: border-color .12s, color .12s, background-color .12s;
}
.chip:hover { border-color: var(--accent); color: var(--fg); }
.chip.is-active { background: rgba(57, 135, 229, .18); border-color: var(--accent); color: #dbeaff; }
.chip[aria-pressed="true"]::before { content: '✓ '; opacity: .75; }

/* ---------- view switch ---------- */

.view-row { margin: 2px 0 14px; }
body[data-view="boss"] .metric-row,
body[data-view="boss"] #compare-legend,
body[data-view="boss"] #raid-grid,
body[data-view="boss"] #pool-section,
body[data-view="boss"] #metric-chart { display: none !important; }
body[data-view="target"] .boss-view { display: none; }
.boss-view { display: grid; gap: 12px; }

/* ---------- metric row & legend ---------- */

.metric-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.metric-row .chip-row + .chip-row { border-left: 1px solid var(--line); padding-left: 14px; }

.cpm-legend { display: flex; align-items: center; gap: 10px; color: var(--fg-dim); font-size: 13px; flex-wrap: nowrap; flex: 1 1 auto; }
.cpm-legend .legend-bar { flex: 0 1 260px; height: 8px; border-radius: 999px; border: 1px solid var(--line); }
.cpm-legend .legend-label { font-weight: 650; color: var(--fg); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cpm-legend .legend-unit { white-space: nowrap; color: var(--fg-mute); }

.compare-legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; font-size: 13px; font-weight: 600; }
.swatch-item { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ---------- raid grid ---------- */

.raid-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.raid-card {
  position: relative; min-height: 84px; padding: 10px 12px;
  background: var(--surface-2); color: #fff;
  border: 1px solid var(--line-soft); border-radius: 12px;
  box-shadow: inset 3px 0 0 var(--class-colour, transparent);
  user-select: none; cursor: grab;
  transition: transform .06s ease, border-color .12s ease, background-color .2s ease;
  --ink: #fff;
}
.raid-card:active { cursor: grabbing; }
.raid-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.raid-card.selected { outline: 2px solid var(--accent-hi); outline-offset: 1px; }
.raid-card .row { display: none; }

.raid-card .name {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  max-width: calc(100% - 24px);
  font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center; color: var(--ink); margin: 0;
}
.raid-card .value {
  position: absolute; right: 12px; top: 8px;
  font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink);
}
.raid-card .cpm-value { color: var(--ink); }
.raid-card .subvalue {
  position: absolute; right: 12px; bottom: 7px;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--ink); opacity: .7;
}

.raid-card.no-casts { background-color: var(--surface-2) !important; --ink: #64748b; }
.raid-card.no-casts .cpm-value { opacity: .7; }
.raid-card.excluded {
  background-color: var(--surface-2) !important; --ink: #64748b;
  border-style: dashed; border-color: var(--line);
}
.raid-card.excluded .subvalue { opacity: .55; }

/* drag states */
.raid-card.dragging { opacity: .6; pointer-events: none; transform: scale(.98); }
.raid-card.manual-drag { opacity: .6; transform: scale(.98); }
.raid-card.drop-target { box-shadow: inset 0 0 0 2px var(--accent-hi); }
.raid-card.drop-target::before {
  content: ''; position: absolute; inset: -2px; border: 2px solid var(--accent-hi);
  border-radius: 13px; pointer-events: none; z-index: 2;
}
.raid-card.placeholder {
  background: repeating-linear-gradient(135deg, #121923, #121923 10px, #0e141d 10px, #0e141d 20px);
  color: var(--fg-mute); border: 1px dashed var(--line); cursor: default; box-shadow: none;
}
.raid-card.placeholder::after {
  content: 'Empty'; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); font-size: 12px; font-weight: 600;
}
.raid-card.placeholder .name,
.raid-card.placeholder .value,
.raid-card.placeholder .subvalue,
.raid-card.placeholder .cpm-value { display: none; }
.raid-card.placeholder.drop-target::before { border-style: dashed; }

/* Sortable's temporary ghost would otherwise add a phantom slot */
.raid-grid[data-suppress-ghost="1"] .sortable-ghost,
.raid-grid[data-suppress-insert="1"] .drag-slot {
  position: absolute !important; width: 0 !important; height: 0 !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important;
  opacity: 0 !important; pointer-events: none !important;
}

.pool-section { margin-top: 14px; }
.pool-title { color: var(--fg-dim); font-size: 13px; margin: 0 0 8px; }
.pool-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; min-height: 20px; }

/* ---------- ranked bar chart ---------- */

.chart { margin-top: 20px; display: grid; gap: 10px; }
.chart-rows { display: grid; gap: 4px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 74px; align-items: center; gap: 12px; }
.bar-name {
  font-size: 13px; font-weight: 550; text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-track { position: relative; height: 16px; }
.bar-fill { display: block; height: 100%; border-radius: 0 3px 3px 0; min-width: 2px; }
.bar-stack { display: flex; gap: 2px; height: 100%; }
.bar-seg { display: block; height: 100%; min-width: 1px; }
.bar-stack .bar-seg:last-child { border-radius: 0 3px 3px 0; }
.bar-row:hover .bar-fill, .bar-row:hover .bar-seg { filter: brightness(1.18); }
.bar-value { font-size: 13px; font-weight: 650; color: var(--fg); font-variant-numeric: tabular-nums; }

/* ---------- per-boss matrix ---------- */

.matrix-wrap { overflow-x: auto; }
.mx-note, .mx-hint { margin: 0 0 6px; color: var(--fg-dim); font-size: 13px; }
.mx-hint strong { color: var(--fg); font-weight: 600; }

table.matrix { border-collapse: separate; border-spacing: 3px; width: 100%; }
table.matrix th, table.matrix td {
  padding: 9px 12px; text-align: right; font-size: 13.5px; white-space: nowrap;
}
table.matrix thead th {
  color: var(--fg-dim); font-weight: 500; vertical-align: bottom;
  background: var(--surface-2); border-radius: 8px;
}
table.matrix thead th.mx-corner { text-align: left; }
.mx-boss { display: block; color: var(--fg); font-weight: 600; font-size: 13.5px; }
.mx-sub { display: block; font-size: 10.5px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-mute); }
table.matrix tbody th.mx-row {
  text-align: left; font-weight: 600; background: var(--surface-2); border-radius: 8px;
}
table.matrix tbody th.mx-row .swatch { margin-right: 8px; vertical-align: -1px; }
table.matrix tbody td { border-radius: 8px; font-weight: 650; font-variant-numeric: tabular-nums; }
table.matrix td.mx-total { background: var(--surface-3); color: var(--fg); border: 1px dashed var(--line); }
table.matrix th.mx-total { color: var(--fg); font-weight: 600; }
table.matrix td.mx-empty { background: var(--surface-1); color: #3f4c5e; }

/* ---------- responsive ---------- */

@media (max-width: 920px) {
  .controls { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  body { padding: 0 14px 32px; }
  .raid-card { min-height: 74px; }
  .raid-card .name { font-size: 1rem; }
  .raid-card .value { font-size: 15px; }
  .raid-card .subvalue { font-size: 10.5px; }
}
@media (max-width: 600px) {
  .raid-grid, .pool-grid { gap: 5px; }
  .raid-card { min-height: 58px; padding: 7px; }
  .raid-card .name { font-size: .85rem; max-width: calc(100% - 8px); }
  .raid-card .value { font-size: 12px; right: 6px; top: 5px; }
  .raid-card .subvalue { display: none; }
  .bar-row { grid-template-columns: 88px 1fr 60px; gap: 8px; }
  .bar-name, .bar-value { font-size: 11px; }
}

/* ---------- deaths view ---------- */

body[data-view="deaths"] .metric-row,
body[data-view="deaths"] #compare-legend,
body[data-view="deaths"] #raid-grid,
body[data-view="deaths"] #pool-section,
body[data-view="deaths"] #metric-chart,
body[data-view="deaths"] .boss-view { display: none !important; }
body:not([data-view="deaths"]) .deaths-view { display: none; }
.deaths-view { display: grid; gap: 12px; }

.dt-group { margin-top: 16px; }
.dt-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.dt-boss { font-size: 14px; font-weight: 650; color: var(--fg); }
.dt-meta { font-size: 12px; color: var(--fg-mute); letter-spacing: .02em; }

table.deaths { border-collapse: separate; border-spacing: 0 3px; width: 100%; }
table.deaths thead th {
  text-align: right; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--fg-mute); padding: 0 12px 4px;
}
table.deaths thead th.dt-who, table.deaths thead th:nth-child(3) { text-align: left; }
table.deaths tbody tr { background: var(--surface-2); }
table.deaths tbody td, table.deaths tbody th {
  padding: 8px 12px; font-size: 13.5px; text-align: right;
  font-variant-numeric: tabular-nums; font-weight: 600;
}
table.deaths tbody th.dt-who { text-align: left; font-weight: 650; }
table.deaths tbody th.dt-who .swatch { margin-right: 8px; vertical-align: -1px; }
table.deaths tbody td.dt-time { color: var(--fg-dim); font-weight: 550; border-radius: 8px 0 0 8px; }
table.deaths tbody td.dt-ability { text-align: left; color: var(--fg-dim); font-weight: 550; }
table.deaths tbody td.dt-verdict { border-radius: 0 8px 8px 0; }

.tag {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em; white-space: nowrap;
}
.tag-prevent { background: rgba(250, 178, 25, .16); color: #fac84f; border: 1px solid rgba(250, 178, 25, .4); }
.tag-oneshot { background: rgba(120, 132, 150, .16); color: #9fb0c4; border: 1px solid rgba(120, 132, 150, .4); }
.tag-unclear { background: rgba(120, 132, 150, .08); color: var(--fg-mute); border: 1px dashed rgba(120, 132, 150, .35); }

/* ---------- spell breakdown ---------- */

.spells-view { margin-top: 20px; display: grid; gap: 10px; }
body[data-view="boss"] .spells-view, body[data-view="deaths"] .spells-view { display: none !important; }
.sp-grid { display: grid; grid-template-columns: minmax(360px, 1.6fr) minmax(220px, 1fr); gap: 18px; align-items: start; }

table.spells { border-collapse: separate; border-spacing: 0 3px; width: 100%; }
table.spells thead th {
  text-align: right; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--fg-mute); padding: 0 12px 4px;
}
table.spells thead th.sp-name { text-align: left; }
table.spells tbody tr { background: var(--surface-2); }
table.spells tbody th, table.spells tbody td {
  padding: 7px 12px; font-size: 13.5px; text-align: right;
  font-variant-numeric: tabular-nums; font-weight: 650;
}
table.spells tbody th.sp-name {
  text-align: left; font-weight: 600; color: var(--fg); border-radius: 8px 0 0 8px;
}
table.spells .sp-bar { width: 34%; padding: 7px 4px; }
.sp-track { display: block; height: 12px; }
.sp-fill { display: block; height: 100%; background: var(--accent); border-radius: 0 3px 3px 0; min-width: 2px; }
table.spells td.sp-else { color: var(--fg-dim); font-weight: 550; border-radius: 0 8px 8px 0; }
table.spells td.sp-none { color: var(--fg-mute); }

.sp-side { display: grid; gap: 14px; align-content: start; }
.sp-target { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 14px; }
.sp-target h3 { margin: 0 0 8px; font-size: 13px; font-weight: 650; color: var(--fg-dim); }
.sp-target h3 .swatch { margin-right: 6px; vertical-align: -1px; }
.sp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.sp-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.sp-list li span { color: var(--fg-dim); }
.sp-list li strong { font-variant-numeric: tabular-nums; }
.sp-hint { margin: 0; }

@media (max-width: 920px) { .sp-grid { grid-template-columns: 1fr; } }
.mx-att { margin-left: 8px; font-size: 11px; font-weight: 600; color: var(--fg-mute); font-variant-numeric: tabular-nums; }
table.deaths td.dt-win { color: var(--fg-dim); font-weight: 550; }
.raid-card.absent { display: none !important; }

/* ---------- death causes ---------- */
.cause-group { margin-top: 18px; }
.cause-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cause { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 11px 14px; }
.cause-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cause-name { font-size: 14px; font-weight: 650; color: var(--fg); }
.cause-count { font-size: 12px; color: var(--fg-mute); font-variant-numeric: tabular-nums; }
.cause-link { margin-left: auto; font-size: 12px; color: var(--accent); text-decoration: none; }
.cause-link:hover { text-decoration: underline; }
.cause-desc { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--fg-dim); }
.cause-pending { color: var(--fg-mute); font-style: italic; }
.mx-note a { color: var(--accent); }

/* ---------- damage taken ---------- */

body[data-view="damage"] .metric-row,
body[data-view="damage"] #compare-legend,
body[data-view="damage"] #raid-grid,
body[data-view="damage"] #pool-section,
body[data-view="damage"] #metric-chart,
body[data-view="damage"] .spells-view,
body[data-view="damage"] .boss-view,
body[data-view="damage"] .deaths-view { display: none !important; }
body:not([data-view="damage"]) .damage-view { display: none; }
.damage-view { display: grid; gap: 12px; }

.dmg-boss { margin-top: 18px; }
.dmg-track { height: 22px; margin: 4px 0 10px; }
.dmg-stack { display: flex; gap: 2px; height: 100%; min-width: 2px; }
.dseg { display: block; height: 100%; min-width: 2px; }
.dmg-stack .dseg:first-child { border-radius: 3px 0 0 3px; }
.dmg-stack .dseg:last-child { border-radius: 0 3px 3px 0; }
.dmg-track:hover .dseg { filter: brightness(1.12); }

.dmg-legend {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 20px;
}
.dmg-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dmg-legend .dl-name { color: var(--fg-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dmg-legend .dl-name a { color: var(--fg-dim); text-decoration: none; }
.dmg-legend .dl-name a:hover { color: var(--accent); text-decoration: underline; }
.dmg-legend .dl-val { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.dmg-legend .dl-pct { width: 46px; text-align: right; color: var(--fg-mute); font-variant-numeric: tabular-nums; }

/* ability filtering in the damage legend */
.dmg-legend li.dl-row { cursor: pointer; border-radius: 6px; padding: 2px 6px; margin-left: -6px; }
.dmg-legend li.dl-row:hover { background: var(--surface-3); }
.dmg-legend li.dl-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dmg-legend li.dl-hidden { opacity: .5; }
.dmg-legend li.dl-hidden .swatch { border: 1px dashed var(--line); }
.dmg-legend li.dl-hidden .dl-name { text-decoration: line-through; }
.dmg-legend li.dl-hidden .dl-pct { color: var(--fg-mute); font-style: italic; }
.dl-only {
  margin-left: 8px; padding: 1px 7px; font: inherit; font-size: 11px; font-weight: 600;
  background: transparent; color: var(--fg-mute); border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer; opacity: 0;
}
.dmg-legend li.dl-row:hover .dl-only, .dl-only:focus-visible { opacity: 1; }
.dl-only:hover { color: var(--accent); border-color: var(--accent); }
.dl-reset {
  margin-left: 10px; padding: 3px 10px; font: inherit; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--fg-dim);
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.dl-reset:hover { border-color: var(--accent); color: var(--fg); }

/* ---------- damage over time ---------- */
.dmg-opts { display: grid; gap: 8px; }
.tl-pick { max-width: 340px; }

.tl-chart { display: flex; gap: 10px; margin: 10px 0 2px; }
.tl-axis {
  display: flex; flex-direction: column; justify-content: space-between;
  width: 62px; text-align: right; font-size: 11px; color: var(--fg-mute);
  font-variant-numeric: tabular-nums; height: 240px;
}
.tl-plot {
  position: relative; flex: 1; height: 240px; display: flex; align-items: flex-end; gap: 1px;
  background: var(--surface-1); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 0 2px; overflow: hidden;
}
.tcol { flex: 1 1 0; display: flex; flex-direction: column-reverse; height: 100%; justify-content: flex-start; min-width: 0; }
.tseg { display: block; width: 100%; }
.tl-grid { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); pointer-events: none; }
.tl-plot:hover .tcol:hover { outline: 1px solid rgba(255,255,255,.35); outline-offset: -1px; }
.tl-ticks { position: relative; height: 16px; margin-left: 72px; font-size: 11px; color: var(--fg-mute); font-variant-numeric: tabular-nums; }
.tl-ticks span { position: absolute; transform: translateX(-50%); }

.tl-legend li { gap: 8px; }
.tl-tag { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 6px; border-radius: 999px; }
.tl-aoe { background: rgba(57,135,229,.18); color: #9fc6f5; border: 1px solid rgba(57,135,229,.4); }
.tl-st { background: rgba(120,132,150,.14); color: var(--fg-mute); border: 1px solid rgba(120,132,150,.35); }
.tl-school { font-size: 11px; color: var(--fg-mute); min-width: 84px; }
.tl-legend { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }

/* smooth stacked areas */
.tl-plot { padding: 0; }
.tl-svg { width: 100%; height: 100%; display: block; }
.tl-rule { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tl-hit { fill: transparent; }
.tl-hit:hover { fill: rgba(255,255,255,.07); }

/* phase ribbon + zoom brush */
.tl-phases { position: relative; height: 22px; margin-left: 72px; margin-bottom: 2px; }
.tl-phase {
  position: absolute; top: 0; height: 20px; padding: 0 8px; overflow: hidden;
  background: var(--surface-3); color: var(--fg-dim);
  border: 1px solid var(--line); border-radius: 5px;
  font: inherit; font-size: 11px; font-weight: 600; line-height: 18px;
  white-space: nowrap; text-overflow: ellipsis; text-align: left; cursor: pointer;
}
.tl-phase:hover { border-color: var(--accent); color: var(--fg); }
.tl-phase.tl-int { background: rgba(201,133,0,.16); border-color: rgba(201,133,0,.45); color: #e2b15c; }
.tl-phase-line { stroke: rgba(255,255,255,.28); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.tl-plot { position: relative; touch-action: none; cursor: crosshair; }
.tl-brush {
  position: absolute; top: 0; bottom: 0; pointer-events: none;
  background: rgba(57,135,229,.22); border-left: 1px solid var(--accent-hi);
  border-right: 1px solid var(--accent-hi);
}

/* direct band labels + school-grouped legend */
.tl-label {
  position: absolute; transform: translate(-50%, -50%); pointer-events: none;
  font-size: 11px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.tl-legends { display: grid; gap: 14px; margin-top: 12px; }
.tl-group { border-left: 2px solid var(--line); padding-left: 12px; }
.tl-school-head {
  display: flex; align-items: center; gap: 8px; margin: 0 0 6px;
  font-size: 12px; font-weight: 650; color: var(--fg); letter-spacing: .01em;
}
.tl-school-sum { color: var(--fg-mute); font-weight: 500; font-variant-numeric: tabular-nums; }
.tl-other { background: rgba(120,132,150,.14); color: var(--fg-mute); border: 1px dashed rgba(120,132,150,.4); }

/* enemy cast markers */
.tl-cast { stroke-width: 1.5; vector-effect: non-scaling-stroke; opacity: .85; }
.tl-cast:hover { stroke-width: 3; opacity: 1; }
.tl-castlab {
  position: absolute; top: 3px; transform: translateX(-50%) rotate(-90deg) translateX(-100%);
  transform-origin: left top; pointer-events: none; font-size: 10px; font-weight: 700;
  letter-spacing: .01em; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.cast-panel { margin-top: 12px; display: grid; gap: 10px; }
.cast-group .tl-school-head { gap: 10px; margin-bottom: 6px; }
.cast-chip .swatch { width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.cast-n { color: var(--fg-mute); font-weight: 500; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* heal absorbs */
.tl-ha { background: rgba(230,75,95,.16); color: #f59aa7; border: 1px solid rgba(230,75,95,.45); }

/* band labels sit on a backdrop so they read on any band, including where they overhang */
.tl-label { background: rgba(11,14,19,.62); padding: 1px 6px; border-radius: 4px; text-shadow: none; }

/* averaging pulls */
.avg-panel { display: grid; gap: 8px; margin: 6px 0 10px; }
.avg-chip { display: inline-flex; align-items: center; gap: 6px; cursor: default; }
.avg-chip.is-kill { border-color: rgba(24,163,92,.55); }
.avg-x { background: none; border: 0; color: var(--fg-mute); font: inherit; font-size: 14px; line-height: 1; cursor: pointer; padding: 0 2px; }
.avg-x:hover { color: #ff8f8f; }
.avg-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.avg-add .dl-reset { margin-left: 0; }
.avg-url { flex: 1 1 340px; min-width: 260px; padding: 6px 10px; font: inherit; font-size: 13px;
  background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; }
.avg-url:focus { outline: none; border-color: var(--accent); }
.avg-warn { color: #e2b15c; }

/* heavy points */
.tl-peak {
  position: absolute; transform: translate(-50%, -125%); pointer-events: auto; cursor: help;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: #ff4d6d; color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface-1);
}
.tl-peak-inline { position: static; transform: none; display: inline-block; margin-right: 8px; box-shadow: none; }
.peak-list { margin-top: 10px; }
.peak-list ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.peak-list li { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; background: var(--surface-2); cursor: pointer; font-size: 13px; }
.peak-list li:hover { outline: 1px solid var(--accent); }
.pk-val { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 72px; }
.pk-src { color: var(--fg-dim); }
.tl-peak.tl-peak-top { transform: translate(-50%, 3px); }

/* casts drawn from several pulls at once: faint, so clusters read as density */
.tl-cast.tl-cast-multi { opacity: .38; stroke-width: 1.2; }
.chip[disabled] { opacity: .4; cursor: not-allowed; }
