#mg-product-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 280;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(1.6rem);
  -webkit-backdrop-filter: blur(1.6rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
  overflow-x: hidden; /* 👈 FIX: Lock horizontal axis */
  max-width: 100vw;   /* 👈 FIX: Prevent viewport expansion */
}

.deck-card-item .btn-tooltip-wrap a {
  position: relative;
  background: rgba(255, 255, 255, 0.10) !important;
  backdrop-filter: blur(1.25rem) saturate(180%) !important;
  -webkit-backdrop-filter: blur(1.25rem) saturate(180%) !important;
  border: 0.0625rem solid rgba(255, 255, 255, 0.18) !important;
  box-shadow:
    inset 0 0.0625rem 0 rgba(255, 255, 255, 0.25),
    0 0.125rem 0.25rem rgba(0, 0, 0, 0.18),
    0 0.25rem 0.75rem rgba(0, 0, 0, 0.14) !important;
  color: #64748b !important;
  overflow: visible !important;
  transition: all 0.22s cubic-bezier(0.25, 1, 0.5, 1) !important;
  font-size: 0.6875rem !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
  border-radius: 6.1875rem !important;
}

.deck-card-item .btn-tooltip-wrap a::before,
.deck-card-item .btn-tooltip-wrap a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
}

.deck-card-item .btn-tooltip-wrap a::before {
  background: radial-gradient(ellipse 100% 45% at 50% 0%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.12) 45%, transparent 70%);
}

.deck-card-item .btn-tooltip-wrap a::after {
  background: radial-gradient(ellipse 70% 30% at 50% 100%, rgba(255, 255, 255, 0.15), transparent 70%);
}

.deck-card-item .btn-tooltip-wrap a>* {
  position: relative;
  z-index: 2;
}

.deck-card-item .btn-tooltip-wrap a:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  border-color: rgba(255, 255, 255, 0.30) !important;
  color: #4f46e5 !important;
  box-shadow:
    inset 0 0.0625rem 0 rgba(255, 255, 255, 0.35),
    0 0.25rem 0.5rem rgba(0, 0, 0, 0.20),
    0 0.5rem 1.25rem rgba(79, 70, 229, 0.22) !important;
  transform: translateY(-0.0625rem);
}

#mg-product-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

#mg-product-modal {
  position: relative;
  width: min(72rem, calc(100% - 2rem));
  height: min(40rem, calc(100vh - 2rem));
  overflow: hidden;
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.94);
  border: 0.0625rem solid rgba(255, 255, 255, 0.74);
  box-shadow:
    inset 0 0.09375rem 0 rgba(255, 255, 255, 0.78),
    inset 0 -0.0625rem 0 rgba(15, 23, 42, 0.08),
    0 1.5rem 4rem rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(1.0rem) saturate(190%);
  -webkit-backdrop-filter: blur(1.0rem) saturate(190%);
  transform: translateY(0.75rem) scale(0.985);
  transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1);
}

#mg-product-modal-backdrop.open #mg-product-modal {
  transform: translateY(0) scale(1);
}

#mg-product-modal::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 85% 42% at 50% 0%, rgba(255, 255, 255, 0.66), transparent 70%),
    radial-gradient(ellipse 70% 28% at 50% 100%, rgba(79, 70, 229, 0.10), transparent 72%);
  pointer-events: none;
  z-index: 0;
}

.mg-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 5;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 0.0625rem solid rgba(226, 232, 240, 0.7);
  background: rgba(255, 255, 255, 0.68);
  color: #64748b;
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.8), 0 0.5rem 1.25rem rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mg-modal-close:hover {
  background: #fff;
  color: #4f46e5;
  transform: translateY(-0.125rem) scale(1.08);
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.9), 0 0.5rem 1.25rem rgba(15, 23, 42, 0.12);
}

.mg-modal-close:active {
  transform: translateY(0) scale(0.92);
}

.mg-modal-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(19.5rem, 24.5rem);
  gap: 2.25rem;
  padding: 1.5rem;
  height: 100%;
  overflow: visible;
}

.mg-modal-gallery {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  min-height: 0;
  gap: 0.75rem;
}

.mg-modal-image-outer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.mg-modal-image-wrap {
  position: relative;
  width: 100%;
  max-height: 100%;
  overflow: hidden;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, #eef2ff, #f8fafc);
  border: 0.0625rem solid rgba(255, 255, 255, 0.72);
  box-shadow:
    inset 0 0.0625rem 0 rgba(255, 255, 255, 0.82),
    inset 0 -0.0625rem 0 rgba(15, 23, 42, 0.06),
    0 0.75rem 2rem rgba(15, 23, 42, 0.12);
}

.mg-modal-image-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Skates-specific modal image overrides for native aspect ratio and premium padding */
.mg-modal-image-wrap.is-skates {
  background: #ffffff;
}

.mg-modal-image-wrap.is-skates img {
  object-fit: contain;
  padding: 1.5rem;
}

.mg-carousel-btn {
  position: absolute;
  top: 50%;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 0.0625rem solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.42);
  color: #0f172a;
  box-shadow: 0 0.5rem 1.25rem rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(1rem) saturate(160%);
  -webkit-backdrop-filter: blur(1rem) saturate(160%);
  cursor: pointer;
  transform: translateY(-50%);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mg-carousel-btn--prev {
  left: 0.5rem;
}

.mg-carousel-btn--next {
  right: 0.5rem;
}

.mg-carousel-btn:hover {
  background: rgba(255, 255, 255, 0.85);
  color: #4f46e5;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.18);
}

.mg-carousel-btn:active {
  transform: translateY(-50%) scale(0.92);
}

.mg-carousel-thumbs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: center;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  flex-shrink: 0;
}

.mg-carousel-thumbs::-webkit-scrollbar {
  display: none;
}

.mg-carousel-thumb {
  flex-shrink: 0;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 0.125rem solid transparent;
  opacity: 0.5;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.5);
}

.mg-carousel-thumb.active {
  border-color: #4f46e5;
  opacity: 1;
  box-shadow: 0 0.125rem 0.5rem rgba(79, 70, 229, 0.25);
}

.mg-carousel-thumb:hover {
  opacity: 1;
}

.mg-carousel-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Skates-specific thumbnail overrides */
.mg-carousel-thumb.is-skates {
  background: #ffffff;
}

.mg-carousel-thumb.is-skates img {
  object-fit: contain;
  padding: 0.35rem;
}

.mg-modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: visible;
  position: relative;
  z-index: 10;
  padding: 0;
  min-height: 0;
}

.mg-modal-content>div:first-child {
  flex-shrink: 0;
  padding-bottom: 0.5rem;
}

@keyframes subtleFadeUp {
  0% {
    opacity: 0.4;
    transform: translateY(6px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.mg-modal-options {
  flex: 1;
  overflow-y: auto;
  padding-left: 0.5rem;   /* NEW: Gives the left shadow room to breathe */
  padding-right: 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 1.5rem;
  margin-left: -0.5rem;   /* NEW: Pulls the container left so visual alignment remains identical */
  margin-right: -0.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.7rem;
  min-height: 0;
}

.mg-modal-options::-webkit-scrollbar {
  width: 0.25rem;
}

.mg-modal-options::-webkit-scrollbar-track {
  background: transparent;
}

.mg-modal-options::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 99rem;
}

.mg-modal-kicker {
  margin: 0 0 0.25rem;
  color: #4f46e5;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.mg-modal-content h2 {
  margin: 0;
  color: #0f172a;
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: 0;
}

.mg-modal-subtitle {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
}

.mg-modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.mg-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0.0625rem solid rgba(203, 213, 225, 0.82);
  background: rgba(255, 255, 255, 0.58);
  color: #475569;
  border-radius: 0.85rem;
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.8), 0 0.25rem 0.75rem rgba(15, 23, 42, 0.03);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mg-action-btn:hover {
  transform: translateY(-0.125rem);
  border-color: rgba(79, 70, 229, 0.35);
  background: rgba(255, 255, 255, 0.9);
  color: #4f46e5;
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.9), 0 0.375rem 0.875rem rgba(15, 23, 42, 0.06);
}

.mg-action-btn:active {
  transform: scale(0.95);
}

.mg-action-btn:focus-visible {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 0.1875rem rgba(79, 70, 229, 0.15), inset 0 0.0625rem 0 rgba(255, 255, 255, 0.8), 0 0.25rem 0.75rem rgba(15, 23, 42, 0.03);
}

.mg-action-btn .material-symbols-outlined {
  transition: transform 0.15s ease;
}

.mg-action-btn:hover .material-symbols-outlined {
  transform: scale(1.1);
}

/* Modal action button tooltips */
.mg-modal-actions .btn-tooltip-wrap {
  position: relative;
}

.mg-modal-actions .btn-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-0.5rem);
  margin-bottom: 0.375rem;
  white-space: nowrap;
  padding: 0.375rem 0.625rem;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10;
  box-shadow: 0 0.25rem 0.75rem rgba(15, 23, 42, 0.15);
}

.mg-modal-actions .btn-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 0.3125rem solid transparent;
  border-top-color: rgba(15, 23, 42, 0.92);
}

.mg-modal-actions .btn-tooltip-wrap:hover .btn-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mg-modal-label .wishlist-btn {
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.mg-modal-label .wishlist-btn:hover {
  background: #fef2f2;
}

.mg-modal-label .wishlist-btn.wishlisted .material-symbols-outlined,
.mg-modal-label .wishlist-btn.wishlisted {
  color: #ef4444;
}

.mg-modal-label .wishlist-btn.wishlisted .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

.mg-modal-spec-group {
  display: flex;
  flex-direction: column;
  /* Removed gap: 0.625rem; to stop the double-spacing */
}

.mg-modal-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #475569;
  font-size: 0.68rem;
  font-weight: 850;
}

.mg-modal-label .material-symbols-outlined {
  color: #4f46e5;
  font-size: 0.95rem;
}

.mg-series-helper-cell {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0.35rem 0.55rem; /* Reduced from 0.5rem 0.65rem */

  /* Match the white glassmorphism style of the buttons */
  background: rgba(255, 255, 255, 0.58);
  border: 0.09375rem solid rgba(203, 213, 225, 0.82);
  border-radius: 0.65rem;
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.8), 0 0.25rem 0.75rem rgba(15, 23, 42, 0.03);
}

/* 1. Lock the container height so the description text never jumps */
.mg-series-helper-cell > div:first-child {
  min-height: 1.15rem; /* Snug fit for the tallest logo */
  margin-bottom: 0.05rem !important; /* Overrides the gap/margin from JS to pull text closer */
}

/* 2. Remove the transition so the logo swaps instantly without growing/shrinking */
.mg-series-helper-icon {
  height: 0.75rem;
  width: auto;
  object-fit: contain;
  margin-bottom: 0.2rem;
  margin-left: -0.15rem;
  filter: grayscale(1) opacity(0.6);
}

/* 3. Apply the visual balancing rules */
.mg-series-helper-icon[src*="mgweave-plus"] {
  height: 1.15rem;
}

.mg-series-helper-icon[src*="mgglide"],
.mg-series-helper-icon[src*="mgesports"] {
  height: 1rem;
}

/* .mg-modal-label img[src*="series.svg"] {
  filter: grayscale(1) opacity(0.6);
} */

.mg-series-helper-desc {
  margin: 0;
  color: #94a3b8;
  font-size: 0.525rem; /* Fractionally smaller */
  font-weight: 600;
  line-height: 1.2; /* Reduced from 1.35 for tighter line spacing */
}

/* REPLACE the grouped .mg-series-grid, .mg-spec-grid with these */
.mg-series-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.625rem; /* Gap between columns */
  row-gap: 0.625rem; /* Slightly increased vertical space between rows */
  margin-top: 0.375rem; /* Tightly connects the grid to its section label */
}

.mg-spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  row-gap: 0.5rem; /* Drastically reduced from 1.25rem to make rows compact */
  margin-top: 0.375rem; /* Tightly connects the grid to its section label */
}

.mg-spec-grid--sizes {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mg-series-choice {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.5rem;
  border-radius: 0.65rem; /* Changed from 0.85rem to match the smaller button size */
  border: 0.09375rem solid rgba(203, 213, 225, 0.82);
  background: rgba(255, 255, 255, 0.58);
  color: #475569;
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.8), 0 0.25rem 0.75rem rgba(15, 23, 42, 0.03);
  cursor: pointer;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: visible !important;
}

.mg-spec-choice {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 2.75rem;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.85rem;
  border: 0.09375rem solid rgba(203, 213, 225, 0.82);
  background: rgba(255, 255, 255, 0.58);
  color: #475569;
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.8), 0 0.25rem 0.75rem rgba(15, 23, 42, 0.03);
  cursor: pointer;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: visible !important; /* Added to prevent badge clipping */
}

.mg-series-choice:hover,
.mg-spec-choice:hover {
  transform: translateY(-0.125rem);
  border-color: rgba(79, 70, 229, 0.4);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.9), 0 0.375rem 0.875rem rgba(15, 23, 42, 0.06);
}

.mg-series-choice.active,
.mg-spec-choice.active {
  border-color: rgba(79, 70, 229, 0.38);
  background: rgba(79, 70, 229, 0.10);
  box-shadow: 0 0.25rem 0.625rem rgba(79, 70, 229, 0.12);
}

.mg-series-choice:active,
.mg-spec-choice:active {
  transform: scale(0.97);
}

.mg-spec-choice.active strong {
  color: #4f46e5;
}

.mg-spec-choice strong {
  overflow-wrap: anywhere;
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 850;
  line-height: 1.12;
  transition: color 0.18s ease;
}

.mg-spec-choice .material-symbols-outlined {
  color: #4f46e5;
  font-size: 0.95rem;
  flex: 0 0 auto;
}

.mg-spec-choice .mg-edge-icon {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
  object-fit: contain;
}

.mg-spec-choice span:last-of-type {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.mg-spec-choice small {
  color: #64748b;
  font-size: 0.5625rem;
  font-weight: 650;
  line-height: 1.22;
}

.mg-freeform-fields {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
  margin-top: 0.625rem;
}

.mg-freeform-fields.open {
  display: grid;
  animation: subtleFadeUp 0.2s ease-out forwards;
}

.mg-freeform-fields label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.58);
  border: 0.09375rem solid rgba(203, 213, 225, 0.82);
  color: #475569;
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 850;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.8), 0 0.25rem 0.75rem rgba(15, 23, 42, 0.03);
  cursor: text;
}

.mg-freeform-fields label:hover {
  transform: translateY(-0.0625rem);
  border-color: rgba(79, 70, 229, 0.35);
}

.mg-freeform-fields label:focus-within {
  border-color: rgba(79, 70, 229, 0.38);
  background: rgba(79, 70, 229, 0.10);
  box-shadow: 0 0.25rem 0.625rem rgba(79, 70, 229, 0.12); /* Removed outer ring, matched active shadow */
  transform: translateY(-0.0625rem);
}

.mg-freeform-fields input {
  min-width: 0;
  width: 100%;
  border: 0 !important;
  background: transparent !important;
  color: #0f172a !important;
  font-weight: 850 !important;
  outline: none !important;
  box-shadow: none !important;
  text-align: right !important;
  font-family: 'Outfit', sans-serif !important;
  font-size: 0.85rem !important;
  padding: 0 !important;
}

.mg-freeform-fields input:focus {
  outline: none !important;
  box-shadow: none !important;
  border: 0 !important;
}

.mg-freeform-fields label span:first-child {
  color: #475569;
  font-weight: 850;
}

.mg-freeform-fields label span:last-child {
  color: #64748b;
  font-weight: 650;
  font-size: 0.65rem;
}

.mg-freeform-fields input::-webkit-inner-spin-button,
.mg-freeform-fields input::-webkit-outer-spin-button {
  opacity: 0.5;
  margin-left: 0.5rem; 
  mix-blend-mode: darken; /* MAGIC TRICK: Makes the white/grey box completely transparent! */
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.mg-freeform-fields input::-webkit-inner-spin-button:hover,
.mg-freeform-fields input::-webkit-outer-spin-button:hover {
  opacity: 0.8; /* Makes the arrows slightly darker when you hover over them */
}

.mg-availability-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  align-self: flex-start;
  padding: 0.45rem 0.65rem;
  border-radius: 99rem;
  background: rgba(79, 70, 229, 0.08);
  color: #4f46e5;
  font-size: 0.68rem;
  font-weight: 850;
}

.mg-availability-chip .material-symbols-outlined {
  font-size: 0.9rem;
}

.mg-modal-footer {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  border-top: 0.0625rem solid rgba(226, 232, 240, 0.78);
}

.mg-quantity-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem;
  border-radius: 99rem;
  background: rgba(241, 245, 249, 0.86);
}

.mg-quantity-control>span {
  padding-left: 0.4rem;
  color: #64748b;
  font-size: 0.65rem;
  font-weight: 850;
}

.mg-quantity-control>div {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.mg-quantity-control button {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #4f46e5;
  box-shadow: 0 0.25rem 0.5rem rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mg-quantity-control button:hover {
  background: #f8fafc;
  color: #4f46e5;
  transform: translateY(-0.0625rem);
  box-shadow: 0 0.25rem 0.5rem rgba(15, 23, 42, 0.08);
}

.mg-quantity-control button:active {
  transform: scale(0.85);
  background: #e2e8f0;
  box-shadow: 0 0.125rem 0.25rem rgba(15, 23, 42, 0.04);
}

.mg-quantity-control button span {
  font-size: 0.9rem;
}

.mg-quantity-control strong {
  min-width: 1.2rem;
  color: #0f172a;
  text-align: center;
  font-size: 0.85rem;
}

.mg-price-summary {
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.05rem;
}

.mg-price-summary span {
  color: #64748b;
  font-size: 0.65rem;
  font-weight: 800;
}

.mg-price-summary strong {
  color: #0f172a;
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
}

.mg-modal-cart-btn {
  grid-column: 1 / -1;
  min-height: 2.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 999rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 850;
}

.mg-modal-cart-btn .material-symbols-outlined {
  font-size: 1rem;
  font-weight: 600;
  vertical-align: middle;
}

@media (max-width: 56rem) {
  /* 1. Transform backdrop to align the modal flush to the bottom */
  #mg-product-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  /* 2. Style modal as a bottom-sheet sliding up */
  #mg-product-modal {
    width: 100%;
    height: auto;
    max-height: 92dvh;
    border-radius: 1.75rem 1.75rem 0 0;
    border: none;
    border-top: 0.0625rem solid rgba(255, 255, 255, 0.74);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    overscroll-behavior: none;
  }

  #mg-product-modal-backdrop.open #mg-product-modal {
    transform: translateY(0);
  }

  /* 3. Adjust close button visibility to overlay images better */
  .mg-modal-close {
    top: 0.85rem;
    right: 0.85rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  /* 4. Fluid layout that scrolls everything except the footer */
 /* 4. Fluid layout that scrolls everything except the footer */
  .mg-modal-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1.25rem 1rem 0 1rem;
    height: auto;
    max-height: 92dvh;
    overflow-y: auto;
    overflow-x: hidden; /* 👈 FIX: Traps any overflowing badges or children */
    width: 100%;        /* 👈 FIX: Strict 100% width */
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* 5. Constrain image height and prevent aggressive cropping */
  .mg-modal-image-wrap {
    max-height: 38dvh;
    flex: none;
    border-radius: 1.25rem;
  }

  .mg-modal-image-wrap img {
    object-fit: contain;
  }

  .mg-modal-content {
    height: auto;
    overflow: visible;
    padding: 0;
  }

  .mg-modal-options {
    overflow-y: visible;
    overflow-x: hidden;
    padding-left: 0;
    padding-right: 0.5rem; /* 👈 FIX: Gives 8px breathing room for hanging badges */
    margin-left: 0;        /* 👈 FIX: Cancels desktop negative margin */
    margin-right: 0;       /* 👈 FIX: Cancels desktop negative margin */
  }

  .mg-spec-grid--sizes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* 6. Mobile-first sticky footer docked at the bottom */
  .mg-modal-footer {
    position: sticky;
    bottom: 0;
    margin-top: 1.5rem;
    margin-left: -1rem;
    margin-right: -1rem;
    margin-bottom: 0;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)) 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(1rem);
    -webkit-backdrop-filter: blur(1rem);
    border-top: 0.0625rem solid rgba(226, 232, 240, 0.8);
    z-index: 100;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
  }
}

@media (max-width: 30rem) {
  /* Restore the 2-column layout for the custom dimension inputs */
  .mg-freeform-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Slightly scale down image thumbnails for narrow devices */
  .mg-carousel-thumb {
    width: 3rem;
    height: 3rem;
  }
}

/* ═══════════════════════════════════════════════════════
   MODAL SERIES & SIZE BADGES (NEW & BESTSELLER)
   ═══════════════════════════════════════════════════════ */
.mg-series-choice .series-badge-pill,
.mg-spec-choice .size-badge-pill {
  position: absolute;
  top: 0;
  right: -0.5rem; /* Moved left from -0.75rem */
  transform: translateY(-50%);
  background: #4f46e5;
  border-radius: 0.35rem; /* Less rounded, more cornered to match visual weight at small size */
  padding: 0.25rem 0.5rem; /* Slightly larger padding */
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.25);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease;
}

.mg-series-choice .series-badge-pill img,
.mg-spec-choice .size-badge-pill img {
  height: 0.45rem; /* Slightly larger icon */
  width: auto;
  display: block;
  filter: brightness(0) invert(1); /* Makes SVG paths white */
}

.mg-series-choice:hover .series-badge-pill,
.mg-spec-choice:hover .size-badge-pill {
  transform: translateY(-60%);
}

.mg-series-choice.active .series-badge-pill,
.mg-spec-choice.active .size-badge-pill {
  transform: translateY(-50%);
  background: #4338ca; /* Darkens the pill slightly when active */
}

/* Center mgweaveplus icon logo vertically (compensating for the superscript PLUS layout in SVG) */
.mg-series-choice[data-value="mgweaveplus"] .relative {
  transform: translateY(-15%);
}

/* Make the entire product tile clickable */
.product-card {
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════
   MODAL HEADER & WISHLIST PILL
   ═══════════════════════════════════════════════════════ */

/* Header wrapper: title block + wishlist pill */
.mg-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  padding-right: 3rem; /* Space for close button (1rem right + 2.25rem width + small gap) */
}

.mg-modal-header > div:first-child {
  min-width: 0;
  flex: 1;
}

/* Wishlist pill button — uses liquid glass system */
.mg-wishlist-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #64748b; /* slate-500 */
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  flex-shrink: 0;
}

/* Suppress liquid-glass pseudo-elements that create sharp bottom line on small pills */
.mg-wishlist-pill.liquid-glass::before,
.mg-wishlist-pill.liquid-glass::after {
  display: none;
}

.mg-wishlist-pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 0.1875rem rgba(79, 70, 229, 0.25);
}

.mg-wishlist-pill .material-symbols-outlined {
  font-size: 1.125rem;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s ease, transform 0.15s ease;
}

.mg-wishlist-pill:hover .material-symbols-outlined {
  transform: scale(1.1);
}

/* Default state uses liquid glass rim-sheen variant */
.mg-wishlist-pill.liquid-glass.rim-sheen {
  --lg-fill-alpha: 0.04;
  --lg-border-alpha: 0.08;
  --lg-blur: 1rem;
  --lg-sat: 180%;
  --lg-brightness: 1.02;
  --lg-contrast: 1;
  --lg-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.08);
  --lg-glow: none;
}

/* Hover: brighter fill + indigo glow (rim-sheen behavior) */
.mg-wishlist-pill.liquid-glass.rim-sheen:hover {
  --lg-fill-alpha: 0.09;
  --lg-glow: 0 0 1.5rem rgba(79, 70, 229, 0.25);
  color: #4f46e5;
}

.mg-wishlist-pill.liquid-glass.rim-sheen:hover .material-symbols-outlined {
  color: #4f46e5;
}

/* Active/wishlisted state: purple brand background, red filled heart */
.mg-wishlist-pill.is-wishlisted {
  --lg-fill-alpha: 0.18;
  --lg-border-alpha: 0.15;
  --lg-glow: 0 0 1.5rem rgba(79, 70, 229, 0.35);
  background: rgba(79, 70, 229, 0.12) !important;
  border-color: rgba(79, 70, 229, 0.25) !important;
  color: #4338ca; /* indigo-700 */
}

.mg-wishlist-pill.is-wishlisted .material-symbols-outlined {
  color: #ef4444; /* red-500 */
  font-variation-settings: 'FILL' 1;
}

.mg-wishlist-pill.is-wishlisted:hover {
  --lg-fill-alpha: 0.24;
  --lg-glow: 0 0 2rem rgba(79, 70, 229, 0.45);
  color: #3730a3;
}

.mg-wishlist-pill.is-wishlisted:active {
  transform: scale(0.97);
}

/* Mobile adjustments for bottom sheet */
/* Mobile adjustments for bottom sheet */
@media (max-width: 56rem) {
  .mg-modal-header {
    flex-wrap: nowrap; /* Forces the button to stay inline with the title */
    gap: 0.75rem;
    padding-right: 0; /* Removed! The close button overlays the image on mobile, so this space isn't needed */
  }
  .mg-wishlist-pill {
    order: 0;
    width: auto;
    padding: 0.35rem 0.65rem; /* Shrinks overall dimensions */
    font-size: 0.65rem; /* Smaller text */
    gap: 0.25rem; /* Tighter gap between icon and text */
  }
  .mg-wishlist-pill .material-symbols-outlined {
    font-size: 0.95rem; /* Smaller icon */
  }
}

/* ═══════════════════════════════════════════════════════
   CUSTOM DIMENSION UNIT DROPDOWN
   ═══════════════════════════════════════════════════════ */
.mg-custom-select-wrap {
  position: relative;
  display: inline-block;
}

.mg-unit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.08rem;
  background-color: rgba(255, 255, 255, 0.58);
  border: 0.09375rem solid rgba(203, 213, 225, 0.82);
  border-radius: 0.45rem;
  padding: 0.25rem 0.3rem 0.25rem 0.45rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.52rem;
  font-weight: 850;
  color: #475569;
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.8), 0 0.25rem 0.75rem rgba(15, 23, 42, 0.03);
  cursor: pointer;
  outline: none;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mg-unit-btn .material-symbols-outlined {
  font-size: 0.75rem;
  transition: transform 0.25s ease;
  color: #64748b;
  margin-top: 0.08rem;
}

.mg-unit-btn:hover {
  transform: translateY(-0.0625rem);
  border-color: rgba(79, 70, 229, 0.35);
  background-color: rgba(255, 255, 255, 0.9);
  color: #4f46e5;
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.9), 0 0.375rem 0.875rem rgba(15, 23, 42, 0.06);
}

.mg-unit-btn:hover .material-symbols-outlined {
  color: #4f46e5;
}

/* Open State */
.mg-custom-select-wrap.open .mg-unit-btn {
  border-color: rgba(79, 70, 229, 0.38);
  background-color: rgba(79, 70, 229, 0.08);
  color: #4f46e5;
  box-shadow: 0 0.25rem 0.625rem rgba(79, 70, 229, 0.12);
}

.mg-custom-select-wrap.open .mg-unit-btn .material-symbols-outlined {
  transform: rotate(180deg);
  color: #4f46e5;
}

/* The Glass Dropdown Panel */
.mg-custom-select-panel {
  position: absolute;
  top: calc(100% + 0.3rem);
  right: 0;
  min-width: 4.5rem;
  background: rgba(255, 255, 255, 0.94);
  border: 0.0625rem solid rgba(255, 255, 255, 0.74);
  border-radius: 0.75rem;
  box-shadow: inset 0 0.09375rem 0 rgba(255, 255, 255, 0.78), inset 0 -0.0625rem 0 rgba(15, 23, 42, 0.08), 0 0.75rem 2rem rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(1.2rem) saturate(190%);
  -webkit-backdrop-filter: blur(1.2rem) saturate(190%);
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.35rem) scale(0.95);
  transform-origin: top right;
  transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 50;
}

.mg-custom-select-wrap.open .mg-custom-select-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.mg-custom-select-option {
  padding: 0.3rem 0.5rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.52rem;
  font-weight: 750;
  color: #475569;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mg-custom-select-option:hover {
  background: rgba(79, 70, 229, 0.06);
  color: #4f46e5;
}

.mg-custom-select-option.active {
  background: transparent;
  color: #4f46e5;
  font-weight: 850;
}

/* Size Tooltip */
.mg-spec-choice .size-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-0.25rem);
  margin-bottom: 0.375rem;
  white-space: nowrap;
  padding: 0.375rem 0.625rem;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 20;
  box-shadow: 0 0.25rem 0.75rem rgba(15, 23, 42, 0.15);
}

.mg-spec-choice .size-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 0.3125rem solid transparent;
  border-top-color: rgba(15, 23, 42, 0.92);
}

.mg-spec-choice:hover .size-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   AUTH MODAL (Shared across all pages)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

@keyframes subtleFadeUp {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes subtleFadeDown {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-0.5rem); }
}

#mg-auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(80px);
  -webkit-backdrop-filter: blur(80px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* Add the exact same high-performance inline grain layer as the navbar */
#mg-auth-modal-backdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
  opacity: 0.15;
  mix-blend-mode: screen;
  pointer-events: none;
}

#mg-auth-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

#mg-auth-modal {
  width: 100%;
  max-width: 26rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(1.5rem) saturate(180%);
  -webkit-backdrop-filter: blur(1.5rem) saturate(180%);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 1.5rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 2rem 3rem rgba(15, 23, 42, 0.12),
    0 0.5rem 1.5rem rgba(15, 23, 42, 0.08);
  padding: 1.5rem 1.75rem 1.75rem;
  transform: scale(0.95) translateY(0.75rem);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.15, 0, 0.2, 1), opacity 0.22s ease;
}

#mg-auth-modal-backdrop.open #mg-auth-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.mg-modal-close {
  position: absolute;
  top: 0.875rem;
  right: 0.875rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.1);
  border: none;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.mg-modal-close:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #1e293b;
}

.mg-modal-close .material-symbols-outlined {
  font-size: 1.5rem;
}

/* Social Auth Buttons */
.auth-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 3rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(0.75rem);
  -webkit-backdrop-filter: blur(0.75rem);
  color: #334155;
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

/* Nudges the icons UP to align perfectly with the text baseline */
.auth-social-btn svg,
.auth-social-btn img {
  transform: translateY(-0.05rem);
  flex-shrink: 0;
}

.auth-social-btn:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(148, 163, 184, 0.55);
}

.auth-social-btn:active {
  transform: scale(0.99);
}

/* Input styling — matches corporate .form-field-glass */
.auth-input-glass {
  position: relative;
  background: rgba(255, 255, 255, 0.75) !important;
  border: 0.0625rem solid rgba(79, 70, 229, 0.2) !important;
  border-radius: 1.75rem !important;
  width: 100%;
  padding: 0.875rem 1.25rem !important;
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: #0f172a !important;
  outline: none !important;
  transition:
    box-shadow 0.35s cubic-bezier(0.25, 1, 0.5, 1),
    border-color 0.35s ease,
    background 0.3s ease;
  backdrop-filter: blur(0.75rem);
  -webkit-backdrop-filter: blur(0.75rem);
  box-shadow:
    inset 0 0.0625rem 0 rgba(255, 255, 255, 0.9),
    0 0.125rem 0.25rem rgba(79, 70, 229, 0.04),
    0 0.5rem 1rem rgba(79, 70, 229, 0.03) !important;
  -webkit-appearance: none;
  appearance: none;
}

.auth-input-glass::placeholder {
  color: #64748b !important;
  font-weight: 400;
  opacity: 0.8;
}

.auth-input-glass:focus {
  border-color: rgba(79, 70, 229, 0.6) !important;
  background: rgba(255, 255, 255, 0.95) !important;
  box-shadow:
    inset 0 0.0625rem 0 rgba(255, 255, 255, 0.9),
    0 0 0 0.0625rem rgba(79, 70, 229, 0.15),
    0 0 0.875rem 0.1875rem rgba(79, 70, 229, 0.15),
    0 0.25rem 0.75rem rgba(79, 70, 229, 0.08) !important;
}

.auth-input-glass:hover:not(:focus) {
  border-color: rgba(79, 70, 229, 0.4) !important;
  box-shadow:
    inset 0 0.0625rem 0 rgba(255, 255, 255, 0.9),
    0 0.125rem 0.375rem rgba(79, 70, 229, 0.06),
    0 0.5rem 1.25rem rgba(79, 70, 229, 0.05) !important;
}

/* Responsive sizing */
@media (max-width: 480px) {
  #mg-auth-modal {
    padding: 1.5rem 1.25rem 1.75rem;
    border-radius: 1.25rem;
  }
  .auth-social-btn { height: 2.75rem; font-size: 0.75rem; }
  .auth-input-glass { padding: 0.75rem 1rem !important; }
}