.cart-container {
  flex: 0 0 58%;
  min-width: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.shopping-cart-container {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 2rem;
}

.shopping-cart-container > .cart-summary-wrapper {
  flex: 0 0 42%;
  min-width: 22rem;
  position: sticky;
  top: calc(var(--header-fixed-height, 7.4rem) + 1rem);
  align-self: flex-start;
  height: fit-content;
  justify-content: flex-start;
  padding-top: 1.75em;
  padding-bottom: 2em;
  padding-left: 2em;
  padding-right: 2em;
}

.shopping-cart-container > .cart-summary-wrapper form {
  width: 100%;
}

.shopping-cart-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0 0.6rem 0;
  margin: 0 0 1.5rem 0;
  font-size: 2rem;
  font-weight: bold;
  color: #fff;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--color-border-solid);
  background: none;
  border-radius: 0;
}

.shopping-cart-title-icon {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
  flex-shrink: 0;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.cart-item {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) 23.5rem;
  gap: 1.5rem;
  align-items: center;
  min-height: 11rem;
  padding: 1.75rem 1.5rem;
  background: rgba(var(--color-primary-rgb), 0.05);
  border-radius: 10px;
  border: 2px solid var(--color-border-solid);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.cart-item:not(.cart-item-rank):not(.cart-item-gem) {
  align-items: start;
  min-height: 11rem;
  height: 11rem;
}

.cart-item:not(.cart-item-rank):not(.cart-item-gem) .cart-item-leading {
  align-self: flex-start;
}

.cart-item:not(.cart-item-rank):not(.cart-item-gem) .cart-item-controls {
  align-self: center;
}

.cart-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.cart-item-leading {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex-shrink: 0;
}

.cart-item-image {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 9rem;
  height: 9rem;
}

.cart-item-image img,
.cart-item-image .product-image-placeholder {
  width: 9rem;
  height: 9rem;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 8px;
}

.cart-item-rank-name {
  color: var(--color-green);
  margin: 0;
  font-size: 2.5rem;
  font-weight: bold;
  line-height: 1.15;
  white-space: nowrap;
}

.cart-item-gem-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
  max-width: 28rem;
  text-align: left;
}

.cart-item-gem-name {
  color: var(--color-green);
  margin: 0;
  font-size: 2rem;
  font-weight: bold;
  line-height: 1.15;
}

.cart-item-gem-description {
  color: var(--color-text-muted);
  font-size: 1.25rem;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-price-group {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  min-width: 0;
}

.cart-item-price-group .cart-item-quantity {
  flex-shrink: 0;
  margin-right: 0.5rem;
  transform: translateX(-2rem);
}

.cart-item-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  overflow: hidden;
  flex-shrink: 1;
}

.cart-item-details h3 {
  color: var(--color-primary);
  margin: 0;
  font-size: 1.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-rank {
  grid-template-columns: minmax(0, auto) 23.5rem;
}

.cart-item-gem {
  grid-template-columns: minmax(0, auto) 23.5rem;
}

.cart-item-rank .cart-item-details,
.cart-item-gem .cart-item-details {
  display: none;
}

.cart-item-description {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-controls {
  grid-column: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10.5rem;
  column-gap: 0.75rem;
  align-items: center;
  width: 23.5rem;
  flex-shrink: 0;
  padding-left: 0;
  box-sizing: border-box;
}

.cart-item-rank .cart-item-controls,
.cart-item-gem .cart-item-controls {
  grid-column: 2;
  width: 23.5rem;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: auto;
  flex-shrink: 0;
}

.qty-controls {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  background: rgba(var(--color-primary-rgb), 0.08);
  border: 1px solid var(--color-border-solid);
  border-radius: 999px;
  padding: 0.2rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

.qty-btn {
  width: 2.35rem;
  height: 2.35rem;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  border-radius: 999px;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
}

.qty-btn:hover {
  background: var(--color-primary);
  color: var(--color-background);
}

.qty-btn:active {
  transform: scale(0.92);
}

.qty-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.quantity {
  background: transparent;
  color: var(--color-text);
  padding: 0 0.5rem;
  border-radius: 0;
  font-size: 1.15rem;
  font-weight: 700;
  width: 2.75rem;
  min-width: 2.75rem;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.cart-item-price {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  margin-left: 0;
  flex-shrink: 0;
}

.total-price {
  color: var(--color-primary);
  font-size: 1.65rem;
  font-weight: bold;
  margin: 0;
  white-space: nowrap;
  width: max-content;
  max-width: 100%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cart-item-rank .total-price {
  color: #fff;
}

.cart-item-gem .total-price {
  color: #fff;
}

.cart-item-actions {
  grid-column: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 10.5rem;
  flex-shrink: 0;
  justify-self: end;
}

.cart-item-rank .cart-item-actions {
  grid-column: 2;
}

.cart-item-actions .btn-remove {
  flex-shrink: 0;
  width: 100%;
  max-width: 10.5rem;
  box-sizing: border-box;
  text-align: center;
}

.btn-remove {
  padding: 1.2rem 2.1rem;
  font-size: 1.2rem;
  min-height: 3.5rem;
}

.btn-remove:hover {
  box-shadow: 0 5px 15px rgba(114, 16, 44, 0.5);
}

.cart-summary-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2rem;
}

.cart-summary-wrapper .cart-summary {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  width: 100%;
}

.cart-summary-wrapper .summary-title {
  color: var(--color-text-muted);
  font-size: 1.85rem;
  margin: 0 0 1.25rem 0;
  text-align: left;
  font-weight: bold;
}

.cart-summary-wrapper .summary-title-primary {
  color: #fff;
}

.cart-extras-title {
  margin-top: 2rem !important;
  margin-bottom: 1rem;
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--color-text);
  text-align: left;
}

.cart-page-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.cart-container .special-offers-container {
  margin-top: 0;
  width: 100%;
  max-width: 100%;
  transform: none;
  background: transparent;
  border: none;
  padding: 0;
}

.form-group {
  margin-bottom: 1.5rem;
}

.cart-summary-wrapper .form-group label {
  display: block;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  margin-bottom: 0.65rem;
  font-weight: 500;
}

.cart-summary-wrapper .form-group .checkout-field-label {
  color: #fff;
  font-size: 1.75rem;
  font-weight: bold;
  line-height: 1.3;
}

.cart-summary-wrapper .form-group input {
  width: 100%;
  padding: 1rem 1.15rem;
  background: rgba(var(--color-primary-rgb), 0.05);
  border: 2px solid var(--color-border-solid);
  border-radius: 8px;
  color: var(--color-text-muted);
  font-size: 1.15rem;
  transition: all 0.3s ease;
}

.cart-summary-wrapper .form-group input:focus {
  outline: none;
  border-color: var(--color-text-muted);
  background: rgba(var(--color-primary-rgb), 0.08);
  box-shadow: none;
}

.form-group input::placeholder {
  color: var(--color-text-muted);
}

.form-group input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-right: 0.65rem;
  cursor: pointer;
  vertical-align: middle;
}

.form-group input[type="checkbox"] + label {
  display: inline;
  margin-bottom: 0;
  cursor: pointer;
  vertical-align: middle;
  font-size: 1.1rem;
  line-height: 1.5;
}

.cart-summary-wrapper .form-group input[type="checkbox"] + label a {
  color: var(--color-text-muted);
  text-decoration: underline;
  transition: color 0.3s ease;
}

.cart-summary-wrapper .form-group input[type="checkbox"] + label a:hover {
  color: var(--color-text);
}

.cart-summary-wrapper .summary-row[hidden] {
  display: none !important;
}

.cart-summary-wrapper .summary-row:not([hidden]) {
  display: flex;
  justify-content: space-between;
  padding: 0.9rem 0;
  color: var(--color-text-muted);
  font-size: 1.3rem;
}

.cart-summary-wrapper .grand-total {
  border-top: 1px solid var(--color-border-solid);
  margin-top: 1rem;
  padding-top: 1.15rem;
  font-size: 1.75rem;
  font-weight: bold;
  color: var(--color-text-muted);
}

.cart-summary-wrapper .summary-amount {
  color: #fff;
  font-weight: bold;
}

.cart-summary-wrapper .summary-amount.cart-discount-amount {
  color: var(--color-green);
}

.cart-summary-wrapper .cart-discount-percent {
  color: var(--color-green);
}

.checkout-terms-group {
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
}

.checkout-terms-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.checkout-terms-row input[type="checkbox"] {
  flex-shrink: 0;
  margin-right: 0;
  margin-top: 0.2rem;
}

.checkout-terms-row label {
  display: block;
  margin-bottom: 0;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1.5;
  text-align: left;
}

.field-error {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  color: #fca5a5;
  text-align: left;
}

.checkout-terms-group .field-error:not([hidden]) {
  display: block;
  width: 100%;
  padding-left: calc(1.15rem + 0.65rem);
}

.form-group.field-invalid input[type="text"] {
  border-color: rgba(220, 38, 38, 0.55);
}

.username-status {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  text-align: left;
  color: #cbd5e1;
}

.username-status[hidden] {
  display: none !important;
}

.username-status.username-status-found {
  color: #86efac;
}

.username-status.username-status-missing {
  color: #fca5a5;
}

.form-group.field-invalid input[type="checkbox"] {
  outline: 2px solid rgba(220, 38, 38, 0.55);
  outline-offset: 2px;
}

.btn-checkout {
  width: 100%;
  margin-top: 0.5rem;
  padding: 1.35rem;
  font-size: 1.35rem;
}

.btn-checkout:hover {
  box-shadow: 0 8px 25px rgba(114, 16, 44, 0.6);
}

.btn-checkout:disabled,
.btn-checkout[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(40%);
  box-shadow: none;
}

.btn-checkout:disabled:hover,
.btn-checkout[disabled]:hover {
  box-shadow: none;
}

.creator-code-group {
  margin-bottom: 1rem;
}

.creator-code-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.creator-code-row input {
  flex: 1;
  min-width: 0;
  padding: 0.9rem 1rem;
  background: rgba(var(--color-primary-rgb), 0.05);
  border: 2px solid var(--color-border-solid);
  border-radius: 8px;
  color: var(--color-text-muted);
  font-size: 1.1rem;
}

.creator-code-row input:focus {
  outline: none;
  border-color: var(--color-text-muted);
}

.creator-code-btn {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  font-size: 1.2rem;
  border-radius: 2px;
  cursor: pointer;
  margin: 0;
}

.creator-code-btn[hidden] {
  display: none !important;
}

.creator-code-message {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  color: #fca5a5;
}

.creator-code-message[hidden] {
  display: none !important;
}

.empty-cart {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-cart p {
  color: var(--color-text-muted);
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

/* Responsive */
@media (max-width: 968px) {
  .cart-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    min-height: auto;
  }

  .cart-item:not(.cart-item-rank):not(.cart-item-gem) {
    height: auto;
  }

  .cart-item-leading {
    width: 100%;
  }

  .cart-item-image,
  .cart-item-image img,
  .cart-item-image .product-image-placeholder {
    width: 7rem;
    height: 7rem;
  }

  .cart-item-controls {
    grid-column: 1;
    width: 100%;
    max-width: 100%;
    grid-template-columns: minmax(0, 1fr) 10.5rem;
  }

  .cart-item-rank .cart-item-controls,
  .cart-item-gem .cart-item-controls {
    grid-column: 1;
    width: 100%;
  }

  .cart-item-details {
    flex-direction: column;
    align-items: flex-start;
  }

  .cart-item-price-group {
    justify-content: flex-end;
  }

  .cart-item-actions {
    grid-column: 2;
    width: 10.5rem;
  }

  .shopping-cart-container {
    flex-direction: column;
  }

  .shopping-cart-container > .cart-summary-wrapper {
    position: static;
    flex: 1 1 100%;
    width: 100%;
  }

  .cart-container {
    flex: 1 1 100%;
    width: 100%;
  }

  .shopping-cart-special-offers {
    margin-top: 0 !important;
  }
}

/* Cart page: "Maybe something else?" — gem-shop style, max 3 offers */
.shopping-cart-special-offers {
  margin-top: 0 !important;
  width: 100%;
}

.shopping-cart-special-offers .shopping-cart-special-bundles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
  min-height: 26.5rem;
  margin-top: 0;
}

.shopping-cart-special-offers .shop-bundle-card {
  min-height: 26.5rem;
}

.shopping-cart-special-offers .shop-bundle-card .special-offer-image-box {
  width: 100%;
  max-width: 92%;
  margin-bottom: 0.6rem;
}

.shopping-cart-special-offers .shop-bundle-card .special-offer-image-box img {
  object-fit: contain;
}

/* Image size/position: edit --cart-offer-* variables in gem-images.css */

.shopping-cart-special-offers .shop-bundle-card h3 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0.5rem 0 0.45rem;
}

.shopping-cart-special-offers .offer-description-snippet {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin: 0 0 0.8rem;
  line-height: 1.35;
}

.shopping-cart-special-offers .gem-amount {
  font-size: 1.75rem;
}

.shopping-cart-special-offers .gem-label,
.shopping-cart-special-offers .gem-bonus {
  font-size: 1.25rem;
}

.shopping-cart-special-offers .shop-bundle-card:nth-child(n+4) {
  display: none;
}

.shopping-cart-special-offers .shop-bundle-card .special-offer-buy-btn {
  width: 100%;
  margin-top: auto;
}

@media (max-width: 968px) {
  .shopping-cart-special-offers .shopping-cart-special-bundles {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .shopping-cart-special-offers .shop-bundle-card {
    min-height: 22rem;
  }

}
