:root {
  --bg: #fafafa;
  --panel: #ffffff;
  --fg: #18181b;
  --muted: #71717a;
  --border: #e4e4e7;
  --killed: #16a34a;
  --survived: #dc2626;
  --nocov: #a1a1aa;
  --error: #d97706;
  --accent: #886868;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0e;
    --panel: #17171a;
    --fg: #f4f4f5;
    --muted: #9f9fa8;
    --border: #2a2a2e;
    --killed: #4ade80;
    --survived: #f87171;
    --nocov: #6e6e78;
    --error: #fbbf24;
    --accent: #f77669;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0e;
  --panel: #17171a;
  --fg: #f4f4f5;
  --muted: #9f9fa8;
  --border: #2a2a2e;
  --killed: #4ade80;
  --survived: #f87171;
  --nocov: #6e6e78;
  --error: #fbbf24;
  --accent: #f77669;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font:
    14px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 96px;
}

.mast {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 8px;
}
h1 {
  font: 700 20px/1 var(--mono);
  margin: 0;
  color: var(--accent);
}
.score {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.score.band-good {
  color: var(--killed);
}
.score.band-mid {
  color: var(--error);
}
.score.band-low {
  color: var(--survived);
}
.score.band-none {
  color: var(--nocov);
}

.killed {
  color: var(--killed);
}
.bg-killed {
  background: var(--killed);
}
.survived {
  color: var(--survived);
}
.bg-survived {
  background: var(--survived);
}
.no_coverage {
  color: var(--nocov);
}
.bg-no_coverage {
  background: var(--nocov);
}
.error {
  color: var(--error);
}
.bg-error {
  background: var(--error);
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  margin: 0 0 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fg) 8%, transparent);
  color: var(--fg);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.chip b {
  font-variant-numeric: tabular-nums;
}
.chip:not(:disabled):not([aria-pressed="true"]):hover {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 40%, transparent);
}
.chip[aria-pressed="true"] {
  box-shadow: inset 0 0 0 1.5px currentColor;
}
.chip:disabled {
  opacity: 0.4;
  cursor: default;
}
.tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
}
.tbtn {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.tbtn:hover {
  background: color-mix(in srgb, var(--fg) 7%, transparent);
  color: var(--fg);
}
.fjump {
  max-width: 140px;
}
/* icon-only tools: square, centered glyph/svg, no relayout on state change */
.ibtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  padding: 6px 0;
  font-size: 15px;
  line-height: 1;
}

/* Instant CSS tooltip: absolutely positioned so it never relayouts siblings,
   and shown without the multi-second delay a native title= carries. Placed
   below the trigger because the toolbar sticks to the viewport top. */
[data-tip] {
  position: relative;
}
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--fg);
  color: var(--bg);
  font-size: 11px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  opacity: 1;
}
[data-tip]:disabled::after {
  display: none;
}
.fcount {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.fcount:empty {
  display: none;
}

/* Recolor the keyboard focus ring off the browser default (blue). Inset so it
   is never clipped by the rounded file/line cards. Only shows for keyboard and
   n/p navigation, not mouse clicks. */
:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

details.file {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 12px 0;
  overflow: hidden;
}
details.file > summary {
  cursor: pointer;
  padding: 13px 16px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}
details.file > summary::-webkit-details-marker {
  display: none;
}
details.file > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  margin-right: 2px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.12s;
}
details.file[open] > summary::before {
  transform: rotate(45deg);
}
.fname {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
}
.fmeta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.fmeta .ct b {
  font-weight: 600;
}
.fscore b {
  color: var(--fg);
}

details.plan {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
}
details.plan > summary .fname {
  color: var(--accent);
}

.plan-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.plan-tbl th,
.plan-tbl td {
  padding: 7px 16px;
  text-align: right;
  border-top: 1px solid var(--border);
}
.plan-tbl th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.plan-tbl th:first-child,
.plan-tbl td.mname {
  text-align: left;
}
.plan-tbl td.mname {
  font-family: var(--mono);
}
.plan-tbl td.z {
  color: var(--muted);
  opacity: 0.4;
}
.plan-tbl tbody tr:hover {
  background: color-mix(in srgb, var(--fg) 4%, transparent);
}

.src {
  border-top: 1px solid var(--border);
  background: var(--bg);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 10px 0;
}
.ln {
  padding: 0 16px;
}
.ln > summary,
.ln:not(details) {
  display: flex;
  align-items: center;
}
.ln .no {
  color: var(--muted);
  opacity: 0.6;
  text-align: right;
  width: 40px;
  flex: none;
  margin-right: 16px;
  user-select: none;
}
.ln .txt {
  flex: 1;
  white-space: pre;
}
details.ln > summary {
  cursor: pointer;
  list-style: none;
}
details.ln > summary::-webkit-details-marker {
  display: none;
}
details.ln > summary:hover {
  background: color-mix(in srgb, var(--fg) 6%, transparent);
}
.ln.b-killed > summary {
  box-shadow: inset 3px 0 var(--killed);
  background: color-mix(in srgb, var(--killed) 5%, transparent);
}
.ln.b-survived > summary {
  box-shadow: inset 3px 0 var(--survived);
  background: color-mix(in srgb, var(--survived) 6%, transparent);
}
.ln.b-no_coverage > summary {
  box-shadow: inset 3px 0 var(--nocov);
  background: color-mix(in srgb, var(--nocov) 6%, transparent);
}
.ln.b-error > summary {
  box-shadow: inset 3px 0 var(--error);
  background: color-mix(in srgb, var(--error) 6%, transparent);
}
.badge {
  margin-left: auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  flex: none;
  font-size: 11px;
  font-weight: 600;
  position: sticky;
  right: 16px;
  padding-left: 28px;
}
.ln.b-killed .badge {
  color: var(--killed);
}
.ln.b-survived .badge {
  color: var(--survived);
}
.ln.b-no_coverage .badge {
  color: var(--nocov);
}
.ln.b-error .badge {
  color: var(--error);
}

.muts {
  margin: 4px 16px 10px 72px;
  white-space: normal;
}
.mut {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 8px 0;
  background: var(--panel);
  font-size: 12px;
  max-width: 720px;
}

.mut .head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}
.st {
  font-weight: 600;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: capitalize;
}
.st.killed,
.chip.killed {
  background: color-mix(in srgb, var(--killed) 12%, transparent);
  color: var(--killed);
}
.st.survived,
.chip.survived {
  background: color-mix(in srgb, var(--survived) 12%, transparent);
  color: var(--survived);
}
.st.no_coverage,
.chip.no_coverage {
  background: color-mix(in srgb, var(--nocov) 16%, transparent);
  color: var(--nocov);
}
.st.error,
.chip.error {
  background: color-mix(in srgb, var(--error) 12%, transparent);
  color: var(--error);
}
.mut .rule {
  font-family: var(--mono);
  color: var(--muted);
}
.mut code {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  border-radius: 6px;
  overflow: hidden;
}
.mut .del,
.mut .add {
  display: block;
  padding: 2px 10px;
  white-space: pre-wrap;
}
.del {
  background: color-mix(in srgb, var(--survived) 9%, transparent);
}
.add {
  background: color-mix(in srgb, var(--killed) 9%, transparent);
}
.mut code.msg {
  color: var(--muted);
  margin-top: 6px;
  white-space: pre-wrap;
}

/* status filter: hide non-matching files and mutant cards, neutralize non-matching lines */
body[data-f="survived"] details.file:not(.has-survived),
body[data-f="killed"] details.file:not(.has-killed),
body[data-f="no_coverage"] details.file:not(.has-no_coverage),
body[data-f="error"] details.file:not(.has-error) {
  display: none;
}
body[data-f="survived"] .mut:not(.m-survived),
body[data-f="killed"] .mut:not(.m-killed),
body[data-f="no_coverage"] .mut:not(.m-no_coverage),
body[data-f="error"] .mut:not(.m-error) {
  display: none;
}
body[data-f="survived"] details.ln:not(.has-survived) > summary,
body[data-f="killed"] details.ln:not(.has-killed) > summary,
body[data-f="no_coverage"] details.ln:not(.has-no_coverage) > summary,
body[data-f="error"] details.ln:not(.has-error) > summary {
  pointer-events: none;
  box-shadow: none;
  background: none;
}
body[data-f="survived"] details.ln:not(.has-survived) .badge,
body[data-f="killed"] details.ln:not(.has-killed) .badge,
body[data-f="no_coverage"] details.ln:not(.has-no_coverage) .badge,
body[data-f="error"] details.ln:not(.has-error) .badge {
  opacity: 0.35;
}

@keyframes flash {
  0% {
    background: color-mix(in srgb, var(--fg) 14%, transparent);
  }
}
.flash > summary {
  animation: flash 1.2s;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin-right: 8px;
}
/* shiki dual-theme: inline styles carry light color + --shiki-dark variable */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .txt span,
  :root:not([data-theme="light"]) .del span,
  :root:not([data-theme="light"]) .add span {
    color: var(--shiki-dark) !important;
  }
}
:root[data-theme="dark"] .txt span,
:root[data-theme="dark"] .del span,
:root[data-theme="dark"] .add span {
  color: var(--shiki-dark) !important;
}
kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--panel);
}

@media (max-width: 640px) {
  .hint {
    display: none;
  }
  .fmeta .ct {
    display: none;
  }
  .muts {
    margin-left: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
