:root {
  --lilac: #585E92;
  --lilac-dark: #4A507C;
  --lilac-soft: rgba(88, 94, 146, 0.1);
  --lilac-border: rgba(88, 94, 146, 0.45);
  --bg: #F7F7FA;
  --bg-pink: #FFF9F9;
  --card: #ffffff;
  --text: #1F1F24;
  --text-body: #2D2D2D;
  --muted: #6B6B78;
  --border: #E4E4EC;
  --success: #2E7D32;
  --danger: #D94848;
  --radius: 14px;
  --radius-sm: 12px;
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;
  --shadow: 0 8px 24px rgba(31, 31, 36, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow-x: hidden; }
[hidden] { display: none !important; }
body {
  font-family: var(--font-body);
  color: var(--text-body);
  background: var(--bg);
  overflow: hidden;
  max-width: 100vw;
}

/* Dark scheme: New Year theme + system dark (default/winter) */
body[data-scheme="dark"],
html[data-scheme="dark"] body {
  --lilac: #9aa3d4;
  --lilac-dark: #b4bbe0;
  --lilac-soft: rgba(154, 163, 212, 0.16);
  --lilac-border: rgba(154, 163, 212, 0.45);
  --bg: #121820;
  --bg-pink: #1a1520;
  --card: #1b2433;
  --text: #f2f4f8;
  --text-body: #e8ecf4;
  --muted: #9aa3b5;
  --border: #2e3a4d;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
body[data-scheme="dark"] .composer {
  background: linear-gradient(180deg, transparent, rgba(18, 24, 32, 0.92) 24%);
}
body[data-scheme="dark"] .bottom-nav,
body[data-scheme="dark"] .top,
body[data-scheme="dark"] .sheet,
body[data-scheme="dark"] .sheet-head {
  background: var(--card);
}
body[data-scheme="dark"] .msg.assistant .bubble,
body[data-scheme="dark"] .profile-card,
body[data-scheme="dark"] .catalog-card,
body[data-scheme="dark"] .cart-row,
body[data-scheme="dark"] .notif-item {
  background: var(--card);
  color: var(--text-body);
  border-color: var(--border);
}
body[data-scheme="dark"] .profile-link {
  color: var(--text);
  border-bottom-color: var(--border);
}
body[data-scheme="dark"] .moderation-banner {
  background: #3a1f24;
  border-color: rgba(217, 72, 72, 0.45);
  color: #ffd4d4;
}
body[data-scheme="dark"] .checkout-note a,
body[data-scheme="dark"] .profile-link:hover {
  color: var(--lilac);
}
body[data-hero-theme="newyear"] .top {
  background: rgba(27, 38, 59, 0.96);
  border-bottom-color: #3a4a5c;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #f7ede2 0%, #ffffff 100%);
  transition: background 0.4s ease;
}
body[data-hero-theme="default"] .atmosphere {
  background: linear-gradient(135deg, #f7ede2 0%, #fff 100%);
}
body[data-hero-theme="spring"] .atmosphere {
  background: linear-gradient(145deg, #fff5f8 0%, #fff9f0 45%, #ffffff 100%);
}
body[data-hero-theme="summer"] .atmosphere {
  background: linear-gradient(135deg, #f0fff4 0%, #f8fff0 40%, #fffef8 100%);
}
body[data-hero-theme="autumn"] .atmosphere {
  background: linear-gradient(135deg, #fff6ed 0%, #ffefd9 50%, #fffaf5 100%);
}
body[data-hero-theme="winter"] .atmosphere {
  background: linear-gradient(180deg, #ffffff, #f0f7ff);
}
body[data-hero-theme="newyear"] .atmosphere {
  background: linear-gradient(145deg, #0d1b2a 0%, #1b263b 35%, #2d3a4f 70%, #1a2332 100%);
}
body[data-hero-theme="march8"] .atmosphere {
  background: linear-gradient(135deg, #fff0f5 0%, #ffe4ef 40%, #fff8fb 100%);
}

.hero-theme-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.hero-particle {
  position: absolute;
  top: -5%;
  opacity: 0;
  animation-name: hero-particle-fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform, opacity;
}
@keyframes hero-particle-fall {
  0% { transform: translate3d(0, -2vh, 0) rotate(0deg); opacity: 0; }
  8% { opacity: 0.9; }
  100% {
    transform: translate3d(var(--drift, 0px), 105vh, 0) rotate(var(--spin, 720deg));
    opacity: 0.15;
  }
}
.hero-particle--petal-sakura {
  width: 9px; height: 12px;
  border-radius: 50% / 62% 62% 38% 38%;
  background: linear-gradient(145deg, #ffb7c5, #ffe0e8);
}
.hero-particle--petal-summer {
  width: 11px; height: 14px;
  border-radius: 40% 60% 50% 50%;
  background: linear-gradient(160deg, #81c784, #c8e6c9);
}
.hero-particle--spark-summer {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255, 235, 120, 0.85);
  box-shadow: 0 0 6px rgba(255, 220, 100, 0.6);
}
.hero-particle--leaf-autumn {
  width: 13px; height: 17px;
  border-radius: 0 80% 0 80%;
  background: linear-gradient(135deg, #d84315, #ff8a65, #ffcc80);
}
.hero-particle--snow {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(144, 202, 249, 0.95);
  box-shadow: 0 0 4px rgba(66, 165, 245, 0.45);
}
body[data-hero-theme="newyear"] .hero-particle--snow {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.65);
}
.hero-particle--heart-march {
  width: 14px; height: 12px;
  background: radial-gradient(circle at 30% 30%, #fce4ec, #f06292 55%, #c2185b);
  clip-path: path("M7 11 C7 11 0 7 0 3.5 C0 1.5 1.5 0 3.5 0 C5 0 6.2 0.8 7 2 C7.8 0.8 9 0 10.5 0 C12.5 0 14 1.5 14 3.5 C14 7 7 11 7 11 Z");
}

/* Logo bloom (site parity) */
.logo-wordmark { color: var(--lilac); display: inline-block; }
.logo-wordmark__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 10px 4px;
  min-height: 2.4rem;
}
.logo-wordmark__stack {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.logo-wordmark__line {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  display: block;
  text-align: center;
  line-height: 1.06;
}
.logo-wordmark__line--lg { font-size: 1.2rem; }
.logo-wordmark__line--sm {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  margin-top: 0.08em;
  font-weight: 500;
}
.logo-bloom {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 0;
  animation: logo-bloom-cycle 5.4s ease-in-out infinite;
  animation-delay: var(--logo-bloom-delay, 0s);
}
.logo-bloom--tl { top: 1px; left: -4px; }
.logo-bloom--tr { top: 4px; right: 0; }
.logo-bloom--bl { bottom: -2px; left: 4px; }
.logo-bloom--br { bottom: 2px; right: -4px; }
@keyframes logo-bloom-cycle {
  0%, 7% { opacity: 0; transform: scale(0.32) rotate(-18deg); filter: brightness(1); }
  20% {
    opacity: 1; transform: scale(1) rotate(2deg);
    filter: brightness(1.12) drop-shadow(0 0 4px rgba(88, 94, 146, 0.85));
  }
  36% {
    opacity: 1; transform: scale(1.09) rotate(-6deg);
    filter: brightness(1.28) drop-shadow(0 0 8px rgba(72, 78, 130, 0.9));
  }
  55% {
    opacity: 0.35; transform: scale(0.84) rotate(5deg);
    filter: brightness(1.04) drop-shadow(0 0 3px rgba(88, 94, 146, 0.35));
  }
  72%, 100% { opacity: 0; transform: scale(0.42) rotate(12deg); filter: brightness(1); }
}

body[data-hero-theme="newyear"] .top {
  background: rgba(27, 38, 59, 0.92);
  border-bottom-color: #3a4a5c;
}
body[data-hero-theme="newyear"] .logo-wordmark,
body[data-hero-theme="newyear"] .logo-bloom__petals { color: #f5f5f5; fill: #f5f5f5; }
body[data-hero-theme="newyear"] .tagline { color: #b0b8c8; }
body[data-hero-theme="newyear"] .ghost {
  background: transparent;
  color: #f5f5f5;
  border-color: #3a4a5c;
}

.theme-list { display: flex; flex-direction: column; gap: 8px; }
.theme-option {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--text-body);
}
.theme-option.is-active { border-color: var(--lilac); background: var(--lilac-soft); }
.theme-swatch {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border);
}
@media (prefers-reduced-motion: reduce) {
  .logo-bloom { animation: none; opacity: 0.5; }
  .hero-theme-particles { display: none; }
}

.app {
  --app-width: 100%;
  --chat-col: 100%;
  position: relative;
  z-index: 1;
  width: var(--app-width);
  max-width: 100%;
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: env(safe-area-inset-top) 0 0;
  background: transparent;
  min-width: 0;
  overflow: hidden;
}

.top {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  min-height: 48px;
  background: transparent;
}
.app-bar-brand {
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  text-decoration: none;
  line-height: 1;
  min-width: 0;
  flex: 1 1 auto;
}
.logo-wordmark--bar {
  color: var(--lilac);
  display: inline-block;
  max-width: 100%;
}
.logo-wordmark--bar .logo-wordmark__inner {
  padding: 1px 4px 2px 12px;
  min-height: 1.55rem;
}
.logo-wordmark--bar .logo-wordmark__line--lg {
  font-size: 0.74rem;
  letter-spacing: 0.09em;
}
.logo-wordmark--bar .logo-wordmark__line--sm {
  font-size: 0.52rem;
  letter-spacing: 0.13em;
  margin-top: 0.05em;
}
.logo-wordmark--bar .logo-bloom--tl {
  top: 0;
  left: -3px;
}
.logo-wordmark--bar .logo-bloom__svg {
  display: block;
  width: 12px;
  height: 12px;
}
body[data-hero-theme="newyear"] .logo-wordmark--bar,
body[data-hero-theme="newyear"] .logo-wordmark--bar .logo-bloom__petals {
  color: #f5f5f5;
  fill: #f5f5f5;
}
.app-bar-menu {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}
.app-bar-menu-bars,
.app-bar-menu-bars::before,
.app-bar-menu-bars::after {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  position: relative;
}
.app-bar-menu-bars::before,
.app-bar-menu-bars::after {
  content: "";
  position: absolute;
  left: 0;
}
.app-bar-menu-bars::before { top: -6px; }
.app-bar-menu-bars::after { top: 6px; }
.app-menu-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 16px 16px;
}
.app-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px;
  background: var(--card);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-body);
  text-align: left;
  cursor: pointer;
}
.app-menu-meta {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.88rem;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-legacy { display: none !important; }
.top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 10px;
  min-width: 0;
}
.brand-block {
  min-width: 0;
  flex: 1 1 auto;
}
.tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.top-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 1 auto;
  max-width: 52%;
}
.top-nav {
  display: none;
}

.city-btn { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.city-sheet-hint { margin: 0 16px 8px; font-size: 0.9rem; }

.ghost {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--lilac);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.ghost:hover { background: var(--lilac-soft); }
.ghost.dark { color: var(--text-body); }

.view-panel {
  overflow-y: auto;
  min-height: 0;
}
#viewChat.feed,
.feed-messages {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#viewChat.feed {
  padding: 12px 16px 18px;
  scroll-behavior: smooth;
  background: transparent;
  min-height: 0;
}
.views-stack {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.views-stack > .view-panel {
  flex: 1;
  min-height: 0;
}

.msg {
  max-width: 100%;
  min-width: 0;
}
.msg.user {
  align-self: flex-end;
  max-width: 88%;
  animation: msg-fade 120ms var(--ease-out) both;
}
.msg.assistant {
  align-self: flex-start;
  width: auto;
  max-width: min(100%, 560px);
}
@keyframes msg-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.bubble {
  padding: 14px 16px;
  border-radius: 16px;
  line-height: 1.45;
  font-size: clamp(0.9rem, 2.6vw, 1rem);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
}
.msg.assistant .bubble {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-body);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}
.msg.user .bubble {
  background: var(--lilac);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Outer wrap is the flex child of .feed — keep overflow off it so height does not collapse */
.cards-wrap {
  flex: 0 0 auto;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  margin-top: 8px;
}
.cards {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 12px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 4px 2px 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.card {
  flex: 0 0 min(240px, 78vw);
  width: min(240px, 78vw);
  max-width: 280px;
  height: max-content;
  scroll-snap-align: start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
}
.card:focus-visible {
  outline: 2px solid var(--lilac);
  outline-offset: 2px;
}
/* Fixed photo height — aspect-ratio inside overflow:hidden flex card clipped price/button */
.card-visual {
  flex: 0 0 132px;
  height: 132px;
  width: 100%;
  background: linear-gradient(135deg, #9AA0C8, #E8EAF6);
  background-size: cover;
  background-position: center;
}
.card-body {
  flex: 0 0 auto;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.card-name {
  font-family: var(--font-body);
  font-size: clamp(0.92rem, 2.5vw, 1rem);
  font-weight: 700;
  margin: 0;
  color: var(--text-body);
  line-height: 1.25;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-desc {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.75rem, 2.2vw, 0.82rem);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.card-more {
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: var(--lilac);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  flex-shrink: 0;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}
.card-delivery {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.2;
  flex-shrink: 0;
}
.price {
  font-weight: 700;
  color: var(--lilac);
  font-size: clamp(0.95rem, 2.6vw, 1.05rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.occasion {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 45%;
  flex-shrink: 1;
}
.card-actions {
  margin-top: 2px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.btn-add {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  border: 0;
  background: var(--lilac);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.btn-add:hover { background: var(--lilac-dark); }
.card-actions .btn-fav {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  margin: 0 !important;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.order-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.order-row:last-child { border-bottom: 0; }
.order-row-main { flex: 1 1 auto; min-width: 0; }
.order-hide-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.order-hide-btn:hover,
.order-hide-btn:focus-visible {
  color: var(--danger, #b42318);
  background: rgba(180, 35, 24, 0.08);
}
.order-hide-btn:disabled {
  opacity: 0.4;
  cursor: wait;
}

.chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-history-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.chat-history-row .chat-history-item {
  flex: 1 1 auto;
  min-width: 0;
}
.chat-history-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
}
.chat-history-actions .ghost {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}
.chat-history-actions .ghost:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.chat-history-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 12px 14px;
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.chat-history-item.is-current {
  border-color: var(--lilac);
  box-shadow: 0 0 0 1px var(--lilac-soft);
}
.chat-history-item strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 4px;
}
.chat-history-item .muted {
  font-size: 0.85rem;
  line-height: 1.35;
}
.chat-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}
.chat-history-badge {
  color: var(--lilac);
  font-weight: 600;
}

.assembly-ready {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(47, 107, 58, 0.08), rgba(255, 255, 255, 0.6));
  border: 1px solid rgba(47, 107, 58, 0.18);
}
.assembly-ready strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ok, #2f6b3a);
}
.assembly-ready-imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.assembly-ready-img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* Product detail sheet */
.product-detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 30, 0.45);
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.product-detail-sheet {
  width: min(560px, 100%);
  max-height: min(92vh, 820px);
  background: var(--card);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.product-detail-handle {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: var(--border);
  margin: 10px auto 6px;
  flex: 0 0 auto;
}
.product-detail-visual {
  aspect-ratio: 1 / 1;
  width: 100%;
  max-height: 42vh;
  background: linear-gradient(135deg, #9AA0C8, #E8EAF6);
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}
.product-detail-body {
  padding: 16px 18px 12px;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
}
.product-detail-body h3 {
  margin: 0 0 8px;
  font-size: clamp(1.15rem, 3.4vw, 1.35rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.product-detail-price {
  font-weight: 700;
  color: var(--lilac);
  font-size: 1.15rem;
  margin-bottom: 10px;
}
.product-detail-desc {
  margin: 0;
  color: var(--text-body);
  font-size: clamp(0.92rem, 2.6vw, 1rem);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.product-detail-actions {
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 0 0 auto;
}
.product-detail-actions .btn-add { width: 100%; }
.product-detail-actions .ghost { width: 100%; border-radius: var(--radius-sm); }

@media (min-width: 1024px) {
  .product-detail-backdrop {
    align-items: center;
    padding: 24px;
  }
  .product-detail-sheet {
    border-radius: 20px;
    max-height: min(88vh, 760px);
    width: min(640px, 100%);
    max-width: 640px;
  }
  .card {
    flex-basis: 220px;
    width: 220px;
  }
}

.composer {
  padding: 8px 12px 10px;
  background: linear-gradient(180deg, transparent, rgba(247,247,250,0.92) 24%);
  min-width: 0;
}
.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  max-width: 100%;
}
.chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--lilac);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip:hover { background: var(--lilac-soft); border-color: var(--lilac-border); }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 6px 6px 10px;
  box-shadow: var(--shadow);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
#input {
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 16px; /* iOS zoom guard */
  padding: 10px 4px;
  color: var(--text-body);
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
#input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
#send {
  border: 0;
  background: var(--lilac);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  height: 42px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
#send:disabled { opacity: 0.55; cursor: wait; }

.typing { display: inline-flex; gap: 5px; align-items: center; height: 1.2em; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  animation: bounce 1s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(31, 31, 36, 0.4);
  overscroll-behavior: none;
}
.sheet {
  position: fixed;
  z-index: 41;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  max-height: min(92dvh, 92vh);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  color: var(--text-body);
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--border);
  box-shadow: 0 -12px 40px rgba(31,31,36,0.12);
  padding: 12px 14px calc(20px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}
html.sheet-open,
html.sheet-open body {
  overflow: hidden !important;
}
html.sheet-open .app {
  pointer-events: none;
}
html.sheet-open .sheet,
html.sheet-open .sheet-backdrop {
  pointer-events: auto;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  padding: 4px 0 8px;
}
.sheet-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 4.5vw, 1.5rem);
  color: var(--text);
  min-width: 0;
  flex: 1;
}
.sheet-head .ghost {
  flex-shrink: 0;
  white-space: nowrap;
}
.sheet-hint { margin: 0 0 10px; font-size: 0.9rem; }
.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sheet-actions .primary,
.sheet-actions .ghost { width: 100%; }
.cart-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.cart-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
}
.cart-row .muted { color: var(--muted); font-size: 0.85rem; }
.cart-row button {
  border: 0; background: transparent; color: var(--lilac);
  font: inherit; font-weight: 600; cursor: pointer;
}
.checkout { display: grid; gap: 8px; }
.delivery-toggle { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 420px) {
  .delivery-toggle { grid-template-columns: 1fr 1fr; }
}
.delivery-opt {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border: 1px solid var(--border, #e8ddd2);
  border-radius: 10px; cursor: pointer; font-size: 0.92rem;
}
.delivery-opt:has(input:checked) { border-color: var(--lilac, #8b6b9e); background: rgba(139,107,158,.08); }
.delivery-opt input { margin-right: 6px; }
.checkout-breakdown { font-size: 0.85rem; }
.checkout input, .checkout textarea {
  font: inherit;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--card);
  color: var(--text-body);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.checkout input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(217, 72, 72, 0.15);
}
.checkout-total { font-size: 1.05rem; margin-top: 4px; }
.primary {
  border: 0;
  background: var(--lilac);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.primary:hover { background: var(--lilac-dark); }
.primary:disabled { opacity: 0.6; cursor: wait; }
.checkout-note { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; min-height: 1.2em; }
.checkout-note--error { color: var(--danger); }
.addr-suggest-wrap { position: relative; }
.addr-suggest {
  position: absolute;
  left: 0; right: 0; top: 100%;
  z-index: 40;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e8ddd2);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(40, 30, 20, 0.12);
  max-height: 220px;
  overflow: auto;
  margin-top: 4px;
}
.addr-suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
  color: var(--ink, #2a2118);
}
.addr-suggest-item:hover { background: rgba(180, 140, 180, 0.12); }
.recipient-pick { margin-bottom: 4px; }
.recipient-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.recipient-chip {
  border: 1px solid var(--border, #e8ddd2);
  background: var(--card, #fff);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text, #2a2a32);
}
.recipient-chip.is-active {
  border-color: var(--lilac, #8b6b9e);
  background: rgba(139, 107, 158, 0.12);
  color: var(--lilac-dark, #5c4a6e);
}
.recipient-addr-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 480px) {
  .recipient-addr-row { grid-template-columns: 1fr 1fr 1fr; }
}
.recipient-row-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

/* Legal consent gate (first visit) */
.consent-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(160deg, #fff9f9 0%, #f7f7fa 45%, #eef0f8 100%);
}
.consent-gate[hidden] { display: none !important; }
.consent-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: var(--shadow);
}
.consent-brand {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--lilac);
  text-align: center;
  margin: 0 0 12px;
  font-size: 1.15rem;
}
.consent-card h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  text-align: center;
  margin: 0 0 8px;
  color: var(--text);
}
.consent-lead {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 14px;
}
.consent-draft {
  background: #fff8e6;
  border: 1px solid #e6c35c;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.88rem;
  margin-bottom: 16px;
  color: var(--text-body);
}
.consent-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
  font-size: 0.95rem;
  line-height: 1.35;
  cursor: pointer;
}
.consent-row input { margin-top: 3px; flex-shrink: 0; }
.consent-row a { color: var(--lilac); font-weight: 600; }
.consent-card .primary { width: 100%; margin-top: 8px; }

/* Bottom tabs (Telegram-like) — mobile / tablet */
.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 6px 2px calc(8px + env(safe-area-inset-bottom));
  z-index: 5;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.nav-item {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  font: inherit;
  cursor: pointer;
  min-width: 0;
  width: 100%;
}
.nav-item.is-active { color: var(--lilac); font-weight: 700; }
.nav-ico { font-size: 1.1rem; line-height: 1; }
.nav-label {
  font-size: 0.68rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 22px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.view-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 4px;
}
.view-head h2 { margin: 0; font-family: var(--font-display); color: var(--lilac); font-size: 1.35rem; }
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 8px 12px 20px;
  width: 100%;
  box-sizing: border-box;
}
.catalog-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
}
.catalog-card:focus-visible {
  outline: 2px solid var(--lilac);
  outline-offset: 2px;
}
.catalog-card-visual {
  aspect-ratio: 1 / 1;
  width: 100%;
  height: auto;
  background: linear-gradient(135deg, #9AA0C8, #E8EAF6);
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}
.catalog-card-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.catalog-card h3 {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.catalog-card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.catalog-card .price-line {
  margin: 0;
  font-weight: 700;
  color: var(--lilac);
  font-size: 0.95rem;
}
.catalog-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 6px;
  align-items: stretch;
  margin-top: 4px;
}
.catalog-card-actions .primary {
  padding: 10px 8px;
  font-size: 0.8rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.catalog-card-actions .btn-fav {
  padding: 0;
  width: 40px;
  height: 40px;
}

/* ——— Yandex-style catalog ——— */
.catalog-yandex {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  padding: 0;
  min-width: 0;
  max-width: 100%;
}
.catalog-yx-top {
  flex-shrink: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px 0;
  z-index: 2;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.catalog-yx-promo {
  margin: 0;
}
.catalog-yx-mode {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: var(--bg);
}
.catalog-yx-mode-btn {
  border: 0;
  border-radius: 999px;
  padding: 9px 6px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition:
    transform var(--duration-fast, 120ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
    background-color var(--duration-ui, 200ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
    color var(--duration-ui, 200ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
    box-shadow var(--duration-ui, 200ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.catalog-yx-mode-btn.is-active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(31, 31, 36, 0.1);
}
body[data-scheme="dark"] .catalog-yx-mode-btn.is-active {
  color: var(--lilac);
}
.catalog-yx-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.catalog-yx-search {
  display: block;
  min-width: 0;
}
.catalog-yx-search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-size: 16px;
  background: var(--bg);
  color: var(--text-body);
  transition:
    border-color var(--duration-ui, 200ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
    box-shadow var(--duration-ui, 200ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.catalog-yx-search input:focus {
  outline: none;
  border-color: var(--lilac-border);
  box-shadow: 0 0 0 3px var(--lilac-soft);
}
.catalog-yx-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-body);
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform var(--duration-fast, 120ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
    background-color var(--duration-ui, 200ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
@media (hover: hover) and (pointer: fine) {
  .catalog-yx-icon-btn:hover { background: var(--lilac-soft); }
}
.catalog-yx-chips-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 12px 10px;
  max-width: 100%;
  box-sizing: border-box;
}
.catalog-yx-chips-wrap::-webkit-scrollbar { display: none; }
.catalog-yx-chips {
  display: flex;
  gap: 8px;
  width: max-content;
  min-width: 100%;
}
.catalog-yx-chip {
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-body);
  cursor: pointer;
  white-space: nowrap;
  transition:
    transform var(--duration-fast, 120ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
    background-color var(--duration-ui, 200ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
    color var(--duration-ui, 200ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.catalog-yx-chip.is-active {
  background: var(--text);
  color: #fff;
}
body[data-scheme="dark"] .catalog-yx-chip.is-active {
  background: var(--lilac);
  color: #fff;
}
.catalog-yx-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0 64px;
  scroll-behavior: smooth;
  max-width: 100%;
}
.catalog-yx-status {
  margin: 16px;
  text-align: center;
}
.yc-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px 0 12px;
}
.yc-section {
  min-width: 0;
}
.yc-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px 10px;
}
.yc-section-head h3 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}
.yc-section-all {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}
.yc-section-all:hover { color: var(--lilac); }
.yc-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 12px;
  padding: 0 12px 4px;
  scrollbar-width: none;
  max-width: 100%;
}
.yc-row::-webkit-scrollbar { display: none; }
.yc-tile {
  flex: 0 0 calc((100vw - 32px) / 2);
  width: calc((100vw - 32px) / 2);
  max-width: 168px;
  scroll-snap-align: start;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  box-sizing: border-box;
}
.yc-tile:focus-visible {
  outline: 2px solid var(--lilac);
  outline-offset: 2px;
  border-radius: 14px;
}
.yc-tile-visual {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, #9AA0C8, #E8EAF6);
  background-size: cover;
  background-position: center;
}
.yc-tile-visual.has-image {
  background-color: #E8EAF6;
}
.yc-tile-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 3px 8px;
  border-radius: 999px;
  background: #2E7D32;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  max-width: calc(100% - 52px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.yc-tile-badge--shop {
  background: rgba(31, 31, 36, 0.72);
  font-size: 0.68rem;
  font-weight: 600;
}
.yc-tile-add {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 1;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(31, 31, 36, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-fast, 120ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
@media (hover: hover) and (pointer: fine) {
  .yc-tile-add:hover { transform: scale(1.04); }
}
.yc-tile-add:active { transform: scale(0.94); }
.yc-tile-meta {
  padding: 8px 2px 0;
  min-width: 0;
}
.yc-tile-price {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--lilac);
  letter-spacing: -0.02em;
}
.yc-tile-name {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--text-body);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.catalog-yx-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 12px 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.catalog-yx-grid .yc-tile {
  flex: none;
  width: 100%;
  max-width: none;
}
.catalog-yx-fab {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(31, 31, 36, 0.12);
  transition:
    transform var(--duration-fast, 120ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
    box-shadow var(--duration-ui, 200ms) var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
@media (hover: hover) and (pointer: fine) {
  .catalog-yx-fab:hover {
    box-shadow: 0 10px 26px rgba(31, 31, 36, 0.16);
  }
}
.catalog-yx-fab:active { transform: scale(0.97); }
.catalog-yx-fab-ico { font-size: 1rem; line-height: 1; }
.catalog-filter-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 16px 16px;
}
.catalog-filter-opt {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--card);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  color: var(--text-body);
}
.catalog-filter-opt.is-active {
  border-color: var(--lilac);
  background: var(--lilac-soft);
  color: var(--lilac);
}
.catalog-cat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 16px;
}
.catalog-cat-btn {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  background: var(--card);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  color: var(--text-body);
}
.catalog-cat-btn:hover { border-color: var(--lilac-border); background: var(--lilac-soft); }
.yc-sections.is-loaded .yc-section {
  animation: catalog-section-in 280ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)) both;
}
.yc-sections.is-loaded .yc-section:nth-child(2) { animation-delay: 35ms; }
.yc-sections.is-loaded .yc-section:nth-child(3) { animation-delay: 70ms; }
.yc-sections.is-loaded .yc-section:nth-child(4) { animation-delay: 105ms; }
.yc-sections.is-loaded .yc-section:nth-child(5) { animation-delay: 140ms; }
@keyframes catalog-section-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .yc-sections.is-loaded .yc-section { animation: none; }
  .yc-tile-add:hover { transform: none; }
  .catalog-yx-mode-btn,
  .catalog-yx-chip,
  .catalog-yx-fab,
  .catalog-yx-icon-btn,
  .yc-tile-add {
    transition: none;
  }
}
@media (min-width: 768px) {
  .yc-tile { flex-basis: 168px; width: 168px; }
  .catalog-yx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .catalog-yx-top { padding: 10px 20px 0; }
  .yc-section-head { padding: 0 20px 10px; }
  .yc-row { padding: 0 20px 4px; scroll-padding-inline: 20px; }
  .catalog-yx-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 8px 20px 16px;
  }
  .catalog-yx-fab { left: 20px; }
}
.btn-fav {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-fav.is-fav {
  color: #2f6b4f;
  background: #e8f5ee;
  border-color: #b7dcc8;
  cursor: default;
  opacity: 0.92;
  pointer-events: none;
}
.profile-panel { padding-bottom: 24px; }
.profile-block { padding: 8px 16px 24px; }
.profile-card {
  background: linear-gradient(145deg, #fff, #f3f1f8);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.profile-select {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font: inherit;
  background: #fff;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.profile-name { margin: 0 0 4px; font-family: var(--font-display); font-size: 1.4rem; color: var(--lilac); }
.loyalty-balance { margin: 10px 0 0; }
.profile-nav { display: flex; flex-direction: column; gap: 4px; }
.profile-link {
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 12px 4px;
  font: inherit;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.profile-link:hover { color: var(--lilac); }
.danger-text { color: var(--danger) !important; }
.wish-block { display: grid; gap: 6px; }
.wish-block .sm { justify-self: start; padding: 6px 10px; font-size: 0.8rem; }
.small { font-size: 0.82rem; }
.moderation-banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(217, 72, 72, 0.35);
  background: #fff5f5;
  color: #7a1f1f;
  font-size: 0.92rem;
  line-height: 1.4;
  white-space: pre-wrap;
}
.profile-notifications { margin: 0 0 16px; }
.notif-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}
.notif-item.is-unread {
  border-color: var(--lilac-border);
  box-shadow: inset 3px 0 0 var(--lilac);
}
.notif-item h4 { margin: 0 0 6px; font-size: 0.95rem; color: var(--lilac); }
.notif-item p { margin: 0; white-space: pre-wrap; font-size: 0.9rem; line-height: 1.4; }
.notif-item .notif-meta { margin-top: 8px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }

/* Bottom tabs cover orders / recipients / cart — keep header lean */
#btnOrders, #btnRecipients, #btnCart { display: none; }

.views-stack, .view-panel, .sheet, .checkout, .profile-block {
  max-width: 100%;
  min-width: 0;
}
.view-head, .profile-block, .composer, .top-row {
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}
.checkout-note {
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.4;
}
.checkout-note a {
  color: var(--lilac);
  font-weight: 700;
  text-decoration: underline;
}
#input, .row input {
  font-size: 16px;
}
.sheet-auth-status { margin-bottom: 10px; }
.recipient-addr-row { margin-top: 0; }

@media (max-width: 480px) {
  .card {
    flex-basis: min(78vw, 260px);
    width: min(78vw, 260px);
  }
  .bubble { font-size: 0.92rem; }
  .top-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .brand-block { max-width: 100%; }
  .top-actions { width: 100%; max-width: 100%; justify-content: flex-start; }
  .sheet-actions { grid-template-columns: 1fr; }
  .product-detail-actions { grid-template-columns: 1fr; }
}

/* ——— Desktop shell (≥1024): real layout, not stretched mobile ——— */
@media (min-width: 1024px) {
  body {
    overflow: hidden;
  }
  .app {
    --app-width: min(1280px, 100%);
    --chat-col: 720px;
    max-width: 1280px;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    background: color-mix(in srgb, var(--bg) 92%, #fff);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 40px rgba(31, 31, 36, 0.06);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  body[data-scheme="dark"] .app {
    background: color-mix(in srgb, var(--bg) 94%, #000);
  }

  .top-row {
    padding: 14px 24px 10px;
  }
  .top-actions {
    max-width: none;
    flex-wrap: nowrap;
  }

  #viewChat.feed {
    padding: 16px 24px 24px;
  }
  .feed-messages {
    width: 100%;
    max-width: var(--chat-col);
    margin: 0 auto;
  }
  .msg.assistant {
    max-width: min(100%, 560px);
  }
  .msg.user {
    max-width: min(88%, 480px);
  }
  .composer {
    width: 100%;
    max-width: var(--chat-col);
    margin: 0 auto;
    padding: 10px 0 16px;
    box-sizing: border-box;
  }
  .quick {
    padding: 0 4px;
  }
  .row {
    margin: 0 4px;
    width: calc(100% - 8px);
  }

  .view-head {
    padding: 16px 24px 8px;
  }
  .catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding: 8px 24px 28px;
  }
  .catalog-card-body {
    padding: 12px;
  }
  .catalog-card h3 {
    font-size: 1rem;
  }
  .profile-block {
    padding: 12px 24px 32px;
    max-width: 720px;
  }

  .sheet {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(560px, calc(100vw - 48px));
    max-width: 560px;
    border-radius: 18px 18px 0 0;
  }

}

@media (min-width: 1280px) {
  .app {
    --app-width: min(1400px, 100%);
    max-width: 1400px;
  }
  .catalog-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.password-field {
  position: relative;
  display: block;
  width: 100%;
}
.password-field input {
  width: 100%;
  padding-right: 44px;
  box-sizing: border-box;
}
.checkout .password-field input {
  padding-right: 44px;
}
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  padding: 8px;
  cursor: pointer;
  color: var(--muted, #6a6a78);
  line-height: 0;
  border-radius: 8px;
}
.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--text-body, var(--text, #1e1e28));
  outline: none;
}
.password-toggle .eye-off { display: none; }
.password-toggle[aria-pressed="true"] .eye-on { display: none; }
.password-toggle[aria-pressed="true"] .eye-off { display: block; }

.pwa-banner {
  position: fixed;
  z-index: 50;
  left: 12px;
  right: 12px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card);
  color: var(--text-body);
  box-shadow: 0 12px 32px rgba(31, 31, 36, 0.16);
  border: 1px solid var(--border);
}
.pwa-banner[hidden] { display: none !important; }
.pwa-banner__text {
  flex: 1 1 140px;
  min-width: 0;
}
.pwa-banner__text strong {
  display: block;
  font-size: 0.92rem;
}
.pwa-banner__text p {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}
.pwa-banner .primary,
.pwa-banner .ghost {
  flex: 0 0 auto;
}
@media (min-width: 880px) {
  .pwa-banner {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: min(420px, calc(100vw - 48px));
  }
}

.pwa-splash {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  background: var(--bg, #F7F7FA);
  padding: env(safe-area-inset-top) 24px env(safe-area-inset-bottom);
}
html.is-pwa-splash .pwa-splash { display: flex; }
html.is-pwa-splash-out .pwa-splash {
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}
html.is-pwa-splash body { overflow: hidden; }
.pwa-splash .logo-wordmark--splash {
  transform: scale(1.55);
  transform-origin: center center;
}

/* Recommend carousels (temperament / palette) — legacy recommend.php parity */
.rec-carousel-wrap {
  margin: 12px 0 8px;
  max-width: 100%;
  padding: 0 4px;
}
.rec-carousel-title {
  margin: 0 0 8px;
  padding: 0 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.rec-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 6px 12px 14px 4px;
  scroll-padding-inline: 12px;
}
.rec-card {
  flex: 0 0 min(82%, 300px);
  max-width: 300px;
  scroll-snap-align: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.rec-card.is-selected {
  border-color: var(--lilac);
  box-shadow: 0 0 0 2px var(--lilac-soft);
}
.rec-card-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ececf2;
  overflow: hidden;
  cursor: zoom-in;
}
.rec-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.rec-card-zoom {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.rec-card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.rec-card-title {
  display: block;
  font-weight: 700;
  color: var(--lilac);
  margin: 0;
  line-height: 1.25;
}
.rec-card-desc {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}
.rec-card-action {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--lilac-dark);
}

/* Dual budget slider (legacy recommend.php) */
.rec-budget-wrap {
  margin: 12px 4px 8px;
  padding: 14px 14px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.rec-budget-values {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: var(--text-body);
}
.rec-budget-dual {
  position: relative;
  height: 2.1rem;
  margin: 4px 0 12px;
}
.rec-budget-dual::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  border-radius: 999px;
  background: #e8e8ee;
}
.rec-budget-dual input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.rec-budget-dual input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--lilac, #585e92);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.rec-budget-dual input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--lilac, #585e92);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.rec-budget-apply {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--lilac);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.rec-budget-hint {
  margin: 10px 0 0;
}

/* Fullscreen image lightbox */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(20, 22, 40, 0.88);
  display: grid;
  place-items: center;
  padding: 24px;
  cursor: zoom-out;
}
.img-lightbox img {
  max-width: min(96vw, 720px);
  max-height: 88vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  background: #fff;
}
.img-lightbox-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #222;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.recommend-profile-sheet {
  max-height: min(92vh, 820px);
  overflow: auto;
}
.recommend-profile-form .rec-carousel {
  margin-bottom: 12px;
}
.recommend-profile-form .rec-card {
  flex-basis: 70%;
}
.recommend-profile-form input[type="number"] {
  width: 100%;
}
@media (min-width: 720px) {
  .rec-card { flex-basis: 260px; }
}

.card-visual.has-photo {
  cursor: zoom-in;
}