:root {
  --bg: #1a1a1a;
  --surface: #262626;
  --border: #3a3a3a;
  --text: #f0f0f0;
  --text-muted: #9a9a9a;
  --accent: #5a8dee;
}

body.theme-dark-purple {
  --bg: #1a1622;
  --surface: #25203a;
  --border: #3e3554;
  --text: #f1eefc;
  --text-muted: #a79bc9;
  --accent: #a374ff;
}

body.theme-dark-red {
  --bg: #1f1414;
  --surface: #2c1c1c;
  --border: #4a2b2b;
  --text: #fbeeec;
  --text-muted: #c79a96;
  --accent: #e0584f;
}

body.theme-dark-pink {
  --bg: #1f1419;
  --surface: #2c1c26;
  --border: #4a2b3e;
  --text: #fbeef5;
  --text-muted: #c79ab6;
  --accent: #ec74b0;
}

body.theme-dark-green {
  --bg: #131a16;
  --surface: #1c2620;
  --border: #2c4036;
  --text: #ecfbf1;
  --text-muted: #97bda6;
  --accent: #4fb878;
}

body.theme-dark-navy {
  --bg: #11161f;
  --surface: #192230;
  --border: #2a384c;
  --text: #ecf3fb;
  --text-muted: #93a8c2;
  --accent: #5aa8ee;
}

body.theme-chopper {
  --bg: #1a1410;
  --surface: #2a2018;
  --border: #4a382a;
  --text: #fdf0e4;
  --text-muted: #c4a68e;
  --accent: #e88a9e;
}

body.theme-perona {
  --bg: #150d1e;
  --surface: #221430;
  --border: #3d1f50;
  --text: #fce8f4;
  --text-muted: #b87fa0;
  --accent: #e84393;
}

body.theme-sakura {
  --bg: #1a1218;
  --surface: #261c24;
  --border: #3e2e3a;
  --text: #fdf0f6;
  --text-muted: #c4a0b4;
  --accent: #f0a0c0;
}

body.theme-sky {
  --bg: #101820;
  --surface: #18242e;
  --border: #283a48;
  --text: #eef6fc;
  --text-muted: #8eb8d4;
  --accent: #60c8e0;
}

/* ---- Light themes ---- */
body.theme-chopper-light {
  --bg: #fdf5ed;
  --surface: #f5e8d8;
  --border: #ddc8b0;
  --text: #2a1e14;
  --text-muted: #8a7060;
  --accent: #d86882;
  --card-bg: #fff8f2;
}

body.theme-perona-light {
  --bg: #fdf0f6;
  --surface: #f4e0ec;
  --border: #dbb8d0;
  --text: #1e0e28;
  --text-muted: #7a5a78;
  --accent: #d83888;
  --card-bg: #fff5fa;
}

body.theme-sakura-light {
  --bg: #fdf2f6;
  --surface: #f6e4ec;
  --border: #e0c4d4;
  --text: #2a1820;
  --text-muted: #8a6878;
  --accent: #e088a8;
  --card-bg: #fff6fa;
}

body.theme-sky-light {
  --bg: #f0f7fc;
  --surface: #e2eef6;
  --border: #b8d4e8;
  --text: #10202e;
  --text-muted: #607888;
  --accent: #3098b8;
  --card-bg: #f6fbff;
}

/* Shared overrides for all light themes */
body[class*="-light"] select,
body[class*="-light"] input[type="text"],
body[class*="-light"] input[type="number"],
body[class*="-light"] textarea {
  background: var(--card-bg, #fff);
  color: var(--text);
  border-color: var(--border);
}

body[class*="-light"] .multiselect-button,
body[class*="-light"] .pill-toggle {
  background: var(--surface);
  color: var(--text);
}

body[class*="-light"] .multiselect-button.active,
body[class*="-light"] .pill-toggle.active,
body[class*="-light"] .view-toggle button.active {
  background: var(--accent);
  color: #fff;
}

body[class*="-light"] .multiselect-panel,
body[class*="-light"] .filters-panel {
  background: var(--card-bg, #fff);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

body[class*="-light"] .card {
  background: var(--card-bg, #fff);
}

body[class*="-light"] .card img {
  border-color: var(--border);
}

body[class*="-light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.4);
}

body[class*="-light"] .modal {
  background: var(--card-bg, #fff);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

body[class*="-light"] .qty-control button {
  background: var(--surface);
  color: var(--text);
}

body[class*="-light"] .rarity {
  background: var(--surface);
  color: var(--text-muted);
  border-color: var(--border);
}

body[class*="-light"] .list-view-table th {
  background: var(--bg);
}

body[class*="-light"] .list-view-table tbody tr:hover {
  background: var(--surface);
}

body[class*="-light"] header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

body[class*="-light"] .toolbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

body[class*="-light"] .group-header {
  color: var(--text-muted);
  border-bottom-color: var(--border);
}

body[class*="-light"] .container-item {
  background: var(--card-bg, #fff);
  border-color: var(--border);
}

body[class*="-light"] .lv-owned button {
  background: var(--surface);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 18px;
  font-weight: 500;
  margin: 0;
}

.header-nav {
  display: flex;
  gap: 8px;
}

.nav-button {
  cursor: pointer;
  height: 34px;
  padding: 0 12px;
}

.support-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #ff5e5b;
  border: 1px solid #ff5e5b;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  padding: 0 14px;
  height: 34px;
  line-height: 34px;
  overflow: hidden;
}

.support-pill:hover {
  background: #ff7a77;
  border-color: #ff7a77;
}

.account-modal {
  max-width: 640px;
}

.account-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.account-col {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.account-subhead {
  margin-top: 18px !important;
}

.account-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.account-field-label {
  font-size: 12px;
  color: var(--text-muted);
}

.account-select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
}

.account-actions-stack {
  flex-direction: column;
  align-items: stretch;
}

.account-hint {
  font-size: 12px;
  line-height: 1.5;
}

.support-modal-btn {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  border-color: #ff7a7a;
  color: #ff7a7a;
}
.support-modal-btn:hover {
  background: rgba(220, 60, 60, 0.12);
}

/* Price feature: toggle, collection value, container worth, completion cost */
.account-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}
.account-toggle input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent, #5a8dee);
}
.account-collection-value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.account-value-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent, #5a8dee);
}
.container-worth {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent, #5a8dee);
  margin-top: 2px;
}
.binder-missing-cost {
  margin-top: 8px;
  font-weight: 600;
  color: var(--accent, #5a8dee);
}
/* Belt-and-suspenders: hide any stray price bits when prices are off */
body.prices-hidden .container-worth,
body.prices-hidden .binder-missing-cost,
body.prices-hidden .wishlist-card-price {
  display: none;
}

/* ---- Select mode (bulk actions) ---- */
.card.selectable .card-img {
  cursor: pointer;
}
.card.selectable {
  outline: 2px solid transparent;
  border-radius: 8px;
  transition: outline-color 0.12s;
}
.card.selectable:hover {
  outline-color: var(--border);
}
.card.selected {
  outline-color: var(--accent, #5a8dee) !important;
}
.card-img {
  position: relative;
}
.card-select-check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 2px solid #fff;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 15px;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.card.selected .card-select-check {
  background: var(--accent, #5a8dee);
  border-color: #fff;
}

.select-action-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 94vw;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--surface, #262626);
  border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}
.select-action-bar.hidden {
  display: none;
}
.select-action-bar .sab-count {
  font-weight: 700;
  color: var(--accent, #5a8dee);
  white-space: nowrap;
}
.select-action-bar .sab-to {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.select-action-bar .sab-target {
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bg, #1a1a1a);
  color: var(--text);
  border: 1px solid var(--border);
  max-width: 220px;
}
.select-action-bar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Binder art picker in the binder header */
.binder-art-select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface, #262626);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  max-width: 140px;
}

@media (max-width: 640px) {
  .account-columns {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .account-col {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
  }
  .account-col:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }
}

.account-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.account-section:first-of-type {
  margin-top: 14px;
  padding-top: 0;
  border-top: none;
}

.account-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.account-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.theme-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-swatch {
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}

.theme-swatch.selected {
  border-color: var(--accent);
}

.theme-swatch-dots {
  display: flex;
  gap: 3px;
}

.theme-swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
}

.containers-modal {
  max-width: 1300px;
}

.container-top-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin: 12px 0 10px;
}

.container-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-right: 18px;
  border-right: 1px solid var(--border);
}

.container-add-form input[type="text"]#new-container-name {
  flex: 0 0 200px;
  min-width: 0;
}

.container-add-form input[type="color"] {
  width: 40px;
  height: 34px;
  padding: 2px;
  cursor: pointer;
}

.container-item .container-binder-img {
  width: 30px;
  height: 40px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

.container-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.container-search-input {
  width: 220px;
  flex: 0 0 220px;
}

.container-type-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.container-type-filter .pill {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
}

.container-type-filter .pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.danger-pill {
  border-color: #ff7a7a !important;
  color: #ff7a7a !important;
}

.danger-pill:hover {
  background: rgba(220, 60, 60, 0.15) !important;
}

.container-sections {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
  margin-top: 12px;
}

.container-section {
  flex: 1 1 240px;
  min-width: 220px;
}

.container-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.container-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.container-grid .container-item {
  flex: 1 1 110px;
  max-width: 150px;
}

.container-grid.bulkbox-grid .container-item {
  flex: 1 1 200px;
  max-width: 260px;
}

.container-item {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  overflow: hidden;
  background: var(--surface);
}

.container-item-image {
  position: relative;
  aspect-ratio: 72 / 100;
  background: var(--bg);
  flex-shrink: 0;
}

.container-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Bulk Box artwork isn't card-portrait shaped, so let it size to the tile's
   width and keep its own aspect ratio instead of being cropped/stretched
   into the 72:100 card-shaped box used by binders/deck boxes/slabs. */
.container-item-image.bulkbox-image {
  aspect-ratio: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container-item-image.bulkbox-image img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Card Box images are roughly square (cube-shaped product), not card-portrait. */
.container-item-image.cardbox-image {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.container-item-image.cardbox-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Slab card preview: a smaller centered "window" over the slab graphic,
   mimicking the visible card area of a real graded card holder.
   Adjust top/left/width/height % below to line up with the Slab.png artwork. */
.slab-preview-window {
  position: absolute;
  top: 21%;
  left: 18%;
  width: 64%;
  height: 64%;
  overflow: hidden;
  border-radius: 4px;
  pointer-events: none;
}

.slab-preview-window img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Slab interior view: single card shown large and centered */
.slab-view {
  display: flex !important;
  justify-content: center;
  align-items: center;
  min-height: 300px;
}

.slab-full-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  max-width: 350px;
}

.slab-full-card img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.slab-card-info {
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
}

.slab-card-info span {
  font-size: 12px;
  color: var(--text-muted);
}

.slab-empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 14px;
  padding: 40px 20px;
}

.container-item-body {
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.container-item .container-swatch {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.container-item .container-name {
  font-size: 13px;
  font-weight: 500;
  max-width: 100%;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.container-item .container-meta {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 100%;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.container-item .container-delete {
  position: absolute;
  top: 4px;
  right: 6px;
  cursor: pointer;
  color: #fff;
  background: rgba(0,0,0,0.55);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  z-index: 2;
}

.container-item .container-color-input {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  cursor: pointer;
  background: none;
}

.modal-owned-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
}

.modal-owned-control button {
  width: 28px;
  height: 28px;
  cursor: pointer;
  padding: 0;
}

.modal-owned-control input {
  width: 60px;
  text-align: center;
  height: 28px;
}

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

.modal-owned-control input[type="number"] {
  -moz-appearance: textfield;
}

.modal-add-container {
  position: relative;
  margin-top: 8px;
}

.modal-add-container-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  border-radius: 999px;
}

#modal-add-container-panel {
  bottom: calc(100% + 4px);
  top: auto;
  min-width: 160px;
}

#modal-add-container-panel .add-container-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  border-radius: 4px;
}

#modal-add-container-panel .add-container-option:hover {
  background: var(--bg);
}

.modal-containers {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 3px 12px;
  max-height: 200px;
  overflow-y: auto;
}

.modal-container-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 2px 0;
  white-space: nowrap;
}

.modal-container-row .swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.modal-container-row .container-name {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
  flex-shrink: 1;
}

.deckbuilder-modal {
  width: 96vw;
  max-width: 1500px;
  height: 97vh;
  max-height: 97vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.db-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding-right: 40px;
}

.db-header h2 {
  margin: 0;
  font-size: 16px;
  white-space: nowrap;
}

.db-legality {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
}

.db-legality.legal {
  background: rgba(40, 180, 100, 0.15);
  color: #3ecb7e;
  border: 1px solid #3ecb7e;
}

.db-legality.illegal {
  background: rgba(220, 60, 60, 0.15);
  color: #ff7a7a;
  border: 1px solid #ff7a7a;
  cursor: help;
}

.db-setup {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  margin-top: 10px;
}

.db-setup input[type="text"] {
  width: 100%;
}

.db-leader-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.db-leader-filters select {
  min-width: 140px;
}

.db-leader-filters input[type="text"] {
  flex: 1;
  min-width: 160px;
  width: auto;
}

.db-setup-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 14px;
}

.db-setup-preview {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.db-leader-preview-empty {
  border: 1px dashed var(--border);
  border-radius: 8px;
  aspect-ratio: 72 / 100;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.db-leader-preview-empty img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.db-setup-preview .multiselect-button {
  width: 100%;
}

.db-setup-preview .multiselect-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.db-leader-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  grid-auto-rows: min-content;
  gap: 10px;
  align-content: start;
}

.db-leader-grid .db-leader-option {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  text-align: center;
  font-size: 12px;
  padding-bottom: 4px;
}

.db-leader-grid .db-leader-option img {
  width: 100%;
  aspect-ratio: 72 / 100;
  object-fit: cover;
  display: block;
}

.db-leader-grid .db-leader-option:hover {
  border-color: var(--accent);
}

.db-leader-grid .db-leader-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.db-builder {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  gap: 14px;
  margin-top: 10px;
  overflow: hidden;
}

.db-left {
  flex: 0 0 260px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.db-leader-card {
  flex: 0 0 auto;
  cursor: pointer;
  position: relative;
  width: 100%;
  max-width: 260px;
}

.db-leader-change-btn {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1;
}

.db-leader-card img {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 72 / 100;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

.db-deck-summary {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.db-deck-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
}

.db-deck-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 3px 4px;
  border-radius: 4px;
}

.db-deck-row:hover {
  background: var(--bg);
}

.db-deck-row .db-deck-row-name {
  flex: 1;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-deck-row .db-deck-row-qty {
  display: flex;
  align-items: center;
  gap: 2px;
}

.db-deck-row button {
  width: 20px;
  height: 20px;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
}

.db-right {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.db-pool-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.db-pool-filters input[type="text"] {
  flex: 1;
  min-width: 160px;
}

.db-pool-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: min-content;
  gap: 10px;
  align-content: start;
}

.db-pool-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: visible;
  background: var(--bg);
  font-size: 11px;
  padding-bottom: 4px;
}

.db-pool-card-img-wrap {
  position: relative;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.db-pool-card img {
  width: 100%;
  aspect-ratio: 72 / 100;
  object-fit: cover;
  display: block;
}

.db-pool-card.synergy {
  border-color: var(--accent);
}

.db-pool-card-name {
  padding: 4px 6px 0;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-pool-card-qty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 6px 0;
}

.db-pool-card-qty button {
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 13px;
  cursor: pointer;
}

.db-pool-card-qty span {
  min-width: 16px;
  text-align: center;
}

.db-pool-card .db-pool-qty {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 11px;
  border-radius: 4px;
  padding: 1px 5px;
  z-index: 2;
}

/* Hover tooltip showing effect text, cost, etc - positioned via JS (fixed, appended to body) */
.db-pool-tooltip {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  font-size: 11px;
  line-height: 1.4;
  z-index: 300;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  max-height: 220px;
  overflow-y: auto;
  pointer-events: none;
}

.db-pool-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
}

.db-pool-tooltip-effect {
  margin-top: 4px;
  color: var(--text);
}

/* Right-click alt art panel */
.db-pool-altpanel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 6px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.db-pool-altpanel img {
  width: 50px;
  aspect-ratio: 72 / 100;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border);
}

.db-pool-altpanel img.active {
  border-color: var(--accent);
}
.binder-modal {
  width: 96vw;
  max-width: 1600px;
  height: 92vh;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.binder-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  gap: 12px;
}

.binder-missing {
  flex: 0 0 240px;
  background: rgba(220, 60, 60, 0.08);
  border: 1px solid rgba(220, 60, 60, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  overflow-y: auto;
}

.binder-missing-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: #ff7a7a;
}

.binder-missing-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

.binder-missing-row a {
  color: var(--accent);
  text-decoration: none;
  font-size: 11px;
  align-self: flex-start;
}

.binder-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding-right: 40px;
}

.binder-title-input {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  min-width: 80px;
  width: auto;
  color: var(--text);
}

.binder-title-input:hover {
  border-color: var(--border);
}

.binder-title-input:focus {
  border-color: var(--accent);
  background: var(--bg);
  outline: none;
}

.binder-pagenav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.binder-bookmark-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.binder-bookmark {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.binder-bookmark .bookmark-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  padding: 0;
  border: none;
  cursor: pointer;
}

.modal-nav-inline {
  cursor: pointer;
  width: 30px;
  height: 30px;
  font-size: 18px;
  line-height: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.modal-nav-inline:disabled {
  opacity: 0.3;
  cursor: default;
}

#binder-page-label {
  font-size: 13px;
  color: var(--text-muted);
  min-width: 90px;
  text-align: center;
}

.binder-bookmark .bookmark-delete {
  color: var(--text-muted);
  cursor: pointer;
}

.binder-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.binder-grid.flow {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  grid-auto-rows: max-content;
  overflow-y: auto;
  align-content: start;
}

.binder-tile {
  position: relative;
  cursor: grab;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}

.binder-grid.flow .binder-tile {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  padding-bottom: 4px;
}

.binder-tile-img-wrap {
  position: relative;
  aspect-ratio: 72 / 100;
  cursor: pointer;
}

.binder-tile-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.binder-tile-name {
  padding: 5px 6px 0;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.binder-tile-id {
  padding: 0 6px;
  text-align: center;
  color: var(--text-muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.binder-tile-qty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 6px 0;
}

.binder-tile-qty button {
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 13px;
  cursor: pointer;
}

.binder-tile-qty span {
  min-width: 16px;
  text-align: center;
}

.binder-tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.binder-tile.empty {
  border-style: dashed;
  cursor: default;
}

.binder-tile.locked {
  border-style: dashed;
  border-color: transparent;
  background: var(--bg);
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

.binder-tile.dragging {
  opacity: 0.4;
}

.binder-tile.drag-over {
  outline: 2px solid var(--accent);
}

.binder-tile .binder-qty {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11px;
  border-radius: 4px;
  padding: 1px 5px;
}

.modal-container-row button {
  width: 20px;
  height: 20px;
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  line-height: 1;
}

.controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.control-group label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

select,
input,
button {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  height: 34px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  flex-wrap: wrap;
}

.view-toggle button {
  cursor: pointer;
}

.view-toggle button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.toolbar input {
  flex: 1;
  min-width: 160px;
}

.size-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.multiselect {
  position: relative;
}

.multiselect-button {
  cursor: pointer;
  white-space: nowrap;
  height: 34px;
}

.multiselect-button.danger-btn {
  border-color: #ff7a7a;
  color: #ff7a7a;
}
.multiselect-button.danger-btn:hover {
  background: rgba(220, 60, 60, 0.15);
}

.multiselect-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.multiselect-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  min-width: 140px;
}

.hidden {
  display: none !important;
}

.multiselect-panel.hidden {
  display: none;
}

.multiselect-panel label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  border: none;
  width: 100%;
}

.multiselect-panel label:hover {
  background: var(--bg);
}

.multiselect-panel input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
}

.multiselect-panel input[type="radio"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* ---- Pill toggle button (e.g. "Show all in colour") ---- */
.pill-toggle {
  cursor: pointer;
  white-space: nowrap;
  height: 34px;
  border-radius: 999px;
}

.pill-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---- Consolidated Filters dropdown ---- */
.filters-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 10px 10px 12px;
  z-index: 50;
  max-height: 70vh;
  overflow-y: auto;
  width: 200px;
}

.filters-panel.hidden {
  display: none;
}

.filter-section + .filter-section {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 6px;
}

.filter-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 2px;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
}

.filter-section-header .caret {
  font-size: 10px;
  width: 12px;
  display: inline-block;
  color: var(--text-muted);
}

.filter-section-title {
  flex: 1;
}

.filter-section-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.filter-section-body {
  display: flex;
  flex-direction: column;
  padding: 2px 0 4px 0;
}

.filter-section-body.hidden {
  display: none;
}

.filter-section-body label {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 4px 2px 4px 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.filter-section-body label:hover {
  background: var(--bg);
}

.filter-section-body input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  flex-shrink: 0;
  order: 2;
  justify-self: end;
}

.size-control button {
  cursor: pointer;
  width: 28px;
  text-align: center;
}

#progress {
  font-size: 14px;
  color: var(--text-muted);
}

.grid-wrapper {
  padding: 16px 24px 48px;
}

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

.group-section {
  margin-bottom: 8px;
}

.group-header {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.card {
  text-align: center;
  min-width: 0;
}

.card-img {
  cursor: pointer;
}

.card img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  background: var(--surface);
  aspect-ratio: 72 / 100;
  object-fit: cover;
}

.card.missing img {
  filter: grayscale(100%) brightness(0.5);
  transition: filter 0.15s ease;
}

.card.missing .card-img:hover img {
  filter: none;
}

.card .label {
  font-size: 12px;
  margin-top: 4px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card .id {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.card.missing .label {
  color: var(--text-muted);
}

.card .rarity {
  display: inline-block;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.qty-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 2px;
}

.qty-control button {
  cursor: pointer;
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 1;
  font-size: 13px;
}

.qty-control .qty-num {
  min-width: 18px;
  font-size: 12px;
  font-weight: 600;
}

.qty-control .qty-num.zero {
  color: var(--text-muted);
}

/* Modal */
body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.action-dialog-overlay {
  z-index: 400;
  background: rgba(0, 0, 0, 0.7);
}

.action-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  animation: action-dialog-in 0.15s ease-out;
}

@keyframes action-dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.action-dialog h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.action-dialog p {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.action-dialog-body {
  margin-bottom: 14px;
}

.action-dialog-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.action-dialog-row label {
  font-size: 12px;
  color: var(--text-muted);
}

.action-dialog-row input,
.action-dialog-row textarea {
  width: 100%;
}

.action-dialog-row textarea {
  min-height: 160px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  resize: vertical;
}

.action-dialog-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.action-dialog-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  background: var(--bg);
  width: 100%;
}

.action-dialog-choice:hover {
  border-color: var(--accent);
}

.action-dialog-choice .swatch-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.action-dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.action-dialog-buttons button {
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.action-dialog-buttons button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.action-dialog-buttons button.danger {
  background: rgba(220, 60, 60, 0.15);
  color: #ff7a7a;
  border-color: #ff7a7a;
}

.action-dialog-summary {
  font-size: 12px;
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.action-dialog-summary .miss {
  color: #ff7a7a;
}

.modal-overlay.hidden {
  display: none;
}

#modal-overlay {
  z-index: 200;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 1500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 24px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  font-size: 18px;
  line-height: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.modal-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  width: 44px;
  height: 44px;
  font-size: 24px;
  line-height: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 210;
}

.modal-nav-prev {
  left: 24px;
}

.modal-nav-next {
  right: 24px;
}

.modal-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.modal-body {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.modal-body img {
  width: 500px;
  aspect-ratio: 72 / 100;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.modal-details {
  flex: 1;
  min-width: 260px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-details h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.modal-id {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 14px;
}

.modal-price {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.modal-price a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--text-muted);
}

.modal-price a:hover {
  color: var(--text);
}

.modal-price-stale {
  opacity: 0.7;
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 14px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.modal-stat {
  min-width: 0;
}

.modal-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.modal-stat-value {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

.stat-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.stat-link:hover {
  text-decoration: underline;
}

.modal-effect {
  margin-top: 12px;
}

.modal-similar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.modal-similar-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.modal-similar-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 6px;
}

.modal-similar-tile {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg);
  font-size: 10px;
  text-align: center;
}

.modal-similar-tile:hover {
  border-color: var(--accent);
}

.modal-similar-tile img {
  width: 100%;
  aspect-ratio: 72 / 100;
  object-fit: cover;
  display: block;
}

.modal-similar-cap {
  padding: 2px 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-effect-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

#modal-effect, #modal-trigger {
  font-size: 14px;
  line-height: 1.6;
}

#modal-trigger-wrap.hidden {
  display: none;
}

#modal-owned-total {
  font-size: 14px;
  font-weight: 500;
}

.modal-breakdown {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-placeholder {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Wishlist ---- */
.card-wishlist {
  background: none;
  border: none;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
  padding: 0 2px;
  flex-shrink: 0;
}

.card-wishlist:hover {
  opacity: 1;
  color: var(--accent);
}

.card-wishlist.active {
  opacity: 1;
  color: var(--accent);
}

.modal-owned-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-wishlist-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s;
}

.modal-wishlist-btn:hover,
.modal-wishlist-btn.active {
  color: var(--accent);
  border-color: var(--accent);
}

.wishlist-list {
  max-height: 300px;
  overflow-y: auto;
  margin: 8px 0;
}

/* Wishlist image grid + toolbar */
.wishlist-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin: 6px 0 4px;
}
.wishlist-filter {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}
.wishlist-filter span {
  font-size: 11px;
  color: var(--text-muted);
}
.wishlist-filter .account-select {
  min-width: 150px;
  width: auto;
}
.wishlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  max-height: 70vh;
  overflow-y: auto;
  margin: 10px 0;
  padding: 2px;
}
.wishlist-card {
  position: relative;
}
.wishlist-card-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.wishlist-card-remove:hover {
  background: #ff5e5b;
  color: #fff;
}
.wishlist-card-price {
  margin-top: 3px;
}
.wishlist-card-price .wishlist-price-link {
  font-size: 11px;
}
@media (max-width: 768px) {
  .wishlist-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}

.wishlist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
}

.wishlist-row:hover {
  background: var(--surface);
}

.wishlist-card-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wishlist-price-link {
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: none;
  border-bottom: 1px dotted var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.wishlist-price-link:hover {
  color: var(--text);
}

.wishlist-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
  line-height: 1;
}

.wishlist-remove:hover {
  color: #ff5e5b;
}

.toggle-box {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  height: 34px;
}

.toggle-box input {
  cursor: pointer;
  margin: 0;
  width: 14px;
  height: 14px;
}

/* ---- List view ---- */
.list-view-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.list-view-table th {
  text-align: left;
  padding: 8px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}

.list-view-table td {
  padding: 6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text);
}

.list-view-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.list-view-table tbody tr:hover {
  background: var(--surface);
}

.list-view-table tr.list-missing td {
  color: var(--text-muted);
  opacity: 0.6;
}

.lv-wish {
  width: 28px;
  text-align: center;
}

.lv-wish .card-wishlist {
  opacity: 0.6;
}

.lv-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lv-container {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  color: var(--text-muted);
}

.lv-owned {
  white-space: nowrap;
  text-align: center;
}

.lv-owned button {
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  vertical-align: middle;
}

.lv-owned span {
  display: inline-block;
  min-width: 20px;
  text-align: center;
  font-size: 13px;
  vertical-align: middle;
}

.lv-owned span.zero {
  color: var(--text-muted);
}

/* ---- Mobile responsiveness ---- */
@media (max-width: 768px) {
  header {
    padding: 10px 12px;
  }

  header h1 {
    font-size: 18px;
  }

  .header-nav {
    gap: 6px;
    flex-wrap: wrap;
  }

  .header-nav .nav-button {
    font-size: 12px;
    padding: 6px 10px;
  }

  .controls {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .control-group {
    flex-direction: row;
    gap: 8px;
  }

  .control-group select {
    flex: 1;
  }

  .toolbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
  }

  .view-toggle button {
    padding: 6px 10px;
    font-size: 12px;
  }

  .multiselect-button,
  .pill-toggle {
    font-size: 12px;
    padding: 6px 10px;
    height: 30px;
  }

  #search {
    width: 100%;
    order: 99;
  }

  .size-control {
    display: none;
  }

  .grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px;
    padding: 0 8px;
  }

  .card .label {
    font-size: 11px;
  }

  .card .id {
    font-size: 10px;
    gap: 3px;
  }

  .qty-control button {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }

  /* Modal */
  .modal-overlay .modal {
    width: 95vw;
    max-width: none;
    max-height: 90vh;
    margin: 5vh auto;
  }

  .modal-body {
    flex-direction: column;
  }

  .modal-body img {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }

  .modal-details {
    min-width: 0;
  }

  .modal-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal-nav {
    display: none;
  }

  /* Containers/Storage modal */
  .containers-modal {
    max-width: 95vw;
  }

  .container-top-row {
    flex-direction: column;
    gap: 10px;
  }

  .container-add-form {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
  }

  .container-type-filter {
    flex-wrap: wrap;
  }

  /* Account modal */
  .account-modal {
    max-width: 95vw;
  }

  /* List view on mobile */
  .list-view-table {
    font-size: 11px;
  }

  .list-view-table th,
  .list-view-table td {
    padding: 4px 3px;
  }

  .lv-name {
    max-width: 100px;
  }

  /* Deck builder */
  .deckbuilder-modal {
    max-width: 95vw;
  }

  .db-layout {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .header-nav {
    justify-content: center;
  }

  .support-pill {
    display: none;
  }

  .modal-body img {
    max-width: 220px;
  }
}

/* ---- Share features ---- */
.modal-id-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-share-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 3px 8px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.modal-share-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.shared-modal {
  max-width: 900px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}

.shared-modal h2 {
  margin: 0 0 4px;
}

.shared-modal .modal-placeholder {
  margin: 0 0 14px;
}

.shared-modal .list-view-table {
  max-height: 60vh;
  overflow-y: auto;
  display: block;
}

/* Shared wishlist card grid */
.shared-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  padding: 4px 0;
}

.shared-card-item {
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.15s, transform 0.1s;
}

.shared-card-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.shared-card-item img {
  width: 100%;
  aspect-ratio: 72 / 100;
  object-fit: cover;
  display: block;
}

.shared-card-info {
  padding: 6px 8px 8px;
  text-align: center;
}

.shared-card-name {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shared-card-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 768px) {
  .shared-card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .shared-modal {
    width: 95vw;
  }
}

/* ---- Wishlist modal ---- */
.wishlist-modal {
  max-width: 1000px;
  width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
}

.wishlist-modal h2 {
  margin: 0 0 4px;
}

/* ---- Foil badges ---- */
.label-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 4px;
}

.label-row .label {
  margin-top: 0;
}

.foil-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  flex-shrink: 0;
  cursor: default;
}

.foil-badge.foil-foil {
  color: #a0b4e0;
}

.foil-badge.foil-holo {
  background: linear-gradient(135deg, #e0a0c0, #a0c0e0, #c0e0a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.foil-badge.foil-md {
  font-size: 14px;
  margin-left: 6px;
}

.lv-foil {
  text-align: center;
  white-space: nowrap;
}

/* ---- Admin editor ---- */
.modal-price-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.5;
  padding: 0 2px;
  line-height: 1;
  transition: opacity 0.15s;
}

.admin-edit-btn:hover {
  opacity: 1;
}

.admin-editor {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-editor-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}

.admin-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.admin-input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
}

.admin-input:focus {
  outline: none;
  border-color: var(--accent);
}

.admin-btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.admin-btn-row .multiselect-button {
  font-size: 12px;
  padding: 4px 10px;
}

.admin-status {
  font-size: 12px;
  color: var(--accent);
  min-height: 16px;
}

/* ============================================================
   Alt arts / other versions
   ------------------------------------------------------------
   The modal image is wrapped in .modal-img-wrap so the hover
   hint can be absolutely positioned over it. Layout properties
   (width / sticky / flex-shrink) live on the WRAPPER now; the
   #modal-img rules below use an ID so they reliably beat the
   older ".modal-body img" rules no matter where those sit.
   ============================================================ */

.modal-img-wrap {
  position: relative;
  width: 500px;
  flex-shrink: 0;
  align-self: flex-start;
  position: sticky;
  top: 0;
  border-radius: 8px;
}

#modal-img {
  display: block;
  width: 100%;
  aspect-ratio: 72 / 100;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  position: static;
}

/* Hint is only interactive when the card actually has other versions */
.modal-altart-hint {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 22px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.15) 35%, rgba(0, 0, 0, 0) 60%);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.modal-img-wrap.has-variants {
  cursor: pointer;
}

.modal-img-wrap.has-variants:hover .modal-altart-hint,
.modal-img-wrap.has-variants:focus-visible .modal-altart-hint {
  opacity: 1;
}

/* ---- The stacked modal itself ---- */
#altart-overlay {
  /* above #modal-overlay (200) and .modal-nav (210),
     below .action-dialog-overlay (400) */
  z-index: 250;
  background: rgba(0, 0, 0, 0.72);
}

.altart-modal {
  max-width: 1100px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.altart-title {
  margin: 0 40px 2px 0;
  font-size: 20px;
}

.altart-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.altart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
  overflow-y: auto;
  padding: 2px 4px 4px 2px;
  flex: 1;
  min-height: 0;
}

.altart-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.altart-tile.is-current {
  border-color: var(--accent, #8b7bd8);
  box-shadow: 0 0 0 2px var(--accent, #8b7bd8);
}

.altart-tile img {
  width: 100%;
  aspect-ratio: 72 / 100;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  display: block;
}

.altart-tile img:hover {
  opacity: 0.85;
}

.altart-tile-id {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.altart-tile-kind {
  font-size: 11px;
  color: var(--text-muted);
}

.altart-current-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.altart-tile-price {
  font-size: 11px;
  color: var(--text-muted);
}

.altart-tile-price a {
  color: inherit;
}

.altart-tile-owned {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.altart-tile-owned .altart-qty {
  min-width: 26px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.altart-tile-owned button {
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  border-radius: 6px;
  cursor: pointer;
}

.altart-tile-owned .altart-wish {
  margin-left: auto;
  width: 26px;
  height: 26px;
  opacity: 0.45;
}

.altart-tile-owned .altart-wish.active {
  opacity: 1;
  color: #e26a9a;
}

@media (max-width: 768px) {
  .modal-img-wrap {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    position: static;
  }

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

@media (max-width: 480px) {
  .modal-img-wrap {
    max-width: 220px;
  }
}
