:root {
    --text: #202420;
    --muted: #687068;
    --line: #d9ddd9;
    --soft: #f3f5f3;
    --soft-2: #f8f9f8;
    --green: #14864f;
    --green-dark: #0c673b;
    --green-soft: #e7f4eb;
    --warning-soft: #fff7e5;
    --model-count: 2;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    background: #fff;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--text);
    background: #fff;
    font-family: "Open Sans", sans-serif;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

button,
select {
    font: inherit;
}

button,
a,
select {
    -webkit-tap-highlight-color: transparent;
}

button,
a {
    touch-action: manipulation;
}

.home-shell,
.comparison,
.not-found {
    width: min(100%, 1050px);
    margin: 0 auto;
}

.home-shell {
    padding: 20px 14px;
}

.builder {
    width: min(100%, 720px);
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.builder__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--line);
}

.builder__head h1 {
    margin: 0;
    font-size: clamp(23px, 4vw, 30px);
    line-height: 1.2;
}

.builder__head p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.builder__count {
    flex: 0 0 auto;
    padding: 4px 8px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 12px;
    white-space: nowrap;
}

.model-picker {
    padding: 0 18px 16px;
}

.picker-row {
    position: relative;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    min-height: 78px;
    border-bottom: 1px solid var(--line);
}

.picker-row--third {
    grid-template-columns: 30px minmax(0, 1fr) 38px;
}

.picker-row__index {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.picker-row__field {
    min-width: 0;
}

.picker-row__field > span {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 13px;
}

.picker-row select {
    width: 100%;
    padding: 3px 28px 3px 0;
    color: var(--text);
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 18px;
    font-weight: 600;
}

.picker-row select:focus-visible {
    box-shadow: 0 2px 0 var(--green);
}

.picker-row__remove {
    width: 32px;
    height: 32px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.builder__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
}

.text-action {
    padding: 10px 0;
    color: var(--text);
    border: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.text-action span {
    margin-right: 4px;
    color: var(--green);
    font-size: 18px;
}

.primary-action {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 11px 16px;
    color: #fff;
    border: 0;
    border-radius: 5px;
    background: var(--green);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.primary-action:hover {
    background: var(--green-dark);
}

.form-error {
    margin: 10px 0 0;
    color: #9a352b;
    font-size: 14px;
    font-weight: 600;
}

.not-found {
    min-height: 100vh;
    padding: 15vh 20px 50px;
    text-align: center;
}

.not-found__code {
    color: var(--green);
    font-size: 14px;
    font-weight: 700;
}

.not-found h1 {
    margin: 8px 0;
    font-size: clamp(28px, 6vw, 42px);
}

.not-found p {
    margin: 0 0 22px;
    color: var(--muted);
}

.comparison {
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
    background: #fff;
}

.model-dock {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid #bfc5bf;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 2px 8px rgba(24, 34, 26, .08);
    backdrop-filter: blur(8px);
}

.model-grid,
.feature-row__values {
    display: grid;
    grid-template-columns: repeat(var(--model-count), minmax(0, 1fr));
}

.model-card {
    position: relative;
    min-width: 0;
    padding: 4px 8px 9px;
    text-align: center;
    border-right: 1px solid var(--line);
}

.model-card:last-child,
.value-cell:last-child {
    border-right: 0;
}

.model-card__image-wrap {
    display: grid;
    height: clamp(56px, 11vw, 88px);
    min-height: 0;
    overflow: hidden;
    place-items: center;
}

.model-card img {
    display: block;
    width: min(100%, 112px);
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    object-fit: contain;
}

.model-card h2 {
    overflow: hidden;
    margin: 3px 0 1px;
    font-size: clamp(14px, 2.5vw, 18px);
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-card__price {
    color: var(--green-dark);
    font-size: clamp(14px, 2.4vw, 17px);
}

.comparison-table {
    border-bottom: 1px solid var(--line);
}

.feature-group__head {
    padding: 10px 12px 9px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #e9ece9;
}

.feature-group__head span {
    display: block;
    margin-bottom: 1px;
    color: var(--muted);
    font-size: 12px;
}

.feature-group__head h2 {
    margin: 0;
    font-size: clamp(19px, 3.5vw, 24px);
    line-height: 1.25;
}

.feature-row {
    border-bottom: 1px solid var(--line);
}

.feature-row__label {
    padding: 8px 10px 7px;
    background: var(--soft-2);
    border-bottom: 1px solid #e8ebe8;
}

.feature-row__label h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
}

.value-cell {
    position: relative;
    min-width: 0;
    min-height: 88px;
    padding: 10px 9px 11px;
    border-right: 1px solid var(--line);
    background: #fff;
}

.value-cell--positive {
    background: var(--green-soft);
}

.value-cell--caution {
    background: var(--warning-soft);
}

.value-cell strong {
    display: block;
    padding-right: 24px;
    font-size: 15px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.value-cell p {
    margin: 5px 0 0;
    color: #4f574f;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.value-details {
    margin-top: 7px;
}

.value-details summary {
    width: fit-content;
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    list-style: none;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.value-details summary::-webkit-details-marker {
    display: none;
}

.value-details summary::after {
    content: " +";
    text-decoration: none;
}

.value-details[open] summary::after {
    content: " −";
}

.value-cell--caution .value-details summary {
    color: #7a5314;
}

.value-details p {
    margin-top: 7px;
}

.check-icon {
    display: grid;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    place-items: center;
    color: #fff;
    border-radius: 50%;
    background: var(--green);
}

.value-cell > .check-icon {
    position: absolute;
    top: 8px;
    right: 7px;
    width: 20px;
    height: 20px;
}

.check-icon svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.4;
}

.link-warning {
    margin: 10px;
    padding: 10px 12px;
    color: #704e16;
    border: 1px solid #dbc38e;
    background: var(--warning-soft);
    font-size: 14px;
    line-height: 1.45;
}

.has-choice-dock {
    padding-bottom: calc(126px + var(--safe-bottom));
}

.choice-dock {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 8px 10px calc(8px + var(--safe-bottom));
    color: #fff;
    background: rgba(30, 35, 31, .98);
    border-top: 1px solid #495049;
    box-shadow: 0 -3px 12px rgba(0, 0, 0, .18);
}

.choice-dock__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
    gap: 8px;
    width: min(100%, 1020px);
    margin: 0 auto;
}

.choice-dock__choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
    gap: 6px;
}

.choice-pill {
    min-width: 0;
    padding: 7px 10px;
    color: #dfe4df;
    border: 1px solid #5b635b;
    border-radius: 4px;
    background: #292e29;
    text-align: left;
    cursor: pointer;
}

.choice-pill span,
.choice-pill strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.choice-pill span {
    font-size: 13px;
}

.choice-pill strong {
    margin-top: 1px;
    color: #fff;
    font-size: 14px;
}

.choice-pill.is-selected {
    border-color: #71d69e;
    background: #17412a;
}

.confirm-choice {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 15px;
    color: #fff;
    border: 0;
    border-radius: 4px;
    background: var(--green);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.confirm-choice:disabled {
    color: #a9afa9;
    background: #4a504a;
    cursor: not-allowed;
}

.confirm-choice.is-loading span:first-child::after {
    content: "…";
}

.choice-dock__status {
    grid-column: 1 / -1;
    margin: 0;
    color: #ffd08b;
    font-size: 12px;
}

.choice-success {
    display: flex;
    align-items: center;
    gap: 10px;
}

.choice-success--inline {
    grid-column: 1 / -1;
    min-height: 54px;
    justify-content: center;
}

.choice-success strong,
.choice-success small {
    display: block;
}

.choice-success strong {
    font-size: 15px;
}

.choice-success small {
    margin-top: 1px;
    color: #c7cdc7;
    font-size: 13px;
}

@media (max-width: 680px) {
    .home-shell {
        padding: 10px;
    }

    .builder__head {
        padding: 14px 13px 11px;
    }

    .builder__head h1 {
        font-size: 23px;
    }

    .builder__head p {
        font-size: 14px;
    }

    .builder__count {
        font-size: 11px;
    }

    .model-picker {
        padding: 0 13px 13px;
    }

    .picker-row {
        min-height: 72px;
    }

    .builder__actions {
        align-items: stretch;
        flex-direction: column;
        gap: 5px;
        padding-top: 10px;
    }

    .text-action {
        align-self: flex-start;
    }

    .primary-action {
        width: 100%;
    }

    .comparison {
        border: 0;
    }

    .model-card {
        padding-right: 5px;
        padding-left: 5px;
    }

    .comparison[style*="3"] .model-card__image-wrap {
        height: 50px;
    }

    .comparison[style*="3"] .model-card h2,
    .comparison[style*="3"] .model-card__price {
        font-size: 13px;
    }

    .feature-group__head {
        padding: 8px 9px;
    }

    .feature-row__label {
        padding: 7px 8px 6px;
    }

    .value-cell {
        min-height: 82px;
        padding: 8px 7px 9px;
    }

    .value-cell > .check-icon {
        top: 6px;
        right: 5px;
    }

    .value-cell strong {
        font-size: 15px;
    }

    .value-cell p {
        font-size: 14px;
        line-height: 1.4;
    }

    .comparison[style*="3"] .value-cell strong {
        font-size: 13px;
    }

    .comparison[style*="3"] .value-cell p {
        font-size: 12px;
    }

    .comparison[style*="3"] .value-details summary {
        font-size: 12px;
    }

    .has-choice-dock {
        padding-bottom: calc(146px + var(--safe-bottom));
    }

    .choice-dock__inner {
        grid-template-columns: 1fr;
    }

    .choice-dock__choices {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .confirm-choice {
        min-height: 48px;
    }
}

@media (max-width: 390px) {
    .feature-row__label h3 {
        font-size: 15px;
    }

    .value-cell {
        padding-right: 6px;
        padding-left: 6px;
    }

    .comparison[style*="3"] .value-cell > .check-icon {
        position: static;
        width: 18px;
        height: 18px;
        margin-bottom: 4px;
    }

    .comparison[style*="3"] .value-cell strong {
        padding-right: 0;
        font-size: 13px;
    }

    .comparison[style*="3"] .value-cell p {
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }
}
