* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Hamburger Menu */
.nav-menu {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1000;
}

.menu-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.menu-toggle:hover {
  background: var(--bg-tertiary);
}

.menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

.menu-overlay.show {
  display: block;
}

.menu-dropdown {
  position: fixed;
  top: 0;
  left: -250px;
  width: 250px;
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--bg-tertiary);
  overflow-y: auto;
  transition: left 0.3s ease;
  z-index: 1001;
}

.menu-dropdown.show {
  left: 0;
}

.menu-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--bg-tertiary);
  font-weight: bold;
  color: var(--accent);
}

.menu-section {
  padding: 10px 0;
  border-bottom: 1px solid var(--bg-tertiary);
}

.menu-section-title {
  padding: 8px 16px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.menu-item {
  display: block;
  padding: 12px 16px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.2s;
}

.menu-item:hover {
  background: var(--bg-tertiary);
}

.menu-item.active {
  background: var(--accent);
  color: var(--bg-primary);
}

.menu-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 8px 16px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: center;
  transition: transform 0.2s;
}

.menu-btn:hover {
  transform: scale(1.02);
}

.menu-btn.random {
  background: linear-gradient(135deg, #9C27B0, #673AB7);
  color: white;
}

.menu-btn.load-data {
  background: linear-gradient(135deg, #4CAF50, #388E3C);
  color: white;
}

:root {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2a2a2a;
  --bg-tertiary: #333;
  --text-primary: #e0e0e0;
  --text-secondary: #aaa;
  --accent: #4CAF50;
  --accent-hover: #45a049;
}

/* Guild Themes */
[data-theme="azorius"] { --bg-primary: #1a2a3a; --bg-secondary: #2a3a4a; --bg-tertiary: #3a4a5a; --accent: #a0c4ff; --accent-hover: #80b4ff; }
[data-theme="dimir"] { --bg-primary: #0d1117; --bg-secondary: #161b22; --bg-tertiary: #21262d; --accent: #6e7681; --accent-hover: #8b949e; }
[data-theme="rakdos"] { --bg-primary: #1a0a0a; --bg-secondary: #2a1515; --bg-tertiary: #3a2020; --accent: #ff6b6b; --accent-hover: #ff5252; }
[data-theme="gruul"] { --bg-primary: #1a1a0a; --bg-secondary: #2a2515; --bg-tertiary: #3a3020; --accent: #ff9f43; --accent-hover: #ffa94d; }
[data-theme="selesnya"] { --bg-primary: #0f1a0f; --bg-secondary: #1a2a1a; --bg-tertiary: #253525; --accent: #a8e6cf; --accent-hover: #88d8b0; }
[data-theme="orzhov"] { --bg-primary: #1a1a1a; --bg-secondary: #252525; --bg-tertiary: #303030; --accent: #d4af37; --accent-hover: #c9a227; }
[data-theme="izzet"] { --bg-primary: #1a0a1a; --bg-secondary: #2a152a; --bg-tertiary: #3a203a; --accent: #ff6b9d; --accent-hover: #ff5287; }
[data-theme="golgari"] { --bg-primary: #0a1a0a; --bg-secondary: #152515; --bg-tertiary: #203020; --accent: #9acd32; --accent-hover: #8bc34a; }
[data-theme="boros"] { --bg-primary: #1a1410; --bg-secondary: #2a2420; --bg-tertiary: #3a3430; --accent: #ff7043; --accent-hover: #ff5722; }
[data-theme="simic"] { --bg-primary: #0a1a1a; --bg-secondary: #152a2a; --bg-tertiary: #203a3a; --accent: #00bcd4; --accent-hover: #00acc1; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
}

.back-button {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  text-decoration: none;
  font-size: 1rem;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  transition: background 0.2s;
}

.back-button:hover {
  background: var(--accent);
  color: #1a1a1a;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  color: #fff;
}

.stats {
  display: flex;
  gap: 30px;
  justify-content: center;
  align-items: center;
  font-size: 1.1rem;
}

.stats strong {
  color: var(--accent);
}

.random-btn {
  background: linear-gradient(135deg, #9C27B0, #673AB7);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.random-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(156, 39, 176, 0.4);
}

.deck-checker-btn {
  background: linear-gradient(135deg, #2196F3, #1976D2);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.deck-checker-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
}

.load-data-btn {
  background: linear-gradient(135deg, #4CAF50, #388E3C);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.load-data-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.load-data-btn.loading {
  opacity: 0.7;
  cursor: wait;
}

.load-data-btn.loaded {
  background: linear-gradient(135deg, #666, #555);
}

.theme-select, .price-source-select {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--accent);
  padding: 8px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
}

.price-source-select option:disabled {
  color: #666;
}

.color-identity-filter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-identity-filter > label:first-child {
  color: var(--text-secondary);
  font-size: 0.85rem;
  white-space: nowrap;
}

.color-checkboxes {
  display: flex;
  gap: 6px;
}

.color-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
}

.color-check input {
  display: none;
}

.color-check span {
  font-weight: bold;
  font-size: 0.8rem;
}

.color-check.W { background: #f9faf4; color: #333; }
.color-check.U { background: #0e68ab; color: white; }
.color-check.B { background: #2a2a2a; color: #aaa; border: 1px solid #555; }
.color-check.R { background: #d32f2f; color: white; }
.color-check.G { background: #388e3c; color: white; }
.color-check.C { background: #9e9e9e; color: #333; }

.color-check:has(input:checked) {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--accent);
}

.achievements {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}

.badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  transition: transform 0.2s;
  position: relative;
  cursor: pointer;
}

.badge.unlocked {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  border: 1px solid var(--accent);
}

.badge.locked {
  background: var(--bg-secondary);
  opacity: 0.4;
  filter: grayscale(1);
}

.badge.unlocked:hover {
  transform: scale(1.05);
}

.badge-icon {
  font-size: 1.1rem;
}

.badge-name {
  color: var(--text-primary);
}

.badge-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  margin-bottom: 6px;
  z-index: 10;
}

.badge:hover .badge-tooltip,
.badge.show-tooltip .badge-tooltip {
  opacity: 1;
}

/* Hero search bar */
.search-hero {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  padding: 30px 20px;
  margin-bottom: 10px;
}

.search-hero .clear-filters-btn {
  white-space: nowrap;
}

.search-hero .search-wrapper {
  position: relative;
  width: 100%;
  max-width: 1000px;
  flex: none;
}

.search-wrapper .search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  pointer-events: none;
  z-index: 1;
}

.search-wrapper input {
  width: 100%;
  padding: 18px 24px 18px 55px;
  font-size: 1.2rem;
  border: 2px solid var(--bg-tertiary);
  border-radius: 50px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.search-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 4px 30px rgba(var(--accent-rgb, 100,100,100), 0.3);
}

.search-wrapper input::placeholder {
  color: #888;
}

.search-wrapper .autocomplete-list {
  top: 100%;
  margin-top: 8px;
  border-radius: 20px;
  max-height: 300px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 25px;
  justify-content: center;
  align-items: center;
  padding: 0 20px;
}

.filters input,
.filters select {
  padding: 10px 14px;
  border: 1px solid var(--bg-tertiary);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 8px;
  font-size: 0.9rem;
}

.filters input {
  width: 200px;
}

.filters select {
  min-width: 120px;
}

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

.filter-group {
  position: relative;
}

.filter-group.price-slider {
  min-width: 200px;
}

.filter-group.color-identity-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--bg-tertiary);
}

.clear-filters-btn {
  padding: 10px 14px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}

.clear-filters-btn:hover {
  background: #c62828;
  color: white;
}

.collection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
}

.collection.hidden {
  display: none;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card {
  background: var(--bg-secondary);
  border: 1px solid #444;
  border-radius: 8px;
  padding: 10px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  transform-style: preserve-3d;
  perspective: 1000px;
}

.card:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 10;
}

/* Foil shimmer effect */
.card.foil .card-image-inner::after,
.card.etched .card-image-inner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(
    125deg,
    transparent 0%,
    rgba(255,255,255,0.15) 25%,
    rgba(255,200,100,0.3) 35%,
    rgba(100,200,255,0.3) 45%,
    rgba(200,100,255,0.3) 55%,
    rgba(255,255,255,0.15) 75%,
    transparent 100%
  );
  background-size: 200% 200%;
  background-position: var(--shimmer-x, 50%) var(--shimmer-y, 50%);
  pointer-events: none;
  z-index: 1;
  backface-visibility: hidden;
}

@keyframes shimmer {
  0%, 100% { background-position: 200% 200%; }
  50% { background-position: 0% 0%; }
}

.card-image-wrapper {
  position: relative;
  width: 146px;
  height: 204px;
  margin: 0 auto 10px;
  perspective: 500px;
}

.card-image-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
}

.card-image {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  display: block;
  background: var(--bg-primary);
  object-fit: cover;
  backface-visibility: hidden;
}

.card-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
  transform: rotateY(180deg);
  backface-visibility: hidden;
}

.card-header {
  margin-bottom: 6px;
}

.card-name {
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
  margin-bottom: 4px;
}

.card-value {
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: bold;
}

.card-set {
  color: #999;
  font-size: 0.9rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.set-icon {
  width: 16px;
  height: 16px;
  filter: invert(0.7);
}

.card-details {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
}

.rarity-common { background: #666; }
.rarity-uncommon { background: #4a7c8c; }
.rarity-rare { background: #8c7a4a; }
.rarity-mythic { background: #8c4a4a; }
.rarity-special { background: #6a4a8c; }

.foil-foil { background: #4a6a8c; }
.foil-etched { background: #6a4a6a; }

.qty-badge {
  background: #546e7a;
}

.duplicate-badge {
  background: #e65100;
}

.type-badge {
  background: #5c6bc0;
}

.cmc-badge {
  background: #7b1fa2;
}

.keyword-badge {
  background: #00695c;
  font-size: 0.65rem;
}

.reserved-badge {
  background: linear-gradient(135deg, #b8860b, #daa520);
  color: #000;
  font-weight: bold;
}

.clickable {
  cursor: pointer;
  transition: transform 0.1s, filter 0.1s;
}

.clickable:hover {
  transform: scale(1.1);
  filter: brightness(1.2);
}

.card-set.clickable:hover {
  transform: none;
  color: var(--accent);
}

/* Collapsible Sections */
.collapsible-section {
  max-width: 1200px;
  margin: 0 auto 15px;
  padding: 0 20px;
}

.section-toggle {
  width: 100%;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.section-toggle:hover {
  background: var(--bg-tertiary);
}

.toggle-icon {
  transition: transform 0.3s;
}

.section-toggle.expanded .toggle-icon {
  transform: rotate(90deg);
}

#filters-content, #achievements {
  padding-top: 15px;
}

.collapsed {
  display: none !important;
}

.load-more-btn {
  display: block;
  width: 200px;
  margin: 20px auto;
  padding: 12px 24px;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: filter 0.2s;
}

.load-more-btn:hover {
  filter: brightness(1.1);
}

/* Dashboard */
.dashboard {
  max-width: 1200px;
  margin: 15px auto 20px;
  padding: 0 20px;
}

.chart-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.chart-box {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 15px;
  text-align: center;
}

.chart-box h3 {
  color: var(--accent);
  margin-bottom: 10px;
  font-size: 1rem;
}

.chart-box canvas {
  max-height: 150px;
}

.chart-box.stats-box {
  text-align: left;
  min-width: 180px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--bg-tertiary);
  gap: 10px;
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-item span {
  color: var(--text-secondary);
  white-space: nowrap;
}

.stat-item strong {
  color: var(--accent);
  white-space: nowrap;
  font-size: 0.95rem;
}

/* Autocomplete */
.filter-group {
  position: relative;
}

.autocomplete-wrapper {
  flex: 1;
  min-width: 150px;
  max-width: 250px;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid #444;
  border-top: none;
  border-radius: 0 0 5px 5px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.autocomplete-list.show {
  display: block;
}

.autocomplete-item {
  padding: 10px 15px;
  cursor: pointer;
  color: #e0e0e0;
}

.autocomplete-item:hover {
  background: #3a3a3a;
}

/* Price Slider */
.price-slider {
  width: 160px;
  flex-shrink: 0;
}

.price-slider label {
  display: block;
  margin-bottom: 10px;
  color: #e0e0e0;
  font-size: 0.85rem;
  white-space: nowrap;
}

#price-range {
  height: 6px;
}

#price-range .noUi-connect {
  background: var(--accent);
}

#price-range .noUi-handle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  top: -6px;
  right: -8px;
  cursor: pointer;
}

#price-range .noUi-handle::before,
#price-range .noUi-handle::after {
  display: none;
}

#price-range .noUi-target {
  background: #444;
  border: none;
  box-shadow: none;
}

@media (max-width: 900px) {
  .chart-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .chart-container {
    grid-template-columns: 1fr;
  }
}

/* View Toggle */
.view-toggle {
  display: flex;
  gap: 5px;
}

.view-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-secondary);
  border: 1px solid #444;
  border-radius: 5px;
  color: #e0e0e0;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-btn:hover {
  background: #3a3a3a;
}

.view-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* Binder View */
.binder {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
  position: relative;
}

.binder.hidden {
  display: none;
}

.binder-wrapper {
  flex: 1;
  background: linear-gradient(135deg, #2c1810 0%, #1a0f0a 100%);
  border-radius: 12px;
  padding: 25px 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5), inset 0 2px 0 rgba(255,255,255,0.1);
  border: 3px solid #3d2817;
  position: relative;
  overflow: hidden;
}

.binder-rings {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 40px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 30px 0;
  z-index: 10;
}

.binder-ring {
  width: 30px;
  height: 30px;
  border: 4px solid #888;
  border-radius: 50%;
  background: linear-gradient(135deg, #aaa 0%, #666 100%);
  box-shadow: 2px 2px 4px rgba(0,0,0,0.5), inset -2px -2px 4px rgba(0,0,0,0.3);
}

.binder-pages {
  display: flex;
  gap: 40px;
  perspective: 2000px;
  position: relative;
  min-height: 624px;
}

.binder-page {
  flex: 1;
  background: linear-gradient(180deg, #1a1a1a 0%, #111 100%);
  border-radius: 4px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
  height: 624px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
  position: relative;
  box-sizing: border-box;
}

.binder-page-left {
  transform-origin: right center;
}

.binder-page-right {
  transform-origin: left center;
}

/* Flipping page overlay */
.flip-page {
  position: absolute;
  top: 0;
  width: calc(50% - 20px);
  height: 624px;
  transform-style: preserve-3d;
  z-index: 10;
  pointer-events: none;
}

.flip-page-next {
  right: 20px;
  transform-origin: left center;
}

.flip-page-prev {
  left: 20px;
  transform-origin: right center;
}

.flip-page-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.flip-page-front,
.flip-page-back {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #1a1a1a 0%, #111 100%);
  border-radius: 4px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
  backface-visibility: hidden;
  box-sizing: border-box;
}

.flip-page-back {
  transform: rotateY(180deg);
}

.flip-page-next.flipping {
  animation: flipNextPage 1.2s cubic-bezier(0.3, 0.0, 0.2, 1) forwards;
}

.flip-page-prev.flipping {
  animation: flipPrevPage 1.2s cubic-bezier(0.3, 0.0, 0.2, 1) forwards;
}

@keyframes flipNextPage {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(-180deg); }
}

@keyframes flipPrevPage {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(180deg); }
}

/* Mobile binder - single page */
@media (max-width: 768px) {
  .binder {
    flex-direction: column;
    gap: 15px;
    padding: 10px;
  }
  
  .binder-nav {
    display: none;
  }
  
  .binder-mobile-nav {
    display: flex;
    gap: 20px;
    order: 2;
    justify-content: center;
  }
  
  .binder-mobile-nav button {
    width: 60px;
    height: 50px;
    background: var(--bg-secondary);
    border: 1px solid #444;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 1.5rem;
    cursor: pointer;
  }
  
  .binder-mobile-nav button:hover:not(:disabled) {
    background: var(--accent);
    color: #000;
  }
  
  .binder-mobile-nav button:disabled {
    opacity: 0.3;
  }
  
  .binder-wrapper {
    width: 100%;
    padding: 10px;
    order: 1;
  }
  
  .binder-pages {
    gap: 0;
  }
  
  .binder-page-left {
    display: none;
  }
  
  .binder-rings {
    display: none;
  }
  
  .binder-page {
    min-height: auto;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    padding: 8px;
  }
  
  .binder-card:nth-child(n+5) {
    display: none;
  }
  
  .binder-page-num {
    position: static;
    transform: none;
    order: 3;
    margin-top: 5px;
  }
  
  .flip-page {
    width: calc(100% - 20px);
    left: 10px !important;
    right: 10px !important;
  }
  
  .flip-page-front,
  .flip-page-back {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    padding: 8px;
  }
  
  .flip-page .binder-card:nth-child(n+5) {
    display: none;
  }
  
  .flip-page-next.flipping {
    animation: flipNextMobile 0.8s cubic-bezier(0.3, 0.0, 0.2, 1) forwards;
  }
  
  .flip-page-prev.flipping {
    animation: flipPrevMobile 0.8s cubic-bezier(0.3, 0.0, 0.2, 1) forwards;
  }
  
  @keyframes flipNextMobile {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(-90deg); }
  }
  
  @keyframes flipPrevMobile {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(90deg); }
  }
}

.binder-card {
  background: #0a0a0a;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 488/680;
  position: relative;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.05);
}

/* Pocket overlay effect */
.binder-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.08) 0%,
    transparent 20%,
    transparent 80%,
    rgba(0,0,0,0.2) 100%
  );
  pointer-events: none;
  z-index: 2;
  border-radius: 4px;
}

.binder-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 15%;
  background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, transparent 100%);
  pointer-events: none;
  z-index: 3;
}

.binder-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.binder-card a {
  display: block;
  width: 100%;
  height: 100%;
}

/* Binder foil shimmer */
.binder-card.foil::before,
.binder-card.etched::before {
  background: linear-gradient(
    125deg,
    transparent 0%,
    rgba(255,255,255,0.1) 25%,
    rgba(255,200,100,0.25) 35%,
    rgba(100,200,255,0.25) 45%,
    rgba(200,100,255,0.25) 55%,
    rgba(255,255,255,0.1) 75%,
    transparent 100%
  );
}

.binder-nav {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
}

.binder-nav button,
.binder-mobile-nav button {
  padding: 10px 20px;
  background: var(--bg-secondary);
  border: 1px solid #444;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.binder-nav button:hover:not(:disabled),
.binder-mobile-nav button:hover:not(:disabled) {
  background: var(--accent);
  color: #000;
}

.binder-nav button:disabled,
.binder-mobile-nav button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.binder-page-num {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  color: #999;
  font-size: 0.9rem;
}

.binder-mobile-nav {
  display: none;
}

@media (max-width: 768px) {
  .binder-nav {
    display: none !important;
  }
  
  .binder-mobile-nav {
    display: flex !important;
    gap: 15px;
    justify-content: center;
  }
}

/* Mobile layout fixes */
@media (max-width: 768px) {
  .filters {
    flex-direction: column;
    gap: 10px;
  }
  
  .filter-group.autocomplete-wrapper {
    max-width: 100%;
    width: 100%;
  }
  
  .price-slider {
    width: 100%;
  }
  
  .filters select {
    width: 100%;
  }
  
  header h1 {
    font-size: 1.5rem;
  }
  
  .stats {
    flex-direction: column;
    gap: 5px;
    font-size: 0.9rem;
  }
  
  .binder-mobile-nav {
    display: flex !important;
  }
}

/* Carousel View */
.carousel {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
  position: relative;
}

.carousel.hidden {
  display: none;
}

.carousel-track {
  flex: 1;
  overflow: hidden;
  padding: 20px 0;
  min-height: 400px;
}

.carousel-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 350px;
}

.carousel-card {
  flex-shrink: 0;
  width: 200px;
  transition: all 0.4s ease-out;
  opacity: 0.5;
  transform: scale(0.8);
  filter: brightness(0.7);
}

.carousel-card.placeholder {
  visibility: hidden;
}

.carousel-card.active {
  width: 300px;
  opacity: 1;
  transform: scale(1);
  filter: brightness(1);
  z-index: 10;
}

.carousel-card.adjacent {
  opacity: 0.7;
  transform: scale(0.9);
  filter: brightness(0.85);
}

.carousel-card img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.carousel-card a {
  display: block;
}

.carousel-card-info {
  text-align: center;
  margin-top: 15px;
  opacity: 0;
  transition: opacity 0.3s;
}

.carousel-card.active .carousel-card-info {
  opacity: 1;
}

.carousel-card-name {
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
  margin-bottom: 5px;
}

.carousel-card-price {
  font-size: 1.1rem;
  color: var(--accent);
}

.carousel-nav {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 20px;
}

.carousel-nav button,
.carousel-mobile-nav button {
  width: 50px;
  height: 50px;
  background: var(--bg-secondary);
  border: 1px solid #444;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.carousel-nav button:hover:not(:disabled),
.carousel-mobile-nav button:hover:not(:disabled) {
  background: var(--accent);
  color: #000;
}

.carousel-nav button:disabled,
.carousel-mobile-nav button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-nav button:focus,
.carousel-mobile-nav button:focus {
  outline: none;
}

.carousel-counter {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: #999;
  font-size: 0.9rem;
}

.carousel-mobile-nav {
  display: none;
}

/* Mobile carousel */
@media (max-width: 768px) {
  .carousel {
    flex-direction: column;
    padding: 10px;
    gap: 15px;
  }
  
  .carousel-nav {
    display: none;
  }
  
  .carousel-mobile-nav {
    display: flex !important;
    gap: 20px;
    justify-content: center;
  }
  
  .carousel-mobile-nav button {
    width: 60px;
    height: 50px;
    background: var(--bg-secondary);
    border: 1px solid #444;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 1.5rem;
    cursor: pointer;
  }
  
  .carousel-mobile-nav button:hover:not(:disabled) {
    background: var(--accent);
    color: #000;
  }
  
  .carousel-mobile-nav button:disabled {
    opacity: 0.3;
  }
  
  .carousel-track {
    width: 100%;
    min-height: 300px;
    padding: 10px 0;
  }
  
  .carousel-cards {
    min-height: 280px;
  }
  
  .carousel-card {
    width: 150px;
    display: none;
  }
  
  .carousel-card.active {
    width: 220px;
    display: block;
  }
  
  .carousel-counter {
    position: static;
    transform: none;
  }
}

/* Carousel foil shimmer */
.carousel-card.foil img,
.carousel-card.etched img {
  position: relative;
}

.carousel-card.foil::after,
.carousel-card.etched::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 60px;
  border-radius: 12px;
  background: linear-gradient(
    125deg,
    transparent 0%,
    rgba(255,255,255,0.1) 25%,
    rgba(255,200,100,0.2) 35%,
    rgba(100,200,255,0.2) 45%,
    rgba(200,100,255,0.2) 55%,
    rgba(255,255,255,0.1) 75%,
    transparent 100%
  );
  pointer-events: none;
}

.carousel-card {
  position: relative;
}

/* Card Preview Modal */
.card-preview {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  transition: opacity 0.2s;
}

.card-preview.hidden {
  opacity: 0;
}

.card-preview img {
  width: 300px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

@media (max-width: 768px) {
  .card-preview {
    display: none !important;
  }
}


/* Timeline View */
.timeline {
  max-width: 1400px;
  margin: 0 auto;
}

.timeline-year {
  margin-bottom: 30px;
}

.year-header {
  font-size: 2rem;
  font-weight: bold;
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 10px;
  margin-bottom: 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.year-toggle {
  transition: transform 0.3s;
}

.timeline-year.year-collapsed .year-toggle {
  transform: rotate(-90deg);
}

.timeline-year.year-collapsed .year-content {
  display: none;
}

.timeline-set {
  margin-bottom: 15px;
  background: var(--bg-secondary);
  border-radius: 10px;
  overflow: hidden;
}

.set-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.set-header:hover {
  background: var(--bg-tertiary);
}

.set-header .set-icon {
  width: 24px;
  height: 24px;
}

.set-header .set-name {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
}

.set-header .set-date {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.set-header .set-count {
  color: var(--accent);
  font-size: 0.9rem;
}

.set-header .set-toggle {
  transition: transform 0.2s;
}

.timeline-set.collapsed .set-toggle {
  transform: rotate(-90deg);
}

.timeline-set.collapsed .set-cards {
  display: none;
}

.set-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  background: var(--bg-primary);
}

.set-cards .card {
  width: 160px;
}

@media (max-width: 768px) {
  .set-cards .card {
    width: calc(50% - 6px);
  }
  
  .set-header {
    flex-wrap: wrap;
  }
  
  .set-header .set-date {
    order: 5;
    width: 100%;
    margin-top: 4px;
  }
}


/* Deck Checker */
.deck-checker {
  max-width: 1000px;
  margin: 0 auto;
}

.deck-input {
  background: var(--bg-secondary);
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  margin-bottom: 30px;
}

.deck-input h2 {
  color: var(--accent);
  margin-bottom: 10px;
}

.deck-input p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.deck-url-input {
  width: 100%;
  max-width: 500px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--bg-tertiary);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 10px;
}

.deck-list-input {
  width: 100%;
  max-width: 500px;
  height: 150px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--bg-tertiary);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: monospace;
  resize: vertical;
  display: block;
  margin: 0 auto 15px;
}

.check-btn {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s;
  display: block;
  margin: 0 auto;
}

.check-btn:hover {
  transform: scale(1.05);
}

.divider {
  color: var(--text-secondary);
  margin: 20px 0;
}

.deck-results.hidden {
  display: none;
}

.results-summary {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 30px;
}

.results-summary > div {
  text-align: center;
}

.summary-count {
  display: block;
  font-size: 2.5rem;
  font-weight: bold;
}

.summary-owned .summary-count { color: #4CAF50; }
.summary-missing .summary-count { color: #f44336; }
.summary-percent .summary-count { color: var(--accent); }

.summary-label {
  color: var(--text-secondary);
}

.results-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.results-column {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
}

.results-column h3 {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--bg-tertiary);
}

.results-column.owned h3 { color: #4CAF50; }
.results-column.missing h3 { color: #f44336; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  max-height: 500px;
  overflow-y: auto;
}

.deck-card-tile {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.deck-card-tile img {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.deck-card-tile.owned {
  box-shadow: 0 0 0 3px #4CAF50;
}

.deck-card-tile.missing {
  box-shadow: 0 0 0 3px #f44336;
  opacity: 0.7;
}

.tile-qty {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
}

.tile-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 4px;
  font-size: 0.65rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-type {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0,0,0,0.8);
  color: #aaa;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.6rem;
}

.empty {
  color: var(--text-secondary);
  font-style: italic;
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
}

.back-link {
  display: block;
  text-align: center;
  margin-top: 30px;
  color: var(--accent);
  text-decoration: none;
}

@media (max-width: 768px) {
  .results-columns {
    grid-template-columns: 1fr;
  }
  
  .results-summary {
    gap: 20px;
  }
  
  .summary-count {
    font-size: 1.8rem;
  }
}
