/* -----------------------------------------------------------------------
   Normies Rarity — Minimalistic dark monochrome theme
   ----------------------------------------------------------------------- */

:root {
  --bg: #1a1b1c;
  --surface: #212223;
  --surface-2: #28292a;
  --surface-3: #303132;
  --border: rgba(227, 229, 228, 0.12);
  --border-2: rgba(227, 229, 228, 0.2);
  --text: #e3e5e4;
  --text-dim: rgba(227, 229, 228, 0.5);
  --text-muted: rgba(227, 229, 228, 0.25);
  --fg-rgb: 227, 229, 228;
  --pixel-on: #48494b;
  --pixel-off: #e3e5e4;
  --green: #22c55e;
  --green-dim: #15803d;
  --accent: #2081e2;
  --accent-dim: #1868b7;
  --radius: 6px;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace;
  --sidebar-width: 260px;
}

@font-face {
  font-family: 'NormiesFont';
  src: url('/NormiesFont.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

::selection {
  background: var(--green);
  color: var(--bg);
}

/* -----------------------------------------------------------------------
   Progress Bar
   ----------------------------------------------------------------------- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  z-index: 200;
  transition: opacity 0.5s;
}

.progress-bar.done {
  opacity: 0;
  pointer-events: none;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  width: 0%;
  transition: width 0.8s ease;
}

/* -----------------------------------------------------------------------
   Header
   ----------------------------------------------------------------------- */
header {
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

h1 {
  font-family: 'NormiesFont', var(--mono);
  font-size: 18px;
  font-weight: normal;
  letter-spacing: 4px;
  color: var(--pixel-off);
}

.header-tag {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--text-dim);
  border: 1px solid var(--border-2);
  padding: 2px 8px;
  border-radius: 3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-pill {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--surface-2);
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.stat-pill .green { color: var(--green); }

.weights-toggle {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  background: var(--surface-2);
}

.weights-toggle:hover {
  color: var(--text);
  border-color: var(--border-2);
}

/* -----------------------------------------------------------------------
   Weights Panel
   ----------------------------------------------------------------------- */
.weights-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  border-bottom: 1px solid transparent;
  background: var(--surface);
}

.weights-panel.open {
  max-height: 300px;
  border-bottom-color: var(--border);
}

.weights-inner {
  padding: 16px 28px 20px;
}

.weights-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.weights-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 14px;
  max-width: 640px;
  line-height: 1.6;
}

.weights-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.weight-chip {
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.weight-chip .wval {
  color: var(--green);
  font-weight: 600;
  margin-left: 4px;
}

.weight-chip.high {
  border-color: var(--green-dim);
  background: rgba(34, 197, 94, 0.06);
}

/* -----------------------------------------------------------------------
   Controls Bar
   ----------------------------------------------------------------------- */
.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}

.controls-row2 {
  display: contents;
}

.controls input,
.controls select {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
}

.controls input:focus,
.controls select:focus {
  border-color: var(--border-2);
}

.controls input {
  width: 220px;
}

.controls select {
  cursor: pointer;
}

.controls select option {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-toggle {
  font-family: var(--mono);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  color: var(--text);
  border-color: var(--border-2);
}

/* -----------------------------------------------------------------------
   Toggle Chips (Listed / THE100) — square, themed
   ----------------------------------------------------------------------- */
.toggle-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  padding: 5px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: all 0.15s;
}

.toggle-chip:hover {
  border-color: var(--border-2);
}

.toggle-chip input {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--text-muted);
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  flex-shrink: 0;
}

.toggle-chip input:checked {
  background: var(--green);
  border-color: var(--green);
}

.toggle-chip input:checked::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 4px;
  width: 4px;
  height: 7px;
  border: solid var(--bg);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.toggle-chip span {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  white-space: nowrap;
  transition: color 0.15s;
}

.toggle-chip:has(input:checked) {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.06);
}

.toggle-chip:has(input:checked) span {
  color: var(--green);
}

.toggle-chip.nav-chip {
  text-decoration: none;
}

.toggle-chip.nav-chip span {
  color: #60a5fa;
}

.toggle-chip.nav-chip:hover {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.08);
}

.toggle-chip.px-tier-low:has(input:checked) {
  border-color: rgba(76, 175, 80, 0.3);
  background: rgba(76, 175, 80, 0.06);
}
.toggle-chip.px-tier-low:has(input:checked) span { color: #4caf50; }
.toggle-chip.px-tier-low:has(input:checked) input { background: #4caf50; border-color: #4caf50; }

.toggle-chip.px-tier-mid:has(input:checked) {
  border-color: rgba(33, 150, 243, 0.3);
  background: rgba(33, 150, 243, 0.06);
}
.toggle-chip.px-tier-mid:has(input:checked) span { color: #64b5f6; }
.toggle-chip.px-tier-mid:has(input:checked) input { background: #2196f3; border-color: #2196f3; }

.toggle-chip.px-tier-high:has(input:checked) {
  border-color: rgba(255, 152, 0, 0.3);
  background: rgba(255, 152, 0, 0.06);
}
.toggle-chip.px-tier-high:has(input:checked) span { color: #ff9800; }
.toggle-chip.px-tier-high:has(input:checked) input { background: #ff9800; border-color: #ff9800; }

.toggle-chip.underpriced-chip:has(input:checked) {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.06);
}
.toggle-chip.underpriced-chip:has(input:checked) span:not(.info-icon) { color: #ef4444; }
.toggle-chip.underpriced-chip:has(input:checked) input { background: #ef4444; border-color: #ef4444; }

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: help;
  position: relative;
  flex-shrink: 0;
}

.info-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: 65vh;
  overflow-y: auto;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  z-index: 100;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.info-tooltip,
.info-tooltip * {
  white-space: normal !important;
}
.tip-formula {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 10px;
}
.tip-terms {
  color: var(--text-dim);
  margin-bottom: 10px;
}
.tip-terms b { color: var(--text); }
.tip-term { margin-bottom: 10px; }
.tip-term:last-child { margin-bottom: 0; }
.tip-rule {
  border-top: 1px solid var(--border-2);
  margin: 8px 0;
}
.tip-example {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 8px;
  font-size: 10.5px;
}
.tip-result {
  color: #ef4444;
  font-size: 10.5px;
}

.info-icon:hover .info-tooltip,
.info-icon:focus .info-tooltip {
  display: block;
}

/* -----------------------------------------------------------------------
   Layout: Sidebar + Content
   ----------------------------------------------------------------------- */
.layout {
  display: flex;
  flex: 1;
}

.layout-main {
  flex: 1;
  min-width: 0;
}

/* -----------------------------------------------------------------------
   Sidebar
   ----------------------------------------------------------------------- */
.sidebar {
  width: 0;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid transparent;
  transition: width 0.25s ease, border-color 0.2s;
  position: sticky;
  top: 64px;
  align-self: flex-start;
  max-height: calc(100vh - 64px);
}

.sidebar.open {
  width: var(--sidebar-width);
  border-right-color: var(--border);
  overflow-y: auto;
}

.sidebar-content,
.sidebar-header {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
}

.sidebar.open .sidebar-header,
.sidebar.open .sidebar-content {
  opacity: 1;
}

.sidebar-header,
.sidebar-content {
  opacity: 0;
  transition: opacity 0.15s;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.sidebar-close {
  display: none;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}

.sidebar-close:hover {
  color: var(--text);
  border-color: var(--border-2);
}

/* Trait Section */
.trait-section {
  border-bottom: 1px solid var(--border);
}

.trait-header {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  cursor: pointer;
  transition: background 0.1s;
  gap: 8px;
}

.trait-header:hover {
  background: var(--surface-2);
}

.trait-name-label {
  flex: 1;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

.trait-name-label.has-filter {
  color: var(--text);
}

.trait-count {
  font-size: 10px;
  color: var(--text-muted);
  min-width: 24px;
  text-align: right;
}

.trait-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.trait-section.open .trait-chevron {
  transform: rotate(180deg);
}

.trait-values {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  padding: 0 18px;
}

.trait-section.open .trait-values {
  max-height: 800px;
  padding: 0 18px 10px;
}

.trait-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
  transition: opacity 0.1s;
}

.trait-option:hover {
  opacity: 0.85;
}

.trait-option input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--text-muted);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  flex-shrink: 0;
}

.trait-option input:checked {
  background: var(--green);
  border-color: var(--green);
}

.trait-option input:checked::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 4.5px;
  width: 5px;
  height: 8px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.trait-option-name {
  flex: 1;
  font-size: 12px;
  color: var(--text-dim);
}

.trait-option.checked .trait-option-name {
  color: var(--text);
}

.trait-option-count {
  font-size: 10px;
  color: var(--text-muted);
  min-width: 30px;
  text-align: right;
}

/* Range Inputs */
.range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.range-input {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
  -moz-appearance: textfield;
}

.range-input::-webkit-outer-spin-button,
.range-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.range-input:focus {
  border-color: var(--border-2);
}

.range-input::placeholder {
  color: var(--text-muted);
}

.range-to {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.range-apply {
  font-family: var(--mono);
  font-size: 11px;
  width: 100%;
  padding: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.range-apply:hover {
  color: var(--text);
  border-color: var(--border-2);
}

/* Wallet Section */
.wallet-section {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.wallet-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.wallet-input-row {
  display: flex;
  gap: 6px;
}

.wallet-input-row input {
  flex: 1;
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

.wallet-input-row input:focus {
  border-color: var(--border-2);
}

.wallet-input-row input::placeholder {
  color: var(--text-muted);
}

.wallet-input-row button {
  font-family: var(--mono);
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.wallet-input-row button:hover {
  color: var(--green);
  border-color: var(--green-dim);
}

.wallet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.wallet-chips:empty { display: none; }

.wallet-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 6px;
  background: rgba(34, 197, 94, 0.06);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius);
  color: var(--green);
}

.wallet-chip-count {
  color: var(--text-muted);
}

.wallet-chip-x {
  cursor: pointer;
  opacity: 0.6;
  font-size: 12px;
  line-height: 1;
  margin-left: 2px;
}

.wallet-chip-x:hover {
  opacity: 1;
}

.wallet-status {
  font-size: 10px;
  margin-top: 6px;
  color: var(--text-muted);
  min-height: 15px;
}

.wallet-status:empty { display: none; }

.wallet-status.success { color: var(--green); }
.wallet-status.error { color: #ef4444; }

.wallet-tag {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.2);
  color: var(--green);
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 18px 0;
}

.burn-section {
  border-top: 1px solid var(--border);
}

.burn-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.burn-section-header:hover {
  color: var(--text);
}

.burn-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.burn-section.open .burn-chevron {
  transform: rotate(180deg);
}

.burn-leaderboard {
  display: none;
  padding: 0 18px 12px;
}

.burn-section.open .burn-leaderboard {
  display: block;
}

.burn-leaderboard-meta {
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.burn-leaderboard-empty {
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 0 6px;
}

.burn-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.15s ease;
}

.burn-row:last-child {
  border-bottom: none;
}

.burn-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.burn-rank {
  color: var(--text-muted);
}

.burn-wallet {
  font-family: var(--mono);
  color: var(--text-dim);
}

.burn-total {
  font-family: var(--mono);
  color: #ef4444;
  font-weight: 600;
}

/* -----------------------------------------------------------------------
   Active Filters
   ----------------------------------------------------------------------- */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 28px;
  min-height: 0;
  align-items: center;
}

.active-filters:not(:empty) {
  padding-top: 12px;
}

.active-tag {
  font-size: 10px;
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.active-tag .remove {
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.active-tag .remove:hover {
  opacity: 1;
}

.active-clear {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 6px;
  transition: color 0.15s;
}

.active-clear:hover {
  color: var(--text-dim);
}

/* -----------------------------------------------------------------------
   Main Grid
   ----------------------------------------------------------------------- */
main {
  padding: 20px 28px;
  min-height: 60vh;
}

.results-info {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-icon {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.empty-text {
  font-size: 12px;
  color: var(--text-dim);
}

/* -----------------------------------------------------------------------
   Card
   ----------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.card:hover {
  border-color: var(--border-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.card-sold {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.4s, transform 0.4s;
}

.card-img {
  position: relative;
  background: var(--pixel-off);
  aspect-ratio: 1;
  overflow: hidden;
}

.card-img img {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  transition: opacity 0.3s;
}

.card-img img.loading {
  opacity: 0;
}

.card-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.card-name-row .card-name {
  margin-bottom: 0;
}

.rank-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text-dim);
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.rank-badge.rarity-legendary {
  background: rgba(255, 152, 0, 0.2);
  color: #ff9800;
}

.rank-badge.rarity-epic {
  background: rgba(156, 39, 176, 0.2);
  color: #ce93d8;
}

.rank-badge.rarity-rare {
  background: rgba(33, 150, 243, 0.2);
  color: #64b5f6;
}

.rank-badge.rarity-uncommon {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.rank-badge.rarity-common {
  background: rgba(158, 158, 158, 0.12);
  color: #9e9e9e;
}

/* Modal rank colors */
.modal-rank.rarity-legendary { color: #ff9800; }
.modal-rank.rarity-epic { color: #ce93d8; }
.modal-rank.rarity-rare { color: #64b5f6; }
.modal-rank.rarity-uncommon { color: var(--green); }
.modal-rank.rarity-common { color: #9e9e9e; }

.card-info {
  padding: 10px;
}

.card-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.card-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.card-meta span {
  font-size: 9px;
  color: var(--text-dim);
  padding: 1px 6px;
  background: var(--surface-2);
  border-radius: 3px;
}

.card-meta span[class^="px-"] {
  margin-left: auto;
}

.card-meta span.px-low {
  color: #4caf50;
  background: rgba(76, 175, 80, 0.15);
}

.card-meta span.px-mid {
  color: #64b5f6;
  background: rgba(33, 150, 243, 0.15);
}

.card-meta span.px-high {
  color: #ff9800;
  background: rgba(255, 152, 0, 0.15);
}

.card-score {
  display: flex;
  flex-direction: column;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

.card-score strong {
  color: var(--text-dim);
  font-weight: 500;
}

.card-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-price {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(32, 129, 226, 0.15);
  color: var(--accent);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.card-price.underpriced {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.card-underpriced {
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.15);
}

.burn-count {
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}

/* -----------------------------------------------------------------------
   OpenSea Pill (Modal)
   ----------------------------------------------------------------------- */
.opensea-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.opensea-pill:hover {
  color: var(--accent);
  border-color: rgba(32, 129, 226, 0.3);
  background: rgba(32, 129, 226, 0.06);
}

.opensea-pill strong {
  color: var(--accent);
  font-weight: 700;
}

/* -----------------------------------------------------------------------
   Scroll Loader
   ----------------------------------------------------------------------- */
.scroll-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 24px 28px 48px;
  font-size: 11px;
  color: var(--text-muted);
}

.scroll-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* -----------------------------------------------------------------------
   Modal
   ----------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 680px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}

.modal-close:hover {
  color: var(--text);
  border-color: var(--border-2);
}

.modal-header {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}

.modal-img {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--pixel-off);
}

.modal-img img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.modal-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.modal-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-rank {
  font-size: 22px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 4px;
}

.modal-score {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.modal-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.modal-pill {
  font-size: 10px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
}

.modal-pill strong {
  color: var(--text);
  font-weight: 500;
}

.modal-pill.burn-pill {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
}
.modal-pill.burn-pill strong { color: #ef4444; }

/* Trait breakdown table */
.breakdown-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.breakdown-table th {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.breakdown-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}

.breakdown-table tr:last-child td {
  border-bottom: none;
}

.breakdown-table .trait-name {
  color: var(--text);
  font-weight: 500;
}

.breakdown-table .trait-value {
  color: var(--text-dim);
}

.breakdown-table .trait-weighted {
  color: var(--green);
  font-weight: 600;
}

.breakdown-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  min-width: 60px;
}

.breakdown-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.3s;
}

.breakdown-total {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}

.breakdown-total strong {
  color: var(--green);
  margin-left: 8px;
  font-weight: 700;
}

/* -----------------------------------------------------------------------
   Loading Skeleton
   ----------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  aspect-ratio: 0.75;
}

/* -----------------------------------------------------------------------
   Scrollbar
   ----------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 3px;
}

/* -----------------------------------------------------------------------
   Refresh Button
   ----------------------------------------------------------------------- */
.refresh-btn {
  font-family: var(--mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  justify-content: center;
}

.refresh-btn:hover:not(:disabled) {
  color: var(--green);
  border-color: var(--green-dim);
  background: rgba(34, 197, 94, 0.06);
}

.refresh-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* -----------------------------------------------------------------------
   Footer
   ----------------------------------------------------------------------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-top: 1px solid rgba(var(--fg-rgb), 0.15);
  flex-shrink: 0;
}

.site-footer a {
  color: rgba(var(--fg-rgb), 0.5);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s;
}

.site-footer a:hover {
  color: var(--text);
}

.created-by {
  font-size: 0.75rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(var(--fg-rgb), 0.5);
}

.created-by a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.created-by a:hover {
  color: var(--text);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* -----------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------- */
@media (max-width: 768px) {
  header {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .header-left { gap: 8px; }
  h1 { font-size: 13px; letter-spacing: 3px; }
  .header-tag { font-size: 8px; padding: 2px 6px; letter-spacing: 2px; }
  .header-right { gap: 8px; }
  .stat-pill { font-size: 9px; padding: 4px 8px; }

  .controls {
    padding: 8px 12px;
    gap: 6px;
  }
  .controls input {
    flex: 1;
    min-width: 0;
    font-size: 11px;
    padding: 8px 10px;
  }
  .controls select {
    flex: 1;
    min-width: 0;
    font-size: 10px;
    padding: 8px 6px;
  }

  .toggle-chip { padding: 4px 8px; gap: 5px; }
  .toggle-chip input { width: 12px; height: 12px; }
  .toggle-chip span { font-size: 9px; }

  .controls-row2 {
    display: flex;
    width: 100%;
    gap: 6px;
    align-items: center;
  }

  /* Sidebar becomes a slide-over on mobile */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 120;
    width: 280px;
    max-height: 100vh;
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  .sidebar:not(.open) {
    transform: translateX(-100%);
    margin-left: 0;
    opacity: 1;
    pointer-events: none;
  }

  .sidebar.open {
    transform: translateX(0);
    margin-left: 0;
  }

  .sidebar-close {
    display: flex;
  }

  main { padding: 10px 8px; }
  .results-info { padding-left: 4px; font-size: 9px; }
  .active-filters { padding: 0 12px; }

  .grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .card { border-radius: 4px; }
  .card:hover { transform: none; box-shadow: none; }
  .card-info { padding: 6px; }
  .card-name { font-size: 9px; margin-bottom: 3px; }
  .card-meta span { font-size: 7px; padding: 1px 4px; }
  .card-meta { gap: 3px; margin-bottom: 3px; }
  .card-score { font-size: 8px; }
  .rank-badge { font-size: 7px; padding: 1px 4px; }

  /* Modal — full screen on mobile */
  .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    padding: 10px;
    padding-top: 48px;
  }

  .modal-header {
    flex-direction: row;
    gap: 14px;
    margin-bottom: 16px;
    align-items: flex-start;
  }

  .modal-img { width: 100px; height: 100px; border-radius: 4px; }
  .modal-name { font-size: 14px; margin-bottom: 4px; }
  .modal-rank { font-size: 20px; margin-bottom: 2px; }
  .modal-score { font-size: 11px; margin-bottom: 10px; }
  .modal-pill { font-size: 9px; padding: 3px 7px; }
  .modal-pills { gap: 4px; }

  .breakdown-title { font-size: 9px; margin-bottom: 8px; }

  .breakdown-table {
    font-size: 10px;
    display: block;
    overflow-x: visible;
    -webkit-overflow-scrolling: touch;
  }

  .breakdown-table thead,
  .breakdown-table tbody { display: table; width: 100%; table-layout: auto; }
  .breakdown-table th { font-size: 8px; padding: 5px 4px; white-space: nowrap; }
  .breakdown-table td { padding: 6px 4px; font-size: 10px; white-space: nowrap; }
  .breakdown-bar { min-width: 20px; }

  .breakdown-total { font-size: 11px; margin-top: 10px; padding-top: 10px; }
  .card-price { font-size: 7px; padding: 1px 4px; }

  .opensea-pill svg { width: 12px; height: 12px; }

  .refresh-btn { font-size: 10px; padding: 10px 12px; margin-top: 12px; }

  .modal-close {
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    font-size: 16px;
    z-index: 10;
  }

  .weights-inner { padding: 12px; }
  .weights-desc { font-size: 10px; }
  .weight-chip { font-size: 9px; padding: 3px 7px; }

  .site-footer {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    padding: 1rem;
  }
  .created-by { font-size: 0.65rem; }
  .footer-links { justify-content: center; }
}

@media (max-width: 380px) {
  h1 { font-size: 12px; letter-spacing: 2px; }
  .header-tag { display: none; }
  .stat-pill { font-size: 8px; padding: 3px 6px; }
  .modal-img { width: 80px; height: 80px; }
  .card-name { font-size: 8px; }
  .card-meta span { font-size: 6px; }
  .card-score { font-size: 7px; }
}
