/* =====================================================================
   FENIX GROUP — 3D-конструктор (/konstruktor/). Использует токены из style.css.
   Раскладка: [этапы | 3D-вид | панель]; на телефоне — 3D-вид закреплён сверху, панель под ним.
===================================================================== */
.kx-head { display: flex; align-items: baseline; gap: .4rem 1.4rem; flex-wrap: wrap; padding: .85rem var(--gutter); background: var(--ink-0); border-bottom: 1px solid var(--line); }
.kx-head h1 { font-size: clamp(1.05rem, 1.6vw, 1.3rem); letter-spacing: -.01em; }
.kx-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.kx-head .breadcrumb { margin: 0; }

.kx { --rail: 236px; --pan: 376px; --hh: 62px; position: relative; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr) var(--pan);
  height: calc(100svh - var(--header-h) - var(--hh)); min-height: 560px; background: var(--ink-1); border-bottom: 1px solid var(--line); color: #EDEDED; font-size: .92rem; }
.kx button { font: inherit; color: inherit; }

/* этапы */
.kx-rail { overflow-y: auto; padding: 1rem .9rem 1.2rem; border-right: 1px solid var(--line); background: var(--ink-0); scrollbar-width: thin; }
.kx-rail-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .9rem; }
.kx-rail-head b { font: 600 .68rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--steel-3); }
.kx-play { padding: .5rem .7rem; font: 600 .72rem/1 var(--mono) !important; color: var(--ink-1) !important; background: var(--grad-fire); clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px)); white-space: nowrap; }
.kx-stages { display: flex; flex-direction: column; gap: 2px; counter-reset: s; }
.kx-stages li { position: relative; }
.kx-stages button { width: 100%; display: flex; align-items: center; gap: .7rem; padding: .62rem .6rem; text-align: left; border-left: 2px solid rgba(255,255,255,.1); color: #A9A9A9 !important; transition: background .2s, color .2s, border-color .2s; }
.kx-stages button em { font: 600 .7rem/1 var(--mono); color: var(--steel-2); min-width: 1.4em; }
.kx-stages button span { font-weight: 500; line-height: 1.25; }
.kx-stages button:hover { background: rgba(255,255,255,.04); color: #fff !important; }
.kx-stages li.done button { border-left-color: rgba(231,136,64,.55); color: #D0D0D0 !important; }
.kx-stages li.done button em { color: var(--fire); }
.kx-stages li.on button { background: linear-gradient(90deg, rgba(231,136,64,.22), rgba(231,136,64,0)); border-left-color: var(--fire); color: #fff !important; }
.kx-stages li.on button em { color: var(--fire-hi); }
.kx-pay { display: block; margin: .7rem 0 .25rem .6rem; font: 600 .6rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--fire); }
.kx-stages li:first-child .kx-pay { margin-top: 0; }

/* 3D-вид */
.kx-view { position: relative; min-width: 0; overflow: hidden; background: radial-gradient(70% 60% at 50% 105%, rgba(231,136,64,.2), transparent 70%), radial-gradient(60% 50% at 50% 0%, rgba(255,255,255,.05), transparent 70%), #0C0C0D; }
#kx-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline: none; }
#kx-canvas:active { cursor: grabbing; }
.kx-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.kx-label { position: absolute; left: 0; top: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: .28rem .5rem; background: rgba(10,10,10,.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); white-space: nowrap; will-change: transform; cursor: pointer; }
.kx-label b { font: 600 .72rem/1.1 var(--font); color: #fff; }
.kx-label i { font: 500 .62rem/1 var(--mono); font-style: normal; color: #B9B9B9; }
.kx-label.on { background: var(--fire); box-shadow: none; }
.kx-label.on b, .kx-label.on i { color: var(--ink-1); }
.kx-cap { position: absolute; left: 14px; top: 14px; max-width: min(340px, 62%); padding: .75rem .9rem; background: rgba(10,10,10,.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); border-left: 2px solid var(--fire); pointer-events: none; }
.kx-cap span { display: block; font: 600 .6rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--fire); margin-bottom: .35rem; }
.kx-cap b { display: block; font: 600 1.05rem/1.15 var(--display); color: #fff; margin-bottom: .35rem; }
.kx-cap p { margin: 0; font-size: .8rem; line-height: 1.45; color: #C2C2C2; }
.kx-tools { position: absolute; right: 12px; top: 12px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 46%; }
.kx-tools button, .kx-selbar button { min-height: 34px; padding: 0 .7rem; font: 600 .72rem/1 var(--mono) !important; color: #E6E6E6 !important; background: rgba(10,10,10,.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); white-space: nowrap; transition: box-shadow .2s, color .2s; }
.kx-tools button:hover, .kx-selbar button:hover { box-shadow: inset 0 0 0 1px var(--fire); color: var(--fire-hi) !important; }
.kx-tools button.on { box-shadow: inset 0 0 0 1px var(--fire); color: var(--fire-hi) !important; }
.kx-tools button:disabled { opacity: .35; pointer-events: none; }
.kx-selbar { position: absolute; left: 50%; bottom: 14px; transform: translate(-50%, 20px); display: flex; align-items: center; gap: 6px; max-width: calc(100% - 24px); padding: 6px 6px 6px 12px; background: rgba(10,10,10,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: inset 0 0 0 1px rgba(231,136,64,.5), 0 14px 40px -12px rgba(0,0,0,.8); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.kx-selbar.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.kx-selbar span { font-size: .8rem; color: #CFCFCF; margin-right: .3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kx-selbar span b { color: #fff; }
.kx-selbar button.pri { color: var(--ink-1) !important; background: var(--grad-fire); box-shadow: none; }
.kx-toast { position: absolute; left: 50%; top: 14px; transform: translate(-50%, -16px); max-width: min(460px, calc(100% - 28px)); padding: .6rem .9rem; font-size: .82rem; line-height: 1.4; text-align: center; color: var(--ink-1); background: var(--grad-fire); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 3; }
.kx-toast.on { opacity: 1; transform: translate(-50%, 0); }
.kx-load { position: absolute; inset: 0; display: grid; place-items: center; padding: 2rem; text-align: center; font: 500 .85rem/1.5 var(--mono); letter-spacing: .06em; color: #BDBDBD; background: #0C0C0D; z-index: 4; }
.kx-hint { position: absolute; left: 14px; bottom: 12px; margin: 0; font: 500 .62rem/1.4 var(--mono); letter-spacing: .06em; color: rgba(255,255,255,.42); pointer-events: none; max-width: 40%; }

/* панель */
.kx-panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--ink-2); }
.kx-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.kx-tabs button { padding: .95rem .2rem; font: 600 .78rem/1 var(--font) !important; color: #9C9C9C !important; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.kx-tabs button:hover { color: #fff !important; }
.kx-tabs button.on { color: #fff !important; border-bottom-color: var(--fire); background: linear-gradient(180deg, rgba(231,136,64,0), rgba(231,136,64,.1)); }
.kx-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem 1rem 1.6rem; scrollbar-width: thin; }
.kx-h { margin: 1.15rem 0 .55rem; font: 600 .64rem/1.2 var(--mono); letter-spacing: .13em; text-transform: uppercase; color: var(--steel-3); }
.kx-body > .kx-h:first-child { margin-top: 0; }
.kx-note { margin: .7rem 0 0; font-size: .78rem; line-height: 1.5; color: #9A9A9A; }
.kx-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 1px; background: var(--line-2); box-shadow: inset 0 0 0 1px var(--line-2); margin-bottom: .2rem; }
.kx-seg button { padding: .68rem .3rem; font-weight: 600; font-size: .82rem; background: var(--ink-3); color: #B5B5B5 !important; transition: background .2s, color .2s; }
.kx-seg button.on { background: var(--grad-fire); color: var(--ink-1) !important; }
.kx-seg.sm { margin-top: .7rem; } .kx-seg.sm button { font-size: .74rem; padding: .55rem .2rem; }
.kx-tpls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kx-tpl { display: flex; flex-direction: column; gap: .2rem; padding: .7rem; text-align: left; background: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s; }
.kx-tpl svg { width: 100%; height: 62px; margin-bottom: .35rem; }
.kx-tpl svg rect { fill: rgba(255,255,255,.05); stroke: #8D8D8D; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.kx-tpl b { font-size: .84rem; color: #fff; } .kx-tpl i { font: 500 .66rem/1.2 var(--mono); font-style: normal; color: #9C9C9C; }
.kx-tpl:hover { box-shadow: inset 0 0 0 1px rgba(231,136,64,.6); }
.kx-tpl.on { box-shadow: inset 0 0 0 1.5px var(--fire); } .kx-tpl.on svg rect { stroke: var(--fire); fill: rgba(231,136,64,.12); }
.kx-btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 46px; margin-top: .8rem; padding: .5rem .8rem; font-weight: 600; font-size: .86rem; text-align: center; color: #fff !important; box-shadow: inset 0 0 0 1px var(--line-2); transition: box-shadow .2s, color .2s; }
.kx-btn:hover { box-shadow: inset 0 0 0 1px var(--fire); color: var(--fire-hi) !important; }
.kx-btn.pri { color: var(--ink-1) !important; background: var(--grad-fire); box-shadow: none; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px)); }
.kx-btn.sm { min-height: 38px; font-size: .78rem; } .kx-btn.ghost { color: #BDBDBD !important; }
.kx-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kx-chips.rooms { margin: .7rem 0; }
.kx-chip { display: inline-flex; align-items: center; gap: .45rem; min-height: 32px; padding: 0 .65rem; font-size: .78rem; color: #CFCFCF !important; background: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s, color .2s; }
.kx-chip i { width: 18px; height: 18px; flex-shrink: 0; background-size: cover; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.kx-chip:hover { box-shadow: inset 0 0 0 1px rgba(231,136,64,.6); }
.kx-chip.on { box-shadow: inset 0 0 0 1.5px var(--fire); color: #fff !important; background: rgba(231,136,64,.14); }
.kx-search { width: 100%; min-height: 42px; padding: 0 .8rem; font: inherit; color: #fff; background: var(--ink-1); border: 1px solid var(--line-2); border-radius: 0; outline: none; }
.kx-search:focus { border-color: var(--fire); }
.kx-sws { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kx-sw { position: relative; display: flex; flex-direction: column; gap: .3rem; padding: 0 0 .45rem; text-align: left; background: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s, transform .2s; }
.kx-sw-img { display: block; width: 100%; aspect-ratio: 1.15; background-size: cover; background-position: center; }
.kx-sw-n { padding: 0 .4rem; font-size: .72rem; line-height: 1.25; color: #DCDCDC; }
.kx-sw-t { margin: auto .4rem 0; font: 600 .56rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #8D8D8D; }
.kx-sw-t.t2 { color: #C9A46A; } .kx-sw-t.t3 { color: var(--fire); }
.kx-sw:hover { box-shadow: inset 0 0 0 1px rgba(231,136,64,.6); transform: translateY(-1px); }
.kx-sw.on { box-shadow: inset 0 0 0 2px var(--fire); }
.kx-sw.on::after { content: "✓"; position: absolute; right: 5px; top: 5px; width: 20px; height: 20px; display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: var(--ink-1); background: var(--fire); }
.kx-furn { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.kx-furn button { display: flex; flex-direction: column; gap: .15rem; padding: .55rem .6rem; text-align: left; background: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s; }
.kx-furn button b { font-size: .78rem; font-weight: 600; color: #E6E6E6; } .kx-furn button i { font: 500 .62rem/1 var(--mono); font-style: normal; color: #8D8D8D; }
.kx-furn button:hover { box-shadow: inset 0 0 0 1px var(--fire); }
.kx-toolrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kx-toolrow button { min-height: 42px; font-size: .78rem; font-weight: 600; background: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); color: #CFCFCF !important; }
.kx-toolrow button.on { background: var(--grad-fire); color: var(--ink-1) !important; box-shadow: none; }
.kx-card { margin-top: 1rem; padding: .9rem; background: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); }
.kx-card .kx-h { margin-top: 0; }
.kx-f { display: grid; grid-template-columns: 78px 1fr; align-items: center; gap: .5rem; margin-bottom: .5rem; font-size: .78rem; color: #A9A9A9; }
.kx-f input, .kx-f select { min-height: 36px; padding: 0 .55rem; font: inherit; color: #fff; background: var(--ink-1); border: 1px solid var(--line-2); border-radius: 0; min-width: 0; width: 100%; }
.kx-dims { display: grid; grid-template-columns: 78px 34px 1fr 34px; align-items: center; gap: .4rem .5rem; margin: .2rem 0 .2rem; font-size: .78rem; color: #A9A9A9; }
.kx-dims b { text-align: center; color: #fff; font: 600 .82rem var(--mono); }
.kx-dims button { height: 34px; font-size: 1.05rem; background: var(--ink-1); box-shadow: inset 0 0 0 1px var(--line-2); }
.kx-dims button:hover { box-shadow: inset 0 0 0 1px var(--fire); }
.kx-total { display: flex; flex-direction: column; gap: .2rem; padding: 1rem; background: radial-gradient(120% 100% at 100% 0%, rgba(231,136,64,.2), transparent 60%), var(--ink-3); box-shadow: inset 0 0 0 1px rgba(231,136,64,.4); }
.kx-total span { font: 600 .64rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--steel-3); }
.kx-total b { font: 600 1.5rem/1.1 var(--display); color: #fff; }
.kx-total em { font: 600 1.25rem/1.2 var(--display); background: var(--grad-fire); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kx-total i { font-style: normal; font-size: .74rem; color: #A9A9A9; } .kx-total u { text-decoration: none; margin-top: .45rem; font-size: .8rem; color: #E0E0E0; }
.kx-tbl { width: 100%; border-collapse: collapse; font-size: .8rem; }
.kx-tbl td { padding: .42rem 0; border-bottom: 1px solid var(--line); color: #CFCFCF; vertical-align: top; }
.kx-tbl td:last-child { text-align: right; white-space: nowrap; padding-left: .8rem; font-family: var(--mono); font-size: .76rem; color: #fff; }

/* текст под приложением */
.kx-about .kx-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.kx-about .kx-step { padding: 1.8rem 1.6rem; background: var(--surface); }
.kx-about .kx-step b { display: block; font: 600 1.6rem/1 var(--display); margin-bottom: .9rem; background: var(--grad-fire); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kx-about .kx-step h3 { margin-bottom: .5rem; } .kx-about .kx-step p { color: var(--muted); font-size: .95rem; }
.kx-cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem 2.5rem; }
.kx-cats h3 { margin-bottom: .6rem; font-size: 1.05rem; } .kx-cats p { color: var(--muted); font-size: .95rem; line-height: 1.7; }

@media (max-width: 1180px) { .kx { --rail: 200px; --pan: 330px; } .kx-hint { display: none; } }
@media (max-width: 900px) {
  .kx { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .kx-view { order: 1; } .kx-rail { order: 2; } .kx-panel { order: 3; }
  .kx-view { position: sticky; top: var(--header-h); z-index: 6; height: 46svh; min-height: 300px; border-bottom: 1px solid var(--line); }
  .kx-rail { position: sticky; top: calc(var(--header-h) + max(46svh, 300px)); z-index: 5; display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .kx-rail::-webkit-scrollbar { display: none; }
  .kx-rail-head { margin: 0; flex-shrink: 0; position: sticky; left: 0; z-index: 1; padding: .2rem .5rem .2rem 0; background: var(--ink-0); } .kx-rail-head b { display: none; }
  .kx-stages { flex-direction: row; gap: 4px; }
  .kx-stages button { padding: .5rem .6rem; border-left: 0; border-bottom: 2px solid rgba(255,255,255,.1); white-space: nowrap; gap: .4rem; }
  .kx-stages li.done button { border-bottom-color: rgba(231,136,64,.55); } .kx-stages li.on button { border-bottom-color: var(--fire); background: rgba(231,136,64,.18); }
  .kx-pay { display: none; }
  .kx-panel { border-left: 0; min-height: 50svh; }
  .kx-tabs { position: sticky; top: calc(var(--header-h) + max(46svh, 300px) + 49px); z-index: 4; background: var(--ink-2); }
  .kx-body { overflow: visible; padding-bottom: 2.4rem; }
  .kx-cap { left: 8px; top: 8px; max-width: 58%; padding: .5rem .6rem; } .kx-cap p { display: none; } .kx-cap b { font-size: .86rem; margin: 0; }
  .kx-tools { right: 8px; top: 8px; max-width: 40%; gap: 4px; } .kx-tools button { min-height: 30px; padding: 0 .5rem; font-size: .64rem !important; }
  .kx-selbar { bottom: 8px; } .kx-selbar span { max-width: 34vw; }
  .kx-label { padding: .2rem .35rem; } .kx-label b { font-size: .62rem; } .kx-label i { font-size: .54rem; }
  .kx-head p { display: none; } .kx { --hh: 0px; }
  .kx-about .kx-steps, .kx-cats { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .kx-selbar, .kx-toast, .kx-sw { transition: none; } }
