/* Конфигуратор террасы: слева сцена (План / 3D), справа панель опций; на мобильных — друг под другом.
   Панель и инструменты повторяют конфигуратор стола (desk.css) — тот же язык интерфейса на всех демо */
.deckcfg {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 24px;
    align-items: start;
    color: var(--color-whte, #fff);
}

/* Липкая колонка, высота сцены и плашка итога — общие (configurator-kit/kit.css: .cfg-view, .cfg-stage, .cfg-deal) */
.deckcfg__stage {
    border-radius: 32px;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 85%, rgba(151, 191, 116, .22), transparent 60%),
        linear-gradient(180deg, #2b2e2b 0%, #1d1f1d 100%);
    border: 1px solid rgba(255, 255, 255, .08);
    transition: background .6s;
}

/* Подсветка включает «вечер» */
.deckcfg__stage.is-night {
    background:
        radial-gradient(ellipse at 50% 85%, rgba(255, 190, 110, .14), transparent 60%),
        linear-gradient(180deg, #101418 0%, #07090b 100%);
}

.deckcfg__stage.is-plan {
    background: #17324d;
}

.deckcfg__stage > canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
    cursor: grab;
    touch-action: none;
}

.deckcfg__stage > canvas:active {
    cursor: grabbing;
}

.deckcfg__stage > canvas[hidden] {
    display: none;
}

/* Курсор плана зависит от того, что под ним (точка, сторона, лестница) — задаётся из JS через --plan-cursor;
   правило перебивает общее «canvas: grab» зоны data-cursor="native" из site-cursor.css */
.deckcfg__stage > .deckcfg__plan,
html.has-site-cursor [data-cursor="native"] .deckcfg__stage > canvas.deckcfg__plan {
    cursor: var(--plan-cursor, default) !important;
}

.deckcfg__loader {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    transition: opacity .4s;
}

.deckcfg__loader span {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, .15);
    border-top-color: var(--color-alt, #97bf74);
    animation: deckcfg-spin 1s linear infinite;
}

@keyframes deckcfg-spin {
    to { transform: rotate(360deg); }
}

.deckcfg--ready .deckcfg__loader {
    opacity: 0;
    pointer-events: none;
}

.deckcfg__nogl {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 56px;
    padding: 0 24px;
    text-align: center;
    color: rgba(255, 255, 255, .7);
}

.deckcfg--nogl .deckcfg__nogl {
    display: block;
}

.deckcfg--nogl [data-deck-mode="3d"],
.deckcfg--nogl [data-deck-tool="ruler"],
.deckcfg--nogl [data-deck-tool="night"],
.deckcfg--nogl .deckcfg__loader {
    display: none;
}

/* Панель инструментов на сцене: План/3D, подсистема, размеры, фото, сброс */
.deckcfg__tools {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 6px;
}

.deckcfg__tool {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(0, 0, 0, .3);
    color: #fff;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s, opacity .2s;
}

.deckcfg__tool:hover:not(:disabled) {
    border-color: var(--color-alt, #97bf74);
    background: rgba(0, 0, 0, .5);
}

.deckcfg__tool.is-active,
.deckcfg__tool.is-active:hover:not(:disabled) {
    background: var(--color-alt, #97bf74);
    border-color: var(--color-alt, #97bf74);
    color: #1d1f1d;
}

.deckcfg__tool:disabled {
    opacity: .35;
    cursor: default;
}

.deckcfg__tool.is-flash {
    animation: deckcfg-flash .5s ease-out;
}

@keyframes deckcfg-flash {
    30% { transform: scale(.88); background: #fff; color: #1d1f1d; }
}

.deckcfg__mode {
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(0, 0, 0, .3);
}

.deckcfg__mode button {
    min-width: 34px;
    padding: 7px 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.deckcfg__mode button.is-active {
    background: var(--color-alt, #97bf74);
    color: #1d1f1d;
}

/* Всплывающее меню стороны или лестницы на плане */
.deckcfg__pop {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 5px 5px 14px;
    border-radius: 999px;
    background: #1d1f1d;
    border: 1px solid rgba(255, 255, 255, .15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
    white-space: nowrap;
    font-size: 13px;
    animation: deckcfg-fade .2s ease-out;
}

.deckcfg__pop[hidden] {
    display: none;
}

@keyframes deckcfg-fade {
    from { opacity: 0; }
}

.deckcfg__pop b {
    margin-right: 6px;
    font-weight: 600;
}

.deckcfg__pop button {
    min-width: 32px;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}

.deckcfg__pop button:hover:not(:disabled) {
    border-color: var(--color-alt, #97bf74);
}

.deckcfg__pop button.is-active {
    background: var(--color-alt, #97bf74);
    border-color: var(--color-alt, #97bf74);
    color: #1d1f1d;
}

.deckcfg__pop button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

/* Подписи размеров (CSS2D поверх сцены) */
.deckcfg__labels {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.deckcfg__labels[hidden] {
    display: none;
}

.deckcfg__dim {
    padding: 3px 7px;
    border-radius: 6px;
    background: var(--color-alt, #97bf74);
    color: #1d1f1d;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.deckcfg__drag {
    position: absolute;
    left: 20px;
    bottom: 16px;
    z-index: 2;
    max-width: calc(100% - 300px);
    font-size: 13px;
    line-height: 1.35;
    color: rgba(255, 255, 255, .45);
    pointer-events: none;
}

.deckcfg__panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, .12);
    /* Сплошной фон — конфигуратор стоит на светлом блоке */
    background: #1d1f1d;
}

.deckcfg__label {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--color-alt, #97bf74);
}

.deckcfg__label output {
    color: var(--color-whte, #fff);
}

/* Сегментированные переключатели: все варианты в одну строку */
.deckcfg__seg {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
}

.deckcfg__seg[hidden] {
    display: none;
}

.deckcfg__seg--under {
    margin-top: 6px;
}

.deckcfg__opt {
    flex: 1 1 auto;
    padding: 8px 10px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.deckcfg__opt:hover {
    background: rgba(255, 255, 255, .08);
}

.deckcfg__opt.is-active {
    background: var(--color-alt, #97bf74);
    color: #1d1f1d;
}

.deckcfg__group--size,
.deckcfg__group--pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.deckcfg__group--pair {
    grid-template-columns: auto 1fr;
}

.deckcfg__range {
    width: 100%;
    height: 38px;
    margin: 0;
    accent-color: var(--color-alt, #97bf74);
    cursor: pointer;
}

/* Площадь: поле ввода в стиле сегмента */
.deckcfg__area {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    cursor: text;
}

.deckcfg__area input {
    width: 52px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}

.deckcfg__area input::-webkit-outer-spin-button,
.deckcfg__area input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.deckcfg__area input:focus {
    outline: none;
}

.deckcfg__area:focus-within {
    box-shadow: inset 0 0 0 1px var(--color-alt, #97bf74);
}

.deckcfg__area span {
    font-size: 14px;
    color: rgba(255, 255, 255, .6);
}

/* Строка «подпись слева — кружки справа» */
.deckcfg__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.deckcfg__row .deckcfg__label {
    margin: 0;
}

.deckcfg__row .deckcfg__seg {
    flex: none;
}

.deckcfg__row .deckcfg__opt {
    min-width: 42px;
    padding: 7px 9px;
    font-size: 13px;
}

.deckcfg__swatches {
    display: flex;
    gap: 8px;
}

.deckcfg__swatch {
    width: 32px;
    height: 32px;
    flex: none;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--sw);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), inset -4px -6px 8px rgba(0, 0, 0, .3);
    outline: 2px solid transparent;
    outline-offset: 3px;
    cursor: pointer;
    transition: outline-color .2s, transform .15s;
}

.deckcfg__swatch[hidden] {
    display: none;
}

.deckcfg__swatch:hover {
    transform: scale(1.08);
}

.deckcfg__swatch.is-active {
    outline-color: var(--color-alt, #97bf74);
}

/* Плитки «иконка + подпись»: формы, доска, направление */
.deckcfg__tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.deckcfg__tiles--4 {
    grid-template-columns: repeat(4, 1fr);
}

.deckcfg__tiles--4 .deckcfg__tile small {
    font-size: 10px;
    letter-spacing: -.01em;
}

.deckcfg__tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
    padding: 8px 4px 7px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .15);
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}

.deckcfg__tile svg {
    width: 40px;
    height: 34px;
}

.deckcfg__tile small {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    opacity: .75;
}

.deckcfg__tile:hover {
    border-color: var(--color-alt, #97bf74);
}

.deckcfg__tile.is-active {
    background: var(--color-alt, #97bf74);
    border-color: var(--color-alt, #97bf74);
    color: #1d1f1d;
}

.deckcfg__tile.is-active small {
    opacity: 1;
}

/* «Своя» форма — индикатор: включается, когда точки двигали на плане */
.deckcfg__tile[data-deck-opt="shape:custom"] {
    cursor: default;
    border-style: dashed;
}

.deckcfg__tile[data-deck-opt="shape:custom"]:not(.is-active) {
    opacity: .5;
}

/* Лестницы: строка на каждую — ступени, ширина, удалить */
.deckcfg__stairs {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.deckcfg__stairs:not(:empty) {
    margin-bottom: 8px;
}

.deckcfg__stair {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 4px 4px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    font-size: 13px;
    animation: deckcfg-pop-in .25s ease-out;
}

@keyframes deckcfg-pop-in {
    from { opacity: 0; transform: translateY(-4px); }
}

.deckcfg__stair > span {
    flex: 1;
    white-space: nowrap;
}

.deckcfg__stepper {
    display: flex;
    align-items: center;
    gap: 2px;
}

.deckcfg__stepper output {
    min-width: 56px;
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.deckcfg__stepper button,
.deckcfg__x {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}

.deckcfg__stepper button:hover,
.deckcfg__x:hover {
    border-color: var(--color-alt, #97bf74);
}

.deckcfg__x {
    border: 0;
    background: rgba(255, 255, 255, .08);
}

/* Опции: плюсик поворачивается в крестик, когда опция добавлена */
.deckcfg__addons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.deckcfg__addon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .15);
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s, opacity .2s;
}

.deckcfg__addon:hover:not(:disabled) {
    border-color: var(--color-alt, #97bf74);
}

.deckcfg__addon:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.deckcfg__plus {
    position: relative;
    width: 22px;
    height: 22px;
    flex: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    transition: transform .25s, background .2s;
}

.deckcfg__plus::before,
.deckcfg__plus::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 2px;
    margin: -1px 0 0 -5px;
    border-radius: 1px;
    background: currentColor;
}

.deckcfg__plus::after {
    transform: rotate(90deg);
}

.deckcfg__addon.is-active {
    background: var(--color-alt, #97bf74);
    border-color: var(--color-alt, #97bf74);
    color: #1d1f1d;
}

.deckcfg__addon.is-active .deckcfg__plus {
    transform: rotate(135deg);
    background: rgba(0, 0, 0, .12);
}

/* Опции — карточки «снимок + название» в один ряд (как у стола), что не влезло — листается свайпом */
.deckcfg__cards {
    display: flex;
    gap: 8px;
    margin: -2px;
    padding: 2px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}

.deckcfg__cards::-webkit-scrollbar {
    display: none;
}

.deckcfg__card {
    flex: 0 0 120px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    scroll-snap-align: start;
    cursor: pointer;
}

.deckcfg__card-img {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    overflow: hidden;
    background: #2b2e2b;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
    transition: box-shadow .2s;
}

.deckcfg__card-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.deckcfg__card-img .deckcfg__plus {
    position: absolute;
    right: 6px;
    bottom: 6px;
    background: rgba(29, 31, 29, .75);
    color: #fff;
}

.deckcfg__card-name {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
}

.deckcfg__card:hover .deckcfg__card-img {
    box-shadow: inset 0 0 0 2px var(--color-alt, #97bf74);
}

.deckcfg__card.is-active .deckcfg__card-img {
    box-shadow: inset 0 0 0 3px var(--color-alt, #97bf74);
}

.deckcfg__card.is-active .deckcfg__plus {
    transform: rotate(135deg);
    background: var(--color-alt, #97bf74);
    color: #1d1f1d;
}

/* День / ночь: кнопка показывает луну, ночью — солнце (вернуть день) */
.deckcfg__icon-sun,
.deckcfg__tool--night.is-active .deckcfg__icon-moon {
    display: none;
}

.deckcfg__tool--night.is-active .deckcfg__icon-sun {
    display: block;
}

/* Смета: материалы и количество из той же раскладки, что план и 3D */
.deckcfg__spec {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.deckcfg__spec td {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .75);
    vertical-align: top;
}

.deckcfg__spec td + td {
    padding-left: 12px;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

/* Низ широкой сцены занят плашкой итога — подсказка уходит наверх, влево от инструментов */
@container (min-width: 900px) {
    .deckcfg__drag {
        top: 24px;
        bottom: auto;
        max-width: calc(100% - 330px);
    }
}

@media (max-width: 1024px) {
    .deckcfg {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Телефон: сцена, кнопки разделов и итог — в один экран; панель — окном поверх кнопок (kit.css: .cfg-panel) */
@media (max-width: 600px) {
    .deckcfg__stage {
        border-radius: 20px;
    }

    /* В окне: плитки и кружки — одной строкой от края до края (листаются свайпом), кружки крупнее */
    .deckcfg__panel .deckcfg__tile {
        width: 96px;
    }

    .deckcfg__panel .deckcfg__swatches {
        gap: 12px;
        margin-block: -9px;
        padding-block: 9px;
    }

    .deckcfg__panel .deckcfg__swatch {
        width: 52px;
        height: 52px;
    }

    .deckcfg__panel .deckcfg__row--colors {
        flex-direction: column;
        align-items: stretch;
    }

    .deckcfg__panel .deckcfg__card {
        width: 132px;
    }

    .deckcfg__opt {
        padding: 8px 8px;
        font-size: 13px;
    }

    .deckcfg__drag {
        display: none;
    }

    .deckcfg__tools {
        top: 10px;
        right: 10px;
        left: 10px;
        justify-content: flex-end;
        gap: 4px;
    }

    .deckcfg__tool {
        width: 36px;
        height: 36px;
    }

    .deckcfg__mode button {
        padding: 7px 10px;
    }

    .deckcfg__pop {
        font-size: 12px;
    }

    .deckcfg__pop b {
        display: none;
    }

    .deckcfg__row {
        flex-wrap: wrap;
        row-gap: 8px;
    }
}
