.collapsible      { display: none; }
.collapsible.open { display: flex; }

/* ---- Filter buttons ---- */
.filter-btn {
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.78rem;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.filter-btn:hover { border-color: var(--accent); color: var(--text); }

.filter-ink-btn {
  flex-shrink: 0;
  align-self: center;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: opacity var(--transition), border-color var(--transition);
}
.filter-ink-btn.active { opacity: 0.2; border-color: var(--accent); }

.filter-type-sep { align-self: stretch; width: 1px; margin: 0 2px; background: var(--border2); }

.filter-type-btn.active,
.filter-set-btn.active,
.filter-rarity-btn.active { border-color: var(--accent); color: var(--accent); text-decoration: line-through; }

.filter-set-btn.active,
.filter-rarity-btn.active { opacity: 0.4; }

.filter-set-btn    { font-weight: 700; }
.filter-rarity-btn { font-weight: 700; transition: var(--trans-interactive); }

/* Each rarity sets --rarity-c; active rule derives text + 12% tint from it. */
.filter-rarity-btn[data-rarity="common"]     { --rarity-c: var(--rarity-common); }
.filter-rarity-btn[data-rarity="uncommon"]   { --rarity-c: var(--rarity-uncommon); }
.filter-rarity-btn[data-rarity="rare"]       { --rarity-c: var(--rarity-rare); }
.filter-rarity-btn[data-rarity="super_rare"] { --rarity-c: var(--rarity-super-rare); }
.filter-rarity-btn[data-rarity="legendary"]  { --rarity-c: var(--rarity-legendary); }
.filter-rarity-btn[data-rarity="enchanted"]  { --rarity-c: var(--rarity-enchanted); }
.filter-rarity-btn[data-rarity="epic"]       { --rarity-c: var(--rarity-epic); }
.filter-rarity-btn[data-rarity="iconic"]     { --rarity-c: var(--rarity-iconic); }
.filter-rarity-btn[data-rarity="promo"]      { --rarity-c: var(--rarity-promo); }
.filter-rarity-btn.active {
  color: var(--rarity-c);
  background: color-mix(in srgb, var(--rarity-c) 12%, transparent);
}

.filter-toggle-btn        { transition: var(--trans-interactive); }
.filter-toggle-btn.active { border-color: var(--blue); color: var(--blue); background: color-mix(in srgb, var(--blue) 10%, transparent); }

.filter-reset-btn       { flex-shrink: 0; padding: 3px 10px; }
.filter-reset-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Search ---- */
.search-row             { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.search-input-wrap      { position: relative; flex: 1 1 200px; min-width: 0; }
.search-input-wrap input { width: 100%; padding-right: 28px; }

.search-clear-btn {
  display: none;
  position: absolute;
  right: 4px;
  top: 50%;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1;
  transform: translateY(-50%);
  cursor: pointer;
}
.search-clear-btn:hover { color: var(--text); }

.search-mode {
  display: flex;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
}
.search-mode-btn {
  padding: 4px 9px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.search-mode-btn.active { background: var(--accent); color: #fff; }

.search-hints        { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.search-hints > span { color: var(--text-dim); font-size: 0.72rem; }

.search-hint-btn {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text-mid);
  font-size: 0.72rem;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.search-hint-btn:hover { border-color: var(--accent); color: var(--text); }
.search-hint-btn code  { font-family: monospace; font-size: 0.72rem; }
#search-hints-toggle   { align-self: flex-start; }
.search-hints-body     { flex-direction: column; gap: 4px; }

/* ---- Filter section ---- */
#filter-section { flex-direction: column; gap: 4px; width: 100%; }

.browser-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.filter-label {
  min-width: 52px;
  color: var(--text-dim);
  font-size: 0.72rem;
  white-space: nowrap;
}

/* ---- Dual slider ---- */
.dual-slider {
  position: relative;
  flex: 1;
  min-width: 80px;
  height: 26px;
}
.ds-track {
  position: absolute;
  left: 7px; right: 7px;
  top: 9px;
  height: 4px;
  background: var(--border2);
  border-radius: 2px;
  pointer-events: none;
}
.ds-ticks {
  position: absolute;
  left: 7px; right: 7px;
  top: 16px;
  pointer-events: none;
}
.ds-tick {
  position: absolute;
  width: 1px;
  height: 4px;
  background: var(--border2);
  opacity: 0.7;
  transform: translateX(-50%);
}
.ds-fill {
  position: absolute;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: background var(--transition);
}
.ds-fill.ds-fill-unset { background: var(--border2); }

.ds-input {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 22px;
  margin: 0; padding: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
}
.ds-input::-webkit-slider-thumb {
  position: relative;
  z-index: 1;
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.4);
  cursor: pointer;
  pointer-events: all;
}
.ds-input::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.4);
  cursor: pointer;
  pointer-events: all;
}
.ds-input::-webkit-slider-runnable-track { background: transparent; }
.ds-input::-moz-range-track              { background: transparent; border: none; }

.ds-stat-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  width: 100%;
}
.ds-stat-item {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 8px;
  min-width: 180px;
}
.ds-val {
  flex-shrink: 0;
  min-width: 32px;
  color: var(--accent);
  font-size: 0.72rem;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .dual-slider                   { height: 32px; }
  .ds-input                      { height: 28px; }
  .ds-input::-webkit-slider-thumb { width: 20px; height: 20px; }
  .ds-input::-moz-range-thumb     { width: 20px; height: 20px; }
}

.filter-tooltip {
  position: absolute;
  z-index: 200;
  padding: 4px 8px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.4);
  color: var(--text);
  font-size: 0.72rem;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  pointer-events: none;
}
