:root {
  --bg: #f4f6f8;
  --panel: #fff;
  --text: #101316;
  --muted: #66717d;
  --line: #dfe6ec;
  --blue: #33a8c7;
  --blue-dark: #16849f;
  --black: #0b0d0f;
  --danger: #b42318;
  --radius: 8px;
}

* { box-sizing: border-box; }

html {
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  background: var(--tg-theme-bg-color, var(--bg));
  color: var(--tg-theme-text-color, var(--text));
  font-family: Inter, Arial, sans-serif;
  touch-action: pan-y;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 16px 14px calc(22px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 12px;
  margin: -16px -14px 16px;
  padding: 14px;
  border-bottom: 1px solid #151a1f;
  background: #050607;
  backdrop-filter: blur(14px);
}

.brand-head {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.brand-head img {
  flex: 0 0 auto;
  width: 132px;
  height: 64px;
  object-fit: contain;
}

.topbar span {
  display: block;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 3px;
  font-size: 22px;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 28px;
  line-height: 1.1;
}

.intro {
  margin-bottom: 14px;
}

.intro h2 {
  font-size: 22px;
  line-height: 1.18;
}

.intro p,
.panel p,
.product-body p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

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

.product-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.product-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #dfe5e8;
}

.product-body {
  padding: 11px;
}

.product-body h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.product-body p {
  min-height: 55px;
  font-size: 13px;
}

.panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
}

.hidden {
  display: none !important;
}

.selected-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.selected-card img {
  width: 112px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  object-fit: cover;
}

.selected-card h3 {
  margin: 0 0 5px;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.ghost-btn,
.primary-btn,
.back-btn {
  min-height: 46px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.primary-btn {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.green-btn {
  border-color: #1f9d55;
  background: #1f9d55;
  color: #fff;
}

.ghost-btn,
.back-btn {
  width: fit-content;
  padding: 0 16px;
}

.back-btn {
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  padding: 0;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.field input,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
  padding: 13px;
  outline: 0;
}

.large-text {
  color: var(--text) !important;
  font-size: 21px;
  font-weight: 900;
}

.notice {
  min-height: 22px;
  color: var(--blue-dark) !important;
  font-weight: 900;
}

.notice.error {
  color: var(--danger) !important;
}

.success {
  min-height: 280px;
  place-content: center;
  text-align: center;
}

@media (min-width: 760px) {
  .app {
    padding-inline: 20px;
  }

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

  .product-body {
    padding: 13px;
  }
}

@media (max-width: 390px) {
  .brand-head img {
    width: 112px;
    height: 56px;
  }

  h1 {
    font-size: 19px;
  }

  .intro h2 {
    font-size: 20px;
  }

  .catalog-grid,
  .choice-row {
    grid-template-columns: 1fr;
  }
}
