:root {
  --bg: #14171c; --panel: #1d222b; --panel2: #262d39; --line: #333b48;
  --text: #d8dee9; --muted: #8a93a3; --accent: #f0b429;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.4 "Segoe UI", system-ui, sans-serif;
}
header {
  position: sticky; top: 0; z-index: 5;
  background: var(--panel); border-bottom: 1px solid var(--line); padding: 8px 14px;
}
header h1 { margin: 0 0 6px; font-size: 16px; letter-spacing: .5px; color: var(--accent); }
.controls { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.controls label { color: var(--muted); font-size: 12px; }
.controls select, .controls input[type=text] {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 4px; padding: 4px 6px; margin-left: 4px; font-size: 13px;
}
.controls .search-wrap { position: relative; display: inline-block; margin-left: 4px; }
.controls .search input { width: 170px; margin-left: 0; padding-right: 22px; }
.controls .clear-btn {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); font-size: 15px;
  line-height: 1; cursor: pointer; padding: 0 3px;
}
.controls .clear-btn:hover { color: var(--text); }
.controls .check { display: flex; align-items: center; gap: 4px; }
.settings-btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 4px; padding: 4px 8px; font-size: 13px; cursor: pointer;
}
.settings-btn:hover { border-color: var(--accent); }
.detail.settings label.check {
  display: flex; align-items: center; gap: 6px; margin: 10px 0; font-size: 13px;
}
.approx { color: #e0a23f; font-size: 12px; }
.hidden { display: none !important; }
.meta { color: var(--muted); font-size: 12px; }
.alt { margin-left: auto; color: var(--accent); text-decoration: none; font-size: 12px; }
.alt:hover { text-decoration: underline; }

main { padding: 12px 14px 60px; }
.queue-section { margin-bottom: 20px; }
.queue-section h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin: 0 0 8px; border-left: 4px solid var(--qc, var(--muted));
  padding-left: 8px;
}
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }

.req-groups { column-width: 380px; column-gap: 14px; }
.req-group {
  break-inside: avoid; margin-bottom: 14px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 10px 12px;
}
.req-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin-bottom: 6px;
}
.req-head.none { font-style: italic; }
.req-icons { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.req-group .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px; text-align: center; cursor: pointer; position: relative;
  transition: border-color .1s;
}
.tile:hover { border-color: var(--accent); }
.tile.dim { opacity: .2; }
.tile.hover-focus {
  border-color: #3fd97a; box-shadow: 0 0 0 2px #3fd97a; z-index: 2;
}
.tile.req-link { border-color: #e0a23f; z-index: 2; animation: tile-pulse-orange 1s ease-in-out infinite; }
.tile.unlock-link { border-color: #4a90d9; z-index: 2; animation: tile-pulse-blue 1s ease-in-out infinite; }
@keyframes tile-pulse-orange {
  0%, 100% { box-shadow: 0 0 0 2px #e0a23f; }
  50% { box-shadow: 0 0 0 5px #e0a23f; }
}
@keyframes tile-pulse-blue {
  0%, 100% { box-shadow: 0 0 0 2px #4a90d9; }
  50% { box-shadow: 0 0 0 5px #4a90d9; }
}
.tile .cameo {
  width: 100%; height: 60px; border-radius: 4px; object-fit: contain;
  image-rendering: pixelated; background: #0c0e12; display: block;
}
.tile .placeholder {
  width: 100%; height: 60px; border-radius: 4px; display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 600; color: #fff;
  text-shadow: 0 1px 2px #0008; padding: 2px; overflow: hidden;
}
.tile .nm { font-size: 11px; margin-top: 4px; line-height: 1.2; height: 2.4em; overflow: hidden; }
.tile .cost { font-size: 11px; color: var(--accent); }
.tile .cost.free { color: var(--muted); }

.tile.compact { width: 64px; padding: 4px; }
.tile.compact .cameo, .tile.compact .placeholder { height: 28px; }
.tile.compact .nm { font-size: 10px; height: 2.2em; margin-top: 2px; }
.tile.compact .cost { display: none; }

.off-indicator {
  position: fixed; right: 14px; z-index: 25; max-width: calc(100vw - 28px);
  display: flex; gap: 8px; padding: 8px; overflow-x: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px #000a;
}
.off-indicator.bottom { bottom: 28px; }
.off-item { width: 96px; flex: 0 0 auto; cursor: pointer; text-align: center; }
.off-chip {
  width: 100%; height: 60px; object-fit: contain; image-rendering: pixelated;
  background: #0c0e12; border-radius: 4px; display: block;
  border: 2px solid var(--line);
}
.off-chip.req-link { border-color: #e0a23f; }
.off-chip.unlock-link { border-color: #4a90d9; }
.off-nm {
  font-size: 11px; color: var(--text); margin-top: 4px; line-height: 1.2;
  height: 2.4em; overflow: hidden;
}

.tip {
  position: fixed; z-index: 20; max-width: 280px; pointer-events: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; box-shadow: 0 6px 24px #0009; font-size: 12px;
}
.tip h3 { margin: 0 0 6px; font-size: 14px; color: var(--accent); }
.tip dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1px 8px; margin: 0; }
.tip dt { color: var(--muted); white-space: nowrap; }
.tip dd { overflow-wrap: anywhere; margin: 0; }
.tip .sec { margin-top: 6px; color: var(--muted); }
.tip .tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.tip .tag { background: var(--panel2); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.overlay {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center;
}
.detail {
  position: relative; width: 320px; max-width: calc(100vw - 32px); max-height: calc(100vh - 80px);
  overflow: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px 18px; box-shadow: 0 10px 40px #000a;
}
#detailClose {
  position: absolute; top: 8px; right: 10px; background: none; border: none;
  color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer;
}
#detailClose:hover { color: var(--text); }
.detail .head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.detail .head img, .detail .head .ph {
  width: 64px; height: 48px; border-radius: 4px; object-fit: contain;
  image-rendering: pixelated; background: #0c0e12; flex: 0 0 auto;
}
.detail h2 { margin: 0; font-size: 17px; color: var(--accent); }
.detail .sub { color: var(--muted); font-size: 12px; }
.detail h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin: 14px 0 5px;
}
.detail h4 {
  font-size: 11px; color: var(--accent); margin: 8px 0 3px; opacity: .85;
}
.detail h4:first-child { margin-top: 0; }
.detail .empty { color: var(--muted); }
.detail .descr { color: var(--text); font-size: 12px; font-style: italic; margin: 0; }
.detail dl.stats { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; margin: 0; font-size: 12px; }
.detail dl.stats dt { color: var(--muted); }
.detail ul { margin: 0; padding-left: 0; list-style: none; }
.detail .weap { padding: 4px 0; border-bottom: 1px solid var(--line); }
.detail .weap:last-child { border-bottom: none; }
.detail .weap .wl1 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.detail .weap .wn { font-weight: 600; }
.detail .weap .dps { color: var(--accent); font-size: 12px; white-space: nowrap; }
.detail .weap .ws { color: var(--muted); font-size: 12px; padding-left: 10px; }
.detail .prereqs { display: flex; flex-wrap: wrap; gap: 5px; }
.detail .prereq {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 4px;
  padding: 2px 7px; font-size: 12px;
}
.detail .prereq.raw { color: var(--muted); font-style: italic; }
.detail .prereq.unlock { cursor: pointer; }
.detail .prereq.unlock:hover { border-color: var(--accent); color: var(--accent); }
footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 5px 14px; font-size: 11px; color: var(--muted);
}
