:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f4f4f5);
  --text: var(--tg-theme-text-color, #1c1c1e);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --accent: var(--tg-theme-button-color, #d6336c);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }

.top { padding: 16px 16px 6px; }
.brand { font-size: 22px; font-weight: 700; letter-spacing: .2px; }
.sub { color: var(--hint); font-size: 13px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none;
  position: sticky; top: 0; background: var(--bg); z-index: 2; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 0; border-radius: 999px; padding: 8px 14px; background: var(--bg2);
  color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

main { padding: 4px 12px 24px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.card { border: 0; padding: 0; text-align: left; background: var(--bg2); border-radius: var(--radius);
  overflow: hidden; color: inherit; font: inherit; cursor: pointer; display: flex; flex-direction: column; }
.card__img { aspect-ratio: 3 / 4; background: #e9e9ee center / cover no-repeat; display: grid; place-items: center;
  color: var(--hint); font-size: 28px; }
.card__body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.card__name { font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.card__price { font-weight: 700; }

.empty { color: var(--hint); text-align: center; padding: 40px 16px; }

.sheet { position: fixed; inset: 0; z-index: 10; }
.sheet__bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.sheet__card { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 18px 18px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.sheet__x { position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .45); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; z-index: 1; }
.sheet__img { aspect-ratio: 4 / 5; max-height: 55vh; width: 100%; background: #e9e9ee center / cover no-repeat;
  display: grid; place-items: center; color: var(--hint); font-size: 40px; }
.sheet__body { padding: 14px 16px 0; }
.sheet__body h2 { margin: 0 0 10px; font-size: 19px; line-height: 1.25; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.price { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.desc { white-space: pre-line; color: var(--text); margin: 0 0 12px; }
.soon { color: var(--hint); font-size: 13px; margin: 0; }

/* Корзина, оформление */
.sticky { position: sticky; top: 0; }
.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px; margin-top: 14px;
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; font-size: 16px; cursor: pointer; }
.btn[disabled] { opacity: .6; }
.fab { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5;
  border: 0; border-radius: 12px; padding: 14px; background: var(--accent); color: var(--accent-text);
  font: inherit; font-weight: 600; font-size: 16px; box-shadow: 0 4px 16px rgba(0,0,0,.2); cursor: pointer; }
body.has-fab main { padding-bottom: 84px; }

.line { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--bg2); }
.line__img { width: 64px; height: 80px; border-radius: 10px; background: #e9e9ee center / cover no-repeat;
  display: grid; place-items: center; color: var(--hint); }
.line__name { font-size: 14px; line-height: 1.25; }
.line__size { color: var(--hint); font-size: 13px; }
.line__price { font-weight: 700; margin-top: 2px; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--bg2); color: var(--text);
  font-size: 18px; cursor: pointer; }
.qty span { min-width: 18px; text-align: center; }

.sum { margin-top: 14px; background: var(--bg2); border-radius: 12px; padding: 12px 14px; }
.sum div { display: flex; justify-content: space-between; padding: 2px 0; }
.sum .total { font-weight: 700; font-size: 17px; border-top: 1px solid rgba(0,0,0,.08); margin-top: 6px; padding-top: 8px; }

fieldset { border: 0; margin: 0 0 8px; padding: 0; }
legend { font-weight: 700; font-size: 16px; padding: 10px 0 6px; }
.fld { display: block; margin: 8px 0; font-size: 13px; color: var(--hint); }
.fld input, .fld select, .fld textarea { display: block; width: 100%; margin-top: 4px; padding: 11px 12px;
  border: 1px solid transparent; border-radius: 10px; background: var(--bg2); color: var(--text); font: inherit; font-size: 16px; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; border-color: var(--accent); }
.fld small { display: block; margin-top: 4px; }
.chk { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: 14px; }
.chk input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); }
.consent a { color: var(--tg-theme-link-color, var(--accent)); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg2); padding: 4px; border-radius: 12px; }
.seg label { text-align: center; padding: 9px; border-radius: 9px; cursor: pointer; font-size: 15px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--bg); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.err { color: #d93025; margin: 10px 0 0; }

.done { text-align: center; padding: 48px 20px; }
.done__icon { font-size: 56px; }
.done h2 { margin: 12px 0 8px; }
.done p { color: var(--hint); white-space: pre-line; }
.btn--ghost { background: var(--bg2); color: var(--text); }
