/* Collection viewer + deck builder overlay. */

.collection-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 18, 0.86);
  z-index: 2500;
  display: grid;
  place-items: center;
  backdrop-filter: blur(8px);
}
.collection-overlay.hidden { display: none; }

.cb-panel {
  width: 92vw;
  max-width: 1280px;
  height: 88vh;
  background: linear-gradient(180deg, #181b35 0%, #0c0d1a 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.cb-loading,
.cb-error {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  padding: 30px;
}
.cb-error button {
  display: block;
  margin-top: 14px;
  padding: 6px 14px;
  background: var(--bg-mid);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
}

.cb-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.cb-title {
  font-family: var(--font-display);
  font-size: 14px;
  flex-shrink: 0;
}
.cb-controls {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
}
.cb-search,
.cb-filter-type,
.cb-filter-tier {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
}
.cb-search { width: 220px; }
.cb-x {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
}
.cb-x:hover { color: var(--ink); }

.cb-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  padding: 14px 18px 18px;
  overflow: hidden;
  flex: 1;
}

.cb-section-title {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cb-collection {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cb-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  padding-right: 6px;
}
.cb-card-wrapper {
  position: relative;
  cursor: pointer;
}
.cb-card-wrapper.exhausted {
  opacity: 0.35;
  filter: grayscale(0.5);
  cursor: not-allowed;
}
.cb-collection-card { width: 130px !important; }
.cb-qty {
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: var(--bg-mid);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 9px;
  padding: 3px 6px;
  border-radius: 8px;
}

.cb-upgrade {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #f7d02c, #ee8130);
  color: #1a0a00;
  border: none;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  z-index: 5;
  box-shadow: 0 2px 6px rgba(247, 208, 44, 0.5);
}
.cb-upgrade:hover { transform: translateX(-50%) translateY(-1px); }
.cb-card-wrapper.is-shiny .cb-collection-card {
  filter: drop-shadow(0 0 8px rgba(247, 208, 44, 0.5));
}

.cb-deck {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 12px;
  overflow: hidden;
}
.cb-deck-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
  margin-bottom: 12px;
}
.cb-deck-select,
.cb-deck-name {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
}
.cb-deck-delete {
  background: rgba(255, 90, 90, 0.12);
  color: var(--bad);
  border: 1px solid rgba(255, 90, 90, 0.25);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
}
.cb-deck-delete:hover { background: rgba(255, 90, 90, 0.2); }
.cb-activate {
  background: linear-gradient(90deg, #6cd97c, #4eb159) !important;
  color: #0a1a0a !important;
  border-color: transparent !important;
  font-weight: 700;
}

.cb-deck-bymtier {
  margin-left: auto;
  display: flex;
  gap: 5px;
}
.tier-pip {
  background: var(--bg-mid);
  color: var(--ink);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: var(--font-display);
}
.tier-pip.tier-1 { border: 1px solid #7AC74C; }
.tier-pip.tier-2 { border: 1px solid #6390F0; }
.tier-pip.tier-3 { border: 1px solid #F7D02C; }
.tier-pip.tier-4 { border: 1px solid #A33EA1; }
.tier-pip.tier-5 { border: 1px solid #EE8130; }

.cb-deck-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.cb-deck-empty {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 20px;
}
.cb-deck-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--accent, #888);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.cb-deck-row:hover { background: rgba(255, 90, 90, 0.18); }
.cb-deck-row.type-martial   { --accent: #A8A77A; }
.cb-deck-row.type-fire     { --accent: #EE8130; }
.cb-deck-row.type-tide    { --accent: #6390F0; }
.cb-deck-row.type-storm { --accent: #F7D02C; }
.cb-deck-row.type-verdant    { --accent: #7AC74C; }
.cb-deck-row.type-frost      { --accent: #96D9D6; }
.cb-deck-row.type-brawl { --accent: #C22E28; }
.cb-deck-row.type-plague   { --accent: #A33EA1; }
.cb-deck-row.type-earth   { --accent: #E2BF65; }
.cb-deck-row.type-sky   { --accent: #A98FF3; }
.cb-deck-row.type-mind  { --accent: #F95587; }
.cb-deck-row.type-swarm      { --accent: #A6B91A; }
.cb-deck-row.type-stone     { --accent: #B6A136; }
.cb-deck-row.type-spectral    { --accent: #735797; }
.cb-deck-row.type-wyrm   { --accent: #6F35FC; }
.cb-deck-row.type-shadow     { --accent: #705746; }
.cb-deck-row.type-iron    { --accent: #B7B7CE; }
.cb-deck-row.type-radiant    { --accent: #D685AD; }

.cb-deck-name { flex: 1; font-weight: 600; }
.cb-deck-meta { color: var(--muted); font-size: 10.5px; }
.cb-deck-count-pill {
  background: var(--bg-mid);
  color: var(--ink);
  padding: 2px 8px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 9px;
}

.cb-deck-actions {
  display: flex;
  gap: 6px;
}
.cb-deck-actions button {
  flex: 1;
  background: var(--bg-mid);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}
.cb-deck-actions button:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.3);
}
.cb-deck-actions button.primary {
  background: linear-gradient(90deg, #f7d02c, #ee8130);
  color: #1a0a00;
  border-color: transparent;
  font-weight: 700;
}
.cb-deck-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.cb-deck-actions button.saved {
  background: linear-gradient(90deg, #6cd97c, #4eb159);
}

.cb-deck-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .cb-body { grid-template-columns: 1fr; }
  .cb-deck { max-height: 40vh; }
}

/* Preset deck recipes menu (Wave 24) */
.cb-preset {
  background: linear-gradient(135deg, #2a1f4a, #1a1538);
  color: #ffd166;
  border: 1px solid rgba(255,209,102,0.5);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.cb-preset:hover {
  background: linear-gradient(135deg, #3a2a6a, #2a2058);
  box-shadow: 0 0 14px rgba(255,209,102,0.35);
}
.cb-preset-menu {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(160deg, #15192a, #0a0c18);
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  padding: 22px;
  z-index: 200;
  width: min(420px, 92vw);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 14px 50px rgba(0,0,0,0.65);
}
.cb-preset-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffd166;
  text-align: center;
  margin-bottom: 14px;
  letter-spacing: 1px;
}
.cb-preset-row {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  padding: 11px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.12s, transform 0.12s;
}
.cb-preset-row:hover {
  background: rgba(255,209,102,0.08);
  border-color: rgba(255,209,102,0.4);
  transform: translateX(3px);
}
.cb-preset-label {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
}
.cb-preset-hint {
  font-size: 11px;
  opacity: 0.7;
  line-height: 1.4;
}
.cb-preset-cancel {
  width: 100%;
  margin-top: 8px;
  background: rgba(255,80,80,0.08);
  color: #ff8a8a;
  border: 1px solid rgba(255,80,80,0.3);
  padding: 9px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}

/* Share-deck button (Wave 29 / Phase 2) */
.cb-share {
  background: linear-gradient(135deg, #2a3a5a, #1a2540);
  color: #d4e0ff;
  border: 1px solid rgba(140, 180, 255, 0.45);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.cb-share:not(:disabled):hover {
  background: linear-gradient(135deg, #3a4a6a, #2a3550);
  box-shadow: 0 0 14px rgba(140, 180, 255, 0.4);
}
.cb-share:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-style: dashed;
}
