.kyp-calculator,
.kyp-calculator * {
    box-sizing: border-box;
}

.kyp-calculator {
    width: 100%;
    max-width: 860px;
    margin: 24px auto;
    padding: 24px;
    border: 1px solid #f1e4cf;
    border-radius: 24px;
    background: #fffdf8;
    color: #2b2118;
    font-family: inherit;
    box-shadow: 0 18px 45px rgba(90, 61, 31, 0.1);
    overflow: visible;
}

.kyp-title {
    margin: 0 0 10px;
    font-size: clamp(24px, 4vw, 34px);
    line-height: 1.12;
    color: #24180f;
}

.kyp-intro {
    margin: 0 0 18px;
    line-height: 1.55;
    color: #6a5848;
}

.kyp-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.kyp-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 7px;
}

.kyp-field[hidden] {
    display: none !important;
}

.kyp-label {
    font-weight: 700;
    line-height: 1.35;
    color: #4b3828;
}

.kyp-control {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #d9c5ad;
    border-radius: 14px;
    background: #fffaf3;
    color: #2b2118;
    font: inherit;
    line-height: 1.35;
    outline: none;
}

.kyp-control:focus {
    border-color: #b77731;
    box-shadow: 0 0 0 3px rgba(183, 119, 49, 0.14);
}

.kyp-help {
    font-size: 13px;
    line-height: 1.45;
    color: #796656;
}

.kyp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.kyp-button {
    min-height: 46px;
    padding: 10px 18px;
    border: 0;
    border-radius: 15px;
    background: #b77731;
    color: #ffffff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease, background .15s ease;
}

.kyp-button:hover,
.kyp-button:focus-visible {
    transform: translateY(-1px);
    opacity: .95;
    outline: none;
}

.kyp-button-secondary {
    border: 1px solid #d9c5ad;
    background: #fffaf3;
    color: #4b3828;
}

.kyp-button-secondary:hover,
.kyp-button-secondary:focus-visible {
    background: #fff3df;
}

.kyp-result {
    width: 100%;
    min-width: 0;
    margin-top: 18px;
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, #fff8ee, #ffffff);
    border: 1px solid #f0dfc8;
    overflow: visible;
}

.kyp-result-main {
    display: flex;
    min-width: 0;
    max-width: 100%;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border-radius: 18px;
    background: #3a2617;
    color: #ffffff;
    font-size: clamp(15px, 2.2vw, 18px);
    line-height: 1.38;
    font-weight: 700;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    overflow-x: hidden;
}

.kyp-result-line {
    display: block;
    max-width: 100%;
    min-width: 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
    word-break: normal;
}

.kyp-result-answer {
    color: #ffffff;
}

.kyp-result-note {
    margin: 12px 0 0;
    color: #6a5848;
    line-height: 1.55;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

.kyp-result-error .kyp-result-main {
    background: #7f1d1d;
}

.kyp-result-error .kyp-result-note {
    color: #7f1d1d;
    font-weight: 700;
}

.kyp-breakdown {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.kyp-breakdown[hidden],
.kyp-breakdown [hidden] {
    display: none !important;
}

.kyp-breakdown > div {
    min-width: 0;
    padding: 12px;
    border-radius: 14px;
    background: #fffaf3;
    border: 1px solid #f0dfc8;
}

.kyp-breakdown span {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 1.35;
    color: #8a633d;
}

.kyp-breakdown strong {
    display: block;
    color: #2b2118;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .kyp-calculator {
        padding: 16px;
        border-radius: 20px;
    }

    .kyp-grid,
    .kyp-breakdown {
        grid-template-columns: 1fr;
    }

    .kyp-title {
        font-size: 24px;
    }

    .kyp-result-main {
        font-size: 15px;
    }

    .kyp-actions,
    .kyp-button {
        width: 100%;
    }
}
