:root {
  --bg: #fafbfc;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --accent: #5865f2;
  --accent-dark: #4752c4;
  --success: #43b581;
  --danger: #f04747;
  --radius: 16px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 6px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.10);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

html {
  scroll-behavior: smooth;
}


header,
nav,
main {
  width: 100%;
  display: flex;
  justify-content: center;
}

header > .topbar {
  width: min(1200px, 96vw);
}

#products {
  width: min(1400px, 96vw);
}

nav {
  width: 100%;
}

.loadingScreen {
  position: fixed;
  inset: 0;
  background: rgba(250, 251, 252, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.3s ease;
}

.loadingScreen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loadingCard {
  background: var(--card);
  border-radius: 18px;
  padding: 24px 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  min-width: min(320px, 90vw);
}

.loadingSpinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(88, 101, 242, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.9s linear infinite;
}

.loadingCard h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.loadingCard p {
  margin: 0;
  color: var(--text-secondary);
  font-weight: 600;
}

.loadingBar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #eef2ff;
  overflow: hidden;
  margin: 14px 0 8px;
}

.loadingBarFill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #7c8cff);
  transition: width 0.25s ease;
}

.loadingCard.ready .loadingBarFill {
  width: 100%;
}

.loadingPercent {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

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

.topbar {
  padding: 20px 16px;
  background: var(--card);
  border-bottom: 1px solid #f0f0f0;
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.topbar > div {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.topbar h1 {
  margin: 0 0 2px 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.topbar p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.cartBtn {
  grid-column: 3;
  justify-self: end;
  position: relative;
  width: 48px;
  height: 48px;
  padding: 0;
  background: var(--accent);
  border-radius: 12px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  color: white;
  transition: 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.cartBtn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 20px rgba(88, 101, 242, 0.25);
  background: var(--accent-dark);
}

.cartBtn:active {
  transform: translateY(0) scale(0.98);
}

.cartBadge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  animation: badgePulse 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 2px solid white;
}

@keyframes badgePulse {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

nav {
  padding: 16px 24px;
  overflow-x: auto;
  border-bottom: 1px solid #f0f0f0;
  background: var(--card);
  position: sticky;
  top: 68px;
  z-index: 19;
  display: flex;
  justify-content: center;
}

.categoryRow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: min(1200px, 100%);
  margin: 0 auto;
}

nav::-webkit-scrollbar {
  height: 4px;
}

nav::-webkit-scrollbar-track {
  background: transparent;
}

nav::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 2px;
}

.category {
  display: inline-block;
  padding: 8px 16px;
  margin: 0 6px;
  background: transparent;
  border: 2px solid #e0e0e0;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: none;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.2s;
  flex-shrink: 0;
}

.category:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(88, 101, 242, 0.05);
}

.category.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.3);
}

#products {
  padding: 24px 0 140px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  #products {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
  }
}

@media (max-width: 600px) {
  #products {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px 0 140px;
  }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid #f5f5f5;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: #efefef;
}

.card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.sizeSelect {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  margin-bottom: 10px;
  background: white;
  font-size: 14px;
  color: var(--text);
}

.card-body {
  padding: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.name {
  margin: 0 0 8px 0;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
}

.meta {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.price {
  margin: 0 0 14px 0;
  font-weight: 800;
  font-size: 20px;
  color: var(--accent);
}

.card button {
  margin-top: auto;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
}

.card button:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.25);
}

button {
  width: 100%;
  margin-top: 10px;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(88, 101, 242, 0.25);
  background: var(--accent-dark);
}

button:active {
  transform: translateY(0);
}

button.secondary {
  background: #f0f0f0;
  color: var(--text);
}

button.secondary:hover {
  background: #e0e0e0;
  box-shadow: var(--shadow-sm);
}

button.danger {
  background: var(--danger);
  color: white;
}

button.danger:hover {
  background: #dc3545;
  box-shadow: 0 6px 16px rgba(240, 71, 71, 0.25);
}

button.primary {
  background: var(--accent);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.shippingControls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  margin-bottom: 16px;
}

.shippingControls label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.shippingControls select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background: white;
  font-size: 14px;
  color: var(--text);
}

.cart {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 420px;
  background: var(--card);
  box-shadow: -10px 0 40px rgba(0,0,0,0.12);
  padding: 24px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 60;
  display: flex;
  flex-direction: column;
}

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

.cartBackdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cartBackdrop.open {
  opacity: 1;
  pointer-events: all;
}

.cart.open {
  transform: translateX(0);
}

@media (max-width: 700px) {
  .cart {
    width: 100%;
    height: 85vh;
    top: auto;
    bottom: 0;
    right: 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

  .cart.open {
    transform: translateY(0);
  }

  #products {
    padding: 20px 0 120px;
  }

  nav {
    top: 76px;
  }
}

/* CART HEADER */
.cartHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #f5f5f5;
}

.cartHeader h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.cartHeader button {
  width: 44px;
  height: 44px;
  padding: 0;
  background: #f5f5f5;
  color: var(--text);
  font-size: 20px;
  margin: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: none;
}

.cartHeader button:hover {
  background: #efefef;
  transform: none;
  box-shadow: none;
}

/* CART ITEMS */
.summary {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #f5f5f5;
}

.cartItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid #f5f5f5;
}

.cartItem > div:first-child {
  flex: 1;
}

.cartItem b {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.cartItem small {
  color: var(--text-secondary);
  font-size: 13px;
}

.qtyControls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 4px 8px;
}

.qtyControls button {
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  background: transparent;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.qtyControls button:hover {
  background: white;
  transform: none;
  box-shadow: none;
}

.qtyControls span {
  min-width: 20px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}

.notice {
  background: rgba(67, 181, 129, 0.1);
  border: 1px solid rgba(67, 181, 129, 0.3);
  color: #1a8a4a;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.summary > p {
  display: flex;
  justify-content: space-between;
  margin: 12px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.summary > h3 {
  display: flex;
  justify-content: space-between;
  margin: 16px 0 20px 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.summaryBox {
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.1) 0%, rgba(67, 181, 129, 0.05) 100%);
  padding: 20px;
  border-radius: 14px;
  border: 1px solid rgba(88, 101, 242, 0.1);
  margin: 20px 0;
}

.summaryBox h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: var(--text);
}

.summaryBox p {
  margin: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
  word-break: break-all;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  padding: 8px;
  background: white;
  border-radius: 6px;
}

.codeBox {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0;
}

.copyCodeBtn {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.copyCodeBtn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.25);
}

.summaryBox small {
  display: block;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

.hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.telegramBtn {
  display: inline-block;
  width: 100%;
  padding: 12px 16px;
  background: #0088cc;
  color: white;
  text-decoration: none;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  margin-top: 12px;
  transition: 0.2s;
  cursor: pointer;
}

.telegramBtn:hover {
  background: #006ba3;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 136, 204, 0.25);
}

.notification {
  position: fixed;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: white;
  padding: 14px 20px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(67, 181, 129, 0.25);
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  animation: none;
  z-index: 100;
  max-width: 90vw;
}

.notification:empty {
  display: none;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid #f0f0f0;
  padding: 12px 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
  z-index: 18;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}

.footerBtn {
  padding: 8px 14px;
  margin: 0;
  font-size: 12px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
  box-shadow: none;
}

.footerBtn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(88, 101, 242, 0.05);
  transform: none;
  box-shadow: none;
}

@media (max-width: 600px) {
  .footer {
    padding: 10px 12px;
    gap: 8px;
  }
  
  .footerBtn {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* MODALS */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  animation: fadeIn 0.3s ease forwards;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
  animation: fadeOut 0.3s ease forwards;
}

.modal:not(.hidden) {
  pointer-events: auto;
}

.modalBackdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 65;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modalBackdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modalContent {
  background: var(--card);
  border-radius: var(--radius);
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 90vw;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 72;
}

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

.modalHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 2px solid #f5f5f5;
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 71;
}

.modalHeader h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.closeBtn {
  width: 44px;
  height: 44px;
  padding: 0;
  background: #f5f5f5;
  color: var(--text);
  font-size: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: none;
  margin: 0;
  flex-shrink: 0;
}

.closeBtn:hover {
  background: #efefef;
  transform: none;
  box-shadow: none;
}

.modalBody {
  padding: 24px;
}

.modalBody h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-top: 16px;
}

.modalBody h3:first-child {
  margin-top: 0;
}

.modalBody p {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tosCheckbox {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 20px 0;
  padding: 16px;
  background: rgba(88, 101, 242, 0.08);
  border: 1px solid rgba(88, 101, 242, 0.2);
  border-radius: 10px;
}

.tosCheckbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.tosCheckbox label {
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  margin: 0;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

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

/* MOBILE RESPONSIVE */
@media (max-width: 700px) {
  .cart {
    width: 100%;
    height: 85vh;
    top: auto;
    bottom: 0;
    right: 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

  .cart.open {
    transform: translateY(0);
  }

  #products {
    padding: 20px 0 120px;
  }

  nav {
    top: 76px;
  }
}