:root {
  color-scheme: dark;
  --bg: #0b0d11;
  --panel: #13171d;
  --panel-2: #191e26;
  --line: #2a303a;
  --text: #edf1f7;
  --muted: #8e99a8;
  --cyan: #5ee2e8;
  --yellow: #ffd166;
  --red: #ff6b75;
  --green: #67d391;
  --orange: #ff9f43;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button, select, input {
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
}
button { cursor: pointer; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  padding: 0 24px;
  background: rgba(11, 13, 17, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand { font-weight: 750; font-size: 18px; letter-spacing: -.02em; }
.session-status { color: var(--muted); margin-right: auto; display: flex; gap: 8px; align-items: center; }
.session-status span { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.session-status.running span { background: var(--green); box-shadow: 0 0 10px rgba(103,211,145,.7); }
.session-status.replay_complete span { background: var(--cyan); }
.session-status.failed span { background: var(--red); }
main { width: 100%; margin: 18px 0 80px; }
.watch-panel {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
label span { white-space: nowrap; }
input, select { min-height: 38px; padding: 7px 10px; }
.report-field { flex: 1 1 360px; }
.check { display: flex; flex-direction: row; align-items: center; min-height: 38px; }
.check input { min-height: auto; }
.actions { display: flex; gap: 8px; }
button, a.ghost { min-height: 36px; padding: 7px 12px; text-decoration: none; }
.primary { background: var(--cyan); color: #071012; border-color: var(--cyan); font-weight: 700; }
.danger { color: var(--red); background: transparent; }
.ghost { color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 7px; }
.replay-options { display: flex; gap: 8px; }
.replay-options input { width: 110px; }
.hidden { display: none !important; }
/* Strict deterministic mode: no agent output exists, so no agent UI is shown. */
body.agents-disabled .agent-panel,
body.agents-disabled .agent-judgment,
body.agents-disabled .agent-button,
body.agents-disabled .badge[class*="route-"] { display: none !important; }
.form-error { flex-basis: 100%; color: var(--red); min-height: 0; }
.empty { margin: 80px auto; text-align: center; color: var(--muted); }
.pulls { display: grid; gap: 50px; margin-top: 12px; }
.pull-card { padding: 18px 24px; border: 1px solid var(--line); border-left: 0; border-right: 0; border-radius: 0; background: var(--panel); }
.pull-head, .agent-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.pull-number { font-weight: 780; font-size: 19px; }
.coverage-warning { color: var(--yellow); cursor: help; }
.pull-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); margin-top: 2px; }
.wcl-link { display: inline-flex; width: 18px; height: 18px; flex: 0 0 18px; border-radius: 3px; }
.wcl-link img { display: block; width: 18px; height: 18px; object-fit: contain; }
.wcl-link:hover { filter: brightness(1.2); }
.wcl-link:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.pull-badges { display: flex; flex-wrap: wrap; justify-content: end; gap: 6px; }
.badge { border-radius: 99px; padding: 3px 8px; font-size: 12px; color: var(--muted); background: var(--panel-2); }
.badge.source { color: var(--text, inherit); border: 1px solid var(--line); }
.badge.complete { color: var(--green); }
.badge.immediate { color: var(--yellow); }
.badge.failed { color: var(--red); }
.badge.route-deep { color: var(--red); }
.badge.route-standard { color: var(--orange); }
.badge.route-quick { color: var(--green); }
.agent-judgment { margin: 16px 0; padding: 12px 14px; background: #202019; border-left: 3px solid var(--yellow); border-radius: 4px; font-size: 15px; }
.findings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 0 0 8px; }
.finding { padding: 9px 11px; margin: 6px 0; background: var(--panel-2); border-radius: 6px; }
.finding.cause { border-left: 2px solid var(--red); }
.finding.issue { border-left: 2px solid var(--orange); }
.none { color: var(--muted); padding: 8px 0; }
details { margin-top: 12px; color: var(--muted); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 450px; overflow: auto; background: #0d1014; padding: 12px; border-radius: 6px; font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; color: #bdc6d2; }
.artifacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 10px; margin-top: 16px; }
.artifact { margin: 0; display: flex; flex-direction: column; background: #090b0e; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.artifact.timeline { grid-column: 1 / -1; }
.artifact-frame { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 80px; overflow: hidden; cursor: zoom-in; color: var(--muted); font-size: 12px; }
.artifact svg { display: block; width: 100%; height: auto; max-height: 680px; }
.artifact.timeline svg { max-width: 100%; max-height: 440px; }
.artifact figcaption { order: -1; padding: 9px 11px; color: var(--text); font-size: 13px; font-weight: 650; border-bottom: 1px solid var(--line); }
.agent-panel { margin-top: 16px; padding: 13px; background: #10141a; border: 1px solid var(--line); border-radius: 7px; }
.viewer-mode .evidence,
.viewer-mode .agent-panel,
.viewer-mode .pull-actions { display: none !important; }
.agent-status { color: var(--muted); font-size: 12px; }
.agent-details { margin-top: 8px; }
.agent-details summary { cursor: pointer; color: var(--muted); }
.agent-run-status { margin-left: 6px; font-size: 11px; }
.agent-output { margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.player-name { color: var(--player-color); font-weight: 800; }
.raid-marker-token { display: inline-block; width: 18px; height: 18px; margin: 0 2px; vertical-align: -4px; background: center / contain no-repeat; }
.raid-marker-cross { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABmJLR0QAMwAzADOGP0P2AAAB4ElEQVQ4EdXBT0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CgRoE7vMLXuEGCvY7Ni0ovGDz79sI4IUGCM5zjBVb4DSucosQOZjU351u9YHDxYymLTLFBggvMPbjCNRrkyDA94PaXQi8apJOJrHPvFi+RY44fsIsZWixxjDilvIt6weD9j2Z2EyJadEhxhS0WaFBig4CIN98d6wWDk9Mz4+BejhJbPMY+niB6UKHDTskHHx/qRYPR+FiKHDe4xOto0eCVBz/hAC1GgbePD/WiwXTvkX/VmOINBHRokaFBihwVkpRq/kgvGiTZiQbXqJCjRYsMJXJsEfESTxMcnelFg/X11PP1Vxajhb104dBGlxRCWlssa6PdTBZHZklm3USX3cT3fzxx1Iz9l/4Bro/BPOR3twoAAAAASUVORK5CYII="); }
.raid-marker-star { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABmJLR0QAMwAzADOGP0P2AAACTElEQVQ4EdXBS0jTARwH8B+CEXX0pB2kQxJEXSJPdSiSHmauTE1Qi7KsEUYYc1vlny2tjPLRNB/lo1IzN7fUvbS/U5uPzcdmEx2WNaZby+XUiT2osW/XIVgx6NDnQ/Rfidi6K+yksEp0qbjdXS7t1ml7BtKJKJSCFZ0k2BsvaPDmN/Zj+oN9RCKRRFGw9l2UXDguVvoLWkxwLSzYGYaJoKCEh284dkPmTMhTgZ10wjg+oaRgHeU/a0u+pYSwwQD7gtdfWv1kNwUjIbdWerpIi3NlOky5vVDpjYUUaE9c6mb6s5CMwpcWbjnrO1vWhVG7B62vDaMUSFQtqyKiUPqNRN6daF69/ufVp33Iqe+DxbkEdmR8ngJVdRoVhc2qPFrDjpjUjYIa7SAjNYCRDqJWb0XvWxdkbL+ZApUqOoVtYzZfpbzzASctLYwClDyq2yntHhoo0ZogbjFAJB9G89gM6vutkMheVVCgdC5vm3rS4WMnZzEwZfvSazJpdIbhGk3fUK/pvf37hHMeGosdD9lx1BmncVdpRonWhKx8SQytVtzCNikss3jj9MA25/E5PF7/mM3lt8x8xvTcIqyuRfS8c+NawyCuVHcju7J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aRS36aRJ1PY1QdTYhKuIQriREIzKci+GBbhhUDdAqKqFT1UOtkPmSL2Tm/K4ldmRYXFJdWY5jiHkOl32U/mqGZ2ocHrcDXipOp+0L7BYt+jpKIHmcZT95NOYChbD+qu59uw9yjRo5HFZC28ECr8uOyVE9vFTdDhqyzaIHI3szvXf7kR3z9lsoJzSEDKpQVZKPof5OjJkNEN9Npm1hwacuKV6X34Wa+TSzYQ1n5bwgPo932GLsR35WAvoYKUaHe5EmiIJ9zAimrRZFN+PxzajGIQ5/z7ygyGO8E48Lykh0xDlSePsJET94RsJDw4m4SEKyhbdI7IloUlxYQiKOpJ76FfQDRA5E9B5OOdQAAAAASUVORK5CYII="); }
.agent-error { color: var(--red); }
.pull-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
dialog { width: min(900px, calc(100% - 30px)); max-height: 80vh; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
dialog::backdrop { background: rgba(0,0,0,.72); }
.image-lightbox { width: 240px; height: 140px; min-width: 0; max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); padding: 0; overflow: hidden; }
.image-lightbox::backdrop { background: rgba(0,0,0,.9); }
.lightbox-head { height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 10px 7px 16px; border-bottom: 1px solid var(--line); }
.lightbox-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.lightbox-viewport { width: 100%; height: calc(100% - 50px); overflow: auto; background: #050608; cursor: grab; touch-action: none; }
.lightbox-viewport.dragging { cursor: grabbing; }
.lightbox-viewport svg { display: block; max-width: none; max-height: none; transform-origin: top left; user-select: none; -webkit-user-drag: none; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; }
.dialog-head h2 { margin: 0; }
.dialog-head p { color: var(--muted); }
.codex-current { padding: 10px; color: var(--cyan); }
.thread-list { display: grid; gap: 7px; overflow: auto; }
.thread { display: flex; gap: 10px; align-items: center; padding: 9px; background: var(--panel-2); border-radius: 6px; }
.thread .preview { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread code { color: var(--muted); }
@media (max-width: 1100px) {
  .findings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deaths-section { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 12px; }
  .pull-card { padding: 15px 12px; }
  .findings { grid-template-columns: 1fr; }
  .watch-panel > label, .replay-options { flex: 1 1 100%; }
  .replay-options { flex-wrap: wrap; }
}

/* Deaths: a tight log; hovering a row opens the death recap. */
.deaths-count { text-transform: none; letter-spacing: 0; font-weight: 500; }
.deaths { max-height: 340px; overflow: auto; font-size: 12px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.death-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.death-table td { padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.death-row { cursor: default; }
.death-row:hover, .death-row:focus-visible { background: var(--panel-2); outline: none; }
.death-row:focus-visible { box-shadow: inset 0 0 0 1px var(--cyan); }
.death-time { width: 40px; color: var(--muted); }
.death-name { width: 118px; }
.death-ability { color: #cdd5df; }
.death-damage { width: 58px; text-align: right; color: #cdd5df; }
.death-damage { position: relative; padding-bottom: 6px; }
/* Hit size relative to the largest killing hit in this pull (square-root scale). */
.hit-bar { position: absolute; left: 6px; right: 6px; bottom: 2px; height: 2px; background: rgba(255, 255, 255, .06); border-radius: 1px; }
.hit-bar i { display: block; height: 100%; margin-left: auto; background: #7d8896; border-radius: 1px; }
.death-row.avoidable .hit-bar i { background: var(--red); }
.none-inline { color: var(--muted); }
/* Avoidable deaths: red edge, tinted row, red ability and damage. */
.death-row.avoidable { background: rgba(255, 107, 117, .09); box-shadow: inset 3px 0 var(--red); }
.death-row.avoidable:hover, .death-row.avoidable:focus-visible { background: rgba(255, 107, 117, .17); }
.death-row.avoidable .death-ability, .death-row.avoidable .death-damage { color: var(--red); font-weight: 600; }

.death-popover { position: fixed; z-index: 30; width: min(580px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow: auto; padding: 10px 12px 12px; background: #0f1319; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 34px rgba(0, 0, 0, .55); font-size: 12px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.death-popover[hidden] { display: none; }
.recap-head { font-size: 13px; }
.recap-cause { color: var(--muted); }
.recap-summary { color: var(--muted); margin: 2px 0 8px; font-size: 11px; }
.recap-rows { display: grid; gap: 2px; }
.recap-row { display: grid; grid-template-columns: 62px 20px minmax(0, 1fr) 54px; gap: 7px; align-items: center; padding: 2px 4px; border-radius: 4px; }
.recap-row.killing { background: rgba(255, 107, 117, .12); box-shadow: inset 2px 0 var(--red); }
.recap-row.healing { opacity: .92; }
.recap-time { color: var(--muted); text-align: right; font-size: 11px; white-space: nowrap; }
.recap-icon { width: 20px; height: 20px; border-radius: 3px; display: block; }
img.recap-icon { border: 1px solid #000; background: #000; }
.recap-main { min-width: 0; }
.recap-line { display: flex; gap: 6px; align-items: baseline; white-space: nowrap; }
.recap-name { font-weight: 600; flex: none; max-width: 58%; overflow: hidden; text-overflow: ellipsis; }
.recap-row.healing .recap-name { color: var(--green); }
.recap-source { color: var(--muted); overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
.recap-amount { margin-left: auto; font-weight: 700; flex: none; }
.recap-amount small { font-weight: 400; margin-left: 3px; }
.recap-bar { display: flex; height: 6px; margin-top: 2px; background: #1a2029; border-radius: 3px; overflow: hidden; }
.recap-bar i { display: block; height: 100%; }
.recap-bar .taken { background: var(--red); }
.recap-bar .overkill { background: #7a1f27; }
.recap-bar .absorbed { background: #5aa9ff; }
.recap-bar .mitigated { background: #3a4452; }
.recap-bar .heal { background: var(--green); }
small.absorbed { color: #5aa9ff; }
small.mitigated { color: #7d8896; }
small.overkill { color: #c25560; }
.recap-hp { position: relative; height: 12px; background: #1a2029; border-radius: 3px; overflow: hidden; }
.recap-hp i { position: absolute; inset: 0 auto 0 0; }
.recap-hp b { position: relative; display: block; text-align: center; font-size: 10px; font-weight: 600; line-height: 12px; text-shadow: 0 0 3px #000; }
.recap-hp.high i { background: #2f8f55; }
.recap-hp.mid i { background: #b8861f; }
.recap-hp.low i { background: #b93a43; }
@media (max-width: 760px) {
  .recap-row { grid-template-columns: 52px 20px minmax(0, 1fr) 44px; }
}
/* Battle.net login: nobody is logged in, so the read-only badge would mislead. */
body.auth-logged-out #viewer-badge { display: none; }
.replay-controls { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-top: 1px solid var(--line); }
.lightbox-head .replay-controls { flex: 1; border-top: 0; padding: 0; max-width: 640px; }
.replay-controls button { min-width: 38px; padding: 4px 8px; }
.replay-controls input[type=range] { flex: 1; min-width: 80px; accent-color: #ff6b75; }
.replay-time { min-width: 52px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
