/* ============================================
   MATCHUP GUIDE
   Version: 1.0
   ============================================ */

/* TODO(palworld): Matchup guide HIDDEN for now — only the Deck Guide is live.
   Markup + JS are left intact; delete this block to bring it back. */
.matchup-guide-section,
.matchup-popup-overlay,
.matchup-delete-overlay,
.matchup-reset-overlay {
  display: none !important;
}

/* === Section Container === */
.matchup-guide-section {
  margin-top: 1.5rem;
}

.matchup-guide-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.matchup-guide-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ps-gold-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.matchup-guide-header .matchup-icon {
  font-size: 18px;
  color: var(--ps-gold-2);
}

/* === Add Button === */
.matchup-add-btn {
  background: transparent;
  border: 2px dashed #555;
  color: var(--ps-gold-2);
  padding: 14px 24px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  width: 100%;
  justify-content: center;
}

.matchup-add-btn:hover {
  border-color: var(--ps-gold-2);
  background: rgba(218, 165, 32, 0.05);
}

/* === Empty State === */
.matchup-empty-state {
  text-align: center;
  padding: 40px 20px;
  border: 2px dashed #333;
  border-radius: 12px;
  color: #777;
}

.matchup-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.matchup-empty-state h4 {
  margin: 0 0 8px;
  color: #999;
  font-size: 16px;
}

.matchup-empty-state p {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.5;
  color: #666;
}

/* === Summary Bar === */
.matchup-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.matchup-summary-record {
  display: flex;
  align-items: center;
  gap: 10px;
}

.matchup-summary-wr {
  font-size: 20px;
  font-weight: 800;
  color: #f5f5f5;
  letter-spacing: -0.5px;
}

.matchup-summary-wl {
  font-size: 13px;
  color: #888;
  font-weight: 600;
}

.matchup-summary-spread {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.matchup-summary-diff {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.matchup-summary-diff.favored {
  background: rgba(77, 142, 47, 0.15);
  color: #6abf40;
  border: 1px solid rgba(77, 142, 47, 0.25);
}

.matchup-summary-diff.even {
  background: rgba(218, 165, 32, 0.15);
  color: var(--ps-gold-2);
  border: 1px solid rgba(218, 165, 32, 0.25);
}

.matchup-summary-diff.unfavored {
  background: rgba(224, 41, 46, 0.15);
  color: #e05555;
  border: 1px solid rgba(224, 41, 46, 0.25);
}

/* === Export PDF Button === */
.matchup-export-pdf-btn {
  background: #2a2a2a;
  border: 1px solid #444;
  color: #aaa;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.matchup-export-pdf-btn:hover {
  background: #3a3a3a;
  color: #f5f5f5;
  border-color: #666;
}

.matchup-export-pdf-btn i {
  font-size: 13px;
}

/* === Matchup Cards List === */
.matchup-guides-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* === Single Matchup Card === */
.matchup-card {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.matchup-card:hover {
  border-color: #3a3a3a;
}

/* Card Header (always visible) */
.matchup-card-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  gap: 12px;
  user-select: none;
}

.matchup-card-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Opponent Legend Images */
.matchup-legends {
  display: flex;
  gap: 0;
  flex-shrink: 0;
}

.matchup-legend-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #333;
  background: #222;
}

.matchup-legend-img:not(:first-child) {
  margin-left: -10px;
}

/* Card Info */
.matchup-card-info {
  flex: 1;
  min-width: 0;
}

.matchup-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #f5f5f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matchup-card-subtitle {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

/* Difficulty Badge */
.matchup-difficulty {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.matchup-difficulty.favored {
  background: rgba(77, 142, 47, 0.2);
  color: #6abf40;
  border: 1px solid rgba(77, 142, 47, 0.3);
}

.matchup-difficulty.even {
  background: rgba(218, 165, 32, 0.2);
  color: var(--ps-gold-2);
  border: 1px solid rgba(218, 165, 32, 0.3);
}

.matchup-difficulty.unfavored {
  background: rgba(224, 41, 46, 0.2);
  color: #e05555;
  border: 1px solid rgba(224, 41, 46, 0.3);
}

/* Drag Handle (owner only) */
.matchup-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  color: #444;
  cursor: grab;
  flex-shrink: 0;
  padding: 4px 0;
  transition: color 0.15s ease;
}

.matchup-drag-handle:hover {
  color: var(--ps-gold-2);
}

.matchup-drag-handle:active {
  cursor: grabbing;
}

.matchup-card.matchup-dragging {
  opacity: 0.4;
  pointer-events: none;
}

.matchup-drag-placeholder {
  background: rgba(218, 165, 32, 0.06);
  border: 2px dashed rgba(218, 165, 32, 0.3);
  border-radius: 10px;
}

/* Win Rate Display */
.matchup-winrate {
  font-size: 11px;
  font-weight: 600;
  color: #aaa;
  padding: 3px 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* W/L Record Buttons (owner only) */
.matchup-record-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.matchup-record-btn {
  background: #2a2a2a;
  border: 1px solid #444;
  color: #ccc;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s ease;
  line-height: 1;
}

.matchup-win-btn:hover {
  background: rgba(77, 142, 47, 0.2);
  border-color: #6abf40;
  color: #6abf40;
}

.matchup-loss-btn:hover {
  background: rgba(224, 41, 46, 0.2);
  border-color: #e05555;
  color: #e05555;
}

.matchup-record-reset {
  background: transparent;
  border: 1px solid transparent;
  color: #555;
  padding: 3px 5px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s ease;
}

.matchup-record-reset:hover {
  color: var(--ps-gold-2);
}

/* Expand Arrow */
.matchup-expand-arrow {
  color: #666;
  font-size: 12px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.matchup-card.expanded .matchup-expand-arrow {
  transform: rotate(180deg);
}

/* Card Body (expandable) */
.matchup-card-body {
  display: none;
  border-top: 1px solid #2a2a2a;
}

.matchup-card.expanded .matchup-card-body {
  display: block;
}

/* Strategy Tabs */
.matchup-strategy-tabs {
  display: flex;
  border-bottom: 1px solid #2a2a2a;
}

.matchup-strategy-tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: #888;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.matchup-strategy-tab:hover {
  color: #ccc;
  background: rgba(255, 255, 255, 0.03);
}

.matchup-strategy-tab.active {
  color: var(--ps-gold-2);
  box-shadow: inset 0 -2px 0 var(--ps-gold-2);
}

/* Strategy Content */
.matchup-strategy-content {
  padding: 16px;
}

.matchup-strategy-panel {
  display: none;
}

.matchup-strategy-panel.active {
  display: block;
}

.matchup-strategy-text {
  font-size: 14px;
  line-height: 1.6;
  color: #ccc;
  white-space: pre-wrap;
  margin: 0;
}

.matchup-strategy-empty {
  font-size: 13px;
  color: #555;
  font-style: italic;
}

/* Owner Actions (edit/delete) */
.matchup-card-actions {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px;
  justify-content: flex-end;
}

.matchup-card-actions button {
  background: #2a2a2a;
  border: 1px solid #444;
  color: #aaa;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.matchup-card-actions button:hover {
  background: #3a3a3a;
  color: #f5f5f5;
}

.matchup-card-actions .matchup-delete-btn:hover {
  background: rgba(224, 41, 46, 0.15);
  border-color: #e0292e;
  color: #e05555;
}

/* ============================================
   MATCHUP GUIDE POPUP / MODAL
   ============================================ */

.matchup-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  overflow-y: auto;
}

.matchup-popup-overlay.active {
  display: flex;
}

.matchup-popup {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  color: #f5f5f5;
  position: relative;
  animation: matchupPopupIn 0.2s ease;
}

@keyframes matchupPopupIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Popup Header */
.matchup-popup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #2a2a2a;
}

.matchup-popup-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: rgba(218, 165, 32, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--ps-gold-2);
  flex-shrink: 0;
}

.matchup-popup-header-text h3 {
  margin: 0;
  font-size: 16px;
  color: var(--ps-gold-2);
}

.matchup-popup-header-text p {
  margin: 2px 0 0;
  font-size: 13px;
  color: #888;
}

.matchup-popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: #888;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.matchup-popup-close:hover {
  color: #f5f5f5;
  background: #333;
}

/* Popup Body */
.matchup-popup-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: calc(80vh - 140px);
  overflow-y: auto;
}

/* Form Fields */
.matchup-field-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #f5f5f5;
  margin-bottom: 6px;
}

.matchup-field-hint {
  font-size: 12px;
  color: #666;
  font-weight: 400;
  margin-left: 6px;
}

.matchup-popup .matchup-field-input,
input[type="text"].matchup-field-input {
  width: 100%;
  padding: 10px 14px;
  background: #252525;
  border: 1px solid #444;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  height: auto;
  margin-bottom: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.matchup-popup .matchup-field-input:focus,
input[type="text"].matchup-field-input:focus {
  outline: none;
  border-color: var(--ps-orange-deep);
  box-shadow: 0 0 0 2px rgba(227, 129, 25, 0.25);
}

.matchup-popup .matchup-field-input::placeholder,
input[type="text"].matchup-field-input::placeholder {
  color: #666;
}

/* Legend Picker */
.matchup-legend-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.matchup-selected-legends {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
}

.matchup-selected-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 20px;
  padding: 4px 10px 4px 4px;
  font-size: 13px;
  color: #f5f5f5;
}

.matchup-selected-pill img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.matchup-selected-pill .pill-remove {
  cursor: pointer;
  color: #888;
  font-size: 14px;
  margin-left: 2px;
  transition: color 0.15s ease;
}

.matchup-selected-pill .pill-remove:hover {
  color: #e05555;
}

.matchup-legend-count {
  font-size: 12px;
  color: #888;
}

/* Add More Button */
.matchup-add-legend-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px dashed #555;
  color: #888;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.matchup-add-legend-btn:hover {
  border-color: var(--ps-gold-2);
  color: var(--ps-gold-2);
}

.matchup-add-legend-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Legend Search Grid (nested popup) */
.matchup-legend-search-panel {
  display: none;
  background: #161616;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px;
  margin-top: 4px;
}

.matchup-legend-search-panel.active {
  display: block;
}

.matchup-popup .matchup-legend-search-input,
input[type="text"].matchup-legend-search-input {
  width: 100%;
  padding: 8px 12px;
  background: #252525;
  border: 1px solid #444;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  height: auto;
  margin-bottom: 10px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.matchup-popup .matchup-legend-search-input:focus,
input[type="text"].matchup-legend-search-input:focus {
  outline: none;
  border-color: var(--ps-orange-deep);
  box-shadow: 0 0 0 2px rgba(227, 129, 25, 0.25);
}

.matchup-popup .matchup-legend-search-input::placeholder,
input[type="text"].matchup-legend-search-input::placeholder {
  color: #666;
}

.matchup-legend-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.matchup-legend-grid::-webkit-scrollbar {
  width: 5px;
}

.matchup-legend-grid::-webkit-scrollbar-track {
  background: transparent;
}

.matchup-legend-grid::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.matchup-legend-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;
  text-align: center;
}

.matchup-legend-option:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #444;
}

.matchup-legend-option.selected {
  border-color: var(--ps-gold-2);
  background: rgba(218, 165, 32, 0.1);
}

.matchup-legend-option.hidden {
  display: none;
}

.matchup-legend-option img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #222;
}

.matchup-legend-option .legend-name {
  font-size: 10px;
  color: #aaa;
  line-height: 1.2;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Difficulty Selector */
.matchup-difficulty-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.matchup-diff-btn {
  padding: 10px 14px;
  border-radius: 8px;
  border: 2px solid #333;
  background: transparent;
  color: #888;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.matchup-diff-btn:hover {
  border-color: #555;
  color: #ccc;
}

.matchup-diff-btn.active[data-diff="favored"] {
  border-color: #4d8e2f;
  background: rgba(77, 142, 47, 0.15);
  color: #6abf40;
}

.matchup-diff-btn.active[data-diff="even"] {
  border-color: var(--ps-gold-2);
  background: rgba(218, 165, 32, 0.15);
  color: var(--ps-gold-2);
}

.matchup-diff-btn.active[data-diff="unfavored"] {
  border-color: #e0292e;
  background: rgba(224, 41, 46, 0.15);
  color: #e05555;
}

/* Strategy Tabs in Popup */
.matchup-popup-strategy-tabs {
  display: flex;
  background: #161616;
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}

.matchup-popup-strat-tab {
  flex: 1;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #888;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.matchup-popup-strat-tab:hover {
  color: #ccc;
}

.matchup-popup-strat-tab.active {
  background: #2a2a2a;
  color: #f5f5f5;
}

.matchup-popup-strategy-panels {
  position: relative;
}

.matchup-popup-strat-panel {
  display: none;
}

.matchup-popup-strat-panel.active {
  display: block;
}

.matchup-popup textarea.matchup-strategy-textarea {
  display: block;
  position: static !important;
  left: auto !important;
  width: 100%;
  min-height: 120px;
  height: 120px;
  padding: 12px 14px;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  color: #f5f5f5;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.matchup-popup textarea.matchup-strategy-textarea:focus {
  outline: none;
  border-color: var(--ps-gold-2);
}

.matchup-popup textarea.matchup-strategy-textarea::placeholder {
  color: #555;
}

.matchup-char-count {
  text-align: right;
  font-size: 11px;
  color: #555;
  margin-top: 4px;
}

.matchup-char-count.near-limit {
  color: #e0292e;
}

/* Popup Footer */
.matchup-popup-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid #2a2a2a;
}

.matchup-popup-cancel {
  background: transparent;
  border: 1px solid #444;
  color: #aaa;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.matchup-popup-cancel:hover {
  background: #2a2a2a;
  color: #f5f5f5;
}

.matchup-popup-save {
  background: linear-gradient(135deg, var(--ps-gold-deep), var(--ps-gold-2));
  border: none;
  color: #000;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.matchup-popup-save:hover {
  background: linear-gradient(135deg, var(--ps-gold-2), var(--ps-gold));
}

.matchup-popup-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   DELETE CONFIRMATION MODAL
   ============================================ */

.matchup-delete-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10002;
  justify-content: center;
  align-items: center;
}

.matchup-delete-overlay.active {
  display: flex;
}

.matchup-delete-modal {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 14px;
  width: 100%;
  max-width: 380px;
  padding: 28px 24px 22px;
  text-align: center;
  animation: matchupPopupIn 0.2s ease;
}

.matchup-delete-modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(224, 41, 46, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 22px;
  color: #e05555;
}

.matchup-delete-modal-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: #f5f5f5;
}

.matchup-delete-modal-text {
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.5;
  color: #999;
}

.matchup-delete-modal-text strong {
  color: #f5f5f5;
}

.matchup-delete-modal-actions {
  display: flex;
  gap: 10px;
}

.matchup-delete-modal-cancel {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid #444;
  color: #aaa;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.matchup-delete-modal-cancel:hover {
  background: #2a2a2a;
  color: #f5f5f5;
}

.matchup-delete-modal-confirm {
  flex: 1;
  padding: 10px 16px;
  background: #e0292e;
  border: none;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.matchup-delete-modal-confirm:hover {
  background: #c9232a;
}

.matchup-delete-modal-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   RESET RECORD CONFIRMATION MODAL
   ============================================ */

.matchup-reset-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10002;
  justify-content: center;
  align-items: center;
}

.matchup-reset-overlay.active {
  display: flex;
}

.matchup-reset-modal {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 14px;
  width: 100%;
  max-width: 380px;
  padding: 28px 24px 22px;
  text-align: center;
  animation: matchupPopupIn 0.2s ease;
}

.matchup-reset-modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 22px;
  color: var(--ps-gold-metal);
}

.matchup-reset-modal-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: #f5f5f5;
}

.matchup-reset-modal-text {
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.5;
  color: #999;
}

.matchup-reset-modal-text strong {
  color: #f5f5f5;
}

.matchup-reset-modal-actions {
  display: flex;
  gap: 10px;
}

.matchup-reset-modal-cancel {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid #444;
  color: #aaa;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.matchup-reset-modal-cancel:hover {
  background: #2a2a2a;
  color: #f5f5f5;
}

.matchup-reset-modal-confirm {
  flex: 1;
  padding: 10px 16px;
  background: var(--ps-gold-metal);
  border: none;
  color: #1a1a1a;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.matchup-reset-modal-confirm:hover {
  background: #c9a230;
}

/* ============================================
   SWAP CARDS — Popup Sections
   ============================================ */

/* Swap section wrapper */
.matchup-swap-section {
  margin-top: 8px;
  margin-bottom: 4px;
}

.matchup-swap-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.matchup-swap-col {
  background: #161616;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 10px;
}

.matchup-swap-col-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.matchup-swap-out .matchup-swap-col-header {
  color: #e05555;
}

.matchup-swap-in .matchup-swap-col-header {
  color: #6abf40;
}

.matchup-swap-count {
  font-size: 11px;
  font-weight: 600;
  background: #2a2a2a;
  padding: 1px 6px;
  border-radius: 10px;
  color: #aaa;
}

.matchup-swap-select-btn {
  margin-left: auto;
  background: transparent;
  border: 1px dashed #444;
  color: #888;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
}

.matchup-swap-select-btn:hover {
  border-color: var(--ps-gold-2);
  color: var(--ps-gold-2);
}

/* Swap card pills in popup */
.matchup-swap-cards {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 30px;
}

.matchup-swap-empty {
  font-size: 11px;
  color: #555;
  font-style: italic;
  text-align: center;
  padding: 6px 0;
}

.matchup-swap-card-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #222;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: #ddd;
}

.matchup-swap-card-pill img {
  width: 24px;
  height: 34px;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
}

.matchup-swap-card-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matchup-swap-card-qty {
  font-weight: 700;
  color: #aaa;
  flex-shrink: 0;
}

.matchup-swap-card-remove {
  cursor: pointer;
  color: #666;
  font-size: 14px;
  padding: 0 2px;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.matchup-swap-card-remove:hover {
  color: #e05555;
}

/* Balance indicator */
.matchup-swap-balance {
  text-align: center;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #161616;
  border: 1px solid #2a2a2a;
  font-size: 12px;
  font-weight: 600;
}

.matchup-swap-balance.unbalanced {
  border-color: rgba(224, 41, 46, 0.3);
  background: rgba(224, 41, 46, 0.05);
}

/* ============================================
   SWAP CARD PICKER (full-panel overlay)
   ============================================ */

.matchup-card-picker {
  padding: 16px 24px 20px;
}

.matchup-card-picker-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.matchup-card-picker-back {
  background: transparent;
  border: 1px solid #444;
  color: #aaa;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.matchup-card-picker-back:hover {
  background: #2a2a2a;
  color: #f5f5f5;
}

.matchup-card-picker-title {
  font-size: 14px;
  font-weight: 700;
  color: #f5f5f5;
}

.matchup-card-picker-remaining {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
}

.matchup-card-picker-footer {
  display: flex;
  justify-content: flex-end;
  padding: 14px 0 0;
  margin-top: 12px;
  border-top: 1px solid #2a2a2a;
}

.matchup-card-picker-done {
  background: linear-gradient(135deg, var(--ps-gold-deep), var(--ps-gold-2));
  border: none;
  color: #000;
  padding: 10px 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.matchup-card-picker-done:hover {
  background: linear-gradient(135deg, var(--ps-gold-2), var(--ps-gold));
}

/* Picker card grid */
.matchup-card-picker-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
}

.matchup-card-picker-grid::-webkit-scrollbar {
  width: 5px;
}

.matchup-card-picker-grid::-webkit-scrollbar-track {
  background: transparent;
}

.matchup-card-picker-grid::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.matchup-picker-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  transition: border-color 0.15s ease;
}

.matchup-picker-card.picker-selected {
  border-color: var(--ps-gold-2);
  background: rgba(218, 165, 32, 0.05);
}

.matchup-picker-card-img {
  width: 32px;
  height: 45px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.matchup-picker-card-info {
  flex: 1;
  min-width: 0;
}

.matchup-picker-card-name {
  font-size: 13px;
  font-weight: 600;
  color: #f5f5f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matchup-picker-card-qty-label {
  font-size: 11px;
  color: #666;
  margin-top: 1px;
}

/* Picker +/- controls */
.matchup-picker-qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.matchup-picker-minus,
.matchup-picker-plus {
  width: 28px;
  height: 28px;
  border: 1px solid #444;
  background: #2a2a2a;
  color: #ccc;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
  padding: 0;
}

.matchup-picker-minus {
  border-radius: 6px 0 0 6px;
}

.matchup-picker-plus {
  border-radius: 0 6px 6px 0;
}

.matchup-picker-minus:hover,
.matchup-picker-plus:hover {
  background: #444;
  color: #fff;
}

.matchup-picker-qty-value {
  width: 30px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #f5f5f5;
  background: #111;
  border-top: 1px solid #444;
  border-bottom: 1px solid #444;
  height: 28px;
  line-height: 28px;
}

/* ============================================
   MULLIGAN PRIORITY — Popup Section
   ============================================ */

.matchup-mulligan-section {
  margin-top: 8px;
  margin-bottom: 4px;
}

.matchup-mulligan-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #b388ff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.matchup-mulligan-count {
  font-size: 11px;
  font-weight: 600;
  background: #2a2a2a;
  padding: 1px 6px;
  border-radius: 10px;
  color: #aaa;
}

.matchup-mulligan-select-btn {
  margin-left: auto;
  background: transparent;
  border: 1px dashed #444;
  color: #888;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
}

.matchup-mulligan-select-btn:hover {
  border-color: #b388ff;
  color: #b388ff;
}

.matchup-mulligan-cards {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 30px;
}

.matchup-mulligan-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #222;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: #ddd;
}

.matchup-mulligan-pill img {
  width: 24px;
  height: 34px;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
}

.matchup-mulligan-card-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matchup-mulligan-card-qty {
  font-weight: 700;
  color: #aaa;
  flex-shrink: 0;
  font-size: 12px;
}

.matchup-mulligan-card-remove {
  cursor: pointer;
  color: #666;
  font-size: 14px;
  padding: 0 2px;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.matchup-mulligan-card-remove:hover {
  color: #e05555;
}

/* ============================================
   MULLIGAN PRIORITY — Read-only (expanded card)
   ============================================ */

.matchup-mulligan-display {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: rgba(179, 136, 255, 0.05);
  border: 1px solid rgba(179, 136, 255, 0.15);
  border-radius: 8px;
}

.matchup-mulligan-display-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #b388ff;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.matchup-mulligan-display-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.matchup-mulligan-display-card {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #ccc;
  background: rgba(255,255,255,0.04);
  padding: 4px 8px;
  border-radius: 6px;
}

.matchup-mulligan-display-card img {
  width: 22px;
  height: 31px;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
}

/* ============================================
   ORPHANED CARD — removed from deck warning
   ============================================ */

/* Read-only display cards */
.matchup-swap-display-card.matchup-card-orphaned,
.matchup-mulligan-display-card.matchup-card-orphaned {
  opacity: 0.55;
  text-decoration: line-through;
  text-decoration-color: rgba(224, 85, 85, 0.5);
}

.matchup-swap-display-card.matchup-card-orphaned span:first-of-type,
.matchup-mulligan-display-card.matchup-card-orphaned span:first-of-type {
  color: #888;
}

/* Edit popup pills */
.matchup-swap-card-pill.matchup-card-orphaned,
.matchup-mulligan-pill.matchup-card-orphaned {
  border-color: rgba(224, 85, 85, 0.4);
  background: rgba(224, 85, 85, 0.08);
  opacity: 0.7;
}

.matchup-swap-card-pill.matchup-card-orphaned .matchup-swap-card-name,
.matchup-mulligan-pill.matchup-card-orphaned .matchup-mulligan-card-name {
  color: #999;
  text-decoration: line-through;
  text-decoration-color: rgba(224, 85, 85, 0.5);
}

/* Header warning icon (owner only) */
.matchup-orphan-warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(224, 165, 32, 0.12);
  color: var(--ps-gold-2);
  font-size: 11px;
  flex-shrink: 0;
  cursor: help;
}

/* "Removed" badge */
.matchup-orphaned-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #e05555;
  background: rgba(224, 85, 85, 0.15);
  border: 1px solid rgba(224, 85, 85, 0.3);
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 1.4;
}

/* ============================================
   SWAP DISPLAY — Read-only (inside expanded card)
   ============================================ */

.matchup-swap-display {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  background: #161616;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
}

.matchup-swap-display-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.matchup-swap-display-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.matchup-swap-display-card {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #ccc;
  padding: 3px 0;
}

.matchup-swap-display-card img {
  width: 22px;
  height: 31px;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
}

.matchup-swap-display-card span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matchup-swap-display-qty {
  margin-left: auto;
  font-weight: 700;
  color: #888;
  flex-shrink: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .matchup-popup-overlay {
    align-items: flex-start;
    padding: 20px 0 0;
  }

  .matchup-popup {
    max-width: 100%;
    margin: 0;
    border-radius: 14px 14px 0 0;
    max-height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
  }

  .matchup-popup-header {
    flex-shrink: 0;
  }

  .matchup-popup-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .matchup-popup-footer {
    flex-shrink: 0;
  }

  .matchup-legend-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .matchup-legend-option img {
    width: 40px;
    height: 40px;
  }

  .matchup-card-header {
    padding: 12px 14px;
  }

  .matchup-legend-img {
    width: 34px;
    height: 34px;
  }

  .matchup-card-title {
    font-size: 13px;
  }

  .matchup-difficulty {
    font-size: 10px;
    padding: 3px 8px;
  }

  .matchup-winrate {
    font-size: 10px;
    padding: 2px 6px;
  }

  .matchup-record-btn {
    padding: 2px 6px;
    font-size: 10px;
  }

  .matchup-swap-columns {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .matchup-swap-display {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .matchup-legend-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .matchup-difficulty-selector {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .matchup-diff-btn {
    padding: 8px 6px;
    font-size: 12px;
  }
}
