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

.rk-calculator {
    --rk-primary: #1f5eff;
    --rk-primary-dark: #1749c7;
    --rk-text: #172033;
    --rk-muted: #667085;
    --rk-border: #d9dfeb;
    --rk-soft: #f5f7fb;
    --rk-success-bg: #eefbf4;
    --rk-success-border: #9ddbb8;
    --rk-error: #b42318;
    width: 100%;
    max-width: 760px;
    margin: 28px auto;
    padding: clamp(20px, 4vw, 36px);
    border: 1px solid var(--rk-border);
    border-radius: 18px;
    background: #fff;
    color: var(--rk-text);
    box-shadow: 0 12px 34px rgba(16, 24, 40, 0.08);
    font: inherit;
}

.rk-header {
    margin-bottom: 24px;
}

.rk-title {
    margin: 0 0 8px;
    color: var(--rk-text);
    font-size: clamp(1.55rem, 4vw, 2rem);
    line-height: 1.2;
}

.rk-intro,
.rk-note {
    margin: 0;
    color: var(--rk-muted);
    line-height: 1.6;
}

.rk-mode-picker {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.rk-mode {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 92px;
    padding: 14px;
    border: 1px solid var(--rk-border);
    border-radius: 12px;
    background: #fff;
    color: var(--rk-text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.rk-mode:hover {
    border-color: var(--rk-primary);
    transform: translateY(-1px);
}

.rk-mode:focus-visible,
.rk-input:focus-visible,
.rk-reset:focus-visible {
    outline: 3px solid rgba(31, 94, 255, 0.25);
    outline-offset: 2px;
}

.rk-mode.is-active {
    border-color: var(--rk-primary);
    background: #f2f6ff;
}

.rk-mode-number {
    display: inline-grid;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: var(--rk-soft);
    color: var(--rk-muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.rk-mode.is-active .rk-mode-number {
    background: var(--rk-primary);
    color: #fff;
}

.rk-mode strong,
.rk-mode small {
    display: block;
}

.rk-mode strong {
    margin-bottom: 4px;
    font-size: 0.95rem;
    line-height: 1.3;
}

.rk-mode small {
    color: var(--rk-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.rk-panel[hidden],
.rk-result-content[hidden],
.rk-result-placeholder[hidden] {
    display: none !important;
}

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

.rk-field {
    display: block;
}

.rk-label {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
}

.rk-input-wrap {
    position: relative;
    display: block;
}

.rk-input {
    width: 100%;
    min-height: 52px;
    padding: 12px 54px 12px 14px;
    border: 1px solid var(--rk-border);
    border-radius: 10px;
    background: #fff;
    color: var(--rk-text);
    font: inherit;
    font-size: 1rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.rk-input:hover,
.rk-input:focus {
    border-color: var(--rk-primary);
}

.rk-input.has-error {
    border-color: var(--rk-error);
}

.rk-suffix {
    position: absolute;
    top: 50%;
    right: 14px;
    color: var(--rk-muted);
    font-weight: 700;
    transform: translateY(-50%);
    pointer-events: none;
}

.rk-field-error {
    display: block;
    min-height: 20px;
    padding-top: 5px;
    color: var(--rk-error);
    font-size: 0.82rem;
    line-height: 1.35;
}

.rk-result {
    margin-top: 8px;
    min-height: 116px;
    padding: 20px;
    border: 1px solid var(--rk-success-border);
    border-radius: 12px;
    background: var(--rk-success-bg);
}

.rk-result-placeholder {
    margin: 24px 0;
    color: var(--rk-muted);
    text-align: center;
}

.rk-result-label {
    display: block;
    margin-bottom: 2px;
    color: #276749;
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rk-result-main {
    display: block;
    color: #185b3b;
    font-size: clamp(1.7rem, 5vw, 2.4rem);
    line-height: 1.2;
}

.rk-result-detail {
    margin: 7px 0 0;
    color: #285f47;
    line-height: 1.5;
}

.rk-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 18px;
    padding: 9px 16px;
    border: 1px solid var(--rk-border);
    border-radius: 9px;
    background: #fff;
    color: var(--rk-text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.rk-reset:hover {
    border-color: var(--rk-primary);
    color: var(--rk-primary-dark);
}

.rk-note {
    margin-top: 12px;
    font-size: 0.85rem;
}

.rk-error {
    color: var(--rk-error);
    font-weight: 700;
}

@media (max-width: 680px) {
    .rk-calculator {
        margin: 20px auto;
        border-radius: 14px;
    }

    .rk-mode-picker,
    .rk-fields {
        grid-template-columns: 1fr;
    }

    .rk-mode {
        min-height: auto;
    }
}
