* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4fc3f7;
  --accent: #66bb6a;
  --bg: #0f0f1a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, var(--bg) 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  color: #e0e0e0;
}

.container {
  max-width: 95%;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2.5rem;
  color: #fff;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #a0a0a0;
  font-size: 1.1rem;
}

h2 {
  color: #fff;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

/* Search Section */
.search-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-bar input {
  flex: 1;
  padding: 0.8rem 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transition: border-color 0.3s;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-bar input::placeholder {
  color: #888;
}

.search-bar button {
  padding: 0.8rem 2rem;
  background: var(--primary);
  color: #1a1a2e;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
}

.search-bar button:hover {
  background: #81d4fa;
  transform: translateY(-1px);
}

/* Category Tabs (Market page) */
.category-tabs {
  display: flex;
  gap: 0.4rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}
.cat-tab {
  padding: 0.5rem 1.2rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #ccc;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
}
.cat-tab:hover {
  background: rgba(79,195,247,0.08);
  border-color: rgba(79,195,247,0.3);
}
.cat-tab.active {
  background: rgba(79,195,247,0.15);
  border-color: #4fc3f7;
  color: #4fc3f7;
  font-weight: 600;
}

.search-bar button:active {
  transform: translateY(0);
}

/* Mode Selector */

/* Select dropdowns */
select {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #fff;
  padding: 0.6rem;
  font-size: 0.85rem;
}
select option {
  background: #1a1a2e;
  color: #fff;
}

.mode-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mode-option {
  cursor: pointer;
}

.mode-option input[type="radio"] {
  display: none;
}

.mode-label {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  font-size: 0.9rem;
  color: #aaa;
  transition: all 0.3s;
}

.mode-option input[type="radio"]:checked + .mode-label {
  background: rgba(79, 195, 247, 0.2);
  border-color: var(--primary);
  color: var(--primary);
}

.mode-option:hover .mode-label {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.foil-text {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 105, 180, 0.1));
}

.mode-option input[type="radio"]:checked + .foil-text {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 105, 180, 0.2));
  border-color: #ffd700;
  color: #ffd700;
}

.loading {
  text-align: center;
  padding: 1rem;
  color: var(--primary);
  font-style: italic;
}

.error {
  text-align: center;
  padding: 1rem;
  color: #ef5350;
  background: rgba(239, 83, 80, 0.1);
  border-radius: 8px;
}

.hidden {
  display: none;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.card-item {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  min-width: 0;
}

.card-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.card-item.foil-card {
  border-color: rgba(255, 215, 0, 0.4);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.05), rgba(255, 105, 180, 0.05), rgba(100, 200, 255, 0.05));
}

.card-image {
  width: 100%;
  max-width: 200px;
  height: 280px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 0.8rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.card-image.foil-img {
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.3);
  position: relative;
}

/* Foil holographic shimmer effect — animated overlay style */
.foil-shimmer-wrap {
  position: relative;
  display: inline-block;
  overflow: hidden;
  border-radius: 8px;
}
.foil-shimmer-wrap img {
  display: block;
}
.foil-shimmer-wrap::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><defs><linearGradient id="g" x1="0%25" y1="0%25" x2="100%25" y2="100%25"><stop offset="0%25" style="stop-color:rgb(255,0,128);stop-opacity:0.3"/><stop offset="16%25" style="stop-color:rgb(255,200,0);stop-opacity:0.3"/><stop offset="33%25" style="stop-color:rgb(0,255,100);stop-opacity:0.3"/><stop offset="50%25" style="stop-color:rgb(0,150,255);stop-opacity:0.3"/><stop offset="66%25" style="stop-color:rgb(128,0,255);stop-opacity:0.3"/><stop offset="83%25" style="stop-color:rgb(255,100,200);stop-opacity:0.3"/><stop offset="100%25" style="stop-color:rgb(255,200,0);stop-opacity:0.3"/></linearGradient></defs><rect fill="url(%23g)" width="200" height="200"/></svg>');
  background-size: 300% 300%;
  mix-blend-mode: color-dodge;
  opacity: 0.55;
  z-index: 1;
  pointer-events: none;
  animation: foilGradient 4s ease infinite;
}
@keyframes foilGradient {
  0% { background-position: 0% 0%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0% 100%; }
  100% { background-position: 0% 0%; }
}

/* Surge Foil — Three.js WebGL shader overlay (see surge-foil.js) */
.surge-foil-wrap {
  position: relative;
  display: inline-block;
  overflow: hidden;
  border-radius: 8px;
}
.surge-foil-wrap img {
  display: block;
}

.card-item .card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.3rem;
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-item .card-set {
  font-size: 0.8rem;
  color: #aaa;
  margin-bottom: 0.3rem;
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-item .card-condition {
  font-size: 0.75rem;
  color: #888;
  margin-top: auto;
  padding-top: 0.5rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.card-item .foil-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: linear-gradient(135deg, #ffd700, #ff69b4);
  color: #1a1a2e;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.card-item .preorder-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(255, 167, 38, 0.2);
  color: #ffa726;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.card-item .sealed-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(171, 71, 188, 0.2);
  color: #ce93d8;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.card-item .accessory-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(79, 195, 247, 0.2);
  color: #4fc3f7;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.card-item .card-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.8rem;
  text-align: center;
}

.card-item .add-btn {
  width: 100%;
  padding: 0.6rem;
  background: var(--accent);
  color: #1a1a2e;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  /* Both stated, and stated here so they reach the <button> and the <a> alike.
     Measured: the pre-order tile came out 46px against the cart tile's 44 in the same row. A
     <button> does not inherit font-family — it was rendering in the user agent's Arial while the
     link took the page font — and neither had a line-height, so each fell back to its own idea of
     `normal`. Two different fonts at two different normals is where the two pixels were. */
  font-family: inherit;
  line-height: 1.25;
  cursor: pointer;
  transition: background 0.3s;
}

.card-item .add-btn:hover {
  background: #81c784;
}

/* A pre-order goes somewhere instead of into the basket, so it is an <a> — which needs the box
   model a <button> gets for free, or it sits at a different height to every other tile in the
   row and stops filling the card's width. Amber rather than the green of Add to Cart: it is a
   different promise, and it should not be pressed by muscle memory. */
.card-item a.add-btn {
  display: block;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  background: #f59e0b;
  color: #1a1a2e;
}
.card-item a.add-btn:hover {
  background: #fbbf24;
}

/* Market Section */
.market-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.market-summary {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem 1.5rem;
  background: rgba(102, 187, 106, 0.1);
  border: 1px solid rgba(102, 187, 106, 0.3);
  border-radius: 10px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.total-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.total-value span:first-child {
  font-size: 1rem;
  color: #aaa;
}

#totalValue {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.card-count {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-count span:first-child {
  color: #aaa;
}

#cardCount {
  font-weight: 600;
  color: #fff;
}

.clear-btn {
  margin-left: auto;
  padding: 0.5rem 1.2rem;
  background: rgba(239, 83, 80, 0.2);
  color: #ef5350;
  border: 1px solid rgba(239, 83, 80, 0.4);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.3s;
}

.clear-btn:hover {
  background: rgba(239, 83, 80, 0.4);
}

/* Market List */
.market-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.market-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.2rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  transition: background 0.2s;
}

.market-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.market-item-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.market-item-thumb {
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.market-item-name {
  font-weight: 500;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.market-foil-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  background: linear-gradient(135deg, #ffd700, #ff69b4);
  color: #1a1a2e;
  border-radius: 8px;
  font-weight: 700;
}

.market-item-set {
  font-size: 0.8rem;
  color: #888;
}

.market-item-qty {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.market-item-qty button {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.market-item-qty button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.market-item-qty span {
  min-width: 24px;
  text-align: center;
  font-weight: 500;
}

.market-item-price {
  font-weight: 600;
  color: var(--accent);
  min-width: 80px;
  text-align: right;
}

.market-item .remove-btn {
  margin-left: 1rem;
  padding: 0.3rem 0.6rem;
  background: transparent;
  color: #ef5350;
  border: 1px solid rgba(239, 83, 80, 0.4);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: background 0.3s;
}

.market-item .remove-btn:hover {
  background: rgba(239, 83, 80, 0.2);
}

.empty-market {
  text-align: center;
  padding: 2rem;
  color: #666;
  font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0.8rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  .search-section {
    padding: 1rem;
    border-radius: 10px;
  }

  .search-bar {
    flex-direction: column;
    gap: 0.5rem;
  }

  .search-bar input {
    width: 100%;
  }

  .search-bar button {
    width: 100%;
    padding: 0.8rem;
  }

  .search-bar select {
    width: 100%;
    padding: 0.7rem;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.6rem;
  }

  .card-item {
    padding: 0.6rem;
  }

  .card-item .card-name {
    font-size: 0.8rem;
  }

  .card-item .card-set {
    font-size: 0.7rem;
  }

  .card-name {
    font-size: 0.85rem;
  }

  .market-summary {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }

  .market-summary button {
    width: 100%;
    padding: 0.8rem;
  }

  .clear-btn {
    margin-left: 0;
  }

  .market-item {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .market-item-info {
    width: 100%;
  }

  .buyer-row {
    flex-direction: column;
    gap: 0.3rem;
  }

  .buyer-row input {
    width: 100%;
  }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    padding: 1rem;
  }

  /* Columns for this range are set in the tablet block further down (200px). The rule that stood
     here said 180px and never applied: two definitions for one breakpoint, the later one winning
     silently. Anyone tuning this number would have seen nothing happen. */
}

/* Touch-friendly: minimum tap target 44px */
@media (hover: none) and (pointer: coarse) {
  button, .tab-btn, .nav-link, .add-btn, .primary-btn, .secondary-btn, .sell-btn {
    min-height: 44px;
    min-width: 44px;
  }

  input, select, textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
    min-height: 44px;
  }

  .card-item .add-btn {
    padding: 0.7rem;
    font-size: 0.9rem;
  }
}

/* Lightbox - click to enlarge card images */
.lightbox-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox-overlay.active { display: flex; }
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.lightbox-overlay .foil-shimmer-wrap {
  border-radius: 12px;
}
.lightbox-overlay .foil-shimmer-wrap img {
  border-radius: 12px;
}
.lightbox-overlay .surge-foil-wrap {
  border-radius: 12px;
}
.lightbox-overlay .surge-foil-wrap img {
  border-radius: 12px;
}
.card-img-clickable { cursor: zoom-in; }

/* Payment method badges */
.badge-pickup { background: rgba(0, 188, 212, 0.2); color: #00bcd4; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.badge-pos { background: rgba(76, 175, 80, 0.2); color: #66bb6a; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.badge-delivery { background: rgba(255, 152, 0, 0.2); color: #ffb74d; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }

/* Stage tracker connector line */
.stage-tracker { position: relative; }
.stage-tracker::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 5%;
  right: 5%;
  height: 2px;
  background: rgba(255,255,255,0.15);
  z-index: 0;
  pointer-events: none;
}
.stage-step { z-index: 1; }
.stage-dot { position: relative; z-index: 1; }

/* ===================== CHECKOUT MODAL ===================== */
.checkout-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.checkout-modal.hidden { display: none; }
.checkout-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
}
.checkout-content {
  position: relative;
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  width: 95%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.checkout-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: none;
  border: none;
  color: #888;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}
.checkout-close:hover { color: #fff; }

/* Step indicators */
.checkout-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.checkout-step {
  font-size: 0.8rem;
  color: #666;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.checkout-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  font-size: 0.7rem;
  font-weight: 700;
}
.checkout-step.active { color: #4fc3f7; }
.checkout-step.active span { background: #4fc3f7; color: #1a1a2e; }
.checkout-step.done { color: #66bb6a; }
.checkout-step.done span { background: #66bb6a; color: #1a1a2e; }
.checkout-step-line {
  width: 30px; height: 2px;
  background: rgba(255,255,255,0.15);
}

/* Timer */
.checkout-timer {
  background: rgba(239,83,80,0.1);
  border: 1px solid rgba(239,83,80,0.3);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  text-align: center;
  margin-bottom: 1rem;
  color: #ef5350;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Items list */
.checkout-items {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 1rem;
}
.checkout-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.checkout-item img {
  width: 36px; height: 50px;
  object-fit: cover;
  border-radius: 4px;
}
.checkout-item-info { flex: 1; }
.checkout-item-name { font-size: 0.85rem; font-weight: 600; color: #fff; }
.checkout-item-detail { font-size: 0.7rem; color: #888; }
.checkout-item-price { font-weight: 600; color: var(--accent, #66bb6a); white-space: nowrap; }

/* Summary */
.checkout-summary {
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.checkout-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.9rem;
  color: #ccc;
}
.checkout-row.checkout-total {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 0.6rem;
  margin-top: 0.4rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent, #66bb6a);
}

/* Address */
.checkout-address-options { margin-bottom: 1.5rem; }
.checkout-radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  cursor: pointer;
  color: #ccc;
  font-size: 0.9rem;
}
.checkout-radio input[type="radio"] { accent-color: #4fc3f7; }
.checkout-saved-address {
  background: rgba(79,195,247,0.08);
  border: 1px solid rgba(79,195,247,0.2);
  border-radius: 8px;
  padding: 0.8rem;
  margin: 0.5rem 0 1rem 1.5rem;
  font-size: 0.85rem;
  color: #ccc;
}
.checkout-new-address {
  margin: 0.5rem 0 1rem 1.5rem;
}
.checkout-new-address textarea {
  width: 100%;
  padding: 0.7rem;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 0.9rem;
  resize: vertical;
}
.checkout-save-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #888;
  cursor: pointer;
}

/* Payment */
.checkout-payment-methods {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.checkout-method-btn {
  flex: 1;
  padding: 0.7rem;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: transparent;
  color: #ccc;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.checkout-method-btn.active {
  border-color: #4fc3f7;
  background: rgba(79,195,247,0.1);
  color: #4fc3f7;
}
.checkout-qr {
  display: flex;
  justify-content: center;
  padding: 1rem;
}
.checkout-qr img { max-width: 200px; border-radius: 8px; }
.checkout-upload {
  margin-top: 1rem;
}
.checkout-upload label {
  display: block;
  font-size: 0.85rem;
  color: #ccc;
  margin-bottom: 0.4rem;
}
.checkout-upload input[type="file"] {
  width: 100%;
  padding: 0.5rem;
  background: rgba(255,255,255,0.08);
  border: 1px dashed rgba(255,255,255,0.3);
  border-radius: 8px;
  color: #ccc;
  font-size: 0.85rem;
}
.checkout-slip-preview {
  margin-top: 0.5rem;
  text-align: center;
}
.checkout-slip-preview img {
  max-width: 150px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2);
}

/* Navigation buttons */
.checkout-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
}
.checkout-next { width: 100%; margin-top: 1rem; }


/* Checkout Step 2 extras */
.checkout-saved-info {
  background: rgba(79,195,247,0.06);
  border: 1px solid rgba(79,195,247,0.15);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
}
.checkout-profile-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.85rem;
  color: #ccc;
}
.checkout-profile-row span:first-child {
  color: #888;
  min-width: 70px;
}
.checkout-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}
.checkout-new-address .form-group {
  margin-bottom: 0.8rem;
}
.checkout-new-address .form-group label {
  display: block;
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.3rem;
}
.checkout-new-address .form-group input,
.checkout-new-address .form-group select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 0.9rem;
}
.checkout-new-address .form-group select:disabled {
  opacity: 0.5;
}


/* ===================== RESPONSIVE ENHANCEMENTS ===================== */

/* Mobile: up to 480px (small phones) */
@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
  }
  .card-image {
    height: 160px;
    max-width: 120px;
  }
  .card-item {
    padding: 0.5rem;
  }
  .card-item .card-name { font-size: 0.75rem; }
  .card-item .card-set { font-size: 0.65rem; }
  .card-item .add-btn { font-size: 0.75rem; padding: 0.5rem; }
  .cond-tab { padding: 0.2rem 0.4rem !important; font-size: 0.6rem !important; }

  /* Condition tabs wrap */
  .cond-tabs { flex-wrap: wrap !important; gap: 0.2rem !important; }

  /* Checkout modal */
  .checkout-content { padding: 1rem; max-height: 95vh; }
  .checkout-steps { gap: 0.3rem; }
  .checkout-step { font-size: 0.7rem; }
  .checkout-step-line { width: 15px; }
  .checkout-form-grid { grid-template-columns: 1fr; }
  .checkout-nav { flex-direction: column; }
  .checkout-nav button { width: 100%; }

  /* Pagination */
  #searchPagination { flex-wrap: wrap; gap: 0.3rem; }
  #searchPagination .tab { font-size: 0.75rem; padding: 0.3rem 0.6rem; }

  /* Cart */
  .market-item { flex-direction: column; align-items: flex-start; }
  .market-item-price { font-size: 0.85rem; }
}

/* Mobile landscape / larger phones: 481-768px */
@media (min-width: 481px) and (max-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .card-image {
    height: 200px;
    max-width: 150px;
  }
  .checkout-content { padding: 1.5rem; }
  .checkout-form-grid { grid-template-columns: 1fr 1fr; }
}

/* Tablet: 769-1024px */
@media (min-width: 769px) and (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  .card-image {
    height: 240px;
    max-width: 180px;
  }
}

/* Desktop: 1025px+ */
@media (min-width: 1025px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
  .container {
    max-width: 95%;
    margin: 0 auto;
  }
}

/* Profile form responsive */
@media (max-width: 480px) {
  .profile-form .form-grid { grid-template-columns: 1fr; }
}

/* Ensure images don't overflow */
img { max-width: 100%; height: auto; }
.card-image { max-width: 100%; }

/* Condition tabs always wrap on small cards */
.cond-tabs { flex-wrap: wrap; justify-content: center; }

/* Tracking Timeline */
.tracking-timeline { position: relative; padding-left: 24px; margin-top: 1rem; }
.tracking-timeline::before { content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: rgba(255,255,255,0.1); }
.timeline-item { position: relative; padding-bottom: 1.2rem; padding-left: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -20px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.3); }
.timeline-dot.dot-active { background: #4fc3f7; border-color: #4fc3f7; box-shadow: 0 0 8px rgba(79,195,247,0.5); }
.timeline-current .timeline-status { color: #4fc3f7; font-weight: 600; }
.timeline-status { color: #e0e0e0; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.15rem; }
.timeline-location { color: #888; font-size: 0.8rem; }
.timeline-date { color: #666; font-size: 0.75rem; margin-top: 0.1rem; }

/* ═══ SETTINGS GROUPS ═══
 *
 * The settings page is twelve sections and ~1,400 lines in one column, with twelve separate
 * Save buttons down it: finding the commission rate meant scrolling past branding, Google
 * sign-in and an SMTP form. lib/settings-nav.js groups them into five and shows one at a time.
 *
 * The strip is built at runtime — the page is design-locked, and more to the point every one
 * of those sections carries a form that writes money settings whose handlers find fields by
 * id. Moving that markup to improve navigation would risk the shop's pricing to rearrange some
 * headings.
 */
.settings-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.settings-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: #cfd6dd;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.settings-group-btn:hover { background: rgba(255, 255, 255, 0.11); color: #fff; }
.settings-group-btn.active {
  background: rgba(79, 195, 247, 0.16);
  border-color: rgba(79, 195, 247, 0.55);
  color: #fff;
}

/* How many sections sit behind this tab — so a group that looks empty can be told apart from
   one that is simply closed. */
.settings-group-count {
  min-width: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35rem;
}

/* One line saying what this group is for. A settings page full of unexplained switches is the
   reason people are frightened of settings pages. */
.settings-group-hint {
  margin: 0 0 1.25rem;
  color: #8f9aa5;
  font-size: 0.86rem;
  line-height: 1.5;
  max-width: 68ch;
}

@media (hover: none) and (pointer: coarse) {
  .settings-group-btn { min-height: 44px; }
}
