:root {
  color-scheme: dark;
  --bg: #11100e;
  --panel: #1b1916;
  --panel-strong: #24211d;
  --text: #f6f0e7;
  --muted: #afa79c;
  --line: #37322b;
  --accent: #c85d4d;
  --accent-2: #4fa394;
  --accent-3: #d4b35e;
  --danger: #ff7770;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(79, 163, 148, 0.12), transparent 36rem),
    linear-gradient(135deg, #11100e 0%, #171613 48%, #101413 100%);
  color: var(--text);
}

button,
input,
textarea,
a {
  touch-action: manipulation;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 108px;
}

body.telegram-shell .app {
  padding-top: calc(max(18px, env(safe-area-inset-top)) + 72px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.brand-mark {
  display: flex;
  min-width: 0;
  align-items: center;
}

.brand-logo {
  display: block;
  width: min(171px, 48vw);
  height: auto;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-3);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 38px;
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.icon-button {
  display: inline-grid;
  min-width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
}

.icon-button.active {
  border-color: transparent;
  background: var(--accent-2);
  color: #071412;
}

.search-icon {
  width: 21px;
  height: 21px;
  opacity: 0.92;
}

.icon-button.active .search-icon {
  filter: brightness(0) saturate(100%);
  opacity: 1;
}

#cartButton {
  grid-template-columns: auto auto;
  gap: 6px;
  min-width: 68px;
  padding: 0 10px;
}

.cart-icon {
  display: block;
  width: 24px;
  height: 22px;
  object-fit: contain;
}

#cartCount {
  min-width: 18px;
  text-align: center;
  font-weight: 800;
}

.search-row {
  position: relative;
  z-index: 12;
  margin: 0 -16px;
  padding: 0 16px 12px;
  background: rgba(17, 16, 14, 0.96);
  backdrop-filter: blur(12px);
  animation: search-reveal 160ms ease both;
}

.search-row[hidden] {
  display: none;
}

.search-row input {
  display: block;
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 48px 0 12px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  line-height: 44px;
  outline: none;
}

.search-row input::placeholder {
  color: #8f8980;
  opacity: 1;
}

.search-row input:focus {
  border-color: var(--accent-2);
}

.search-clear {
  position: absolute;
  top: 0;
  right: 18px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  padding: 0;
}

.search-clear:active {
  color: var(--text);
}

.search-clear[hidden] {
  display: none;
}

@keyframes search-reveal {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tabs,
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar,
.chips::-webkit-scrollbar {
  display: none;
}

.tabs button,
.chips button {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 25, 22, 0.8);
  color: var(--muted);
  padding: 0 12px;
  white-space: nowrap;
}

.tabs button.active,
.chips button.active {
  border-color: transparent;
  background: var(--accent-2);
  color: #071412;
  font-weight: 760;
}

.menu-loader {
  position: absolute;
  right: 16px;
  bottom: 8px;
  left: 16px;
  z-index: 1;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(79, 163, 148, 0.16);
  opacity: 1;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.menu-loader span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-2);
  animation: loader-slide 0.8s ease-in-out infinite;
}

.menu-list {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 170ms ease,
    transform 170ms ease;
}

.menu-list.is-loading {
  opacity: 0.78;
  transform: translateY(3px);
  pointer-events: none;
}

@keyframes loader-slide {
  0% {
    transform: translateX(-115%);
  }

  100% {
    transform: translateX(245%);
  }
}

.category-block {
  padding: 20px 0 12px;
}

.category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.category-title h2 {
  font-size: 22px;
  line-height: 1.1;
}

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

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.product-card {
  display: grid;
  grid-template-rows: 160px auto;
  min-height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 25, 22, 0.9);
}

.product-card.no-image {
  grid-template-rows: auto;
}

.product-image {
  display: grid;
  width: 100%;
  height: 160px;
  place-items: center;
  object-fit: cover;
  background: var(--panel-strong);
  opacity: 0;
  transition: opacity 180ms ease;
}

.product-image.loaded {
  opacity: 1;
}

.product-placeholder {
  color: rgba(246, 240, 231, 0.38);
  font-weight: 850;
  letter-spacing: 0;
}

.product-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.product-card h3 {
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.18;
  letter-spacing: 0;
}

.product-description {
  display: -webkit-box;
  min-height: 40px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.product-card.no-image .product-description {
  display: block;
  min-height: 0;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.portion {
  color: var(--accent-3);
  font-size: 13px;
}

.product-footer,
.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.price {
  color: var(--text);
  font-size: 18px;
  font-weight: 780;
}

.variant-list {
  display: grid;
  gap: 8px;
}

.variant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 17, 15, 0.78);
}

.variant-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.variant-label {
  color: var(--accent-3);
  font-size: 13px;
  line-height: 1.2;
}

.variant-price {
  color: var(--text);
  font-size: 16px;
  line-height: 1.1;
}

.add-button,
.qty button,
.submit-button,
.bottom-bar button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 780;
}

.add-button {
  min-width: 42px;
  height: 38px;
}

.qty {
  display: grid;
  grid-template-columns: 34px 30px 34px;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.qty button {
  height: 34px;
  background: var(--panel-strong);
}

.qty span {
  font-weight: 780;
}

.bottom-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(17, 16, 14, 0.96) 30%);
}

.bottom-bar button {
  display: flex;
  width: min(100%, 640px);
  height: 52px;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  padding: 0 18px;
  box-shadow: var(--shadow);
}

.scroll-top {
  position: fixed;
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 22;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(36, 33, 29, 0.92);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  backdrop-filter: blur(12px);
}

.scroll-top[hidden] {
  display: none;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.58);
}

.drawer.open {
  display: flex;
}

.drawer-panel {
  width: 100%;
  max-height: 92vh;
  overflow: auto;
  border-radius: 8px 8px 0 0;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(27, 25, 22, 0.96);
  backdrop-filter: blur(12px);
}

.cart-items {
  display: grid;
  gap: 10px;
  padding: 14px 16px 4px;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cart-item-title {
  margin: 0 0 6px;
  font-weight: 720;
}

.cart-item-price {
  color: var(--muted);
  font-size: 14px;
}

.cart-item-meta {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-3);
  font-size: 13px;
}

.order-form {
  display: grid;
  gap: 12px;
  padding: 14px 16px max(18px, env(safe-area-inset-bottom));
}

.order-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

.order-form input,
.order-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #12110f;
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
  outline: none;
}

.order-form textarea {
  resize: vertical;
}

.order-form input:focus,
.order-form textarea:focus {
  border-color: var(--accent-2);
}

.drawer-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  font-size: 18px;
}

.submit-button {
  height: 50px;
  background: var(--accent-2);
  color: #071412;
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.form-status {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.35;
}

.form-status.error {
  color: var(--danger);
}

.empty {
  padding: 34px 0;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .app {
    padding-right: 12px;
    padding-left: 12px;
  }

  body.telegram-shell .app {
    padding-top: calc(max(18px, env(safe-area-inset-top)) + 74px);
  }

  .search-row {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .search-clear {
    right: 14px;
  }

  .menu-loader {
    right: 12px;
    left: 12px;
  }

  h1 {
    font-size: 32px;
  }

  .products-grid {
    gap: 10px;
  }

  .product-card:not(.no-image) {
    grid-template-rows: 118px auto;
  }

  .product-image {
    height: 118px;
  }

  .product-body {
    padding: 10px;
  }

  .product-card h3 {
    font-size: 15px;
  }

  .product-description {
    min-height: 38px;
    font-size: 13px;
    -webkit-line-clamp: 2;
  }

  .product-card.no-image .product-description {
    min-height: 0;
    -webkit-line-clamp: unset;
  }

  .price {
    font-size: 16px;
  }
}
