/* Конфигуратор набора — мобильный интерфейс (до 1023px). Поведение — configurator-m.js.
   На десктопе (от 1024px) работает прежняя вёрстка из snippets/configurator3.liquid. */

.cfgm, .cfgm-bar { display: none; }

@media (max-width: 1023px) {
  .cfg3-desk { display: none !important; }

  .cfgm {
    --c-ink: #1b1b1b;
    --c-muted: #6f6f6f;
    --c-line: #e4e4e4;
    --c-soft: #f5f5f3;
    --c-accent: #febd22;
    --c-accent-soft: #fff6dc;
    --c-orange: #ff6602;
    --c-err: #d93a1a;
    display: block; max-width: 640px; margin: 0 auto 88px; color: var(--c-ink);
    font-size: 15px; line-height: 1.35;
  }
  .cfgm *, .cfgm *::before, .cfgm *::after { box-sizing: border-box; }
  .cfgm button { font: inherit; color: inherit; }
  .cfgm h2 { margin: 0; font-size: 20px; line-height: 1.2; text-transform: none; letter-spacing: 0; }
  .cfgm [hidden] { display: none !important; }

  /* ---------- шаги ---------- */
  .cfgm-step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-width: 0; }
  .cfgm-num {
    flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--c-accent); color: var(--c-ink); font-weight: 700; font-size: 15px;
  }
  .cfgm-num-done::after {
    content: ''; width: 11px; height: 6px; margin-top: -3px;
    border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(-45deg);
  }
  .cfgm-picked {
    margin-left: auto; min-width: 0; max-width: 55%; color: var(--c-muted); font-size: 13px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .cfgm-step { margin-top: 28px; }
  .cfgm-step-sub { margin: -6px 0 10px; color: var(--c-muted); font-size: 13px; }

  /* ---------- блок «Ваши поездки» ---------- */
  .cfgm-trip { background: #fff; color: var(--c-ink); }
  .cfgm-param { padding: 12px 0 10px; border-top: 1px solid var(--c-line); }
  .cfgm-param:first-of-type { border-top: 0; padding-top: 2px; }
  .cfgm-param-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .cfgm-param-top label { font-size: 15px; color: var(--c-ink); }
  .cfgm-val { font-size: 15px; color: var(--c-muted); white-space: nowrap; }
  .cfgm-val b { font-size: 30px; line-height: 1; color: var(--c-ink); font-variant-numeric: tabular-nums; }
  .cfgm-param-hint { font-size: 12px; color: var(--c-muted); margin-top: 2px; min-height: 15px; }
  .cfgm-param-ctl { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
  .cfgm-step-btn {
    flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; padding: 0; cursor: pointer;
    border: 1.5px solid var(--c-line); background: #fff; color: var(--c-ink) !important;
    font-size: 22px !important; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  }
  .cfgm-step-btn:active { background: var(--c-soft); }

  .cfgm-range {
    -webkit-appearance: none; appearance: none; flex: 1 1 auto; min-width: 0; height: 40px; margin: 0;
    background: transparent !important; border: 0 !important; padding: 0 !important; box-shadow: none !important;
    cursor: pointer; --p: 0%; touch-action: pan-y;
  }
  .cfgm-range:focus { outline: none; }
  .cfgm-range::-webkit-slider-runnable-track {
    height: 6px; border-radius: 3px;
    background: linear-gradient(to right, var(--c-accent) var(--p), #e4e4e4 var(--p));
  }
  .cfgm-range::-moz-range-track { height: 6px; border-radius: 3px; background: #e4e4e4; }
  .cfgm-range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--c-accent); }
  .cfgm-range::-webkit-slider-thumb {
    -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%;
    background: #fff; border: 4px solid var(--c-accent); box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  }
  .cfgm-range::-moz-range-thumb {
    width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 4px solid var(--c-accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  }
  .cfgm-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(254, 189, 34, .45); }

  .cfgm-segs { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--c-line); display: grid; gap: 10px; }
  .cfgm-seg-row { display: flex; align-items: center; gap: 12px; }
  .cfgm-seg-label { flex: 0 0 56px; color: var(--c-ink); }
  .cfgm-seg {
    flex: 1 1 auto; display: flex; padding: 3px; gap: 3px; border-radius: 10px; background: var(--c-soft);
  }
  .cfgm-seg button {
    flex: 1 1 0; min-width: 0; height: 38px; border: 0; border-radius: 8px; padding: 0 4px; cursor: pointer;
    background: transparent; color: var(--c-ink) !important; font-size: 15px; transition: background .15s, color .15s;
    -webkit-tap-highlight-color: transparent;
  }
  .cfgm-seg button.is-on { background: var(--c-accent); color: var(--c-ink) !important; font-weight: 700; }
  .cfgm-seg button:focus-visible, .cfgm-step-btn:focus-visible { outline: 2px solid var(--c-orange); outline-offset: 2px; }

  /* ---------- варианты товаров ---------- */
  .cfgm-opts { display: grid; gap: 10px; }
  .cfgm-opt {
    position: relative; display: flex; gap: 12px; align-items: flex-start;
    padding: 10px 44px 10px 10px; border: 1.5px solid var(--c-line); border-radius: 14px; background: #fff;
    transition: border-color .15s, background .15s, box-shadow .15s;
  }
  .cfgm-opt.is-on { border-color: var(--c-accent); background: var(--c-accent-soft); box-shadow: 0 0 0 1px var(--c-accent); }
  .cfgm-opt.is-off { opacity: .55; }
  .cfgm-opt-hit {
    position: absolute; inset: 0; z-index: 1; width: 100%; border: 0; padding: 0; margin: 0;
    background: transparent; border-radius: 14px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .cfgm-opt-hit:focus-visible { outline: 2px solid var(--c-orange); outline-offset: 2px; }
  .cfgm-opt.is-off .cfgm-opt-hit { cursor: not-allowed; }
  .cfgm-opt-img {
    flex: 0 0 76px; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: var(--c-soft);
    display: flex; align-items: center; justify-content: center;
  }
  .cfgm-opt-img img { width: 100%; height: 100%; object-fit: cover; max-width: none !important; }
  .cfgm-opt-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
  .cfgm-tag {
    align-self: flex-start; font-size: 12px; line-height: 1.2; padding: 3px 8px; border-radius: 20px;
    background: var(--c-ink); color: #fff;
  }
  .cfgm-opt.is-on .cfgm-tag { background: var(--c-orange); }
  .cfgm-opt-name { font-weight: 700; font-size: 16px; line-height: 1.2; overflow-wrap: anywhere; }
  .cfgm-opt-params { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13px; color: var(--c-muted); }
  .cfgm-opt-params b { color: var(--c-ink); font-weight: 600; }
  .cfgm-opt-desc { font-size: 13px; color: var(--c-muted); }
  .cfgm-opt-foot { display: flex; align-items: center; gap: 12px; margin-top: 2px; }
  .cfgm-opt-price { font-weight: 700; font-size: 16px; white-space: nowrap; }
  .cfgm-opt-price.is-na { color: var(--c-err); font-weight: 600; font-size: 14px; }
  .cfgm-opt-more {
    position: relative; z-index: 2; margin-left: auto; padding: 6px 0 6px 8px; font-size: 13px;
    color: var(--c-muted) !important; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap;
  }

  .cfgm-mark {
    position: absolute; top: 12px; right: 12px; width: 24px; height: 24px; border-radius: 50%;
    border: 2px solid #c9c9c9; background: #fff; transition: border-color .15s, background .15s;
  }
  .cfgm-opt.is-multi .cfgm-mark { border-radius: 7px; }
  .cfgm-opt.is-on .cfgm-mark { border-color: var(--c-ink); background: var(--c-ink); }
  .cfgm-opt.is-on .cfgm-mark::after {
    content: ''; position: absolute; left: 6px; top: 5px; width: 9px; height: 5px;
    border-left: 2px solid var(--c-accent); border-bottom: 2px solid var(--c-accent); transform: rotate(-45deg);
  }

  .cfgm-note {
    margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--c-soft);
    font-size: 14px; line-height: 1.45; color: #3a3a3a;
  }
  .cfgm-note:empty { display: none; }
  .cfgm abbr[title] { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
  .cfgm-abbr-tip {
    display: block; margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: var(--c-ink); color: #fff;
    font-size: 13px; line-height: 1.4; white-space: pre-line;
  }

  /* ---------- итог ---------- */
  .cfgm-total {
    margin-top: 32px; padding: 16px; border-radius: 16px; background: #fff;
    border: 2px solid var(--c-accent); scroll-margin-top: 70px;
  }
  .cfgm-step { scroll-margin-top: 70px; }
  .cfgm-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .cfgm-stat { padding: 10px 12px; border-radius: 12px; background: var(--c-soft); }
  .cfgm-stat b { display: block; font-size: 20px; line-height: 1.15; }
  .cfgm-stat span { font-size: 12px; color: var(--c-muted); }
  .cfgm-items { list-style: none; margin: 16px 0 0; padding: 0; }
  .cfgm-items li {
    display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--c-line); font-size: 14px; margin: 0;
  }
  .cfgm-items li::before { display: none; }
  .cfgm-items li > span:first-child { flex: 0 0 96px; color: var(--c-muted); }
  .cfgm-items a { color: var(--c-ink) !important; overflow-wrap: anywhere; }
  .cfgm-specs { margin: 6px 0 0; padding: 12px 0 0; border-top: 1px solid var(--c-line); font-size: 14px; }
  .cfgm-specs div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
  .cfgm-specs dt { color: var(--c-muted); font-weight: 400; margin: 0; }
  .cfgm-specs dd { margin: 0; font-weight: 600; text-align: right; white-space: nowrap; }
  .cfgm-warn-soft { margin: 10px 0 0; font-size: 13px; color: var(--c-muted); font-style: italic; }
  .cfgm-total-buy {
    display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--c-line);
  }
  .cfgm-total-price { flex: 1 1 auto; min-width: 0; }
  .cfgm-total-price small { display: block; font-size: 12px; color: var(--c-muted); }
  .cfgm-total-price b { font-size: 26px; line-height: 1.1; white-space: nowrap; }
  .cfgm-err {
    margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: #fdecea; color: var(--c-err); font-size: 14px;
  }

  .cfgm-buy {
    flex: 0 0 auto; height: 48px; padding: 0 22px; border: 0; border-radius: 12px; cursor: pointer;
    background: var(--c-orange, #ff6602); color: #fff !important; font: inherit; font-weight: 700; font-size: 16px;
    white-space: nowrap; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
    transition: background .15s, transform .1s;
  }
  .cfgm-buy:active { transform: scale(.97); }
  .cfgm-buy:focus-visible { outline: 3px solid var(--c-accent, #febd22); outline-offset: 2px; }
  .cfgm-buy.is-busy { background: #9a9a9a; cursor: progress; font-size: 14px; }

  @keyframes cfgm-bump { 0% { transform: scale(1); } 35% { transform: scale(1.08); color: #ff6602; } 100% { transform: scale(1); } }
  .cfgm-bump { display: inline-block; animation: cfgm-bump .35s ease-out; }

  /* ---------- липкая панель внизу ---------- */
  .cfgm-bar {
    display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 950;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #fff; border-top: 1px solid #e4e4e4; box-shadow: 0 -6px 20px rgba(0, 0, 0, .08);
    transform: translateY(110%); transition: transform .22s ease;
  }
  .cfgm-bar.is-shown { transform: none; }
  .cfgm-bar.is-err { border-top: 2px solid #d93a1a; }
  .cfgm-bar-sum {
    flex: 1 1 auto; min-width: 0; text-align: left; border: 0; background: none; padding: 0; cursor: pointer;
    font: inherit; color: #1b1b1b; -webkit-tap-highlight-color: transparent;
  }
  .cfgm-bar-sum b { display: block; font-size: 21px; line-height: 1.15; white-space: nowrap; }
  .cfgm-bar-sum small {
    display: block; font-size: 12px; color: #6f6f6f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .cfgm-bar-sum small::after { content: ' ›'; }
  body.cfgm-page { padding-bottom: 0; }
  body.cfgm-page.m-buybar-on { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 359px) {
  .cfgm-opt-img { flex-basis: 60px; width: 60px; height: 60px; }
  .cfgm-buy { padding: 0 16px; }
  .cfgm-val b { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .cfgm *, .cfgm-bar { transition: none !important; animation: none !important; }
}
