:root {
  --bg: #14161a;
  --panel: #1c1f26;
  --panel2: #242832;
  --text: #e6e8ec;
  --muted: #9aa0ac;
  --line: #2e333d;
  --S: #f5b942;
  --A: #b98cff;
  --B: #5aa9ff;
  --C: #5ad19a;
  --D: #6b7280;
  --F: #e05555;
  --U: #9aa0ac; /* unranked (grey X) */
  --FF: #5aa9ff; /* frame-favored perk highlight */
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, "Segoe UI", Roboto, sans-serif;
}
header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(var(--bg), rgba(20, 22, 26, 0.92));
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  backdrop-filter: blur(6px);
}
h1 { margin: 0 0 10px; font-size: 18px; font-weight: 700; }
h1 span { color: var(--muted); font-weight: 400; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { border-color: #3a4150; }
.btn.ghost { background: transparent; }
input, select {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
}
#search { min-width: 200px; flex: 1; }
.stats { margin-top: 10px; color: var(--muted); font-size: 12px; display: flex; gap: 14px; }
.stats b { color: var(--text); }
.import-hint {
  margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  color: var(--muted); font-size: 11.5px;
}
.import-hint .ih-lbl { font-weight: 600; color: #b9c0cc; }
.import-hint .ih-step {
  background: var(--panel2); border: 1px solid var(--line);
  padding: 1px 7px; border-radius: 5px; white-space: nowrap;
}
.import-hint .ih-sep { color: #4a5160; }
.import-hint a { color: var(--B); text-decoration: none; }
.import-hint a:hover { text-decoration: underline; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(345px, 1fr));
  gap: 11px;
  padding: 16px 18px 60px;
}
.empty { color: var(--muted); padding: 40px; text-align: center; grid-column: 1/-1; }
.welcome { padding: 70px 20px; }
.welcome h2 { color: var(--text); margin: 0 0 6px; font-size: 22px; }
.welcome p { margin: 0 0 22px; }
.welcome-btns { display: flex; gap: 12px; justify-content: center; margin-bottom: 18px; }
.welcome-btns .btn { font-size: 15px; padding: 12px 20px; }
.welcome .whint { font-size: 12px; color: #6b7280; margin: 0; }

/* ---- triage board (sized up ~15%) ---- */
.triage { padding: 14px 20px 90px; }
.type-sec { margin-bottom: 20px; }
.type-hd {
  font-size: 17px; font-weight: 700; color: var(--text);
  padding: 7px 0; border-bottom: 1px solid var(--line); margin-bottom: 9px;
  cursor: pointer; user-select: none; display: flex; align-items: center; gap: 8px;
}
.type-hd:hover { color: #fff; }
.type-hd .caret { color: var(--muted); font-size: 12px; width: 12px; }
.type-hd small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.frame-group {
  background: #191c23; border: 1px solid var(--line); border-radius: 10px;
  padding: 2px 12px 6px; margin-bottom: 9px;
}
.frame-group.alt { background: #1f2129; }
.frame-hd {
  font-size: 13px; font-weight: 600; color: #b9c0cc; text-transform: uppercase;
  letter-spacing: 0.03em; padding: 8px 0 5px; border-bottom: 1px solid var(--line); margin-bottom: 2px;
  display: flex; align-items: center; gap: 8px;
}
.frame-hd small { opacity: 0.7; }
.frame-hd .bdg.brk { text-transform: capitalize; letter-spacing: 0; }
.frame-group .namegrp:last-child { border-bottom: none; }
.namegrp {
  display: grid; grid-template-columns: 200px 1fr 1fr; gap: 10px;
  align-items: stretch; padding: 6px 0; border-bottom: 1px solid #23262e;
}
.namegrp .nm { font-weight: 600; font-size: 15px; align-self: center; }
.namegrp .nm small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.col-lane {
  display: flex; flex-wrap: wrap; gap: 7px; align-content: flex-start;
  padding: 4px; border-radius: 6px; min-height: 34px;
}
.col-lane.keep { background: rgba(90, 209, 154, 0.05); }
.col-lane.junk { background: rgba(224, 85, 85, 0.05); }
/* single sticky KEEP/JUNK header above the scrolling list (replaces per-row labels) */
.board-hd {
  position: sticky; z-index: 4;
  display: grid; grid-template-columns: 200px 1fr 1fr; gap: 10px;
  padding: 7px 12px; margin-bottom: 8px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.lane-hd {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 3px 8px; border-radius: 6px;
}
.lane-hd.keep { color: #7fe0b0; background: rgba(90, 209, 154, 0.12); }
.lane-hd.junk { color: #f0928a; background: rgba(224, 85, 85, 0.12); }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--D);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 14px; user-select: none;
}
.chip:hover { filter: brightness(1.2); }
.chip.S { border-left-color: var(--S); }
.chip.A { border-left-color: var(--A); }
.chip.B { border-left-color: var(--B); }
.chip.C { border-left-color: var(--C); }
.chip.F { border-left-color: var(--F); }
.chip.U { border-left-color: var(--U); }
.chip img { width: 26px; height: 26px; border-radius: 5px; }
.chip .t { font-weight: 800; }
.chip .t.S { color: var(--S); } .chip .t.A { color: var(--A); } .chip .t.B { color: var(--B); }
.chip .t.C { color: var(--C); } .chip .t.D { color: var(--D); } .chip .t.F { color: var(--F); } .chip .t.U { color: var(--U); }
.chip .pk { color: var(--muted); }
.chip .pw { color: #6b7280; font-size: 12px; }
.bdg { font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 5px; }
.bdg.boss { background: rgba(245, 185, 66, 0.18); color: var(--S); }
.bdg.speed { background: rgba(90, 169, 255, 0.18); color: var(--B); }
.bdg.craft { background: rgba(224, 85, 85, 0.16); color: #ff8a6a; }
.bdg.brk { background: rgba(255, 255, 255, 0.1); color: #e6e8ec; text-transform: capitalize; }
.elem { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 4px rgba(0,0,0,0.5) inset; }
.triage-bar {
  position: sticky; top: 0; z-index: 4; display: flex; gap: 16px; align-items: center;
  padding: 8px 4px; color: var(--muted); font-size: 13px;
}
.triage-bar b { color: var(--text); }

/* ---- DIM-style hover tooltip ---- */
.tip {
  position: fixed; z-index: 50; pointer-events: none; display: none;
  width: 360px; background: #12141a; border: 1px solid #333a47;
  border-radius: 10px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden; font-size: 12px;
}
.tip-pool { padding: 10px; display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.pool-col { display: flex; flex-direction: column; gap: 6px; align-items: center; flex: 0 0 auto; }
.pool-lbl { width: 56px; text-align: center; line-height: 1.1; color: var(--muted); font-size: 9px; text-transform: uppercase; margin-bottom: 1px; }
.pool { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 56px; text-align: center; }
.pool img { width: 34px; height: 34px; border-radius: 50%; background: #0e1013; border: 2px solid #2e333d; box-sizing: border-box; }
.pool span {
  font-size: 9px; color: var(--muted); line-height: 1.1;
  height: 21px; overflow: hidden; /* fixed 2-line box so icons stay row-aligned */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.pool.eq img { border-color: #cfd6e4; } /* equipped */
.pool.eq span { color: var(--text); font-weight: 600; }
.pool.ag img { border-color: var(--S); } /* Aegis-recommended */
.pool.ag span { color: var(--S); }
.pool.eq.ag img { box-shadow: 0 0 0 2px rgba(245, 185, 66, 0.3); }
.pool.ff img { border-color: var(--FF); } /* same-frame favored perk */
.pool.ff span { color: var(--FF); }
.ff-line { color: var(--FF); }
.tip.show { display: block; }
.tip-hd { display: flex; gap: 9px; align-items: center; padding: 10px; border-bottom: 1px solid #262b34; }
.tip-hd img { width: 44px; height: 44px; border-radius: 6px; }
.tip-hd .tn { font-weight: 700; font-size: 14px; }
.tip-hd .tt { color: var(--muted); font-size: 11px; }
.tip-tier { margin-left: auto; font-weight: 800; font-size: 18px; }
.tip-stats { padding: 4px 10px 10px; }
.tip-stats .sl { color: var(--muted); }
.tip-ft { padding: 8px 10px; border-top: 1px solid #262b34; color: var(--muted); }
.tip-ft b { color: var(--text); }
