:root {
  --bg: #fff2f6;
  --card: #ffffff;
  --pink: #ff6fa0;
  --pink-dark: #e14e83;
  --pink-soft: #ffe1ec;
  --text: #3d2b33;
  --muted: #a97e8d;
  --line: #ffd6e4;
}

* {
  box-sizing: border-box;
}

button,
select,
.pill {
  touch-action: manipulation;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
}

h1,
.brand {
  font-family: 'Quicksand', sans-serif;
}

header {
  padding: 28px 24px 18px;
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}

header h1 {
  font-size: 28px;
  color: var(--pink-dark);
  margin: 0 0 4px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.logo-img {
  height: 40px;
  width: auto;
  display: block;
}

header p {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

.header-actions {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-widget {
  position: static;
}

#cartButton {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--pink-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--pink-dark);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.cart-panel {
  display: none;
  position: absolute;
  top: 50px;
  right: 0;
  width: 300px;
  max-height: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(61, 43, 51, 0.15);
  z-index: 50;
  text-align: left;
  flex-direction: column;
}

.cart-panel.open {
  display: flex;
}

.cart-items-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 8px 14px;
}

.cart-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
  margin: 0;
}

.cart-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

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

.cart-item-name {
  font-weight: 700;
  line-height: 1.3;
}

.cart-item-meta {
  color: var(--muted);
  font-size: 11.5px;
}

.cart-item-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.cart-panel-footer {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}

#cartCheckoutBtn {
  margin-top: 0;
  padding: 10px;
}

#cartCheckoutBtn:disabled {
  background: #d8c3cb;
  cursor: not-allowed;
}

.top-row {
  max-width: 1200px;
  margin: 18px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
}

.search-wrap input::placeholder {
  color: var(--muted);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: flex;
  align-items: center;
}

select#sortSelect {
  padding: 12px 34px 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background-color: var(--card);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23e14e83' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.pills {
  max-width: 1200px;
  margin: 16px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.pills::-webkit-scrollbar {
  display: none;
}

.pill {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.pill .count {
  opacity: .6;
  font-weight: 600;
  margin-left: 4px;
}

.pill.active {
  background: var(--pink);
  border-color: var(--pink);
  color: white;
}

.pill.active .count {
  opacity: .85;
}

.grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  content-visibility: auto;
  contain-intrinsic-size: 1px 400px;
}

.card-img-wrap {
  position: relative;
}

.card img,
.card video {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.video-container {
  position: relative;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.vid-poster,
.vid-click {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vid-click {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 10, 15, 0.28);
  pointer-events: none;
  transition: background .15s;
}

.video-container:hover .play-overlay {
  background: rgba(20, 10, 15, 0.4);
}

.tag-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--text);
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}

.sale-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--pink-dark);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}

.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 5px;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.card-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.card-cat {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--pink-dark);
}

.card-name {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  min-height: 37px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-content: start;
  gap: 5px;
  margin-top: 2px;
  max-height: 68px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.stat-row::-webkit-scrollbar {
  width: 5px;
}

.stat-row::-webkit-scrollbar-track {
  background: transparent;
}

.stat-row::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.stat-chip {
  display: flex;
  align-items: center;
  background: var(--pink-soft);
  color: var(--pink-dark);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  letter-spacing: .01em;
  line-height: 1.3;
  white-space: normal;
  word-break: break-word;
}

.variant-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 1px 0 3px;
}

.variant-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--pink-soft);
  color: var(--pink-dark);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.variant-pill.active {
  background: var(--pink-dark);
  border-color: var(--pink-dark);
  color: white;
}

.variant-pill.unavailable {
  opacity: .5;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}

.price-now {
  font-size: 17px;
  font-weight: 700;
}

.price-was {
  font-size: 13px;
  color: var(--muted);
  text-decoration: line-through;
}

.low-stock {
  font-size: 11px;
  font-weight: 700;
  color: var(--pink-dark);
}

.out-of-stock {
  font-size: 11px;
  font-weight: 700;
  color: #c04141;
  text-transform: uppercase;
}

.qty-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-row button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--pink-soft);
  color: var(--pink-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.qty-row span {
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

.add-btn {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 999px;
  background: var(--pink-dark);
  color: white;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .03em;
  text-transform: uppercase;
  cursor: pointer;
}

.add-btn:disabled {
  background: #d8c3cb;
  cursor: not-allowed;
}

.add-btn.just-added {
  background: #2e8b57;
}

.load-more-wrap {
  text-align: center;
  padding: 6px 24px 50px;
}

.load-more-btn {
  padding: 12px 28px;
  border-radius: 999px;
  border: 1px solid var(--pink-dark);
  background: transparent;
  color: var(--pink-dark);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .02em;
  cursor: pointer;
  display: none;
}

.load-more-btn:hover {
  background: var(--pink-soft);
}

.photo-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(61, 43, 51, 0.75);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(61, 43, 51, 0.25);
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  max-width: 90vw;
  text-align: center;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.auth-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.auth-login-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #5865F2;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.auth-login-btn:hover {
  background: #4a54d6;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
}

.auth-user img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: block;
}

.auth-user span {
  font-weight: 700;
  color: var(--text);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-logout {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
}

.login-required {
  background: var(--pink-soft);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.login-required p {
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

#checkoutFormFields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notes-count {
  margin: -2px 0 0;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.checkout-verified-user {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--pink-soft);
  border-radius: 10px;
  padding: 8px 12px;
}

.checkout-verified-user img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.checkout-verified-user span {
  font-weight: 700;
  font-size: 13.5px;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 15, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--card);
  border-radius: 18px;
  padding: 24px;
  width: 90%;
  max-width: 380px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-box h2 {
  font-size: 18px;
  margin: 0 0 2px;
  padding-right: 24px;
}

.modal-sub {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.modal-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--pink-dark);
  margin-top: 8px;
}

.modal-box input,
.modal-box select,
.modal-box textarea {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  resize: none;
}

.modal-box textarea {
  min-height: 60px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
}

.modal-submit {
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 999px;
  background: var(--pink-dark);
  color: white;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .03em;
  cursor: pointer;
}

.modal-submit:disabled {
  background: #d8c3cb;
  cursor: not-allowed;
}

.modal-status {
  font-size: 13px;
  text-align: center;
  margin: 8px 0 0;
  min-height: 18px;
}

.modal-status.error {
  color: #c04141;
}

.modal-status.success {
  color: #2e8b57;
}

.checkout-items-list {
  max-height: 160px;
  overflow-y: auto;
  margin-top: 6px;
}

.checkout-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

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

.checkout-grand-total {
  text-align: right;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-top: 6px;
}

.checkout-success {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 4px 4px;
}

.checkout-success.show {
  display: flex;
}

.success-icon-wrap {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--pink-soft);
  border: 2px solid var(--pink);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  animation: successPop .45s cubic-bezier(.34, 1.56, .64, 1);
}

.success-icon-wrap img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.checkout-success h2 {
  margin: 0 0 4px;
  font-size: 17px;
  color: var(--pink-dark);
}

.success-order-id {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  color: var(--text);
  font-size: 15px;
  margin: 0 0 12px;
  background: var(--pink-soft);
  padding: 5px 14px;
  border-radius: 999px;
  display: inline-block;
}

.checkout-success p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 260px;
}

.checkout-success-close {
  margin-top: 18px;
  padding: 10px 22px;
  border: none;
  border-radius: 999px;
  background: var(--pink-dark);
  color: white;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .03em;
  text-transform: uppercase;
  cursor: pointer;
}

#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 15, 0.88);
  z-index: 999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

#lightbox.open {
  display: flex;
}

#lightbox img {
  max-width: 85vw;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  background: #111;
}

#lightbox .lb-controls {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 16px;
}

#lightbox button {
  background: var(--pink);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

#lightbox .lb-count {
  color: white;
  font-size: 13px;
  font-weight: 600;
}

#lightbox .lb-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: transparent;
  border: none;
  color: white;
  font-size: 26px;
  cursor: pointer;
}

.empty,
.loading {
  color: var(--muted);
  padding: 50px 24px;
  text-align: center;
  grid-column: 1 / -1;
}

@keyframes cartBump {
  0% { transform: scale(1); }
  35% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.cart-count.bump {
  animation: cartBump .35s ease;
}

@keyframes successPop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

@media (max-width: 640px) {
  .header-actions {
    top: 18px;
    right: 16px;
  }

  .auth-user span {
    max-width: 60px;
  }

  header {
    padding: 20px 16px 14px;
    text-align: left;
  }

  header h1 {
    font-size: 22px;
    justify-content: flex-start;
    padding-right: 130px;
  }

  .logo-img {
    height: 30px;
  }

  .cart-panel {
    width: calc(100vw - 32px);
    right: -8px;
  }

  .top-row {
    padding: 0 16px;
    flex-direction: column;
  }

  select#sortSelect {
    width: 100%;
  }

  .pills {
    padding: 0 16px;
  }

  .grid {
    padding: 16px 16px 40px;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .card-name {
    font-size: 13px;
    min-height: 34px;
  }

  .price-now {
    font-size: 15px;
  }

  .add-btn {
    padding: 10px;
    font-size: 11.5px;
  }

  .qty-row button {
    width: 32px;
    height: 32px;
  }

  .modal-box {
    padding: 20px;
  }
}

@media (max-width: 400px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .card-name {
    font-size: 12.5px;
  }
}
