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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-hover: #242424;
  --gold: #c9a962;
  --gold-light: #e8d5a3;
  --text: #f5f5f5;
  --text-muted: #a0a0a0;
  --border: #2a2a2a;
  --radius: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-bottom: var(--safe-bottom);
  -webkit-font-smoothing: antialiased;
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 15, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: var(--safe-top);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  max-width: 720px;
  margin: 0 auto;
}

.logo {
  height: 40px;
  width: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.app-splash img {
  width: min(42vw, 160px);
  height: min(42vw, 160px);
  object-fit: contain;
}

.app-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-locked-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  min-height: 50dvh;
  gap: 16px;
}

.app-locked-screen.hidden {
  display: none !important;
}

.app-locked-logo {
  width: min(36vw, 120px);
  height: min(36vw, 120px);
  object-fit: contain;
}

.app-locked-screen h2 {
  font-size: 20px;
  color: var(--gold-light);
}

.app-locked-screen p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 320px;
}

body.app-locked #app-catalog,
body.app-locked .promo-banner {
  display: none !important;
}

.install-btn {
  background: var(--gold);
  color: #1a1a1a;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.install-btn:active {
  transform: scale(0.97);
}

.promo-banner {
  background: linear-gradient(135deg, #2a2418 0%, #1a1a1a 50%, #2a2418 100%);
  border-bottom: 1px solid rgba(201, 169, 98, 0.3);
  padding: 16px;
}

.promo-content {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 720px;
  margin: 0 auto;
}

.promo-badge {
  flex-shrink: 0;
  background: var(--gold);
  color: #1a1a1a;
  font-weight: 800;
  font-size: 18px;
  padding: 10px 12px;
  border-radius: 10px;
  line-height: 1;
}

.promo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.promo-text strong {
  font-size: 15px;
  color: var(--gold-light);
}

.promo-text span {
  font-size: 13px;
  color: var(--text-muted);
}

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 10px 24px;
}

.loading,
.error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error button {
  background: var(--gold);
  color: #1a1a1a;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-weight: 600;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.product-count {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 6px 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.product-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, background 0.15s;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  width: 100%;
  text-align: left;
  font: inherit;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}

.product-card.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.product-card:active {
  transform: scale(0.98);
  background: var(--surface-hover);
}

.product-image-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #111;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--text-muted);
}

.product-badge.sold {
  background: rgba(180, 50, 50, 0.85);
  color: #fff;
}

.product-badge.new {
  background: rgba(201, 169, 98, 0.9);
  color: #1a1a1a;
}

.product-info {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.product-title {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  margin-top: auto;
}

.product-price .compare {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: line-through;
  font-weight: 400;
  margin-left: 4px;
}

.footer {
  text-align: center;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  border-top: 1px solid var(--border);
}

.footer span {
  color: var(--text-muted);
  font-size: 13px;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s;
}

.sheet-backdrop.visible {
  opacity: 1;
}

.variant-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 201;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(20px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 0.3s ease;
  max-height: 85dvh;
  overflow-y: auto;
}

.variant-sheet.visible {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.sheet-header {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.sheet-image {
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: #111;
}

.sheet-header-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.sheet-header-text h2 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.sheet-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
}

.sheet-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.option-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.option-group select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 12px;
  font-size: 15px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23c9a962' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.buy-btn {
  width: 100%;
  background: var(--gold);
  color: #1a1a1a;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 10px;
}

.buy-btn:active {
  transform: scale(0.98);
}

.buy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sheet-close {
  width: 100%;
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 12px;
  font-size: 14px;
  cursor: pointer;
}

.checkout-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

.checkout-overlay p {
  color: var(--gold-light);
  font-size: 15px;
}

.install-banner {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.install-banner-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 22px;
  max-width: 340px;
  width: 100%;
  text-align: center;
}

.install-banner-icon {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  margin-bottom: 16px;
}

.install-banner-inner h2 {
  font-size: 22px;
  margin-bottom: 10px;
  color: var(--gold-light);
}

.install-banner-inner p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
}

.install-ios-help {
  font-size: 13px !important;
  color: var(--gold-light) !important;
}

@media (min-width: 480px) {
  .products-grid {
    gap: 14px;
  }

  .product-title {
    font-size: 12px;
  }
}
