/* killmail.stream — clean EVE battle reports. Dark, minimal, brtools-inspired. */
html, body { overflow-x: hidden; overflow-x: clip; } /* clip where supported, hidden as fallback (older iOS) — no stray element may push the page wider than the viewport */
:root {
  --bg: #060409;
  --bg-soft: #0b0712;
  --panel: #100b18;
  --panel-2: #161020;
  --border: #2c2140;
  --border-soft: #241b36;
  --text: #ece4f4;
  --muted: #9d8ab8;
  --faint: #6f5f8a;
  --blue: #8b5cf6;
  --blue-dim: rgba(139, 92, 246, 0.25);
  --red: #ff7a7a;
  --red-dim: rgba(255, 122, 122, 0.12);
  --purple: #a78bfa;
  --green: #3fd68c;
  --gold: #d4a94e;
  --gray: #9aa3b2;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* The dark canvas must live on <html> too — iOS rubber-band overscroll
   paints from the root element, and without this you get white bars
   flashing on every edge while scrolling. */
html { background: #060409; }
body {
  background: linear-gradient(180deg, #0d0816 0%, var(--bg) 45%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; font-weight: 700; font-size: 16px; letter-spacing: 0.2px; cursor: pointer; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); }
.brand small { color: var(--faint); font-weight: 400; font-size: 12px; }
.topbar .spacer { flex: 1; min-width: 0; }
#top-form { display: flex; align-items: center; gap: 8px; min-width: 0; } /* the form itself is a flex item of .topbar; without min-width:0 WebKit sizes it by its content and it overflows the bar */
.topbar #top-form .btn { flex: none; } /* the Go button keeps its size while the input shrinks */
.topbar input[type="text"] {
  width: min(420px, 40vw);
  min-width: 0; /* inputs have an intrinsic min-width; let flexbox shrink them */
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; outline: none;
}
.topbar input[type="text"]:focus { border-color: var(--blue); }
@media (max-width: 620px) {
  .topbar { padding: 10px 12px; gap: 10px; }
  .brand small { display: none; }
  .topbar .btn { padding: 8px 10px; }
}

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
/* battle report: use the screen — team columns smash at landing width */
.wrap.rep { max-width: 1760px; }
main.wrap { flex: 1; padding-top: 28px; padding-bottom: 60px; }

/* ---------- landing ---------- */
.hero { text-align: center; padding: 56px 0 30px; }
.hero h1 { font-size: 34px; margin: 0 0 10px; letter-spacing: -0.5px; }
.hero h1 .accent { color: var(--blue); }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto 26px; font-size: 15px; }
.magic-shimmer {
  background: linear-gradient(110deg, var(--blue) 30%, #ffffff 50%, var(--blue) 70%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: magic-shimmer 2.8s linear infinite;
}
@keyframes magic-shimmer { to { background-position: 200% center; } }
@media (prefers-reduced-motion: reduce) { .magic-shimmer { animation: none; } }
.magic-line { font-size: 18px; margin: -14px auto 26px; }
.inputrow { display: flex; gap: 10px; max-width: 640px; margin: 0 auto; }
.inputrow input {
  flex: 1; background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 13px 16px; font-size: 14px; outline: none;
}
.inputrow input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); }
.btn {
  background: linear-gradient(180deg, #8b5cf6, #6d28d9); color: #fff; border: none; border-radius: var(--radius);
  padding: 13px 22px; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 600; }
.btn.ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn:disabled { opacity: 0.5; cursor: wait; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 48px; }
.feature { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 18px; }
.feature h3 { margin: 0 0 8px; font-size: 14px; }
.feature p { margin: 0; color: var(--muted); font-size: 13px; }
.sources { margin-top: 40px; text-align: center; color: var(--faint); font-size: 12px; }
.recent { margin-top: 36px; text-align: left; }
.recent h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--faint); margin: 0 0 10px; font-weight: 700; }
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-row { display: flex; align-items: stretch; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.recent-open { flex: 1; min-width: 0; background: none; border: none; color: var(--text); text-align: left; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; }
.recent-open:hover { background: var(--panel-2); }
.recent-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-x { background: none; border: none; color: var(--faint); padding: 0 14px; cursor: pointer; font-size: 13px; }
.recent-x:hover { color: var(--red); }

/* ---------- report header ---------- */
.rep-head { margin-bottom: 20px; }
.rep-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.rep-title h2 { margin: 0; font-size: 24px; letter-spacing: -0.3px; }
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,93,93,0.35);
  font-size: 11px; font-weight: 800; letter-spacing: 1px; border-radius: 20px; padding: 3px 10px;
}
.live-badge .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.rep-meta { color: var(--muted); font-size: 13px; margin-top: 6px; display: flex; gap: 16px; flex-wrap: wrap; }
.rep-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  padding: 6px 12px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none;
}
.chip:hover { border-color: var(--blue); color: var(--text); }
.chip.on { border-color: var(--red); color: var(--red); }
.chip.sm { font-size: 11px; padding: 3px 9px; }
#tl-dots.on { border-color: var(--blue); color: var(--blue); }
/* "my org" star chip: gold when it's your highlighted org */
.chip.star-chip.on { border-color: var(--gold); color: var(--gold); }
#btn-myorg { max-width: 220px; }
#btn-myorg, #pfilter-stars .chip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* unfavorite affordance inside the header chip */
#btn-myorg-x { margin-left: 6px; padding: 0 4px; border-radius: 4px; opacity: .55; font-size: 13px; line-height: 1; }
#btn-myorg-x:hover { opacity: 1; background: rgba(255,255,255,.12); }
/* the stars wrapper must obey [hidden] — .chip's display:inline-flex would
   otherwise keep a stale, untappable star chip visible forever */
#pfilter-stars[hidden] { display: none; }
#pfilter-stars:not([hidden]) { display: inline-flex; gap: 6px; }

/* ---------- pilot search filter ---------- */
.pfilter { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; }
.pfilter input { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); padding: 10px 12px; font-size: 14px; font: inherit; }
.pfilter input:focus { outline: none; border-color: var(--accent); }
.pfilter input::placeholder { color: var(--faint); }
.pfilter-x { flex: none; background: none; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--muted); width: 38px; height: 38px; cursor: pointer; font-size: 13px; }
.pfilter-x:hover { color: var(--red); border-color: var(--red); }
.pcard.f-dim { opacity: 0.22; }
.pcard.f-hide { display: none; }
.pcard.f-hi { box-shadow: inset 0 0 0 1px var(--gold); border-color: var(--gold); }

/* ---------- stat strip ---------- */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 18px 0; }
.stat { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 12px 14px; }
.stat .k { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.8px; }
.stat .v { font-size: 20px; font-weight: 700; font-family: var(--mono); margin-top: 2px; }

/* ---------- teams ---------- */
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
/* mobile: teams sit side-by-side in a snap strip — pan between them instead
   of scrolling through stacked cards */
@media (max-width: 760px) {
  .teams { display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .teams::-webkit-scrollbar { display: none; }
  .team { flex: 0 0 92%; scroll-snap-align: start; }
  /* no internal scroll on the pilot list — the whole page scrolls */
  .tnav { display: flex; }
}
.sys-row { display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--border-soft); font-size:13px; flex-wrap:wrap; }
.sys-row .nm { font-weight:700; }
.sys-row .win { color:var(--muted); font-size:12px; font-family:var(--mono); }
.sys-row .tag { font-size:10px; color:var(--faint); text-transform:uppercase; letter-spacing:.6px; border:1px solid var(--border-soft); padding:2px 6px; border-radius:4px; }
.sys-rm { margin-left:auto; background:var(--panel-2); border:1px solid var(--border-soft); color:var(--muted); border-radius:6px; width:28px; height:28px; cursor:pointer; font-size:12px; }
.sys-rm:hover { color:var(--red); border-color:var(--red); }
.sys-add { display:grid; grid-template-columns:1.2fr 1fr 1fr auto; gap:8px; margin-top:14px; }
.sys-add input { background:var(--panel-2); border:1px solid var(--border); color:var(--text); border-radius:8px; padding:9px 10px; font-size:13px; color-scheme:dark; min-width:0; }
.sys-add input:focus { outline:none; border-color:var(--blue); }
.sys-err { color:var(--red); font-size:12px; min-height:18px; margin-top:6px; }
@media (max-width:760px){ .sys-add { grid-template-columns:1fr 1fr; } }
.tnav { display: none; align-items: center; justify-content: center; width: 34px; height: 46px;
  flex: none; background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 8px;
  color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; padding: 0; }
.tnav:active { background: var(--border-soft); }
.team-head .thead-mid { flex: 1; min-width: 0; }
.team { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; }
.team-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.team-head img { width: 40px; height: 40px; border-radius: 8px; background: var(--panel-2); }
.team-head .nm { font-weight: 700; font-size: 15px; }
.team-head .sub { color: var(--muted); font-size: 12px; }
/* winning team: green header */
.team.won > .team-head { background: rgba(46, 160, 80, 0.16); border-bottom-color: rgba(46, 160, 80, 0.45); }
.team.won > .team-head .nm { color: #8dffab; }
/* teams editor panel: br-tools-style group rows */
.tedit-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.tedit { background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 10px 12px; }
.tedit-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.tedit-head img { width: 32px; height: 32px; border-radius: 6px; background: var(--panel-2); flex: none; }
.tedit-head .nm { font-weight: 700; font-size: 13px; }
.tedit-head .sub { color: var(--muted); font-size: 11px; }
/* drag-and-drop team editor: pilot rows lift off on press-and-hold */
.pilot-list { max-height: 300px; overflow-y: auto; margin-top: 2px; }
.pilot-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin: 0 -8px;
  border-radius: 6px; font-size: 12px; cursor: grab;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: pan-y;
}
.pilot-row:hover { background: var(--panel); }
.pilot-row .picon { width: 20px; height: 20px; border-radius: 4px; background: #0a0f16; flex: none; }
.pilot-row .pilot-nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.pilot-row .pilot-corp { display: block; font-weight: 400; color: var(--muted); font-size: 10px; }
.pilot-row.lifting { opacity: .35; }
.pilot-row.sel { background: rgba(229, 194, 104, .16); outline: 1px solid var(--gold); cursor: default; }
/* battle-tab pilot card drag-and-drop: press-and-hold a card to move the
   pilot to another team (or the "+ New team" card that appears mid-drag) */
.pcard { cursor: grab; }
.pcard.lifting { opacity: .35; }
.pcard-ghost {
  position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none;
  margin: 0; border-color: var(--gold); cursor: grabbing;
  box-shadow: 0 10px 28px rgba(0,0,0,.65); opacity: .95;
}
.team.drop-on { outline: 2px dashed var(--gold); outline-offset: -3px; }
/* team-header drag-and-drop: press-and-hold a team header to merge the whole
   team into another team by dropping it on that team's column */
.team-head { cursor: grab; }
.team-head.lifting { opacity: .35; }
.team-ghost {
  position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none;
  margin: 0; cursor: grabbing; background: var(--panel);
  border: 2px solid var(--gold); border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0,0,0,.65); opacity: .95;
}
.new-team-drop {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 18px 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 4px; min-height: 140px; flex: 0 0 auto;
}
.new-team-drop .tnew-plus { font-size: 26px; color: var(--faint); }
.new-team-drop .nm { font-weight: 700; font-size: 14px; }
.new-team-drop.drop-on { border-color: var(--gold); outline: 2px dashed var(--gold); outline-offset: -2px; }
.drag-hint { font-size: 11px; color: var(--faint); text-align: center; margin: 4px 0 -8px; }
.team-bar { height: 6px; }
.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.team-grid > div { padding: 12px 16px; border-top: 1px solid var(--border-soft); }
.team-grid > div + div { border-left: 1px solid var(--border-soft); }
.team-grid .k { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.8px; }
.team-grid .v { font-size: 17px; font-weight: 700; font-family: var(--mono); }
.eff { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.eff > div { height: 100%; border-radius: 4px; }
.team-ally { padding: 10px 16px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.team-ally img { width: 20px; height: 20px; border-radius: 4px; vertical-align: -5px; margin-right: 4px; }

/* ---------- timeline ---------- */
.panel { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); margin: 18px 0; overflow: hidden; }
.panel-head { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; gap: 10px; }
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px; }
#timeline-canvas { width: 100%; height: 280px; display: block; cursor: ew-resize; touch-action: none; }
#timeline-canvas.locked { touch-action: pan-y; cursor: default; }
.playback { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
#tl-hover { flex: 1; text-align: left; color: #a8d0ff; font-weight: 600; min-width: 0; }
.play-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.play-btn:hover { border-color: var(--blue); color: var(--blue); }
.playback input[type="range"] { flex: 1; accent-color: var(--blue); }
.playback .t { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 150px; text-align: right; }
.playback .isk { color: #ffd24a; font-weight: 700; font-size: 15px; }
.playback .speeds { display: flex; gap: 4px; }
.playback .speeds button {
  background: var(--panel-2); border: 1px solid var(--border-soft); color: var(--muted);
  font-size: 11px; font-family: var(--mono); padding: 4px 8px; border-radius: 6px; cursor: pointer;
}
.playback .speeds button.on { border-color: var(--blue); color: var(--blue); font-weight: 700; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: baseline; }

/* ---------- composition ---------- */
.comp { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .comp { grid-template-columns: 1fr; } }
.comp-side h4 { margin: 0 0 10px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.classrow { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.classrow:last-child { border-bottom: none; }
.cls-sym { width: 30px; height: 30px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; color: #06121f; flex-shrink: 0; }
.classrow .nm { width: 110px; color: var(--muted); }
.classrow .bar { flex: 1; height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; position: relative; }
.classrow .bar > div { height: 100%; }
.classrow .nums { font-family: var(--mono); font-size: 12px; min-width: 92px; text-align: right; }
.classrow .nums .lost { color: var(--red); }

/* ---------- tables ---------- */
.tabs { display: flex; gap: 6px; padding: 10px 16px 0; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.tab { background: none; border: none; color: var(--muted); font-size: 13px; font-weight: 600; padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--blue); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--faint);
  padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap;
}
table.data th:hover { color: var(--text); }
table.data th.num, table.data td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data td { padding: 8px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.data tr:hover td { background: rgba(255,255,255,0.02); }
table.data tr.dead td { background: var(--red-dim); }
.cell-ship { display: flex; align-items: center; gap: 10px; }
.cell-ship img { width: 32px; height: 32px; border-radius: 6px; background: var(--panel-2); }
.cell-ship .s { font-weight: 600; }
.cell-ship .p { font-size: 11px; color: var(--muted); }
.cell-ent { display: flex; align-items: center; gap: 8px; }
.cell-ent img { width: 24px; height: 24px; border-radius: 5px; background: var(--panel-2); }
.isk-pos { color: var(--green); } .isk-neg { color: var(--red); }

/* ---------- kill list ---------- */
.kill { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.kill:last-child { border-bottom: none; }
.kill:hover { background: rgba(255,255,255,0.02); }
.kill img.ship { width: 36px; height: 36px; border-radius: 7px; background: var(--panel-2); }
.kill .vt { flex: 1; min-width: 0; }
.kill .vt .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kill .vt .c { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kill .val { font-family: var(--mono); text-align: right; }
.kill .val .isk { font-weight: 700; }
.kill .val .t { font-size: 11px; color: var(--faint); }
.kill .fb { font-size: 11px; color: var(--muted); max-width: 180px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ---------- misc ---------- */
details.how { margin: 18px 0; background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); }
details.how summary { padding: 12px 16px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
details.how .body { padding: 0 16px 14px; font-size: 12.5px; color: var(--muted); }
details.how table { width: 100%; border-collapse: collapse; margin-top: 8px; }
details.how td, details.how th { padding: 5px 8px; border-bottom: 1px solid var(--border-soft); text-align: left; font-size: 12px; }
details.how td.num { text-align: right; font-family: var(--mono); }

.loading { text-align: center; padding: 60px 20px; color: var(--muted); }
.loading .spin { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; margin: 0 auto 16px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { background: var(--red-dim); border: 1px solid rgba(255,93,93,0.4); border-radius: var(--radius); padding: 16px 18px; margin: 20px 0; font-size: 14px; }
.error b { color: var(--red); }

footer { border-top: 1px solid var(--border); padding: 22px 20px; color: var(--faint); font-size: 12px; text-align: center; }
footer a { color: var(--muted); }

.empty { padding: 40px 20px; text-align: center; color: var(--faint); }
.progress { max-width: 640px; margin: 8px auto 0; height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--blue); border-radius: 3px; transition: width 0.3s; }
.status-line { text-align: center; color: var(--muted); font-size: 13px; margin-top: 12px; min-height: 20px; }

/* ---- main tabs (Battle / Details) ---- */
.main-tabs { display: flex; gap: 4px; padding: 6px 2px 0; border-bottom: 1px solid var(--border); margin: 4px 0 16px; }
.main-tabs .tab { font-size: 14px; padding: 10px 18px; }
.main-tabs .tab.on { border-bottom-color: var(--blue); }

/* ---- pilot roster (battle tab) ---- */
.roster { border-top: 1px solid var(--border-soft); }
.pilot { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--border-soft); }
.pilot > img { width: 32px; height: 32px; border-radius: 6px; background: var(--panel-2); flex: none; }
.pilot img.sh { width: 28px; height: 28px; border-radius: 6px; }
.pilot .pi { flex: 1; min-width: 0; }
.pilot .pn { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pilot .ps { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pilot .pnums { font-family: var(--mono); font-size: 12px; text-align: right; display: flex; flex-direction: column; gap: 1px; flex: none; }
.pilot.dead { opacity: 0.5; }
.pilot.pending { opacity: 0.45; }
.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; flex: none; }
.pill.alive { background: rgba(80, 200, 120, 0.14); color: #6fe3a1; }
.pill.engaged { background: rgba(255, 180, 60, 0.16); color: #ffbe5c; }
.pill.dead { background: rgba(255, 93, 93, 0.16); color: #fff; }
.pill.pending { background: rgba(120, 140, 170, 0.14); color: #9fb0c9; }

/* ---- pilot rows (battle tab): skinny br-tools-style rows, single column ---- */
.pcards { display: flex; flex-direction: column; gap: 6px; padding: 4px 12px 14px; }
/* Uniform roster grid: ship | name+sub+deaths | right-aligned numbers | corp/ally icons.
   Every data point sits in a fixed column so cards scan like a table. */
.pcard { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 10px; align-items: start; background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 7px 10px; transition: border-color .2s; }
.pcard img.pship { width: 40px; height: 40px; border-radius: 6px; background: #0a0f16; }
.pcard .pship.none { width: 40px; height: 40px; border-radius: 6px; background: var(--panel-2); border: 1px dashed var(--border-soft); }
.pcard .pmain { min-width: 0; }
.pcard .pname { font-weight: 700; font-size: 13px; color: #ffd24a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* pilot names link to zkb — keep the name color, underline on hover only */
.pcard .pname a { color: inherit; }
.pcard .pname a:hover { text-decoration: underline; }
.pcard .picons { display: flex; gap: 4px; }
.pcard .picon { width: 20px; height: 20px; border-radius: 4px; background: #0a0f16; }
.pcard .psub { font-size: 12.5px; color: var(--muted); margin-top: 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .pnums { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; }
@media (max-width: 620px) {
  .pcard { grid-template-columns: 36px minmax(0, 1fr); }
  .pcard .picons { display: none; }
  .pcard img.pship, .pcard .pship.none { width: 36px; height: 36px; }
  /* numbers get their own full-width row so the name / ship chain / death
     rows above keep the full width instead of being squeezed to nothing */
  .pcard .pnums {
    grid-column: 1 / -1;
    flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: flex-start;
    gap: 4px 14px; border-top: 1px solid var(--border-soft); padding-top: 6px; margin-top: 4px;
  }
}
.pcard .dmgline { font-family: var(--mono); font-size: 12px; }
.pcard .dmg { color: #fff; font-weight: 700; }
.pcard .dmg.top { color: #4ade80; }
.pcard .kl { color: #fff; font-weight: 600; }
.pcard .kl.top { color: #4ade80; }
.pcard.dead .death { background: rgba(0,0,0,0.32); border-color: rgba(255,255,255,0.10); }
.pcard .tanked { color: #ff8585; font-weight: 700; font-family: var(--mono); font-size: 12px; }
.pcard.dead { background: rgba(120, 24, 24, 0.20); border-color: rgba(255, 93, 93, 0.45); }
.pcard.dead .pname { color: #ff8585; }
.pcard.dead .psub { color: rgba(255,255,255,0.72); }
/* team header: groups dropdown */
.glink { background: none; border: none; color: inherit; font-size: inherit; cursor: pointer; padding: 0; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.grp-drop { border-bottom: 1px solid var(--border-soft); background: rgba(0,0,0,0.28); padding: 8px 16px 10px; display: flex; flex-direction: column; gap: 7px; }
.grp-drop-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.grp-drop-row img { width: 20px; height: 20px; border-radius: 4px; background: var(--panel-2); flex: none; }
.grp-drop-row .gr { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-drop-row .muted { flex: none; }
.pcard.dead .tanked { color: #fff; }
.pcard.dead img.pship { filter: saturate(0.35) brightness(0.72); }
.pcard.engaged { border-color: rgba(255, 180, 60, 0.42); }
.pcard.pending { opacity: 0.5; }
/* per-death rows: every ship a pilot lost, so rows reconcile with team ISK */
.pcard .death { display: flex; align-items: baseline; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 3px; background: rgba(255,93,93,0.09); border: 1px solid rgba(255,93,93,0.22); border-radius: 5px; padding: 2px 7px; }
.pcard .death .dt { color: rgba(255,255,255,0.72); flex: none; }
.pcard .death .dship { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.pcard .death .dv { color: #fff; font-weight: 700; font-size: 12px; flex: none; }
.pcard .death a { color: #ff9f43; text-decoration: none; font-weight: 700; font-size: 10px; flex: none; }
.pcard .death a:hover { text-decoration: underline; }
.pcard .moredeaths { display: block; width: 100%; text-align: left; background: none; border: none; padding: 3px 7px 0; font-family: var(--mono); font-size: 11px; color: var(--muted); cursor: pointer; }
.pcard .moredeaths:hover { color: #fff; }
.sys-row.removed { opacity: .55; }

/* ---------- details tab: nerdy stuff ---------- */
.kfilters { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
.kfilters input, .kfilters select {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); padding: 8px 10px; font-size: 13px; font: inherit; min-width: 0;
}
.kfilters input:focus, .kfilters select:focus { outline: none; border-color: var(--accent); }
.kfilters input::placeholder { color: var(--faint); }
.kfilters #kf-q { flex: 2; min-width: 140px; }
.kfilters #kf-min { width: 110px; flex: none; }
.kfilters select { flex: none; }
table.data tr.won td { background: rgba(63,214,140,0.06); }
.dbg-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .dbg-cols { grid-template-columns: 1fr; } }
.blob-bar { height: 8px; background: #ffffff14; border-radius: 4px; overflow: hidden; }
.blob-bar > div { height: 100%; border-radius: 4px; }
#ddbg-body h4 { margin: 0 0 6px; font-size: 13px; }
.neutral-row { display: flex; gap: 8px; flex-wrap: wrap; }
.neutral-chip { cursor: default; }
/* live badge: reconnecting state */
.live-badge.reconnecting { color: #ff9f43; border-color: rgba(255,159,67,0.35); background: rgba(255,159,67,0.08); }
.live-badge.reconnecting .pulse { background: #ff9f43; }
/* progressive render: report is painted but expansion is still running */
.live-badge.building { color: var(--blue); border-color: rgba(77,159,255,0.35); background: rgba(77,159,255,0.08); }
.live-badge.building .pulse { background: var(--blue); }
