:root {
  --bg: #ffffff;
  --bg-raised: #f7f7f7;
  --line: #e3e3e3;
  --text: #1a1a1a;
  --text-dim: #6b6b6b;
  --red: #E1251B;
  --red-dim: #F6D3D1;
  --red-strong: #B01810;
  --bg-rgb: 255, 255, 255;
  --mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
  --bg: #121212;
  --bg-raised: #1c1c1c;
  --line: #2e2e2e;
  --text: #f0f0f0;
  --text-dim: #a0a0a0;
  --red: #FF453A;
  --red-dim: #4A1512;
  --red-strong: #FF7A70;
  --bg-rgb: 18, 18, 18;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  transition: background-color 0.2s ease, color 0.2s ease;
  line-height: 1.5;
}

.wrap {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Topbar ---- */
.topbar {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(var(--bg-rgb), 0.92);
  backdrop-filter: blur(6px);
  z-index: 20;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-logo { width: 26px; height: 26px; border-radius: 6px; display: block; }
.accent { color: var(--red); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.telegram-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.telegram-btn:hover { background: var(--red); color: #ffffff; }
.telegram-btn svg { width: 16px; height: 16px; fill: currentColor; }

.theme-toggle {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.theme-toggle:hover { border-color: var(--red); }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.cart-toggle {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 14px;
  transition: border-color 0.15s ease;
}
.cart-toggle:hover { border-color: var(--red); }
.cart-count {
  background: var(--red);
  color: #ffffff;
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ---- Hero ---- */
.hero {
  padding: 64px 0 40px;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}
.eyebrow {
  font-family: var(--mono);
  color: var(--red);
  font-size: 13px;
  letter-spacing: 0.03em;
  margin: 0 0 14px;
}
.hero h1 {
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.08;
  margin: 0 0 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.hero-sub {
  color: var(--text-dim);
  max-width: 700px;
  margin: 0 auto;
  font-size: 19px;
}

/* ---- Catalog ---- */
.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 340px));
  gap: 16px;
  padding-bottom: 80px;
  justify-content: center;
}
.loading { color: var(--text-dim); font-family: var(--mono); }

.category-heading {
  grid-column: 1 / -1;
  font-family: var(--mono);
  color: var(--red);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 28px 0 -4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.category-heading:first-child { border-top: none; padding-top: 0; margin-top: 0; }

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  border-color: var(--red);
  box-shadow: 0 10px 24px rgba(225, 37, 27, 0.10);
}

.card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.card-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}
.card-price {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--red);
}
.card-tiers {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}
.tier-applied {
  color: var(--red);
  font-weight: 600;
}
.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-input {
  width: 72px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 8px;
  font-family: var(--mono);
  text-align: center;
}
.add-btn {
  flex: 1;
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
  transition: background 0.15s ease, color 0.15s ease;
}
.add-btn:hover { background: var(--red); color: #ffffff; }
.add-btn.added { background: var(--red); color: #ffffff; }

/* ---- Cart panel ---- */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 30;
}
.cart-overlay.visible { opacity: 1; pointer-events: auto; }

.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(460px, 92vw);
  background: var(--bg);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 40;
  display: flex;
  box-shadow: -8px 0 24px rgba(0,0,0,0.06);
}
.cart-panel.open { transform: translateX(0); }
.cart-panel-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 20px;
}
.cart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.cart-head h2 { margin: 0; font-size: 18px; color: var(--text); }
.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
}
.icon-btn:hover { color: var(--red); }

.cart-items {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cart-empty { color: var(--text-dim); font-size: 14px; }

.cart-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  font-size: 14px;
}
.cart-item-name { font-weight: 600; color: var(--text); }
.cart-item-meta { color: var(--text-dim); font-family: var(--mono); font-size: 12px; margin-top: 4px; }
.cart-item-price { font-family: var(--mono); color: var(--red); white-space: nowrap; }
.remove-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
  margin-top: 4px;
}
.remove-btn:hover { color: var(--red); }

.cart-foot { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 12px; }
.field { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 14px; }
.field .optional { color: #a3a3a3; }
.field input {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 10px;
  font-family: var(--sans);
}
.field input:focus { outline: none; border-color: var(--red); }
.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 18px;
  margin-bottom: 14px;
  color: var(--text);
}
.cart-total-row span:last-child { color: var(--red); }

.btn-primary {
  width: 100%;
  background: var(--red);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 13px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-primary:not(:disabled):hover { opacity: 0.88; }

.checkout-msg {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 10px;
  min-height: 18px;
}
.checkout-msg.error { color: var(--red-strong); }
.checkout-msg.success { color: var(--red); }

select#cartCoin, select#cartNetwork, select#deliveryMethod {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 10px;
  font-family: var(--sans);
  font-size: 14px;
}
select#cartCoin:focus, select#cartNetwork:focus, select#deliveryMethod:focus { outline: none; border-color: var(--red); }

.payment-display {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.payment-label {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.payment-amount {
  font-family: var(--mono);
  font-size: 20px;
  color: var(--red);
  margin: 0 0 14px;
}
.qr-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  padding: 12px;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid var(--line);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.address-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.address-row code {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
  text-align: left;
  color: var(--text);
}
.icon-action-small {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-action-small:hover { background: var(--red); color: #ffffff; }
.icon-action-small.copied { background: var(--red); color: #ffffff; }

.payment-status {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.payment-status.confirmed { color: var(--red); font-weight: 600; }

.btn-secondary-small {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  cursor: pointer;
}
.btn-secondary-small:hover { border-color: var(--red); color: var(--red); }

/* ---- Footer (centered, wider text column) ---- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 48px 0 32px;
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 40px;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}
.footer-brand {
  font-family: var(--mono);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.footer-brand .brand-logo { width: 22px; height: 22px; border-radius: 5px; }
.footer-tagline {
  font-family: var(--sans);
  color: var(--text-dim);
  font-size: 13px;
  margin: 10px 0 0;
  line-height: 1.6;
  width: 100%;
}
.footer-info { max-width: 760px; }
.footer-info p { margin: 0 0 8px; line-height: 1.6; }
.footer-copy {
  color: #a3a3a3;
  font-size: 12px;
  letter-spacing: 0.02em;
}

@media (max-width: 640px) {
  .hero { padding: 40px 0 28px; }
}
