/* «Пластик к принтеру»: блок на странице принтера и полноэкранная «мастерская» заправки AMS (kit.js) */

/* ===== Блок на странице: весь блок — кнопка, слоты понятны без подписи «подобрать» ===== */
.kit { display: none; }
.js .kit { display: flex; flex-direction: column; gap: 8px; }
.kit__open { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 16px; width: 100%; padding: 16px 18px; border: 0; border-radius: var(--r); background: var(--bg-2); color: inherit; text-align: left; cursor: pointer; transition: box-shadow 160ms ease; }
@media (hover: hover) { .kit__open:hover { box-shadow: inset 0 0 0 1.5px #cfd6d1; } .kit__open:hover .kslot:not(.is-full) .kslot__spool { border-color: var(--accent-strong); } }
.kit.is-full .kit__open { box-shadow: inset 0 0 0 1.5px var(--accent-strong); }
.kit__head { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kit__head b { font: 700 17px/1.25 var(--display); }
.kit__head small { color: var(--muted); font-size: 14px; line-height: 1.35; }
.kit__head strong { color: var(--ink); }
.kit__mini { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: #2a2f2c; }
.kit__mini.kams--lite, .kit__mini--shelf { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.kit__mini .kslot { width: 40px; height: 40px; padding: 0; }
.kit__mini .kslot__plus { font-size: 18px; }
.kit__extra { margin-left: 2px; color: #fff; font-weight: 700; font-size: 14px; }
.kit__mini.kams--lite .kit__extra, .kit__mini--shelf .kit__extra { color: var(--ink); }
.kit__list { list-style: none; margin: 0; padding: 4px 4px 0; display: grid; gap: 6px; }
.kit__row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 84px; align-items: center; gap: 12px; font-size: 14px; }
.kit__dot { position: relative; width: 40px; height: 40px; border-radius: 10px; background: var(--bg-2); overflow: hidden; }
.kit__dot::before { content: ''; position: absolute; inset: 11px; border-radius: 50%; background: var(--c, #999); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.kit__dot img { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; background: var(--bg-2); }
.kit__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.kit__name b { color: var(--ink); font-weight: 600; }
.kit__name small { margin-left: 6px; font-size: 12px; }
.kit__qty { display: inline-flex; align-items: center; border-radius: 999px; background: var(--bg-2); }
.kit__qty b { min-width: 22px; text-align: center; font-weight: 700; }
.kit__qty button { width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--ink); font: 600 18px/1 var(--text); cursor: pointer; }
.kit__qty button:hover:not(:disabled) { background: var(--bg-3); }
.kit__qty button:disabled { color: #b9c2bc; cursor: default; }
.kit__sum { text-align: right; font-weight: 600; white-space: nowrap; }
@media (max-width: 520px) { .kit__row { grid-template-columns: 40px minmax(0, 1fr) auto; row-gap: 0; } .kit__dot { grid-row: span 2; } .kit__name { align-self: end; } .kit__qty { grid-row: span 2; } .kit__sum { grid-column: 2; align-self: start; text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; } }
.kslot__cnt { position: absolute; right: 2px; top: 2px; min-width: 30px; padding: 3px 7px; border-radius: 999px; background: var(--ink); color: #fff; font: 700 13px/1.1 var(--text); text-align: center; box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
.kit__links { display: flex; gap: 18px; padding: 0 4px; }
.kit__links button { border: 0; background: none; padding: 0; color: var(--accent-strong); font: 600 14px var(--text); cursor: pointer; }
.kit__links button + button { color: var(--muted); }
@media (max-width: 520px) { .kit__open { grid-template-columns: 1fr; } .kit__mini { justify-self: start; } }

/* ===== Слот с катушкой ===== */
.kslot { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 6px; border: 0; border-radius: 50%; background: none; cursor: pointer; color: inherit; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.kslot__spool { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; transition: transform 200ms var(--ease), box-shadow 200ms ease; }
.kslot__spool svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25)); }
.kslot:not(.is-full) .kslot__spool { border: 2px dashed rgba(255, 255, 255, 0.35); }
.kams--lite .kslot:not(.is-full) .kslot__spool, .kx__shelf .kslot:not(.is-full) .kslot__spool, .kit__mini.kams--lite .kslot:not(.is-full) .kslot__spool, .kit__mini--shelf .kslot:not(.is-full) .kslot__spool { border-color: #b9c2bc; }
.kslot__plus { font: 300 28px/1 var(--display); color: rgba(255, 255, 255, 0.6); }
.kams--lite .kslot__plus, .kx__shelf .kslot__plus, .kit__mini.kams--lite .kslot__plus, .kit__mini--shelf .kslot__plus { color: #8b958f; }
.kslot__n { position: absolute; left: 0; top: 0; display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 12px; font-weight: 700; }
.kams--lite .kslot__n { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.kslot__led { position: absolute; left: 22%; right: 22%; bottom: -4px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); }
.kslot.is-full .kslot__led { background: var(--led, #fff); box-shadow: 0 0 10px var(--led, #fff); }
.kams--lite .kslot__led { display: none; }
/* подпись под катушкой: какой пластик в слоте */
.kslot__tag { position: absolute; left: 50%; top: calc(100% + 10px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; max-width: 120%; padding: 3px 8px; border-radius: 8px; background: var(--bg); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); color: var(--muted); font-size: 11px; line-height: 1.25; white-space: nowrap; pointer-events: none; }
.kslot__tag b { color: var(--ink); font-size: 11px; font-weight: 700; }
.kslot__tag, .kslot__tag b { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* текущий слот пульсирует — сюда встанет катушка */
.kslot.is-cur .kslot__spool { box-shadow: 0 0 0 3px var(--accent-strong), 0 0 0 8px rgba(0, 178, 45, 0.25); }
.kslot.is-cur:not(.is-full) .kslot__spool { border-color: transparent; animation: kpulse 1.6s ease-in-out infinite; }
@keyframes kpulse { 50% { box-shadow: 0 0 0 3px var(--accent-strong), 0 0 0 14px rgba(0, 178, 45, 0.08); } }
@media (hover: hover) { .kx .kslot:hover .kslot__spool { transform: scale(1.04); } }
.kslot.is-pop .kslot__spool svg { animation: kspin 620ms var(--ease); }
@keyframes kspin { from { transform: translateY(-40%) rotate(-200deg) scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.kslot.is-no { animation: kno 420ms ease; }
@keyframes kno { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ===== Рисунок AMS ===== */
.kams { position: relative; padding: 52px 26px 34px; border-radius: 26px; }
.kams__bays { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding-bottom: 44px; }
.kams__brand { position: absolute; left: 26px; top: 20px; font: 700 13px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.kams--pro, .kams--ams { background: linear-gradient(180deg, #363c38, #1d221f); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 24px 60px rgba(0, 0, 0, 0.22); }
.kams--pro .kams__brand, .kams--ams .kams__brand { color: rgba(255, 255, 255, 0.55); }
.kams__lid { position: absolute; left: 12px; right: 12px; top: 12px; height: 62%; border-radius: 18px 18px 50% 50% / 18px 18px 28px 28px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.02)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); pointer-events: none; }
.kams--lite { background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.kams--lite .kams__brand { color: var(--muted); }
.kams__bar { position: absolute; left: 16px; right: 16px; bottom: 66px; height: 12px; border-radius: 6px; background: #c9d0cb; }
.kams__hub { position: absolute; left: 50%; bottom: 60px; width: 48px; height: 24px; transform: translateX(-50%); border-radius: 8px; background: #b5bdb7; }
/* все четыре слота заполнены — подсветка слотов пробегает волной */
.kams.is-party .kslot__led { animation: kled 900ms ease 2; }
.kams.is-party .kslot:nth-child(2) .kslot__led { animation-delay: 120ms; }
.kams.is-party .kslot:nth-child(3) .kslot__led { animation-delay: 240ms; }
.kams.is-party .kslot:nth-child(4) .kslot__led { animation-delay: 360ms; }
.kams.is-party { animation: kjoy 700ms var(--ease); }
@keyframes kled { 50% { transform: scaleX(1.6); box-shadow: 0 0 22px var(--led, #fff); } }
@keyframes kjoy { 30% { transform: translateY(-6px) scale(1.01); } }

/* ===== «Мастерская» на весь экран ===== */
.kit-open, .kit-open body { overflow: hidden; }
.kx { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: radial-gradient(1200px 600px at 30% 0%, #ffffff, var(--bg-2)); opacity: 0; transition: opacity 200ms ease; }
.kx[hidden] { display: none; }
.kx.is-in { opacity: 1; }
.kx__bar { display: flex; align-items: center; gap: 16px; padding: 12px clamp(16px, 3vw, 32px); background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px); box-shadow: 0 1px 0 var(--line); }
.kx__back { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--bg-2); font: 600 15px var(--text); cursor: pointer; }
.kx__t { flex: 1; font: 700 18px/1.2 var(--display); text-align: center; }
.kx__sum { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.kx__sum b { font: 800 20px var(--display); }
.kx__sum span { color: var(--muted); font-size: 13px; }
.kx__done { height: 44px; padding: 0 26px; }
.kx__main { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); min-height: 0; }
.kx__stage { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: clamp(18px, 3vw, 40px); overflow: auto; }
.kx__stage > * { width: min(720px, 100%); }
.kx__coach { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; border-radius: 18px; background: var(--bg); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08); }
.kx__coach::after { content: ''; position: absolute; left: 40px; bottom: -8px; width: 16px; height: 16px; background: inherit; transform: rotate(45deg); border-radius: 3px; }
.kx__coach b { font: 700 19px/1.25 var(--display); }
.kx__coach span { color: var(--muted); font-size: 15px; line-height: 1.45; }
.kx__coach.is-ok { background: var(--ink); } .kx__coach.is-ok b { color: #fff; } .kx__coach.is-ok span { color: rgba(255, 255, 255, 0.78); }
.kx__coach.is-warn { box-shadow: inset 0 0 0 2px var(--sale), 0 8px 30px rgba(0, 0, 0, 0.08); } .kx__coach.is-warn b { color: var(--sale); }
.kx.is-intro .kx__coach { animation: kcoach 420ms var(--ease) both 260ms; }
.kx.is-intro .kx__ams { animation: kams-in 700ms var(--ease) both; }
.kx.is-intro .kx__ams .kslot { animation: kslot-in 500ms var(--ease) both; }
.kx.is-intro .kx__ams .kslot:nth-child(1) { animation-delay: 300ms; } .kx.is-intro .kx__ams .kslot:nth-child(2) { animation-delay: 380ms; }
.kx.is-intro .kx__ams .kslot:nth-child(3) { animation-delay: 460ms; } .kx.is-intro .kx__ams .kslot:nth-child(4) { animation-delay: 540ms; }
@keyframes kams-in { from { opacity: 0; transform: translateY(40px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes kslot-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes kcoach { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.kx__ams[hidden] { display: none; }
.kx__prog { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 14px; font-weight: 600; }
.kx__prog button { border: 0; background: none; padding: 0; color: var(--accent-strong); font: inherit; cursor: pointer; }
.kx__dots { display: inline-flex; gap: 6px; }
.kx__dots i { width: 28px; height: 6px; border-radius: 3px; background: var(--line); transition: background-color 300ms ease; }
.kx__dots i.is-on { background: var(--accent-strong); }
.kx__shelf[hidden] { display: none; }
.kx__shelf.is-new { animation: kcoach 420ms var(--ease); }
.kx__shelf-t { margin-bottom: 8px; font-weight: 700; font-size: 16px; }
.kx__shelf-t small { color: var(--muted); font-weight: 400; font-size: 14px; }
.kx__shelf-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 58px 14px; padding: 14px 14px 58px; border-radius: var(--r); background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }

/* Выбор пластика — панель справа */
.kx__pick { display: flex; flex-direction: column; gap: 12px; padding: 22px; overflow: auto; background: var(--bg); box-shadow: -1px 0 0 var(--line); }
.kpick__t { font: 700 18px/1.2 var(--display); }
.kpick__rm { margin-left: 6px; border: 0; background: none; color: var(--sale); font: 600 15px var(--text); cursor: pointer; }
.kpick__cats { display: flex; flex-wrap: wrap; gap: 6px; }
.kpick__cat { height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--bg-2); font-size: 15px; font-weight: 600; cursor: pointer; }
.kpick__cat[aria-pressed="true"] { background: var(--ink); color: #fff; }
.kpick__mats { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.kpick__mat { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px; border: 0; border-radius: 9px; background: none; box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; font-weight: 500; cursor: pointer; }
.kpick__mat small { color: var(--sale); font-size: 11px; font-weight: 600; }
.kpick__mat[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent-strong); color: var(--accent-strong); font-weight: 600; }
.kpick__note { color: var(--muted); font-size: 13px; }
.kpick__spool { display: inline-flex; align-self: flex-start; padding: 3px; border-radius: 10px; background: var(--bg-2); }
.kpick__spool button { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: none; font-size: 14px; font-weight: 500; cursor: pointer; }
.kpick__spool [aria-pressed="true"] { background: var(--bg); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.kpick__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.kcol { display: flex; flex-direction: column; gap: 2px; padding: 6px 6px 8px; border: 0; border-radius: 14px; background: var(--bg-2); text-align: left; cursor: pointer; transition: box-shadow 160ms ease, transform 160ms var(--ease); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.kcol__img { display: block; position: relative; aspect-ratio: 1; margin-bottom: 4px; border-radius: 10px; background: #e9ecea; overflow: hidden; }
.kcol__img img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 220ms ease; }
.kcol__img.is-in img { opacity: 1; }
/* превью нет — кружок цвета на сером, а не цветной квадрат во всю плитку */
.kcol__img.is-err img { display: none; }
.kcol__img.is-err::after { content: ''; position: absolute; inset: 22%; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
/* смена типа или материала: плитки проявляются лесенкой */
.kpick__grid.is-enter > .kcol { animation: kpick-in 260ms var(--ease) backwards; animation-delay: calc(var(--k, 0) * 18ms); }
@keyframes kpick-in { from { opacity: 0; transform: translateY(8px); } }
.kcol__name { padding: 0 4px; font-size: 14px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcol__meta { padding: 0 4px; color: var(--muted); font-size: 12px; }
.kcol.is-on { box-shadow: inset 0 0 0 2px var(--accent-strong); }
.kcol:disabled { opacity: 0.4; cursor: default; }
@media (hover: hover) { .kcol:not(:disabled) { cursor: grab; } .kcol:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1); } .kcol.is-on:hover { box-shadow: inset 0 0 0 2px var(--accent-strong); } .kx .kslot.is-full { cursor: grab; } }

/* Перетаскивание */
.kx.is-drag, .kx.is-drag * { cursor: grabbing !important; }
.kghost { position: fixed; left: 0; top: 0; z-index: 1100; width: 80px; height: 80px; pointer-events: none; filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.35)); }
.kghost svg { width: 100%; height: 100%; animation: klift 180ms var(--ease) both; }
@keyframes klift { from { transform: scale(0.7); } to { transform: scale(1.08); } }
.kslot.is-lift { opacity: 0.35; }
.kslot.is-over .kslot__spool { box-shadow: 0 0 0 3px var(--accent-strong), 0 0 0 12px rgba(0, 178, 45, 0.3); transform: scale(1.08); }
.kx__msg { position: fixed; left: 50%; bottom: 28px; z-index: 1001; transform: translate(-50%, 8px); padding: 10px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 200ms ease, transform 200ms var(--ease); max-width: calc(100% - 32px); text-align: center; }
.kx__msg.is-on { opacity: 1; transform: translate(-50%, 0); }
.kx__msg.has-btn { pointer-events: auto; display: flex; align-items: center; gap: 14px; }
.kx__msg button { border: 0; background: none; padding: 0; color: #7fe39a; font: 700 14px var(--text); cursor: pointer; }
.kx__clear { height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: none; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font: 600 15px var(--text); cursor: pointer; }
.kx__clear[hidden] { display: none; }
@media (hover: hover) { .kx__clear:hover { color: var(--sale); box-shadow: inset 0 0 0 1px var(--sale); } }

/* Телефон: сверху AMS (прилипает), под ним выбор пластика, всё в одной прокрутке */
@media (max-width: 900px) {
  .kx__bar { gap: 8px; padding: 8px 12px; }
  .kx__back { width: 40px; padding: 0; justify-content: center; }
  .kx__back-t, .kx__sum span { display: none; }
  .kx__t { font-size: 16px; text-align: left; }
  .kx__sum b { font-size: 16px; }
  .kx__done { height: 40px; padding: 0 16px; }
  .kx__main { display: block; overflow: auto; }
  .kx__stage { display: contents; }
  .kx__stage > *, .kx__pick { width: auto; margin: 0 12px; }
  .kx__coach { margin-top: 12px; padding: 12px 14px; }
  .kx__coach b { font-size: 16px; } .kx__coach span { font-size: 14px; }
  .kx__ams { position: sticky; top: 0; z-index: 3; margin: 12px 0 0; border-radius: 0 0 20px 20px; }
  .kams { padding: 36px 10px 18px; }
  .kams__brand { left: 14px; top: 13px; font-size: 11px; }
  .kams__bays { gap: 8px; padding-bottom: 36px; }
  .kams__bar { bottom: 52px; } .kams__hub { bottom: 48px; }
  .kslot__n { min-width: 18px; height: 18px; font-size: 10px; }
  .kslot__tag { font-size: 10px; padding: 2px 5px; max-width: 112%; } .kslot__tag b { font-size: 10px; }
  .kx__prog { margin-top: 10px; }
  .kx__shelf { margin-top: 14px; }
  .kx__clear { padding: 0 10px; font-size: 14px; }
  .kx__shelf-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 50px 10px; padding: 10px 10px 50px; }
  .kx__pick { margin-top: 16px; padding: 16px 12px 28px; border-radius: 20px 20px 0 0; box-shadow: 0 -1px 0 var(--line); }
  .kpick__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .kx, .kx * { animation: none !important; transition: none !important; } }
