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

:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1a1a1a);
  --hint: var(--tg-theme-hint-color, #999999);
  --link: var(--tg-theme-link-color, #2678b6);
  --btn: var(--tg-theme-button-color, #2678b6);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f0f0f0);
  --section-bg: var(--tg-theme-section-bg-color, #ffffff);
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 80px;
  -webkit-user-select: none;
  user-select: none;
}

.view {
  display: none;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 20px;
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
}

.subtitle {
  color: var(--hint);
  font-size: 14px;
  margin-top: 4px;
}

.rate-banner {
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--secondary-bg);
  border-radius: 8px;
  font-size: 12px;
  color: var(--hint);
  display: inline-block;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.product-card {
  background: var(--section-bg);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.product-card:active {
  transform: scale(0.97);
}

.product-card-image {
  width: 100%;
  aspect-ratio: 1;
  background: var(--secondary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card-info {
  padding: 10px;
}

.product-card-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}

.product-card-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--link);
}

.product-card-price-ars {
  font-size: 11px;
  color: var(--hint);
}

/* Product Detail */
.product-detail {
  text-align: center;
}

.detail-image {
  width: 100%;
  aspect-ratio: 1;
  background: var(--secondary-bg);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  margin-bottom: 16px;
  overflow: hidden;
}

.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-detail h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.detail-desc {
  color: var(--hint);
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.detail-price {
  margin-bottom: 20px;
}

.price-usd {
  font-size: 28px;
  font-weight: 700;
  color: var(--link);
}

.price-ars {
  display: block;
  font-size: 14px;
  color: var(--hint);
  margin-top: 4px;
}

.quantity-selector {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  background: var(--secondary-bg);
  border-radius: 24px;
  padding: 8px 16px;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--btn);
  color: var(--btn-text);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quantity-selector span {
  font-size: 20px;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

/* Cart */
.cart-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--section-bg);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.cart-item-image {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: var(--secondary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-size: 14px;
  font-weight: 600;
}

.cart-item-qty {
  font-size: 12px;
  color: var(--hint);
}

.cart-item-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--link);
}

.cart-item-remove {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--hint);
  cursor: pointer;
  padding: 4px;
}

.cart-empty {
  text-align: center;
  padding: 40px;
  color: var(--hint);
}

.cart-summary {
  margin-top: 20px;
  padding: 16px;
  background: var(--section-bg);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 700;
}

.cart-total-ars {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--hint);
  margin-top: 4px;
}

/* Checkout */
.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.checkout-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.checkout-form input,
.checkout-form textarea {
  padding: 12px;
  border: 1px solid var(--secondary-bg);
  border-radius: 10px;
  font-size: 15px;
  background: var(--section-bg);
  color: var(--text);
  font-family: inherit;
}

.checkout-form input:focus,
.checkout-form textarea:focus {
  outline: none;
  border-color: var(--btn);
}

/* Payment Result */
.result-container {
  text-align: center;
  padding: 40px 20px;
}

.result-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.result-container h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.result-container p {
  color: var(--hint);
  font-size: 15px;
  line-height: 1.5;
}

/* Cart FAB */
.cart-fab {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--btn);
  color: var(--btn-text);
  border: none;
  border-radius: 28px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
}
