:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1a1a1a);
  --hint: var(--tg-theme-hint-color, #8a8a8a);
  --link: var(--tg-theme-link-color, #2678b6);
  --button: var(--tg-theme-button-color, #2678b6);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f4f4f5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.topbar h1 { font-size: 17px; margin: 0; }

.cart-btn {
  position: relative;
  border: none;
  background: var(--secondary-bg);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 15px;
  cursor: pointer;
  color: var(--text);
}
.cart-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 4px;
  background: var(--button);
  color: var(--button-text);
  border-radius: 999px;
  font-size: 11px;
  line-height: 18px;
  margin-left: 2px;
}

.catalog {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px 16px;
}

.card {
  background: var(--secondary-bg);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.card-photo-wrap { position: relative; }
.badge-soon {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.72);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  z-index: 1;
}
.card-photo {
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--secondary-bg);
  object-fit: contain;
  display: block;
}
.card-photo.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hint);
  font-size: 12px;
  text-align: center;
  padding: 8px;
}
.card-body { padding: 8px 10px 12px; }
.card-name { font-size: 13px; font-weight: 600; line-height: 1.25; margin: 0 0 4px; }
.card-price { font-size: 12.5px; color: var(--hint); }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  z-index: 20;
}
.modal.hidden { display: none; }
.modal-sheet {
  background: var(--bg);
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 20px 16px 28px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: var(--secondary-bg);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  color: var(--text);
}

.detail-photos-wrap { position: relative; }
.detail-photos-wrap .badge-soon { top: 12px; right: 12px; }
.detail-photos {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
}
.detail-photos img {
  height: 240px;
  border-radius: 12px;
  flex-shrink: 0;
}
.detail-photos .placeholder {
  height: 240px;
  width: 180px;
  background: var(--secondary-bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hint);
  font-size: 13px;
  text-align: center;
  padding: 10px;
  flex-shrink: 0;
}

.detail-name { font-size: 18px; font-weight: 700; margin: 4px 0 8px; }
.detail-notes { font-size: 13.5px; color: var(--hint); line-height: 1.5; margin-bottom: 16px; }

.volume-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.volume-opt {
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
}
.volume-opt.selected {
  border-color: var(--button);
  background: var(--secondary-bg);
}
.volume-opt.disabled {
  opacity: 0.35;
  pointer-events: none;
}
.volume-opt .ml { font-size: 13px; font-weight: 700; display: block; }
.volume-opt .price { font-size: 11.5px; color: var(--hint); display: block; margin-top: 2px; }
.volume-opt .price-old {
  font-size: 10.5px;
  color: var(--hint);
  opacity: 0.6;
  text-decoration: line-through;
  display: block;
  margin-top: 2px;
}
.volume-opt .price-final {
  color: var(--text);
  font-weight: 700;
  font-size: 12.5px;
}

.gift-bottle-picker { margin-bottom: 16px; }
.gift-bottle-label { font-size: 12.5px; color: var(--hint); margin: 0 0 8px; }
.gift-bottle-opt {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
  background: var(--bg);
}
.gift-bottle-opt.selected {
  border-color: var(--button);
  background: var(--secondary-bg);
}
.gift-bottle-opt .price { color: var(--hint); font-size: 12px; }

.cart-savings { font-size: 12.5px; font-weight: 600; color: #2e9e4f; }

.add-btn, .submit-btn {
  width: 100%;
  border: none;
  background: var(--button);
  color: var(--button-text);
  padding: 13px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.add-btn:disabled { opacity: 0.4; }

.cart-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.cart-row-name { font-size: 13.5px; font-weight: 600; }
.cart-row-sub { font-size: 12px; color: var(--hint); }
.cart-row-right { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  border: none;
  background: var(--secondary-bg);
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
}
.remove-btn { border: none; background: none; color: #d9534f; font-size: 13px; cursor: pointer; }

.cart-total { font-size: 15px; font-weight: 700; margin: 14px 0; text-align: right; }
.cart-empty { color: var(--hint); font-size: 13.5px; padding: 20px 0; text-align: center; }

.checkout-form { display: flex; flex-direction: column; gap: 12px; }
.consent-label {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 8px !important;
  font-size: 12px !important;
  color: var(--hint);
}
.consent-label input { margin-top: 2px; flex-shrink: 0; }
.consent-label a { color: var(--link); }
.checkout-form label { font-size: 12.5px; color: var(--hint); display: flex; flex-direction: column; gap: 4px; }
.checkout-form select,
.checkout-form input,
.checkout-form textarea {
  font-size: 14px;
  padding: 10px;
  border-radius: 10px;
  border: 1.5px solid rgba(0,0,0,0.12);
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
}
