:root {
  --bg: #fff;
  --ink: #0a0a0a;
  --muted: #8a8a8a;
  --line: #e6e6e6;
  --soft: #f4f4f4;
  --accent: #ff5a00;
  --pad: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; height: 100%; background: var(--bg); }

body {
  color: var(--ink);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }

#app { min-height: 100%; display: flex; flex-direction: column; }

.screen { flex: 1; display: flex; flex-direction: column; padding: var(--pad); padding-bottom: calc(var(--pad) + env(safe-area-inset-bottom)); }
.screen.center { justify-content: center; }

h1 { font-size: 30px; line-height: 1.05; font-weight: 800; letter-spacing: -0.02em; text-transform: uppercase; margin: 0 0 10px; }
h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; text-transform: uppercase; margin: 0; }
.lead { color: var(--muted); margin: 0 0 28px; }
.dot { color: var(--accent); }

.back { align-self: flex-start; font-size: 14px; color: var(--muted); padding: 4px 0 14px; }

/* Кнопки */
.btn {
  display: block; width: 100%; padding: 17px 20px; border-radius: 14px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 15px;
  text-transform: uppercase; letter-spacing: 0.04em; text-align: center;
}
.btn:active { opacity: 0.8; }
.btn.accent { background: var(--accent); }
.btn.ghost { background: none; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn:disabled { background: var(--line); color: var(--muted); }
.stack { display: grid; gap: 10px; }

/* Большие варианты выбора */
.option {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 22px 20px; border-radius: 16px; box-shadow: inset 0 0 0 1.5px var(--ink);
  text-align: left; font-weight: 800; font-size: 18px; text-transform: uppercase; letter-spacing: -0.01em;
}
.option small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); text-transform: none; letter-spacing: 0; margin-top: 2px; }
.option::after { content: "→"; font-size: 22px; color: var(--accent); font-weight: 400; }
.option:active { background: var(--ink); color: #fff; }

/* Галерея */
.head { position: sticky; top: 0; z-index: 2; background: var(--bg); margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 12px; padding: var(--pad) var(--pad) 10px; border-bottom: 1px solid var(--line); }
.head .back { padding-bottom: 8px; display: block; }
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 12px calc(var(--pad) * -1) 0; padding: 0 var(--pad); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-width: 44px; padding: 8px 14px; border-radius: 999px; background: var(--soft); font-weight: 600; font-size: 14px; }
.chip.on { background: var(--accent); color: #fff; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.card { text-align: left; display: block; }
.card .ph { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--soft); }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .name { font-weight: 600; font-size: 14px; margin-top: 8px; line-height: 1.25; }
.card .sizes { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card.picked .ph { box-shadow: inset 0 0 0 3px var(--accent); }
.card.picked .ph::after { content: "✓"; position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center; }
.card.out { opacity: 0.4; }
.empty { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 48px 0; }

/* Карточка товара */
.detail { padding: 0; }
.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; background: var(--soft); }
.carousel::-webkit-scrollbar { display: none; }
.carousel img { flex: none; width: 100%; aspect-ratio: 3 / 4; max-height: 62vh; object-fit: cover; scroll-snap-align: center; }
.dots { display: flex; gap: 5px; justify-content: center; margin-top: -18px; position: relative; height: 18px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(0, 0, 0, 0.25); }
.dots i.on { background: var(--accent); }
.detail .body { padding: var(--pad); flex: 1; }
.detail .back { position: absolute; top: 12px; left: 12px; z-index: 3; background: #fff; color: var(--ink); border-radius: 999px; padding: 8px 14px; }
.label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 20px 0 10px; }
.sizes-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.size { min-width: 54px; padding: 13px 12px; border-radius: 12px; box-shadow: inset 0 0 0 1.5px var(--ink); font-weight: 700; text-align: center; }
.size.on { background: var(--accent); box-shadow: none; color: #fff; }
.size:disabled { box-shadow: inset 0 0 0 1px var(--line); color: #c4c4c4; text-decoration: line-through; }
.link { display: inline-block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.bar { position: sticky; bottom: 0; background: var(--bg); padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

/* Итог */
.rows { margin: 8px 0 24px; }
.row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row img { width: 56px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--soft); }
.row .k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.row .t { font-weight: 600; line-height: 1.25; }
.row .s { margin-left: auto; font-weight: 800; color: var(--accent); white-space: nowrap; }
.grow { flex: 1; }
.error { color: var(--accent); font-size: 14px; margin: 0 0 12px; }
.big { font-size: 56px; line-height: 1; color: var(--accent); margin-bottom: 16px; }

/* Итог: строки можно менять */
button.row { width: 100%; text-align: left; }
.row.edit .s { margin-left: auto; }
.chev { font-size: 12px; color: var(--muted); margin-left: 10px; white-space: nowrap; }
.chev::after { content: " ›"; }
.btn.text { background: none; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 500; padding: 12px; }
.btn.text:disabled { background: none; }

/* «Что я уже выбрал» */
.bag {
  position: fixed; top: 10px; right: 12px; z-index: 5; width: 42px; height: 42px; border-radius: 50%;
  background: #fff; color: var(--ink); display: grid; place-items: center; box-shadow: 0 1px 8px rgba(0, 0, 0, 0.14);
}
.bag b {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.backdrop { position: fixed; inset: 0; z-index: 6; background: rgba(0, 0, 0, 0.45); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; background: var(--bg); border-radius: 20px 20px 0 0;
  padding: 10px var(--pad) calc(var(--pad) + env(safe-area-inset-bottom)); max-height: 80vh; overflow-y: auto;
  animation: up 0.2s ease-out;
}
.sheet .grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 16px; }
.sheet .rows { margin: 4px 0 16px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* Логотип и цвета */
.logo { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); height: 34px; }
.screen.center { position: relative; }
.chips + .chips { margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sw { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18); }
.chip.on .sw { box-shadow: 0 0 0 1.5px #fff; }
.color { color: var(--muted); font-size: 14px; margin-top: 4px; }
