/* Design Showcase — оболочка. Нейтральная тёмная, чтобы не спорить с дизайном сайта. */

:root {
  --ink: #0e1013;
  --panel: rgba(20, 22, 27, .82);
  --panel-solid: #16181d;
  --line: rgba(255, 255, 255, .13);
  --text: #f2f3f5;
  --muted: #9aa1ad;
  --accent: #ff5a1f;
  --radius: 12px;
  --bar-h: 54px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button, a, .tab, .seg__btn { touch-action: manipulation; }

/* ============================================================ ПРОСМОТРЩИК = */

body.viewer {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink);
}

#app { position: fixed; inset: 0; }

.stage {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
  background: var(--ink);
}

.stage__box {
  position: relative;
  /* flex: none — иначе контейнер ужимает «десктопную» ширину под окно
     и масштабирование теряет смысл */
  flex: 0 0 auto;
  width: 100%;
  height: 100%;
  background: #fff;
  transform-origin: top center;
  transition: width .2s ease, transform .2s ease;
}

body.is-device .stage__box {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 18px 60px rgba(0, 0, 0, .55);
}

.stage__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* подпись с выбранной шириной и масштабом */
.scale-badge {
  position: absolute;
  left: calc(10px + var(--safe-l));
  bottom: calc(10px + var(--safe-b));
  z-index: 80;
  display: none;
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(12, 14, 18, .75);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  pointer-events: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
body.is-device .scale-badge { display: block; }

/* ---------------------------------------------------------------- шапка -- */

.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  color: var(--text);
  background: var(--panel);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line);
  transform: translateY(0);
  transition: transform .28s cubic-bezier(.22, .8, .3, 1), opacity .2s ease;
  padding-top: var(--safe-t);
  max-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body.is-bar-hidden .bar { transform: translateY(-110%); }
body.is-bar-off .bar { transform: translateY(-110%); opacity: 0; pointer-events: none; }

.bar__inner {
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 max(10px, var(--safe-r)) 0 max(10px, var(--safe-l));
}

.bar__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
  padding: 6px 8px 6px 4px;
  border-radius: 9px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 32%;
}
.bar__brand:hover { background: rgba(255, 255, 255, .07); }

/* режим клиента: бренд — просто подпись, никуда не ведёт */
.bar__brand--static { cursor: default; }
.bar__brand--static:hover { background: transparent; }
.bar__brand--static .bar__logo { color: var(--muted); }

.bar__logo { display: inline-flex; color: var(--accent); flex: 0 0 auto; }

.bar__titles { display: flex; flex-direction: column; min-width: 0; }
.bar__title {
  font-size: 13.5px; font-weight: 600; line-height: 1.15; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar__client {
  font-size: 11px; color: var(--muted); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* вкладки вариантов */
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding: 3px;
  background: rgba(255, 255, 255, .06);
  border-radius: 10px;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  scroll-snap-align: center;
  transition: background .15s ease, color .15s ease;
}
.tab:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tab.is-active { background: var(--text); color: #14161a; font-weight: 600; }

.tab__n {
  font-family: var(--mono);
  font-size: 11px;
  min-width: 14px;
  text-align: center;
  opacity: .75;
}
.tab.is-active .tab__n { opacity: 1; color: var(--accent); }
.tab__name { white-space: nowrap; }

.bar__tools { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, .1); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
body.is-panel-open .bar__tools .icon-btn.is-on { background: rgba(255, 255, 255, .14); color: var(--text); }

/* «поделиться с клиентом» — главное действие админа, поэтому акцентная */
.icon-btn--share {
  background: rgba(255, 90, 31, .16);
  color: var(--accent);
}
.icon-btn--share:hover { background: rgba(255, 90, 31, .28); color: #ff7a45; }

/* ------------------------------------------------------- панель настроек -- */

.panel {
  display: none;
  padding: 14px max(14px, var(--safe-l)) 16px;
  border-top: 1px solid var(--line);
  background: rgba(12, 14, 18, .6);
}
body.is-panel-open .panel { display: block; }

.panel__row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.panel__label { font-size: 12px; color: var(--muted); min-width: 110px; }

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: rgba(255, 255, 255, .07);
  border-radius: 9px;
}
.seg__btn {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.seg__btn:hover { color: var(--text); background: rgba(255, 255, 255, .07); }
.seg__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg__btn.is-active { background: var(--text); color: #14161a; font-weight: 600; }

.panel__hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.7; }
.panel__hint b { color: var(--text); font-family: var(--mono); font-weight: 600; }

/* --------------------------------------------------- язычок скрытой шапки - */

.handle {
  position: fixed;
  top: var(--safe-t);
  left: 50%;
  transform: translateX(-50%);
  z-index: 91;
  display: none;
  align-items: flex-start;
  justify-content: center;
  width: 88px;
  height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
body.is-bar-off .handle { display: flex; }

.handle__grip {
  width: 44px;
  height: 5px;
  margin-top: 5px;
  border-radius: 99px;
  background: rgba(20, 22, 27, .35);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25);
  transition: background .15s ease, width .15s ease;
}
.handle:hover .handle__grip { background: var(--accent); width: 60px; }

/* ------------------------------------------------------- кнопка «заказать» */

.cta {
  position: fixed;
  right: max(18px, var(--safe-r));
  bottom: max(18px, var(--safe-b));
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  max-width: calc(100vw - 24px);
}

.cta__dock { display: flex; align-items: center; gap: 6px; }

.cta__button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(255, 90, 31, .38), 0 2px 6px rgba(0, 0, 0, .25);
  transition: transform .15s ease, box-shadow .15s ease;
}
.cta__button:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(255, 90, 31, .46); }
.cta__button:active { transform: translateY(0); }
.cta__button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.cta__button-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cta__mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 99px;
  background: var(--panel-solid);
  color: var(--muted);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  opacity: 0;
  transition: opacity .15s ease, color .15s ease;
}
.cta:hover .cta__mini, body.is-cta-open .cta__mini { opacity: 1; }
.cta__mini:hover { color: var(--text); }

body.is-cta-mini .cta__button { display: none; }
body.is-cta-mini .cta__mini {
  opacity: 1;
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 20px rgba(255, 90, 31, .38);
}
body.is-cta-mini .cta__mini svg { transform: rotate(45deg); width: 16px; height: 16px; }

.cta__sheet {
  display: none;
  width: min(320px, calc(100vw - 32px));
  padding: 16px;
  border-radius: 16px;
  background: var(--panel-solid);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
}
body.is-cta-open:not(.is-cta-mini) .cta__sheet { display: block; }

.cta__title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.cta__note { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }

.cta__links { display: flex; flex-direction: column; gap: 7px; margin: 13px 0 10px; }

.cta__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .07);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.cta__link:hover { background: rgba(255, 255, 255, .13); }
.cta__link--primary { background: var(--accent); color: #fff; }
.cta__link--primary:hover { background: #ff6d38; }

.cta__which {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
  border-top: 1px solid var(--line);
  padding-top: 9px;
  overflow-wrap: anywhere;
}

.ic { display: inline-flex; align-items: center; }

/* ----------------------------------------------------------- подсказки --- */

.tip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  max-width: min(280px, calc(100vw - 16px));
  padding: 7px 10px;
  border-radius: 8px;
  background: #23262d;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease;
}
.tip.is-on { opacity: 1; }

/* ------------------------------------------------------- уведомление ----- */

.toast {
  position: fixed;
  left: max(14px, var(--safe-l));
  bottom: max(14px, var(--safe-b));
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(460px, calc(100vw - 28px));
  padding: 11px 12px 11px 15px;
  border-radius: 12px;
  background: var(--panel-solid);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  font-size: 13px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-on { opacity: 1; transform: translateY(0); }

.toast__text { flex: 1 1 auto; }
.toast__action {
  flex: 0 0 auto;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.toast__action:hover { text-decoration: underline; }
.toast__close {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.toast__close:hover { background: rgba(255, 255, 255, .1); color: var(--text); }

/* чтобы не наезжало на подпись с масштабом */
body.has-toast .scale-badge { display: none; }

.noscript {
  position: fixed; inset: auto 0 0 0; z-index: 200;
  padding: 14px; background: var(--panel-solid); color: var(--text); font-size: 14px;
}
.noscript a { color: var(--accent); }

/* ================================================================ ГЛАВНАЯ = */

body.home {
  min-height: 100dvh;
  background: var(--ink);
  color: var(--text);
  padding: clamp(28px, 5vw, 48px) clamp(16px, 4vw, 24px) 64px;
}

.home__head { max-width: 1100px; margin: 0 auto 32px; }
.home__head h1 { margin: 0; font-size: clamp(24px, 5vw, 38px); letter-spacing: -.02em; line-height: 1.15; }
.home__head p { margin: 8px 0 0; color: var(--muted); font-size: clamp(13.5px, 2.4vw, 15px); line-height: 1.5; }

.grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  min-height: 150px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
.card:hover {
  border-color: rgba(255, 90, 31, .55);
  transform: translateY(-2px);
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .03));
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card__top h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; line-height: 1.25; }
.card__client { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.card__note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.card__bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card__count { font-size: 12px; color: var(--muted); }

.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 7px; background: rgba(255, 255, 255, .09);
  font-family: var(--mono); font-size: 11.5px; color: var(--text);
}

.home__foot { max-width: 1100px; margin: 36px auto 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.home__foot code, .empty code { font-family: var(--mono); color: var(--text); }

.empty { grid-column: 1 / -1; color: var(--muted); font-size: 14px; line-height: 1.6; }
.empty pre {
  font-family: var(--mono); font-size: 12.5px; color: var(--text);
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
  padding: 14px; border-radius: 12px; overflow-x: auto;
}

/* ====================================================== ПЛАНШЕТЫ И УЖЕ === */

@media (max-width: 1024px) {
  .bar__brand { max-width: 28%; }
}

@media (max-width: 860px) {
  :root { --bar-h: 50px; }

  .bar__client { display: none; }
  .bar__title { font-size: 12.5px; }
  .bar__brand { max-width: 34%; }

  /* на узком экране название показываем только у активного варианта */
  .tab__name { display: none; }
  .tab.is-active .tab__name {
    display: block;
    max-width: 38vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tab { padding: 0 10px; height: 34px; }

  /* настройки: кнопки крупнее под палец */
  .panel { max-height: min(62dvh, 420px); overflow-y: auto; }
  .panel__label { min-width: 96px; }
  .seg { flex: 1 1 auto; }
  .seg__btn { flex: 1 1 0; padding: 10px 8px; font-size: 13px; text-align: center; }

  .cta { right: max(12px, var(--safe-r)); bottom: max(12px, var(--safe-b)); }
  .cta__button { height: 44px; padding: 0 15px; font-size: 14px; }
  .cta__mini { opacity: 1; }
  .cta__sheet { width: min(320px, calc(100vw - 24px)); }
}

@media (max-width: 620px) {
  /* совсем узко — подпись над кнопками, иначе они не влезают */
  .panel__row { flex-direction: column; align-items: stretch; gap: 7px; margin-bottom: 14px; }
  .panel__label { min-width: 0; }

  .bar__inner { gap: 7px; padding-left: max(7px, var(--safe-l)); padding-right: max(7px, var(--safe-r)); }
  .bar__titles { display: none; }
  .bar__brand { max-width: none; flex: 0 0 auto; padding: 6px; }
  .icon-btn { width: 32px; height: 32px; }
  .bar__tools { gap: 2px; }
  .tab.is-active .tab__name { max-width: 40vw; }
  .cta__button-text { max-width: 48vw; }
  .scale-badge { font-size: 10px; padding: 4px 7px; }

  /* уведомление во всю ширину, кнопка заказа рядом не помещается */
  .toast {
    left: max(10px, var(--safe-l));
    right: max(10px, var(--safe-r));
    bottom: calc(max(12px, var(--safe-b)) + 54px);
    max-width: none;
    flex-wrap: wrap;
    font-size: 12.5px;
  }
}

/* телефон в альбомной ориентации — экрана по высоте почти нет */
@media (max-height: 480px) and (orientation: landscape) {
  :root { --bar-h: 44px; }
  .tab { height: 30px; }
  .icon-btn { width: 30px; height: 30px; }
  .panel { max-height: 62dvh; padding-top: 10px; padding-bottom: 10px; }
  /* по горизонтали место есть, а по вертикали нет — возвращаем строки в ряд */
  .panel__row { flex-direction: row; align-items: center; margin-bottom: 8px; }
  .panel__label { min-width: 92px; }
  .seg__btn { padding: 7px 8px; }
  .panel__hint { display: none; }
  .cta__button { height: 40px; }
  .cta__sheet { padding: 13px; }
  .cta__links { margin: 10px 0 8px; }
  .cta__link { padding: 9px 12px; }
}

/* устройства без мыши — подсказки не нужны, попадания крупнее */
@media (hover: none) {
  .tip { display: none; }
  .tab { min-height: 34px; }
  .cta:hover .cta__button { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
