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

body {
  font-family: 'Argentum', sans-serif;
  background: #fdfdfd;
  color: #202020;
}

.cart-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  animation: cart-overlay-in .3s ease-out forwards;
  background: rgba(0,0,0,0);
}
@keyframes cart-overlay-in { to { background: rgba(0,0,0,.6); } }

.cart-modal-box {
  background: #fdfdfd;
  width: 100%; max-width: 860px; max-height: 90vh;
  overflow-y: auto;
  animation: cart-modal-up .35s cubic-bezier(.16,1,.3,1) forwards;
  opacity: 0; transform: translateY(20px) scale(.97);
}

.cart-modal-box.loading {
  opacity: 0.75;
  transition: opacity .15s ease;
}
@keyframes cart-modal-up { to { opacity: 1; transform: translateY(0) scale(1); } }

.cart-modal-header {
  position: relative; padding: 24px 0; text-align: center;
}
.cart-modal-header h1 {
  font-weight: 900; font-size: 24px;
  letter-spacing: .07em; text-transform: uppercase;
}
.cart-close-btn {
  position: absolute; right: 16px; top: 24px;
  background: none; border: none; font-size: 28px;
  cursor: pointer; color: #202020; line-height: 1;
  transition: opacity .2s;
}
.cart-close-btn:hover { opacity: .5; }

.divider { height: 1px; background: #ccc; }

.empty-state {
  padding: 60px 20px; text-align: center;
  color: #555; font-size: 14px;
}

.cart-modal-box.cart-modal-box--fetching,
.cart-modal-box.cart-modal-box--empty {
  display: flex;
  flex-direction: column;
  min-height: min(360px, 70vh);
}

.cart-modal-box--fetching > .cart-modal-header,
.cart-modal-box--fetching > .divider,
.cart-modal-box--empty > .cart-modal-header,
.cart-modal-box--empty > .divider {
  flex-shrink: 0;
}

.cart-modal-box--fetching .empty-state,
.cart-modal-box--empty .empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 32px 20px;
}

.cart-loading-text,
.cart-empty-text {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #666;
}

.cart-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cart-left {
  padding: 24px;
  width: 100%;
}

.cart-left h2 {
  text-align: center; font-weight: 800;
  font-size: 14px; letter-spacing: .07em;
  text-transform: uppercase; margin-bottom: 24px;
}

.cart-item {
  display: grid;
  grid-template-columns: 20px 150px minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  animation: fade-in .4s ease forwards;
  opacity: 0;
}
@keyframes fade-in { to { opacity: 1; } }

.cart-item .remove-btn {
  background: none; border: none; cursor: pointer;
  color: #888; font-size: 16px;
  transition: color .2s;
  margin: 0;
  padding: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cart-item .remove-btn:hover { color: #202020; }

.cart-item > img {
  width: 150px; height: 150px; object-fit: cover;
  background: #f5f5f5;
}

.cart-item .remove-btn img {
  width: 15px;
  height: 15px;
  background: none;
}

.item-info { flex: 1; display: flex; justify-content: space-between; align-items: center; }
.item-details h3 { font-weight: 800; font-size: 18px; flex: 1; line-height: 20px; margin-bottom: 6px; }
.item-details .series { color: #555; font-size: 14px; font-weight: 400; line-height: 16px; margin-bottom: 6px; }
.item-details .series { text-transform: none; }
.item-details .price-row {
  font-size: 16px;
  line-height: 18px;
  font-weight: 700;
  margin-top: 0;
}
.item-details .price-row .sale {
  color: #ba3d3d;
  font-weight: 700;
}
.item-details .price-row .price-sep {
  font-weight: 400;
  color: #858585;
}
.item-details .price-row .old {
  font-size: 16px;
  line-height: 18px;
  font-weight: 500;
  color: #858585;
  text-decoration: line-through;
}

.qty-controls {
  display: flex; align-items: center; gap: 10px;
  border-left: 1px solid #202020; padding-left: 16px; margin-left: 16px;
  height: 100%;
}
.qty-controls button {
  background: none; border: none; cursor: pointer;
  color: #888; font-size: 18px; transition: color .2s;
}
.qty-controls button:hover { color: #202020; }
.qty-controls span { font-size: 14px; font-weight: 500; width: 16px; text-align: center; }

.cart-total {
  font-weight: 800; font-size: 14px; text-align: center; margin-top: 20px; letter-spacing: 0.25%;
}

.qty-controls img {
  width: 15px; height: 15px;
  background: none;
}

.qty-btn:disabled,
.remove-btn:disabled {
  cursor: not-allowed;
  transition: 0.15s ease;
}

.qty-btn,
.remove-btn {
  transition: 0.15s ease;
}

.cart-form { display: flex; flex-direction: column; gap: 20px; }
.cart-form-field { text-align: center; }
.cart-form-field label {
  display: block; font-size: 14px; font-weight: 300; margin-bottom: 8px; color: #202020; line-height: 18px;
}
.cart-form-field input {
  width: 100%; max-width: 350px; margin: 0 auto; display: block;
  text-align: center; background: transparent;
  border: none; border-bottom: 1px solid #ccc;
  padding-bottom: 8px; font-size: 14px; color: #858585; font-weight: 200;
  outline: none; transition: border-color .2s;
}
.cart-form-field input:focus { border-color: #202020; }
.cart-form-field input::placeholder { color: #aaa; }

.payment-section { text-align: center; }
.payment-label { display: block; font-size: 14px; font-weight: 300; margin-bottom: 12px; }
.radio-option {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer; margin-bottom: 8px;
  max-width: 300px; margin-left: auto; margin-right: auto;
}
.radio-option input { width: 16px; height: 16px; }

.form-actions {
  display: flex;
  justify-content: center;
  padding: 16px 24px 24px;
  position: sticky;
  bottom: 0;
  background: #fdfdfd;
  border-top: 1px solid #ccc;
}
.btn-pay {
  background: #202020; color: #fdfdfd;
  font-weight: 900; font-size: 13px;
  letter-spacing: .2em; text-transform: uppercase;
  padding: 16px 48px; border-radius: 8px;
  border: none; cursor: pointer;
  transition: opacity .2s;
}
a.btn-pay {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-align: center;
}
.btn-pay:hover { opacity: .85; }

@media (max-width: 768px) {
  .cart-overlay {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
  }

  .cart-modal-box {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .cart-modal-header {
    flex-shrink: 0;
    padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
    text-align: center;
  }

  .cart-modal-header h1 {
    font-size: 18px;
    letter-spacing: 0.06em;
    padding: 0 40px;
  }

  .cart-close-btn {
    right: max(12px, env(safe-area-inset-right));
    top: max(10px, env(safe-area-inset-top));
    font-size: 24px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .cart-modal-box > .divider {
    flex-shrink: 0;
  }

  .empty-state {
    padding: 40px max(16px, env(safe-area-inset-left)) 40px max(16px, env(safe-area-inset-right));
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .cart-content {
    flex: 1;
    flex-direction: column;
    flex-wrap: nowrap;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .cart-left {
    flex: 0 0 auto;
    min-width: 0;
    width: 100%;
    padding: 16px max(16px, env(safe-area-inset-left)) 20px max(16px, env(safe-area-inset-right));
    overflow: visible;
  }

  .cart-left {
    border-bottom: none;
  }

  .cart-left h2 {
    font-size: 12px;
    margin-bottom: 16px;
  }

  .cart-item {
    display: grid;
    grid-template-columns: 18px 108px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    column-gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
  }

  .cart-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .cart-item > img {
    width: 108px;
    height: 108px;
    flex-shrink: 0;
  }

  .cart-item .remove-btn {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    justify-self: center;
    align-self: center;
  }

  .cart-item .remove-btn img {
    width: 12px;
    height: 12px;
  }

  .item-info {
    flex: 1;
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .item-details {
    min-width: 0;
  }

  .item-details h3 {
    font-size: 18px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    margin-bottom: 3px;
  }

  .item-details .series {
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 3px;
  }

  .item-details .price-row {
    font-size: 14px;
    flex-wrap: nowrap;
    white-space: nowrap;
    margin-top: 0;
  }

  .item-details .price-row .price-sep {
    margin-left: 5px;
    margin-right: 5px;
    flex-shrink: 0;
  }

  .item-details .price-row .old {
    font-size: 14px;
  }

  .qty-controls {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    padding-top: 0;
    padding-bottom: 0;
    justify-content: flex-start;
    gap: 8px;
    min-height: 0;
    align-items: center;
  }

  .qty-controls button {
    min-width: 28px;
    min-height: 28px;
    padding: 4px;
    box-sizing: content-box;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .qty-controls img {
    width: 12px;
    height: 12px;
  }

  .qty-controls span {
    font-size: 14px;
    min-width: 20px;
  }

  .cart-total {
    margin-top: 16px;
    font-size: 13px;
  }

  .cart-form-field input {
    max-width: none;
    width: 100%;
  }

  .radio-option {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start;
  }

  .form-actions {
    padding: 12px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .btn-pay {
    width: 100%;
    max-width: none;
    padding: 12px 20px;
    font-size: 12px;
    letter-spacing: 0.14em;
    border-radius: 6px;
    box-sizing: border-box;
  }

  .radio-option input {
    width: 14px;
    height: 14px;
  }
}

@media (min-width: 769px) {
  .qty-controls {
    padding-top: 14px;
    padding-bottom: 14px;
  }
}