:root {
  --greige: #e4ddd3;
  --wall: #ebe5db;
  --charcoal: #2a2724;
  --charcoal-soft: #3a3531;
  --slate: #6f675f;
  --linen: #f7f3ec;
  --terracotta: #c45a32;
  --terracotta-hot: #d4683c;
  --terracotta-deep: #a34828;
  --sand: #cfc5b8;
  --taupe: #8a8178;
  --brown: var(--charcoal);

  --accent: var(--terracotta);
  --page-bg: var(--wall);
  --surface: var(--linen);
  --text: var(--charcoal);
  --muted: var(--slate);
  --radius: 26px;
  --container: 1120px;
  --font-sans: "Plus Jakarta Sans", "Segoe UI", ui-sans-serif, sans-serif;
  --font-display: "Syne", "Plus Jakarta Sans", ui-sans-serif, sans-serif;
  --puff:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 6px rgba(42, 39, 36, 0.1),
    0 22px 50px rgba(42, 39, 36, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--page-bg);
}

body {
  background:
    radial-gradient(900px 480px at 10% -8%, rgba(196, 90, 50, 0.12), transparent 55%),
    radial-gradient(720px 420px at 90% 0%, rgba(42, 39, 36, 0.07), transparent 50%),
    linear-gradient(180deg, #efe9df 0%, var(--wall) 45%, #e5ddd2 100%);
  overflow-x: hidden;
}
html.scroll-locked,
body.scroll-locked {
  overflow: hidden !important;
  overscroll-behavior: none;
}
body.scroll-locked {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}
body.scroll-locked .cart-drawer,
body.scroll-locked .cart-drawer section,
body.scroll-locked .modal-backdrop,
body.scroll-locked .checkout-card,
body.scroll-locked .product-detail,
body.scroll-locked .ref-sheet,
body.scroll-locked .profile-card,
body.scroll-locked .success-card {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.sf-aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.sf-island {
  position: absolute;
  border-radius: 34px;
  box-shadow: var(--puff);
  animation: sf-drift 18s ease-in-out infinite;
}

.sf-island-a {
  width: 110px;
  height: 110px;
  left: 8%;
  top: 16%;
  background: linear-gradient(160deg, #f0ebe3, #d8d0c4);
  opacity: 0.8;
}

.sf-island-b {
  width: 96px;
  height: 96px;
  right: 12%;
  top: 30%;
  background: linear-gradient(160deg, #3a3531, #1f1c1a);
  opacity: 0.75;
  animation-delay: -6s;
}

.sf-island-c {
  width: 120px;
  height: 120px;
  left: 40%;
  bottom: 12%;
  background: linear-gradient(160deg, #d4683c, #a34828);
  opacity: 0.7;
  animation-delay: -11s;
  animation-duration: 24s;
}

@keyframes sf-drift {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-2deg); }
  50% { transform: translate3d(14px, -16px, 0) rotate(3deg); }
}

#app {
  position: relative;
  z-index: 1;
  max-width: var(--container);
  margin: 0 auto;
  padding: 18px 18px 90px;
}

.loading {
  min-height: 60vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

header {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px 12px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(58, 53, 49, 0.96), rgba(42, 39, 36, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--puff);
  color: #f3ebe1;
  animation: sf-in 0.55s ease both;
}

@keyframes sf-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

header b,
.shop-logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: -0.03em;
  font-weight: 750;
  color: #f3ebe1;
}

.shop-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-actions button,
.hero button,
.product button,
.submit-order,
#finish-order,
#checkout {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  background: linear-gradient(145deg, var(--terracotta-hot), var(--terracotta-deep));
  color: #fff8f2;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(196, 90, 50, 0.28);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.header-actions button {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.header-actions button:hover,
.hero button:hover,
.product button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

body.card-bordered .product {
  border: 1px solid rgba(42, 39, 36, 0.14);
  box-shadow: none;
  background: var(--surface);
}
body.card-flat .product {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding-left: 0;
  padding-right: 0;
}
body.card-soft .product { box-shadow: var(--puff); }

body.button-outline .hero button,
body.button-outline .product button,
body.button-outline .submit-order {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: none;
}

body.button-pill .hero button,
body.button-pill .product button,
body.button-pill .submit-order,
body.button-pill .header-actions button {
  border-radius: 999px;
}

body.header-minimal header {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  top: 0;
  color: var(--text);
}
body.header-minimal header b,
body.header-minimal .shop-logo { color: var(--text); }
body.header-minimal .header-actions button {
  background: var(--charcoal);
  color: #fff;
}

body.header-solid header {
  background: var(--charcoal);
}

body.header-glass header {
  background: linear-gradient(180deg, rgba(58, 53, 49, 0.92), rgba(42, 39, 36, 0.96));
  backdrop-filter: blur(18px);
}

main {
  display: grid;
  gap: 28px;
  margin-top: 28px;
}

.hero {
  min-height: min(74vh, 580px);
  padding: clamp(36px, 7vw, 72px);
  border-radius: 36px;
  background:
    linear-gradient(145deg, rgba(42, 39, 36, 0.9), rgba(58, 53, 49, 0.78)),
    radial-gradient(circle at 82% 18%, rgba(196, 90, 50, 0.38), transparent 42%),
    linear-gradient(180deg, #3a3531, #2a2724);
  color: #f6efe6;
  box-shadow: var(--puff);
  animation: sf-in 0.7s ease both;
  display: grid;
  align-content: end;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  right: 8%;
  top: 14%;
  border-radius: 40px;
  background: linear-gradient(160deg, #d4683c, #a34828);
  box-shadow: var(--puff);
  opacity: 0.85;
  animation: sf-drift 14s ease-in-out infinite;
}

.hero > div { position: relative; z-index: 1; }

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.45;
}
.hero.banner .hero-media img { opacity: 0.55; }

.hero small {
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #e4ddd3;
  font-size: 11px;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1.05;
  max-width: 100%;
  letter-spacing: -0.03em;
  font-weight: 750;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hero p {
  margin: 0;
  max-width: 34ch;
  color: rgba(246, 239, 230, 0.78);
  line-height: 1.55;
}

.hero button,
.hero-cta {
  width: fit-content;
  margin-top: 8px;
  text-decoration: none;
  display: inline-flex;
}

section h2 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  margin: 0 0 16px;
  letter-spacing: -0.03em;
}

.categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.categories button {
  border: 1px solid rgba(42, 39, 36, 0.08);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  box-shadow: 0 10px 24px rgba(42, 39, 36, 0.05);
}

.categories button.active,
.categories button:hover {
  background: var(--charcoal);
  color: #f3ebe1;
  border-color: transparent;
}
.categories button.cat-child {
  opacity: 0.92;
  font-size: 12px;
  background: color-mix(in srgb, var(--surface) 70%, var(--greige));
}
.product-brand {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}
.product {
  cursor: pointer;
}
.product-detail {
  max-width: 520px;
  position: relative;
  color: #171717;
  background: #fff;
  display: flex;
  flex-direction: column;
  max-height: min(92dvh, 720px);
}
.product-detail .modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(42,39,36,.12);
  color: #171717;
  cursor: pointer;
}
.product-detail-media {
  border-radius: 16px;
  overflow: hidden;
  margin: 0 0 10px;
  flex: 0 0 auto;
  background: linear-gradient(160deg, #e4ddd3, #d5cdc1);
}
.product-detail-media img,
.product-detail-media .image {
  width: 100%;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
  object-fit: contain;
  display: block;
  background: #f4f1ec;
}
.product-detail-media .image {
  display: grid;
  place-items: center;
  min-height: 180px;
  font-size: 28px;
  color: #9a9a9a;
}
.product-detail-meta {
  display: grid;
  gap: 4px;
  margin: 0 0 8px;
  flex: 0 0 auto;
}
.product-detail .product-brand {
  color: #8a8178;
}
.product-detail h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: #171717;
}
.product-detail .product-price {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #171717;
}
.product-detail-body {
  flex: 1 1 auto;
  min-height: 72px;
  overflow: auto;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f4f1ec;
}
.product-desc {
  color: #3a3531;
  line-height: 1.45;
  white-space: pre-wrap;
  margin: 0;
  font-size: 14px;
}
.product-desc-empty {
  color: #8a8178;
  font-size: 13px;
}
.product-detail .modal-actions {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex: 0 0 auto;
  margin-top: auto;
}
.product-detail .modal-actions .primary,
.product-detail .modal-actions .ghost {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border: 0;
}
.product-detail .modal-actions .primary {
  background: var(--terracotta, #c45a32);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  text-align: left;
}
.product-detail .modal-actions .primary.detail-order {
  flex: 1.4;
}
.product-detail .modal-actions .ghost {
  flex: 0.8;
}
.product-detail .modal-actions .detail-order-label {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
}
.product-detail .modal-actions .detail-order-sum {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
}
body.tg-miniapp .product-detail .modal-actions .primary,
html.tg-miniapp .product-detail .modal-actions .primary {
  background: var(--terracotta, #c45a32);
  color: #fff;
}
.product-detail .modal-actions .primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.product-detail .modal-actions .ghost {
  background: #ece7e0;
  color: #171717;
}

.catalog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  min-height: 44px;
}

#catalog-search {
  border: 1px solid rgba(42, 39, 36, 0.08);
  background: var(--surface);
  border-radius: 999px;
  padding: 11px 16px;
  min-width: min(280px, 100%);
  outline: 0;
}

.grid {
  display: grid;
  /* min(..., 100%) prevents auto-fill from forcing page wider than viewport */
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.grid.mode-list { grid-template-columns: 1fr; }
.grid.mode-compact { grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); }

.product {
  background: var(--surface);
  border: 1px solid rgba(42, 39, 36, 0.06);
  border-radius: 28px;
  padding: 14px;
  display: grid;
  gap: 10px;
  box-shadow: var(--puff);
  animation: sf-in 0.55s ease both;
}

.product img,
.product .image {
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  max-height: none;
  object-fit: contain;
  object-position: center;
  border-radius: 20px;
  background: transparent;
  display: block;
  color: var(--taupe);
}
.product .image:not(img) {
  aspect-ratio: 4 / 3;
  background: #f3eee6;
  display: grid;
  place-items: center;
}

.product h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.product p {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.product select {
  border: 1px solid rgba(42, 39, 36, 0.08);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
}

.features {
  padding: 8px 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.feature-grid article {
  background: var(--surface);
  border-radius: 24px;
  padding: 22px;
  border: 1px solid rgba(42, 39, 36, 0.06);
  box-shadow: var(--puff);
  font-family: var(--font-display);
  font-weight: 650;
}

.text {
  background: var(--charcoal);
  color: #f3ebe1;
  border-radius: 32px;
  padding: clamp(28px, 5vw, 48px);
  box-shadow: var(--puff);
}

.text h2 { color: #fff; }
.text p { color: rgba(243, 235, 225, 0.72); max-width: 48ch; }

.cart-drawer {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(380px, calc(var(--app-w, 100%) - 24px));
  background: linear-gradient(180deg, #3a3531, #2a2724);
  color: #f3ebe1;
  border-radius: 32px;
  box-shadow: var(--puff);
  transform: translateX(110%);
  transition: transform 0.28s ease;
  z-index: 20;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.cart-drawer.open { transform: none; }

.cart-drawer > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cart-drawer h2 {
  margin: 0;
  font-family: var(--font-display);
}

.cart-drawer section {
  padding: 16px 22px;
  overflow: auto;
}

.cart-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cart-line small { color: rgba(243, 235, 225, 0.55); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button,
.remove,
#close {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.cart-drawer footer {
  padding: 18px 22px 22px;
  display: grid;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.cart-drawer .cart-footer {
  display: grid;
  gap: 12px;
}
.cart-drawer .cart-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
}
.cart-drawer .cart-total span {
  color: rgba(243, 235, 225, 0.62);
}
.cart-drawer .cart-total b {
  font-size: 1.25rem;
}
.cart-drawer .checkout-btn,
.cart-drawer #checkout {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
  color: #171717;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}
.cart-drawer #checkout:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
body.tg-miniapp .cart-drawer .checkout-btn,
body.tg-miniapp .cart-drawer #checkout,
html.tg-miniapp .cart-drawer .checkout-btn,
html.tg-miniapp .cart-drawer #checkout {
  background: var(--terracotta, #c45a32);
  color: #fff;
  border-radius: 12px;
  min-height: 48px;
}
body.tg-miniapp.has-tg-mainbutton .cart-drawer footer,
body.tg-miniapp.has-tg-mainbutton .cart-drawer .cart-footer {
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
/* Keep in-drawer checkout visible even with MainButton — do not hide it */
body.tg-miniapp.has-tg-mainbutton .cart-drawer #checkout {
  display: block;
}

.empty-cart { color: rgba(243, 235, 225, 0.55); padding: 24px 0; }

#modal { position: relative; z-index: 60; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(42, 39, 36, 0.45);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: auto;
  overscroll-behavior: contain;
}

.checkout-card,
.success-card,
.profile-card {
  width: min(920px, 100%);
  background: var(--linen);
  border-radius: 32px;
  padding: 24px;
  box-shadow: var(--puff);
  border: 1px solid rgba(42, 39, 36, 0.06);
}

.checkout-head,
.success-card {
  position: relative;
}

.checkout-head h2,
.success-card h2 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

.checkout-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 22px;
}

.checkout-card label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.checkout-card input,
.checkout-card textarea,
.checkout-card select {
  border: 1px solid rgba(42, 39, 36, 0.1);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
}

.option {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(42, 39, 36, 0.08);
  border-radius: 16px;
  margin-bottom: 8px !important;
  background: color-mix(in srgb, var(--greige) 45%, white);
}

.option input { width: auto; }

.delivery-zone-hint {
  display: block;
  margin: -4px 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent, #c45a32) 12%, white);
  color: var(--text, #2a2724);
  font-size: 13px;
  line-height: 1.4;
}
.delivery-zone-hint[hidden] { display: none !important; }

.pvz-map {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 12px;
}
.pvz-pin {
  text-align: left;
  border: 1px solid rgba(42, 39, 36, 0.1);
  background: #fff;
  border-radius: 16px;
  padding: 10px 12px;
  cursor: pointer;
}
.pvz-pin.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.pvz-pin b { display: block; }
.pvz-pin small { color: var(--muted); }

.order-summary {
  padding: 18px;
  border-radius: 24px;
  background: var(--charcoal);
  color: #f3ebe1;
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 18px;
}

.order-summary p,
.order-summary .grand {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0;
}

.order-summary .grand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-top: 14px;
}

.success-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--terracotta-hot), var(--terracotta-deep));
  color: #fff;
  font-size: 24px;
  margin-bottom: 12px;
  box-shadow: var(--puff);
}

.portal-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.portal-tabs button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--greige) 55%, white);
  cursor: pointer;
}

.portal-tabs button.active {
  background: var(--accent);
  color: #fff;
}

.loyalty-card {
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(196, 90, 50, 0.18), rgba(42, 39, 36, 0.06));
  margin-bottom: 12px;
}

.loyalty-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
}

.profile-orders article {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(42, 39, 36, 0.08);
}

.error {
  max-width: 28rem;
  margin: 20vh auto;
  padding: 1.5rem;
  text-align: center;
  background: var(--surface);
  border-radius: 28px;
  box-shadow: var(--puff);
}

@media (max-width: 820px) {
  .checkout-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .hero::after { display: none; }
  .sf-island { opacity: 0.35; }
}

/* —— Telegram / narrow mobile —— */
/* Critical: early boot marks html.tg-miniapp in <head>; body class arrives later.
   Use html.tg-miniapp for layout so iPhone never falls back to desktop minmax(220px). */
html.tg-miniapp,
body.tg-miniapp {
  min-height: 100%;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
  overscroll-behavior-x: none;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-rendering: geometricPrecision;
}
html.tg-miniapp {
  overflow-x: hidden !important;
  max-width: 100%;
}
html.tg-miniapp #app,
body.tg-miniapp #app {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box;
}
html.tg-miniapp main,
body.tg-miniapp main {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}
/* Force 2-col product grid even before body.tg-miniapp exists */
html.tg-miniapp .grid,
body.tg-miniapp .grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}
html.tg-miniapp .grid.mode-list,
body.tg-miniapp .grid.mode-list {
  grid-template-columns: 1fr !important;
}
html.tg-miniapp .product,
body.tg-miniapp .product {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden;
}
html.tg-miniapp .product img,
html.tg-miniapp .product .image,
body.tg-miniapp .product img,
body.tg-miniapp .product .image {
  max-width: 100% !important;
  width: 100% !important;
  height: auto;
}

body.tg-miniapp {
  background: var(--page-bg);
  color: var(--text);
  /* transforms blur text in Telegram WebView */
  --puff: 0 8px 20px rgba(42, 39, 36, 0.1);
}

html.tg-miniapp .sf-aurora,
body.tg-miniapp .sf-aurora,
body.tg-miniapp .sf-island,
body.tg-miniapp .hero::after,
body.tg-miniapp body::before {
  display: none !important;
}

body.tg-miniapp header,
body.tg-miniapp .hero,
body.tg-miniapp .product,
body.tg-miniapp .feature-grid article,
body.tg-miniapp .text {
  animation: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
}

html.tg-miniapp #app,
body.tg-miniapp #app {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  overflow-x: hidden !important;
  padding:
    calc(8px + env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    calc(24px + env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
}
html.tg-miniapp main,
html.tg-miniapp header,
html.tg-miniapp .vitrina-top,
html.tg-miniapp .vitrina-carousel,
html.tg-miniapp .vitrina-tiles,
html.tg-miniapp .products,
html.tg-miniapp .grid,
html.tg-miniapp .hero,
html.tg-miniapp .catalog-head,
body.tg-miniapp main,
body.tg-miniapp header,
body.tg-miniapp .vitrina-top,
body.tg-miniapp .vitrina-carousel,
body.tg-miniapp .vitrina-tiles,
body.tg-miniapp .products,
body.tg-miniapp .grid,
body.tg-miniapp .hero,
body.tg-miniapp .catalog-head,
body.tg-miniapp .tg-menu,
body.tg-miniapp .tg-profile-panel,
body.tg-miniapp .tg-ref-card {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
/* Horizontal chip/category rows must scroll INSIDE, not expand page.
   width:0 + min-width:100% is the reliable iOS flex overflow trap. */
html.tg-miniapp .categories,
html.tg-miniapp .vitrina-chips,
body.tg-miniapp .categories,
body.tg-miniapp .vitrina-chips {
  display: flex;
  flex-wrap: nowrap;
  width: 0;
  min-width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

/* Admin iPhone preview has no real safe-area — keep title clear of the notch. */
body.tg-admin-preview #app {
  padding-top: 10px;
}
body.tg-admin-preview header {
  max-width: calc(100% - 24px);
}
body.tg-admin-preview header b,
body.tg-admin-preview .shop-logo {
  max-width: min(42vw, 140px);
}

body.tg-miniapp header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  padding: 10px 12px;
  border-radius: 16px;
  gap: 8px;
  box-shadow: var(--puff);
}

body.tg-miniapp header b,
body.tg-miniapp .shop-logo {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  max-width: 48vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.tg-miniapp .header-actions button {
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

body.tg-miniapp main {
  gap: 16px;
  margin-top: 12px;
}

body.tg-miniapp .hero {
  min-height: 0 !important;
  height: auto !important;
  padding: 16px !important;
  border-radius: 18px;
  align-content: start;
  gap: 8px;
  box-shadow: var(--puff);
}

body.tg-miniapp .hero small {
  font-size: 10px;
  letter-spacing: 0.12em;
}

body.tg-miniapp .hero h1 {
  font-family: var(--font-sans) !important;
  font-size: 22px !important;
  line-height: 1.15 !important;
  max-width: 100% !important;
  letter-spacing: -0.02em;
  font-weight: 750;
}

body.tg-miniapp .hero p {
  font-size: 13px;
  line-height: 1.4;
  max-width: 100%;
}

body.tg-miniapp .hero button,
body.tg-miniapp .hero-cta {
  width: 100%;
  justify-content: center;
  margin-top: 6px;
  padding: 12px 14px;
  font-size: 14px;
  box-shadow: none;
}

body.tg-miniapp section h2 {
  font-family: var(--font-sans);
  font-size: 18px;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

body.tg-miniapp .cat-nav {
  display: grid;
  gap: 8px;
}
body.tg-miniapp .categories,
body.tg-miniapp .cat-row {
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  display: flex;
}
body.tg-miniapp .categories::-webkit-scrollbar,
body.tg-miniapp .cat-row::-webkit-scrollbar { display: none; }
body.tg-miniapp .cat-row-l3 button.cat-child {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
body.tg-miniapp .cat-level-break { display: none; }
body.tg-miniapp .categories button,
body.tg-miniapp .cat-row button {
  flex: 0 0 auto;
  padding: 8px 12px;
  font-size: 12px;
  box-shadow: none;
}
.category-tiles .vitrina-tile{
  position:relative;
  border:0;
  padding:0;
  cursor:pointer;
  font:inherit;
  color:inherit;
  background:transparent;
}
.category-tiles .cat-tile-label{
  position:absolute;
  left:10px;right:10px;bottom:10px;
  z-index:2;
  color:#fff;
  font:700 13px/1.2 "Plus Jakarta Sans",system-ui,sans-serif;
  text-shadow:0 1px 8px rgba(0,0,0,.65);
  text-align:left;
  pointer-events:none;
}
.category-tiles .vitrina-tile.on .vitrina-tile-media::after{
  content:"";
  position:absolute;inset:0;
  border:2px solid #0a84ff;
  border-radius:inherit;
  pointer-events:none;
}

body.tg-miniapp .catalog-head {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
}

body.tg-miniapp #catalog-search {
  min-width: 0;
  width: 100%;
  font-size: 14px;
  padding: 10px 12px;
}

body.tg-miniapp .product {
  border-radius: 14px;
  padding: 8px;
  gap: 6px;
  box-shadow: var(--puff);
}
body.tg-miniapp .product img,
body.tg-miniapp .product .image {
  border-radius: 10px;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: center;
  background: transparent;
}
body.tg-miniapp .product .image:not(img) {
  aspect-ratio: 4 / 3;
  background: #2a2a2c;
}
body.tg-miniapp .product h3 {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 650;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
body.tg-miniapp .product p { font-size: 13px; }
body.tg-miniapp .product button {
  width: 100%;
  padding: 9px 10px;
  font-size: 12px;
  box-shadow: none;
}
body.tg-miniapp .product select {
  width: 100%;
  font-size: 12px;
}

body.tg-miniapp .feature-grid {
  grid-template-columns: 1fr;
  gap: 8px;
}
body.tg-miniapp .feature-grid article {
  padding: 12px 14px;
  border-radius: 14px;
  font-family: var(--font-sans);
  font-size: 13px;
}

body.tg-miniapp .text {
  border-radius: 16px;
  padding: 14px;
}

/* Kill page-level 100vw blowouts inside miniapp */
body.tg-miniapp .cart-drawer {
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100% !important;
  max-width: 100% !important;
  max-height: min(86dvh, 720px);
  border-radius: 18px 18px 0 0;
  transform: translateY(110%);
  transition: transform 0.22s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: none !important;
  overscroll-behavior: contain;
}
body.tg-miniapp .cart-drawer.open { transform: translateY(0); }

body.tg-miniapp .modal-backdrop {
  align-items: end;
  padding: 0;
  backdrop-filter: none;
}
body.tg-miniapp .checkout-card,
body.tg-miniapp .success-card,
body.tg-miniapp .profile-card {
  width: 100%;
  max-height: 94dvh;
  overflow: auto;
  border-radius: 18px 18px 0 0;
  padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px));
}
body.tg-miniapp .product-detail {
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  color: #171717;
  max-height: 94dvh;
}
body.tg-miniapp .product-detail-media img,
body.tg-miniapp .product-detail-media .image {
  aspect-ratio: auto;
  max-height: none;
  object-fit: contain;
}
body.tg-miniapp .product-detail-body {
  min-height: 72px;
}
body.tg-miniapp .checkout-grid { grid-template-columns: 1fr; }
body.tg-miniapp .order-summary { position: static; }

body.tg-miniapp.has-tg-mainbutton #app {
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}
body.tg-miniapp.has-tg-mainbutton .tg-cart-fallback {
  display: none;
}

/* Always compact on phones even without TG class */
@media (max-width: 640px) {
  .sf-aurora, .sf-island, .hero::after { display: none !important; }
  #app {
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px 24px;
  }
  header {
    top: 0;
    padding: 10px 12px;
    border-radius: 16px;
    animation: none;
    backdrop-filter: none;
  }
  header b, .shop-logo {
    font-family: var(--font-sans);
    font-size: 15px;
  }
  main { gap: 16px; margin-top: 12px; }
  .hero {
    min-height: 0;
    padding: 16px;
    border-radius: 18px;
    animation: none;
    align-content: start;
  }
  .hero h1 {
    font-family: var(--font-sans);
    font-size: 22px;
    max-width: 100%;
    line-height: 1.15;
  }
  .hero p { font-size: 13px; max-width: 100%; }
  .hero button, .hero-cta {
    width: 100%;
    justify-content: center;
    box-shadow: none;
  }
  section h2 {
    font-family: var(--font-sans);
    font-size: 18px;
  }
  .grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .product { min-width: 0; max-width: 100%; overflow: hidden; }
  .product img, .product .image { max-width: 100% !important; width: 100% !important; }
  .product { animation: none; border-radius: 14px; padding: 8px; }
  .product h3 { font-family: var(--font-sans); font-size: 13px; }
  .cart-drawer {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%; max-height: 86dvh;
    border-radius: 18px 18px 0 0;
    transform: translateY(110%);
  }
  .cart-drawer.open { transform: translateY(0); }
  .checkout-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
}

.vitrina-top{display:grid;gap:10px;margin:0 0 18px}
.vitrina-chips{display:flex;gap:8px;overflow:auto;padding:2px 2px 4px;scrollbar-width:none}
.vitrina-chips::-webkit-scrollbar{display:none}
.vitrina-sort,.vitrina-chip{
  border:0;border-radius:999px;background:var(--surface,#2c2c2e);color:var(--text,#f5f5f7);
  padding:10px 14px;font:650 13px/1 "Plus Jakarta Sans",system-ui,sans-serif;white-space:nowrap;cursor:pointer;
}
.vitrina-sort{width:40px;height:40px;padding:0;border-radius:50%}
.vitrina-chip.on{background:#fff;color:#111}
.products > .vitrina-chips{margin:0 0 10px}
.products > .cat-nav-inline{display:grid;gap:8px;margin:0 0 10px}
.catalog-head.is-search-only{margin-top:0}
.vitrina-top,
.vitrina-carousel,
.vitrina-tiles,
.vitrina-tile{
  visibility:visible !important;
  opacity:1 !important;
}
.vitrina-carousel{display:grid;gap:10px}
.vitrina-carousel-stage{
  position:relative;
  width:100%;
  aspect-ratio:2 / 1;
  border-radius:22px;
  overflow:hidden;
  background:#1a1a1c;
  box-sizing:border-box;
}
@supports not (aspect-ratio: 2 / 1){
  .vitrina-carousel-stage{
    height:0;
    padding:0 0 50%;
  }
}
/* Fixed banner frame: stacked slides with smooth crossfade. */
.vitrina-carousel .vitrina-banner{
  position:absolute;
  inset:0;
  display:block !important;
  width:100% !important;
  height:100% !important;
  aspect-ratio:auto;
  border-radius:22px;
  overflow:hidden;
  background:#1a1a1c;
  color:#fff;
  text-decoration:none;
  box-sizing:border-box;
  min-height:0;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  z-index:0;
  transition:opacity .85s ease, visibility .85s ease;
}
.vitrina-carousel .vitrina-banner.is-active{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  z-index:1;
}
.vitrina-banner img,
.vitrina-banner-ph{
  position:absolute;
  inset:0;
  width:100% !important;
  height:100% !important;
  max-width:none !important;
  max-height:none !important;
  min-height:0;
  object-fit:cover;
  object-position:center;
  display:block !important;
  border-radius:22px;
  background:#1a1a1c;
}
.vitrina-banner-ph{background:linear-gradient(135deg,#151515,#2d2d2d)}
.vitrina-banner-copy{position:absolute;right:16px;bottom:16px;max-width:58%;text-align:right;text-shadow:0 2px 12px rgba(0,0,0,.7)}
.vitrina-banner.image-only .vitrina-banner-copy{display:none}
.vitrina-banner-copy b{display:block;font-size:clamp(16px,4.2vw,22px);line-height:1.15;letter-spacing:.01em}
.vitrina-banner-copy small{display:block;margin-top:4px;font-size:12px;opacity:.88}
.vitrina-dots{display:flex;justify-content:center;gap:7px}
.vitrina-dots button{
  width:7px;height:7px;border:0;border-radius:50%;
  background:rgba(255,255,255,.28);padding:0;cursor:pointer;
  transition:background .25s ease, transform .25s ease;
}
.vitrina-dots button.on{background:#fff;transform:scale(1.15)}
@media (prefers-reduced-motion: reduce){
  .vitrina-carousel .vitrina-banner{transition:none}
  .vitrina-dots button{transition:none}
}
/* 2 equal columns: padding gutters inside 50% so total never exceeds 100%
   (margin-based calc(50%-5px) was expanding the page in Telegram iOS). */
.vitrina-tiles{
  display:block !important;
  width:100% !important;
  max-width:100% !important;
  box-sizing:border-box;
  padding:0;
  margin:0;
  font-size:0;
  letter-spacing:0;
  overflow:hidden;
}
.vitrina-tiles::after{
  content:"";
  display:table;
  clear:both;
}
.vitrina-tile{
  display:grid;
  grid-template-columns:36px minmax(0,1fr);
  gap:10px;
  align-items:center;
  width:100%;
  min-width:0;
  min-height:88px;
  padding:12px;
  border-radius:18px;
  box-sizing:border-box;
  background:var(--surface,#2c2c2e);
  color:var(--text,#fff);
  text-decoration:none;
  border:1px solid transparent;
  overflow:hidden;
  font-size:13px;
}
.vitrina-tile.image-only{
  float:left !important;
  display:block !important;
  width:50% !important;
  max-width:50% !important;
  min-width:0 !important;
  min-height:0 !important;
  height:auto !important;
  margin:0 !important;
  padding:0 5px 10px !important;
  box-sizing:border-box !important;
  background:transparent !important;
  border:0 !important;
  border-radius:18px;
  overflow:hidden;
  font-size:0;
}
.vitrina-tile.image-only:nth-child(2n){
  margin-right:0 !important;
}
.vitrina-tile-media{
  position:relative;
  display:block;
  width:100%;
  max-width:100%;
  aspect-ratio:1 / 1;
  overflow:hidden;
  border-radius:18px;
  background:#2a2a2c;
}
@supports not (aspect-ratio: 1 / 1){
  .vitrina-tile-media{
    height:0;
    padding:0 0 100%;
  }
}
.vitrina-tile.image-only img{
  position:absolute;
  left:0;top:0;right:0;bottom:0;
  width:100% !important;
  height:100% !important;
  max-width:100% !important;
  max-height:100% !important;
  object-fit:cover;
  object-position:center;
  display:block !important;
  border-radius:18px;
  background:#2a2a2c;
}
.vitrina-tile:hover{border-color:rgba(255,255,255,.18)}
.vitrina-tile.image-only:hover{border-color:transparent;opacity:.96}
html.tg-miniapp .vitrina-tiles,
body.tg-miniapp .vitrina-tiles {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}
html.tg-miniapp .vitrina-tile.image-only,
body.tg-miniapp .vitrina-tile.image-only {
  float: left !important;
  width: 50% !important;
  max-width: 50% !important;
  margin: 0 !important;
  padding: 0 5px 10px !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
}
html.tg-miniapp .vitrina-banner,
body.tg-miniapp .vitrina-banner {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}
html.tg-miniapp .vitrina-banner img,
html.tg-miniapp .vitrina-tile-media,
html.tg-miniapp .vitrina-tile.image-only img,
body.tg-miniapp .vitrina-banner img,
body.tg-miniapp .vitrina-tile-media,
body.tg-miniapp .vitrina-tile.image-only img {
  max-width: 100% !important;
}
.vitrina-tile:not(.image-only) img,.vitrina-tile-ico{
  width:36px;height:36px;border-radius:12px;object-fit:contain;background:#111;
  display:grid;place-items:center;flex-shrink:0;
}
.vitrina-tile > div{min-width:0}
.vitrina-tile b{
  display:block;
  font-size:11px;
  line-height:1.3;
  letter-spacing:.01em;
  text-transform:uppercase;
  white-space:normal !important;
  overflow:visible !important;
  text-overflow:unset !important;
  overflow-wrap:break-word;
}
.vitrina-tile small{
  display:block;
  margin-top:3px;
  font-size:11px;
  line-height:1.3;
  color:var(--muted,#a1a1a6);
  white-space:normal !important;
  overflow:visible !important;
  text-overflow:unset !important;
  overflow-wrap:break-word;
}
body.has-vitrina .product,body.tg-miniapp .product{background:#fff;color:#171717;border-radius:18px}
body.has-vitrina .product .heart,body.tg-miniapp .product .wish{color:#9a9a9a}
body.has-vitrina header.vitrina-header{background:transparent;border:0;box-shadow:none}
.invite-share{
  margin-top:14px;
  padding:14px;
  border-radius:14px;
  background:rgba(0,0,0,.04);
  text-align:left;
  display:grid;
  gap:10px;
}
.invite-share .invite-code,
.invite-share .invite-link{
  display:block;
  padding:10px 12px;
  border-radius:10px;
  background:rgba(255,255,255,.7);
  word-break:break-all;
  font-size:13px;
}
.invite-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.invite-actions a,
.invite-actions button{
  flex:1 1 140px;
}

@media (prefers-reduced-motion: reduce) {
  .sf-island, .hero::after, header, .hero, .product { animation: none !important; }
}

.product{content-visibility:auto;contain-intrinsic-size:320px;}
body.tg-miniapp .product,
html.tg-miniapp .product{content-visibility:visible;contain-intrinsic-size:auto;}
.product-cover{background:transparent;}
body.tg-miniapp .product-cover{background:transparent;}

/* ===== Telegram tab bar + profile ===== */
.tg-tabbar{
  position:fixed;
  left:0;right:0;bottom:0;
  z-index:40;
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:0;
  min-height:64px;
  padding:6px 4px calc(6px + env(safe-area-inset-bottom,0px));
  background:#1c1c1e;
  border-top:1px solid rgba(255,255,255,.08);
}
.tg-tab{
  appearance:none;
  border:0;
  background:transparent;
  color:#8e8e93;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:3px;
  min-width:0;
  padding:6px 2px;
  cursor:pointer;
  font:inherit;
}
.tg-tab.on{color:#0a84ff}
.tg-tab-ico{
  position:relative;
  width:28px;height:28px;
  display:grid;
  place-items:center;
}
.tg-tab-ico svg{display:block}
.tg-tab-ico .sf-ico{overflow:visible}
.tg-tab-ico .sf-fill{display:none}
.tg-tab-ico .sf-outline{display:block}
.tg-tab.on .sf-fill{display:block}
.tg-tab.on .sf-outline{display:none}
.tg-tab .sf-ico{transform:translateY(.5px)}
.tab-avatar{
  width:24px;height:24px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#34c759;
  color:#fff;
  font-size:9px;
  font-weight:800;
  letter-spacing:.02em;
  line-height:1;
  overflow:hidden;
}
.tg-tab.on .tab-avatar{
  box-shadow:0 0 0 2px #0a84ff;
}
.tg-tab-label{
  font-size:10px;
  line-height:1.1;
  font-weight:600;
}
.tg-tab-badge{
  position:absolute;
  top:-4px;right:-8px;
  min-width:16px;height:16px;
  padding:0 4px;
  border-radius:999px;
  background:#ff3b30;
  color:#fff;
  font-size:10px;
  font-weight:700;
  display:grid;
  place-items:center;
  font-style:normal;
}
body.has-tabbar #app,
body.has-tabbar main.has-tabbar{
  padding-bottom:calc(78px + env(safe-area-inset-bottom,0px));
}
body.tg-miniapp.has-tabbar .cart-drawer{
  bottom:calc(64px + env(safe-area-inset-bottom,0px));
}
.tg-page{padding:8px 4px 24px}
.tg-page-title{
  margin:8px 8px 16px;
  font-size:28px;
  letter-spacing:-.03em;
}
.tg-profile{padding:10px 0 24px}
.tg-profile-hero{
  display:grid;
  justify-items:center;
  gap:8px;
  padding:28px 16px 18px;
  text-align:center;
}
.tg-ref-card{
  margin:0 12px 12px;
  padding:14px;
  border-radius:16px;
  background:#2c2c2e;
  color:#f5f5f7;
  display:grid;
  gap:8px;
}
.tg-ref-card > b{
  font-size:15px;
  font-weight:700;
}
.tg-ref-card > p{
  margin:0;
  color:#a1a1a6;
  font-size:13px;
  line-height:1.35;
}
.tg-ref-card .invite-code,
.tg-ref-card .invite-link{
  display:block;
  padding:10px 12px;
  border-radius:12px;
  background:rgba(255,255,255,.08);
  color:#f5f5f7;
  font-size:13px;
  word-break:break-all;
}
.tg-ref-card .invite-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-top:4px;
}
.tg-ref-card .tg-ref-share,
.tg-ref-card .tg-ref-copy{
  appearance:none;
  border:0;
  border-radius:12px;
  padding:11px 12px;
  font:inherit;
  font-size:14px;
  font-weight:600;
  text-align:center;
  text-decoration:none;
  cursor:pointer;
}
.tg-ref-card .tg-ref-share{
  background:#30d158;
  color:#003a12;
}
.tg-ref-card .tg-ref-copy{
  background:#3a3a3c;
  color:#f5f5f7;
}
.tg-avatar{
  width:92px;height:92px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#34c759;
  color:#fff;
  font-size:34px;
  font-weight:800;
  letter-spacing:.02em;
  overflow:hidden;
}
.tg-avatar.has-photo,
.tab-avatar.has-photo{
  background:transparent;
  padding:0;
}
.tg-avatar img,
.tab-avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  border-radius:50%;
}
.tg-profile-hero h2{
  margin:0;
  font-size:24px;
  font-weight:750;
  letter-spacing:-.02em;
  color:var(--text,#f5f5f7);
}
.tg-username{
  color:#8e8e93;
  font-size:14px;
}
.tg-menu{
  display:grid;
  gap:10px;
  padding:0 12px;
}
.tg-menu-row{
  width:100%;
  border:0;
  border-radius:16px;
  background:#2c2c2e;
  color:#f5f5f7;
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 14px;
  text-align:left;
  cursor:pointer;
  font:inherit;
}
.tg-menu-ico{
  width:34px;height:34px;
  border-radius:10px;
  flex:0 0 34px;
  display:grid;
  place-items:center;
  color:#fff;
  background:#34c759;
  position:relative;
}
.tg-menu-ico::before{
  content:"";
  width:16px;height:16px;
  background:currentColor;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 11c1.7 0 3-1.3 3-3s-1.3-3-3-3-3 1.3-3 3 1.3 3 3 3Zm-8 0c1.7 0 3-1.3 3-3S9.7 5 8 5 5 6.3 5 8s1.3 3 3 3Zm0 2c-2.3 0-7 1.2-7 3.5V19h14v-2.5C15 14.2 10.3 13 8 13Zm8 0c-.3 0-.7 0-1 .1 1.2.9 2 2.1 2 3.4V19h6v-2.5c0-2.3-4.7-3.5-7-3.5Z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 11c1.7 0 3-1.3 3-3s-1.3-3-3-3-3 1.3-3 3 1.3 3 3 3Zm-8 0c1.7 0 3-1.3 3-3S9.7 5 8 5 5 6.3 5 8s1.3 3 3 3Zm0 2c-2.3 0-7 1.2-7 3.5V19h14v-2.5C15 14.2 10.3 13 8 13Zm8 0c-.3 0-.7 0-1 .1 1.2.9 2 2.1 2 3.4V19h6v-2.5c0-2.3-4.7-3.5-7-3.5Z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.tg-menu-ico.tone-orders{background:#ff9f0a}
.tg-menu-ico.tone-orders::before{
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 7h16l-1.2 12.2A2 2 0 0 1 16.8 21H7.2a2 2 0 0 1-2-1.8L4 7Zm4-3h8l1 3H7l1-3Z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 7h16l-1.2 12.2A2 2 0 0 1 16.8 21H7.2a2 2 0 0 1-2-1.8L4 7Zm4-3h8l1 3H7l1-3Z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.tg-menu-ico.tone-bonus{background:#bf5af2}
.tg-menu-ico.tone-bonus::before{
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2 9.5 8.5 3 9.3l5 4.6L6.5 20 12 16.7 17.5 20 16 13.9l5-4.6-6.5-.8L12 2Z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2 9.5 8.5 3 9.3l5 4.6L6.5 20 12 16.7 17.5 20 16 13.9l5-4.6-6.5-.8L12 2Z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.tg-menu-ico.tone-ref{background:#30d158}
.tg-menu-ico.tone-ref::before{
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 11c1.7 0 3-1.3 3-3s-1.3-3-3-3-3 1.3-3 3 1.3 3 3 3Zm-8 0c1.7 0 3-1.3 3-3S9.7 5 8 5 5 6.3 5 8s1.3 3 3 3Zm0 2c-2.3 0-7 1.2-7 3.5V19h14v-2.5C15 14.2 10.3 13 8 13Zm8 0c-.3 0-.7 0-1 .1 1.2.9 2 2.1 2 3.4V19h6v-2.5c0-2.3-4.7-3.5-7-3.5Z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 11c1.7 0 3-1.3 3-3s-1.3-3-3-3-3 1.3-3 3 1.3 3 3 3Zm-8 0c1.7 0 3-1.3 3-3S9.7 5 8 5 5 6.3 5 8s1.3 3 3 3Zm0 2c-2.3 0-7 1.2-7 3.5V19h14v-2.5C15 14.2 10.3 13 8 13Zm8 0c-.3 0-.7 0-1 .1 1.2.9 2 2.1 2 3.4V19h6v-2.5c0-2.3-4.7-3.5-7-3.5Z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.tg-menu-ico.tone-addr{background:#64d2ff}
.tg-menu-ico.tone-addr::before{
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a7 7 0 0 0-7 7c0 5.3 7 13 7 13s7-7.7 7-13a7 7 0 0 0-7-7Zm0 9.5A2.5 2.5 0 1 1 12 6a2.5 2.5 0 0 1 0 5.5Z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a7 7 0 0 0-7 7c0 5.3 7 13 7 13s7-7.7 7-13a7 7 0 0 0-7-7Zm0 9.5A2.5 2.5 0 1 1 12 6a2.5 2.5 0 0 1 0 5.5Z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.tg-menu-ico.tone-support{background:#ffd60a;color:#1c1c1e}
.tg-menu-ico.tone-support::before{
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 4h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-5 4v-4H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 4h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-5 4v-4H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.tg-menu-text{
  flex:1;
  min-width:0;
  font-size:15px;
  font-weight:600;
  line-height:1.25;
}
.tg-menu-value{
  color:#8e8e93;
  font-size:14px;
}
.tg-menu-chev{
  color:#636366;
  font-size:22px;
  line-height:1;
}
.tg-profile-panel{
  margin:14px 12px 0;
  padding:14px;
  border-radius:16px;
  background:#2c2c2e;
  color:#f5f5f7;
}
.tg-panel-head{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:12px;
}
.tg-panel-head button{
  border:0;
  background:transparent;
  color:#0a84ff;
  font:inherit;
  font-weight:600;
  cursor:pointer;
  padding:0;
}
.tg-panel-head b{font-size:16px}
.tg-profile-panel .invite-share,
.tg-profile-panel .profile-orders,
.tg-profile-panel .loyalty-card{
  background:transparent;
  color:inherit;
}
.tg-profile-panel .invite-code,
.tg-profile-panel .invite-link{
  background:rgba(255,255,255,.08);
  color:#f5f5f7;
}
body.tg-miniapp .tg-tabbar{display:grid}
body:not(.tg-miniapp):not(.has-vitrina) .tg-tabbar{display:none}

.ref-sheet-backdrop{
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.62);
  padding:16px 12px calc(16px + env(safe-area-inset-bottom,0px));
}
body.tg-miniapp .ref-sheet,
.ref-sheet {
  max-height: min(86dvh, 720px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}
body.tg-miniapp.has-tabbar .ref-sheet {
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  max-height: min(82dvh, 720px);
}
body.tg-miniapp .modal-backdrop.ref-sheet-backdrop {
  z-index: 80;
  align-items: center;
  padding: 16px 12px calc(72px + env(safe-area-inset-bottom, 0px));
}
.ref-sheet,
.ref-sheet-modal{
  width:min(100%,440px);
  margin:0 auto;
  border-radius:22px;
  background:#2c2c2e;
  color:#f5f5f7;
  padding:22px 18px 20px;
  display:grid;
  gap:12px;
  position:relative;
  box-shadow:0 24px 60px rgba(0,0,0,.45);
  animation:ref-sheet-up .28s ease both;
}
@keyframes ref-sheet-up{
  from{transform:translateY(18px) scale(.98);opacity:0}
  to{transform:translateY(0) scale(1);opacity:1}
}
.ref-sheet-close{
  position:absolute;
  top:12px;right:12px;
  width:34px;height:34px;
  border:0;border-radius:50%;
  background:rgba(255,255,255,.08);
  color:#fff;
  font-size:20px;
  cursor:pointer;
  z-index:2;
}
.ref-sheet-ico{
  width:64px;height:64px;
  margin:8px auto 0;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:var(--terracotta,#c45a32);
  color:#fff;
}
.ref-stats{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
}
.ref-stat{
  display:grid;
  gap:4px;
  justify-items:center;
  text-align:center;
  padding:12px 8px;
  border-radius:14px;
  background:rgba(255,255,255,.06);
}
.ref-stat b{
  font-size:18px;
  font-weight:700;
  letter-spacing:.01em;
  font-variant-numeric:tabular-nums;
}
.ref-stat small{
  color:#8e8e93;
  font-size:11px;
  line-height:1.25;
}
.ref-sheet h2{
  margin:0;
  text-align:center;
  font-size:22px;
  letter-spacing:-.02em;
}
.ref-sheet-text{
  margin:0;
  text-align:center;
  color:#a1a1a6;
  font-size:14px;
  line-height:1.4;
}
.ref-consent{
  display:flex;
  align-items:flex-start;
  gap:12px;
  font-size:14px;
  color:#d1d1d6;
  line-height:1.45;
  cursor:pointer;
  text-align:left;
  position:relative;
}
.ref-consent-input{
  position:absolute;
  opacity:0;
  width:1px;height:1px;
  margin:0;padding:0;
  clip:rect(0 0 0 0);
}
.ref-consent-box{
  flex:0 0 auto;
  width:26px;
  height:26px;
  margin-top:0;
  border-radius:8px;
  border:2px solid var(--terracotta,#c45a32);
  background:transparent;
  box-sizing:border-box;
  position:relative;
}
.ref-consent-input:checked + .ref-consent-box{
  background:var(--terracotta,#c45a32);
  border-color:var(--terracotta,#c45a32);
}
.ref-consent-input:checked + .ref-consent-box::after{
  content:"";
  position:absolute;
  left:50%;
  top:45%;
  width:7px;
  height:12px;
  border:solid #fff;
  border-width:0 2.5px 2.5px 0;
  transform:translate(-50%,-55%) rotate(45deg);
  box-sizing:border-box;
}
.ref-consent-input:focus-visible + .ref-consent-box{
  outline:2px solid rgba(196,90,50,.45);
  outline-offset:2px;
}
.ref-consent-text{
  flex:1;
  min-width:0;
  text-align:left;
  text-wrap:pretty;
}
.ref-policy-link{
  display:inline;
  border:0 !important;
  background:none !important;
  padding:0 !important;
  margin:0;
  width:auto !important;
  height:auto !important;
  border-radius:0 !important;
  color:var(--terracotta,#c45a32) !important;
  font:inherit !important;
  font-weight:600 !important;
  font-size:inherit !important;
  line-height:inherit !important;
  text-align:left !important;
  cursor:pointer;
  text-decoration:underline;
  text-underline-offset:2px;
  box-shadow:none !important;
}
.ref-sheet-error{
  margin:0;
  color:#ff453a;
  font-size:13px;
  text-align:center;
}
.ref-sheet-btn{
  appearance:none;
  border:0;
  border-radius:14px;
  padding:14px 16px;
  background:var(--terracotta,#c45a32);
  color:#fff;
  font:inherit;
  font-weight:700;
  font-size:16px;
  text-align:center;
  text-decoration:none;
  cursor:pointer;
}
.ref-sheet-btn.ref-share-btn,
.ref-sheet-btn[data-invite-share]{
  background:var(--terracotta,#c45a32);
  color:#fff;
}
.ref-sheet-btn:disabled{
  opacity:.7;
  cursor:not-allowed;
}
.ref-sheet-btn.ghost{
  background:#3a3a3c;
  color:#f5f5f7;
}
.ref-sheet .invite-code,
.ref-sheet .invite-link,
.ref-sheet .invite-link-a{
  display:block;
  padding:12px;
  border-radius:12px;
  background:rgba(255,255,255,.08);
  color:#f5f5f7;
  font-size:13px;
  text-decoration:none;
  white-space:nowrap;
  overflow-x:auto;
  overflow-y:hidden;
  word-break:normal;
  overflow-wrap:normal;
  -webkit-overflow-scrolling:touch;
}
.ref-sheet-actions{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
  margin-top:4px;
}
.invite-code-wrap{display:grid;gap:6px;min-width:0}
.invite-code-wrap small{color:#8e8e93;font-size:12px}
.ref-sheet .invite-code-btn,
.ref-sheet .invite-link-btn{
  appearance:none;
  border:0;
  width:100%;
  text-align:left;
  cursor:pointer;
  font:inherit;
}
.ref-sheet .invite-code-btn{
  font-size:20px;
  font-weight:700;
  letter-spacing:.04em;
  text-align:center;
  padding:14px 12px;
}
a.invite-link-a,
.invite-link-a,
.invite-link{
  display:block;
  padding:12px 14px;
  border-radius:12px;
  background:rgba(255,255,255,.08);
  color:#f5f5f7;
  text-decoration:none;
  font-size:13px;
  line-height:1.35;
  font-weight:600;
  white-space:nowrap;
  overflow-x:auto;
  overflow-y:hidden;
  word-break:normal;
  overflow-wrap:normal;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
a.invite-link-a::-webkit-scrollbar,
.invite-link-a::-webkit-scrollbar,
.invite-link::-webkit-scrollbar{display:none}
.tg-ref-card .invite-code,
.tg-ref-card .invite-link,
.tg-ref-card .invite-link-a,
.tg-invite-panel .invite-code,
.tg-invite-panel .invite-link,
.tg-invite-panel .invite-link-a,
.tg-profile-panel .invite-code,
.tg-profile-panel .invite-link,
.tg-profile-panel .invite-link-a{
  background:rgba(255,255,255,.08);
  color:#f5f5f7;
  text-decoration:none;
  white-space:nowrap;
  overflow-x:auto;
  word-break:normal;
}
.tg-invite-panel,
.tg-ref-card{
  display:grid;
  gap:12px;
}
.tg-ref-card .ref-sheet-actions,
.tg-invite-panel .ref-sheet-actions{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
}
.ref-web-link{display:none!important}

/* Flavor list mode (per category / subcategory) */
.flavor-board{
  display:grid;
  gap:14px;
  margin-top:8px;
}
.flavor-hero{
  position:relative;
  border-radius:18px;
  overflow:hidden;
  background:#2c2c2e;
  aspect-ratio:16/10;
}
.flavor-hero img,
.flavor-hero-ph{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.flavor-hero-ph{
  display:grid;
  place-items:center;
  color:#8e8e93;
  font-size:42px;
  aspect-ratio:16/10;
}
.flavor-hero-meta{
  position:absolute;
  left:0;right:0;bottom:0;
  padding:16px 14px 14px;
  background:linear-gradient(transparent,rgba(0,0,0,.72));
  color:#fff;
}
.flavor-hero-meta small{
  display:block;
  opacity:.8;
  font-size:12px;
  margin-bottom:4px;
}
.flavor-hero-meta h2{
  margin:0;
  font-size:20px;
  letter-spacing:-.02em;
}
.flavor-list{
  display:grid;
  gap:8px;
}
.flavor-row{
  appearance:none;
  border:0;
  width:100%;
  display:flex;
  align-items:center;
  gap:12px;
  text-align:left;
  padding:12px 14px;
  border-radius:14px;
  background:var(--surface,#2c2c2e);
  color:var(--text,#f5f5f7);
  font:inherit;
  cursor:pointer;
  box-shadow:0 0 0 1px rgba(255,255,255,.06) inset;
}
body:not(.tg-miniapp):not(.has-vitrina) .flavor-row{
  background:#fff;
  color:#171717;
  box-shadow:0 0 0 1px rgba(0,0,0,.08) inset;
}
.flavor-row.is-on{
  box-shadow:0 0 0 2px var(--terracotta,#c45a32) inset;
}
.flavor-row.is-out{
  opacity:.55;
  cursor:not-allowed;
}
.flavor-check{
  flex:0 0 auto;
  width:24px;
  height:24px;
  border-radius:8px;
  border:2px solid var(--terracotta,#c45a32);
  box-sizing:border-box;
  position:relative;
  background:transparent;
}
.flavor-row.is-on .flavor-check{
  background:var(--terracotta,#c45a32);
}
.flavor-row.is-on .flavor-check::after{
  content:"";
  position:absolute;
  left:50%;
  top:45%;
  width:7px;
  height:12px;
  border:solid #fff;
  border-width:0 2.5px 2.5px 0;
  transform:translate(-50%,-55%) rotate(45deg);
}
.flavor-text{
  display:grid;
  gap:2px;
  min-width:0;
}
.flavor-text b{
  font-size:15px;
  font-weight:650;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.flavor-text small{
  color:var(--muted,#a1a1a6);
  font-size:13px;
}
.flavor-bar{
  position:sticky;
  bottom:calc(12px + env(safe-area-inset-bottom,0px));
  z-index:5;
  padding-top:4px;
}
body.tg-miniapp.has-tabbar .flavor-bar{
  bottom:calc(72px + env(safe-area-inset-bottom,0px));
}
.flavor-add{
  appearance:none;
  border:0;
  width:100%;
  border-radius:14px;
  padding:14px 16px;
  background:var(--terracotta,#c45a32);
  color:#fff;
  font:inherit;
  font-weight:700;
  font-size:16px;
  cursor:pointer;
}
.flavor-add:disabled{
  opacity:.55;
  cursor:not-allowed;
}
.showcase-flavors .catalog-head{
  margin-bottom:4px;
}

