/* The catalog's View and Filter popovers (.prd/19 C4/C5) and the theme tokens they are drawn with, shared by
   the deck builder (inside .deck-builder) and /cards (inside .catalog-menus, .prd/20 F8). Moved here unchanged from
   decks/deck-builder.css (L7 tokens) and decks/deck-catalog.css (C4/C5); every `.deck-builder X` rule also names
   `.catalog-menus X`, so both scopes get the same declarations at the same specificity. Linked after
   deck-catalog.css on /decks/ — the cascade the rules had there. */

/* L7 dark tokens [CSS 3tkmg3opueqaw.css:273955 … :274375], with the stylesheet's lab() overrides. */
.deck-builder,
.catalog-menus {
  --background: #1b1c26;
  --foreground: #e6e7ef;
  --card: #14151f;
  --popover: #14151f;
  --primary: #00b0d6;
  --primary-foreground: #f8f8f8;
  --secondary: #2c2d38;
  --muted: #2c2d38;
  --muted-foreground: #8e8f95;
  --accent: #2c2d38;
  --destructive: #82181a;
  --border: #383a45;
  --input: #20212b;
  --ring: #00b0d6;
  --radius: 0.375rem;
}

@supports (color: lab(0% 0 0)) {
  .deck-builder,
  .catalog-menus {
    --background: lab(10.5017% 1.7127 -7.25419);
    --foreground: lab(91.8042% 0.653565 -3.72446);
    --card: lab(7.05658% 1.67041 -7.16021);
    --popover: lab(7.05658% 1.67041 -7.16021);
    --primary: lab(65.8981% -33.0161 -35.083);
    --secondary: lab(18.629% 1.60295 -7.29785);
    --muted: lab(18.629% 1.60295 -7.29785);
    --muted-foreground: lab(59.3234% 0.665635 -3.71721);
    --accent: lab(18.629% 1.60295 -7.29785);
    --border: lab(24.4324% 1.55185 -7.32018);
    --input: lab(12.8242% 1.67496 -7.26859);
    --ring: lab(65.8981% -33.0161 -35.083);
  }
}

/* /cards' scope (.prd/20 F8): the menus mount in an empty .catalog-menus box (they are position: fixed), which
   carries the builder's base text and the same control reset deck-builder.css gives .deck-builder — styles.css
   styles every button / input / select of the site. The page around it keeps its own look. */
.catalog-menus {
  color: var(--foreground);
  font-size: 16px;
  line-height: 1.5;
}

.catalog-menus button,
.catalog-menus input,
.catalog-menus select {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0 solid transparent;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  width: auto;
}

.catalog-menus button {
  cursor: default;
}

.catalog-menus svg.lucide {
  flex: none;
  width: 14px;
  height: 14px;
}

.catalog-menus .db-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------- C4 View menu */
/* fixture catalog.viewMenu.legendTab: 256 × 518, padding 10, radius 6, border border/70, bg background/98,
   shadow 0 16px 36px rgba(0,0,0,.2); "Group by" 12px/500 over a 44px select (14px/500) with a rule under
   (12px below); SORT BY / DIRECTION 11px/600, 16.5 tall, 12px above; sort options 234 × 36 (14px/400,
   4px apart; the chosen one on secondary with a check); Asc / Desc 115 × 36, 14px/500, 4px apart. */
.db-view-menu,
.db-filter-menu {
  position: fixed;
  top: 0;
  left: 0;
  max-width: calc(100vw - 16px);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--background) 98%, transparent);
  color: var(--foreground);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
  font-size: 14px;
  line-height: 20px;
}

.db-view-menu {
  z-index: 126;
  width: 256px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 10px;
  backdrop-filter: blur(24px);
}

.db-view-group {
  display: grid;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  color: var(--foreground);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: normal;
  text-transform: none;
}

.db-view-menu:focus,
.db-filter-menu:focus {
  outline: none;
}

.db-view-select-wrap {
  position: relative;
  display: block;
}

.deck-builder .db-view-select,
.catalog-menus .db-view-select {
  width: 100%;
  height: 44px;
  padding: 0 36px 0 12px;
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  appearance: none;
}

.db-view-select-wrap .db-view-select-chevron {
  position: absolute;
  top: 15px;
  right: 12px;
  color: var(--muted-foreground);
  pointer-events: none;
}

.db-view-heading {
  margin: 12px 0 4px;
  color: color-mix(in oklab, var(--foreground) 58%, transparent);
  font-size: 11px;
  font-weight: 600;
  line-height: 16.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.db-view-options {
  display: grid;
  gap: 4px;
}

.deck-builder .db-view-option,
.catalog-menus .db-view-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: calc(var(--radius) - 2px);
  color: color-mix(in oklab, var(--foreground) 78%, transparent);
  font-size: 14px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}

.deck-builder .db-view-option:hover,
.catalog-menus .db-view-option:hover {
  background: color-mix(in oklab, var(--secondary) 60%, transparent);
  color: var(--foreground);
}

.deck-builder .db-view-option[aria-pressed="true"],
.catalog-menus .db-view-option[aria-pressed="true"] {
  background: var(--secondary);
  color: var(--foreground);
}

.db-view-option .db-view-check {
  visibility: hidden;
}

.deck-builder .db-view-option svg.lucide,
.catalog-menus .db-view-option svg.lucide {
  width: 16px;
  height: 16px;
}

.db-view-option[aria-pressed="true"] .db-view-check {
  visibility: visible;
}

.db-view-directions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.deck-builder .db-view-direction,
.catalog-menus .db-view-direction {
  height: 36px;
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in oklab, var(--background) 70%, transparent);
  color: color-mix(in oklab, var(--foreground) 72%, transparent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.deck-builder .db-view-direction[aria-pressed="true"],
.catalog-menus .db-view-direction[aria-pressed="true"] {
  background: var(--secondary);
  color: var(--foreground);
}

/* ------------------------------------------------------------------- C5 Filter menu */
/* fixture catalog.filterMenu (Legend tab 608 × 324.5, Main Deck tab 608 × 438.5): a 40px head ("Filter
   cards" 14px/600, × "Close filters" 32 × 32, 12px in) over a body padded 8/12 whose tinted boxes sit 6px
   apart (border 1, padding 4/8; PRIMARY sky, CARD PROPERTIES amber, ADVANCED violet, STATUS slate — the
   fixture's class set gives the tones and their dark variants); box titles 9px/600 with a dot and a rule;
   row labels 10px/600 in a 4rem column, 6px before the controls; DOMAIN toggles 28 × 28 and the Main Deck
   chips 24 tall in a 2px-padded segment, 1px apart; SET chips 28 tall 12px/500, 4px apart (padding 8 / 6 by
   the chip widths: "Origins 16" 73.2, "0 2" 28); the two top boxes 6px apart (PRIMARY content 270); KEYWORDS / TAGS
   277 × 32 triggers 10px apart opening 277 × 320 lists; STATUS switches 182.7 × 28, 8px apart. */
.db-filter-menu {
  z-index: 128;
  display: flex;
  flex-direction: column;
  width: 38rem;
}

/* /cards' "full" layout (.prd/20 F3: 7 domains, every type, 9 energy chips): a wider popover so the DOMAIN row
   stays one row (7 × 28px toggles need a 340px box); still capped at the viewport by max-width. Decks never draws
   it. */
.db-filter-menu.is-full {
  width: 44rem;
}

.db-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 12px;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
}

.db-filter-heading {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.deck-builder .db-filter-close,
.catalog-menus .db-filter-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted-foreground);
  font-size: 16px;
  cursor: pointer;
}

.deck-builder .db-filter-close:hover,
.catalog-menus .db-filter-close:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.deck-builder .db-filter-close svg.lucide,
.catalog-menus .db-filter-close svg.lucide {
  width: 16px;
  height: 16px;
}

.db-filter-body {
  display: grid;
  gap: 6px;
  padding: 8px 12px;
}

.db-filter-top {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.db-filter-box {
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid color-mix(in oklab, var(--tone) 10%, transparent);
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--tone) 2.5%, transparent);
}

.db-filter-box.is-primary {
  --tone: lab(70.687% -23.6078 -45.9483);
  --tone-text: color-mix(in oklab, lab(80.3307% -20.2945 -31.385) 70%, transparent);
}

.db-filter-box.is-properties {
  --tone: lab(80.1641% 16.6016 99.2089);
  --tone-text: color-mix(in oklab, lab(86.4156% 6.13147 78.3961) 70%, transparent);
}

.db-filter-box.is-advanced {
  --tone: lab(62.8239% 34.9159 -60.0512);
  --tone-text: color-mix(in oklab, lab(76.7419% 18.3911 -37.0706) 70%, transparent);
}

.db-filter-box.is-status {
  --tone: lab(65.5349% -2.25151 -14.5072);
  --tone-text: color-mix(in oklab, lab(84.7652% -1.94535 -7.93337) 55%, transparent);
  background: color-mix(in oklab, var(--tone) 2%, transparent);
}

.db-filter-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
  color: var(--tone-text);
  font-size: 9px;
  font-weight: 600;
  line-height: 13.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.db-filter-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--tone-text);
}

.db-filter-rule {
  flex: 1 1 auto;
  height: 1px;
  background: color-mix(in oklab, var(--tone) 18%, transparent);
}

.db-filter-row {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  column-gap: 6px;
  align-items: start;
}

.db-filter-row + .db-filter-row {
  margin-top: 6px;
}

.db-filter-label {
  margin: 0;
  color: color-mix(in oklab, var(--foreground) 58%, transparent);
  font-size: 10px;
  font-weight: 600;
  line-height: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.db-filter-row > .db-filter-label {
  padding: 4px 0;
}

.db-filter-segment {
  display: flex;
  flex-wrap: wrap;
  justify-self: start;
  gap: 1px;
  padding: 2px;
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--secondary) 35%, transparent);
}

.db-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.deck-builder .db-filter-chip,
.catalog-menus .db-filter-chip,
.deck-builder .db-filter-switch,
.catalog-menus .db-filter-switch,
.deck-builder .db-filter-domain,
.catalog-menus .db-filter-domain {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in oklab, var(--secondary) 30%, transparent);
  color: color-mix(in oklab, var(--foreground) 72%, transparent);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
  cursor: pointer;
}

.deck-builder .db-filter-chip.is-small,
.catalog-menus .db-filter-chip.is-small {
  height: 24px;
  padding: 0 6px;
  gap: 3px;
  background: transparent;
}

.deck-builder .db-filter-chip:hover,
.catalog-menus .db-filter-chip:hover,
.deck-builder .db-filter-switch:hover,
.catalog-menus .db-filter-switch:hover,
.deck-builder .db-filter-domain:hover,
.catalog-menus .db-filter-domain:hover {
  color: var(--foreground);
}

.deck-builder .db-filter-chip[aria-pressed="true"],
.catalog-menus .db-filter-chip[aria-pressed="true"],
.deck-builder .db-filter-domain[aria-pressed="true"],
.catalog-menus .db-filter-domain[aria-pressed="true"] {
  background: var(--background);
  color: var(--foreground);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--primary) 35%, transparent), 0 1px 2px 0 rgba(0, 0, 0, 0.25);
}

.db-filter-count {
  color: color-mix(in oklab, var(--foreground) 45%, transparent);
  font-size: 9px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.deck-builder .db-filter-domain,
.catalog-menus .db-filter-domain {
  justify-content: center;
  width: 28px;
  padding: 0;
}

/* Our stand-in for the reference's domain art (a Non-goal): the rune colours of the site's card text. */
.db-domain-glyph {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.db-domain-glyph::before {
  content: attr(data-glyph);
}

.db-domain-glyph.is-fury { background: #9a3412; }
.db-domain-glyph.is-calm { background: #2f7f91; }
.db-domain-glyph.is-mind { background: #4f46e5; }
.db-domain-glyph.is-body { background: #596d45; }
.db-domain-glyph.is-chaos { background: #7c3a72; }
.db-domain-glyph.is-order { background: #b08918; }

/* /cards' 7th DOMAIN toggle (.prd/20 E1): no domain. */
.db-domain-glyph.is-colorless { background: #6b7280; }

.db-filter-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.db-filter-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.db-filter-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.deck-builder .db-filter-combo,
.catalog-menus .db-filter-combo {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in oklab, var(--secondary) 20%, transparent);
  color: var(--foreground);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  text-align: left;
  cursor: pointer;
}

.db-filter-combo-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Open, the trigger's chevron points up (screenshots 17 / 62). */
.db-filter-combo[aria-expanded="true"] .db-filter-combo-chevron {
  transform: rotate(180deg);
}

.db-filter-combo .db-filter-combo-icon {
  color: var(--muted-foreground);
}

/* The Keywords / Tags list (fixture keywordsDropdown / tagsDropdown: 277 × 320, "Search Keywords...",
   rows with a checkbox and the count). Fixed, so the menu's edge does not clip it (screenshot 17). */
.db-filter-list {
  position: fixed;
  z-index: 130;
  display: flex;
  flex-direction: column;
  width: 277px;
  height: 320px;
  overflow: hidden;
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: var(--radius);
  background: var(--background);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3);
}

/* Screenshot 17 (read off its pixels): the search field 36 tall, 8px in, a 2px ring when focused, the
   rows from 51px down. */
.db-filter-list-field {
  position: relative;
  display: block;
  flex: none;
  padding: 8px 8px 6px;
  letter-spacing: normal;
  text-transform: none;
}

.db-filter-list-field .db-filter-list-icon {
  position: absolute;
  top: 18px;
  left: 20px;
  width: 16px;
  height: 16px;
  color: var(--muted-foreground);
  pointer-events: none;
}

.deck-builder .db-filter-list-search,
.catalog-menus .db-filter-list-search {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
}

.deck-builder .db-filter-list-search:focus,
.catalog-menus .db-filter-list-search:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}

.db-filter-list-options {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 8px 8px;
}

.deck-builder .db-filter-option,
.catalog-menus .db-filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--foreground);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.deck-builder .db-filter-option:hover,
.catalog-menus .db-filter-option:hover {
  background: var(--secondary);
}

.db-filter-box-check {
  flex: none;
  width: 16px;
  height: 16px;
  border: 1px solid color-mix(in oklab, var(--border) 100%, transparent);
  border-radius: 4px;
  background: color-mix(in oklab, var(--secondary) 40%, transparent);
}

.db-filter-option[aria-checked="true"] .db-filter-box-check {
  border-color: var(--primary);
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.db-filter-option-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-filter-option-count {
  color: var(--muted-foreground);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.db-filter-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.db-filter-status-item {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.deck-builder .db-filter-switch,
.catalog-menus .db-filter-switch {
  width: 100%;
  padding: 0 8px;
}

.db-switch-track {
  position: relative;
  flex: none;
  width: 28px;
  height: 14px;
  margin-left: auto;
  border: 1px solid color-mix(in oklab, var(--border) 100%, transparent);
  border-radius: 999px;
  background: color-mix(in oklab, var(--secondary) 80%, transparent);
  transition: background-color 0.15s;
}

/* Screenshot 07: a 28 × 14 grey track with a white knob at the left when off. */
.db-switch-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}

.db-filter-switch[aria-checked="true"] {
  color: var(--foreground);
}

.deck-builder .db-filter-switch:disabled,
.catalog-menus .db-filter-switch:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.db-filter-switch[aria-checked="true"] .db-switch-track {
  border-color: var(--primary);
  background: var(--primary);
}

.db-filter-switch[aria-checked="true"] .db-switch-thumb {
  background: #fff;
  transform: translateX(14px);
}

/* A narrow screen stacks the two columns [추정 — the phone Filter menu was not opened]. */
@media (max-width: 39.999rem) {
  .db-filter-top,
  .db-filter-pair,
  .db-filter-status {
    grid-template-columns: minmax(0, 1fr);
  }

  .db-filter-menu {
    max-height: calc(100vh - 16px);
    overflow-y: auto;
  }
}
