:root {
  color-scheme: light;
  --bg: #eef1f5;
  --panel: #ffffff;
  --soft: #f6f7f9;
  --text: #20242c;
  --muted: #858b96;
  --line: #e8ebef;
  --primary: #1677ff;
  --green: #24a865;
  --orange: #ff9f0a;
  --red: #f04452;
  --shadow: 0 12px 32px rgba(25, 35, 52, 0.1);
  --phone: 430px;
}

* {
  box-sizing: border-box;
}

html {
  background: #e6eaf0;
}

body {
  width: min(100%, var(--phone));
  min-height: 100vh;
  margin: 0 auto;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-shadow: 0 0 50px rgba(28, 37, 54, 0.13);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 68px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand > #logo {
  display: grid;
  flex: 0 0 42px;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(145deg, #1976f3, #ff725e);
  color: white;
  font-size: 19px;
  font-weight: 850;
}

.brand-copy {
  display: block;
  min-width: 0;
}

.brand-copy strong,
.brand-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy strong {
  font-size: 16px;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.icon-button {
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--text);
  font-size: 20px;
}

.desktop-nav {
  display: none;
}

main {
  padding: 12px 10px 92px;
}

.telegram-shell,
.telegram-card {
  width: 100%;
}

.telegram-card {
  min-height: calc(100vh - 172px);
  border-radius: 12px;
  background: var(--panel);
  padding: 14px 12px 22px;
}

.search {
  display: grid;
  grid-template-columns: 22px 1fr 28px;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  padding: 0 10px 0 14px;
  color: var(--muted);
}

.search input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.search button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #e3e7ec;
  color: #6f7681;
  font-size: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 12px;
}

.section-head > div {
  min-width: 0;
}

.section-head strong,
.section-head span {
  display: block;
}

.section-head strong {
  font-size: 17px;
}

.section-head div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.category-toggle {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.category-wrap {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: 84px;
  margin-bottom: 22px;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.category-wrap.expanded {
  max-height: 900px;
}

.category-wrap button {
  overflow: hidden;
  min-width: 0;
  min-height: 38px;
  border: 1px solid #edf0f3;
  border-radius: 9px;
  background: var(--soft);
  padding: 0 5px;
  color: #454b55;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-wrap button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.product-head {
  padding-top: 1px;
}

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

.load-more {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 1px solid #cfe0ff;
  border-radius: 10px;
  background: #eef5ff;
  color: var(--primary);
  font-weight: 800;
}

.load-more[hidden] {
  display: none;
}

.product {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 8px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.product:active {
  transform: scale(0.985);
}

.product-img,
.product-visual {
  position: relative;
  width: 100%;
  aspect-ratio: 1.35;
  border-radius: 8px;
  object-fit: cover;
  background: #f2f4f7;
}

.product h3 {
  display: -webkit-box;
  min-height: 40px;
  margin: 9px 1px 4px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 14px;
  line-height: 1.42;
  letter-spacing: 0;
}

.product p {
  display: none;
}

.price {
  display: block;
  margin: 0 1px 7px;
  color: var(--red);
  font-size: 16px;
  font-weight: 850;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  margin: 0 1px 7px;
  color: var(--muted);
  font-size: 10px;
}

.product-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock {
  overflow: hidden;
  height: 4px;
  border-radius: 999px;
  background: #edf0f3;
}

.stock i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.product-visual {
  background: linear-gradient(145deg, #20bf55, #0f9d48);
}

.product-visual::before,
.product-visual::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: white;
}

.product-visual::before {
  width: 52%;
  height: 39%;
  left: 18%;
  top: 23%;
}

.product-visual::after {
  width: 42%;
  height: 31%;
  right: 13%;
  bottom: 20%;
}

.product-visual.link {
  background: linear-gradient(145deg, #1677ff, #20c997);
}

.product-visual.service {
  background: linear-gradient(145deg, #805ad5, #f59e0b);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 16;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, var(--phone));
  min-height: 66px;
  margin: 0 auto;
  padding: 7px 8px max(7px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(18px);
}

.bottom-nav a,
.bottom-nav button {
  display: grid;
  place-items: center;
  gap: 1px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
}

.bottom-nav span {
  font-size: 22px;
  line-height: 1;
}

.bottom-nav small {
  font-size: 11px;
}

.bottom-nav .active {
  color: var(--primary);
}

dialog {
  width: min(398px, calc(100vw - 20px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  border: 0;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.28);
}

dialog::backdrop {
  background: rgba(20, 24, 31, 0.48);
  backdrop-filter: blur(2px);
}

.dialog-card {
  display: grid;
  gap: 10px;
  padding: 18px 16px;
}

.dialog-card h2 {
  margin: 0 0 2px;
  text-align: center;
  font-size: 20px;
}

.gradient-note,
.green-note,
.yellow-note,
.red-note,
.blue-note {
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

.gradient-note {
  color: white;
  text-align: center;
  background: linear-gradient(90deg, #ee5ea8, #f4b33f);
}

.green-note {
  background: #ebfff3;
  border: 1px solid #b7ebc6;
}

.yellow-note {
  background: #fff9e8;
  border: 1px solid #ffdc85;
}

.red-note {
  color: #c93340;
  background: #fff2f3;
  border: 1px solid #ffc9cd;
}

.blue-note {
  background: #eef5ff;
  border: 1px solid #c6d9fa;
}

.dialog-card ol {
  margin: 0;
  padding-left: 20px;
  color: #5c626c;
  font-size: 13px;
  line-height: 1.65;
}

label {
  display: grid;
  gap: 7px;
  color: #6f7681;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 9px 11px;
}

menu {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

menu button,
.dialog-card > button,
.drawer button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--orange);
  padding: 0 20px;
  color: white;
  font-weight: 800;
}

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

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

.summary {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.summary p {
  margin: 0;
}

pre {
  white-space: pre-wrap;
  border-radius: 8px;
  background: #151a23;
  color: white;
  padding: 12px;
}

.warn,
.countdown {
  color: #c93340;
}

.countdown {
  text-align: center;
  font-weight: 850;
}

.drawer {
  position: fixed;
  top: 0;
  right: max(0px, calc((100vw - var(--phone)) / 2));
  z-index: 30;
  display: grid;
  align-content: start;
  gap: 14px;
  width: min(340px, 88vw);
  height: 100vh;
  padding: 22px 20px;
  background: white;
  box-shadow: -14px 0 38px rgba(24, 32, 48, 0.18);
  transform: translateX(110%);
  transition: transform 0.22s ease;
}

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

.drawer h2 {
  margin: 2px 0 8px;
  font-size: 25px;
  line-height: 1.2;
}

.drawer .close-drawer {
  justify-self: end;
  margin-left: 0;
  padding: 0;
  background: var(--soft);
  color: var(--text);
}

.drawer button:not(.close-drawer) {
  width: 100%;
  min-height: 52px;
  border-radius: 10px;
  background: var(--orange);
  font-size: 16px;
}

.drawer-note {
  margin: 10px 0 0;
  border: 1px solid #ffe0aa;
  border-radius: 10px;
  background: #fff8ec;
  padding: 12px;
  color: #5d4a2e;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.fatal {
  padding: 36px 20px;
  color: #cf1322;
  font-weight: 800;
}

.back-to-top {
  position: fixed;
  right: max(18px, calc((100vw - var(--phone)) / 2 + 18px));
  bottom: 82px;
  z-index: 15;
  display: none;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  color: white;
  font-size: 19px;
  box-shadow: var(--shadow);
}

.back-to-top.show {
  display: grid;
}

.checkbox-line {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-line input {
  width: auto;
}

.pay-disabled {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #ffd0d4;
  border-radius: 8px;
  background: #fff5f6;
  padding: 11px;
  color: #c93340;
}

.detail-top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}

.x {
  justify-self: end;
  border: 0;
  background: transparent;
  font-size: 26px;
}

@media (max-width: 360px) {
  .category-wrap {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .products {
    gap: 8px;
  }

  .product {
    padding: 7px;
  }
}
