/* ===== БАЗА ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 20px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: radial-gradient(ellipse at 30% 20%, #f0f4ff, #ffffff 60%, #f9fafb);
    color: #1f2937;
}

.page {
    width: 100%;
    max-width: 880px;
}

/* ===== КАРТОЧКИ ===== */
.card {
    background: #ffffff;
    border-radius: 32px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 40px;
    margin-bottom: 28px;
    transition: all 0.4s ease;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card:hover {
    border-color: rgba(129, 140, 248, 0.2);
    box-shadow: 0 12px 50px rgba(99, 102, 241, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* ===== ЗАГОЛОВОК С ИЛЛЮСТРАЦИЕЙ ===== */
.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.card-header-text {
    flex: 1;
    min-width: 0;
}

.card h1 {
    font-size: 30px;
    font-weight: 300;
    color: #111827;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.card h1::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #ef4444, #c084fc, #818cf8, #3b82f6);
    margin-top: 12px;
    border-radius: 2px;
}

.subtitle {
    color: rgba(0, 0, 0, 0.4);
    font-size: 14px;
    margin-bottom: 0;
}

/* ===== HERO ИЛЛЮСТРАЦИЯ (компактная) ===== */
.hero-illustration {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    position: relative;
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.10), rgba(167, 139, 250, 0.05));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(129, 140, 248, 0.12);
}

.hero-illustration::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 30%, rgba(129, 140, 248, 0.18), transparent 65%);
}

.hero-svg {
    width: 88px;
    height: 88px;
    z-index: 1;
}

.fan-blade {
    transform-origin: 60px 58px;
    animation: spin 2s linear infinite;
}

.cold-wave {
    animation: pulse 2s ease-in-out infinite;
}


/* ===== ЗАГОЛОВКИ СЕКЦИЙ С ЛИНИЕЙ ===== */
.section-title {
    font-size: 15px;
    font-weight: 600;
    color: #4f46e5;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 20px;
    /* Чуть больше отступ снизу */
    padding-left: 4px;
    display: flex;
    align-items: center;
    gap: 8px;

    /* Магия линии: */
    position: relative;
    white-space: nowrap;
    /* Запрещаем перенос текста заголовка */
}

/* Линия, идущая от текста до края */
.section-title::after {
    content: '';
    flex-grow: 1;
    /* Занимает всё оставшееся пространство */
    height: 1px;
    background: linear-gradient(90deg, rgba(129, 140, 248, 0.3), transparent);
    margin-left: 12px;
    /* Отступ от текста/иконки */
    opacity: 0.6;
}

.section-divider {
    display: none;
}

.form-section {
    margin-bottom: 32px;
}

.form-section:last-child {
    margin-bottom: 0;
}

.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.2), transparent);
    margin: 24px 0;
}

/* ===== ИКОНКИ В ВЫПАДАЮЩЕМ СПИСКЕ ===== */
.dropdown li .opt-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    color: rgba(220, 38, 38, 0.55);
    transition: color 0.15s ease, transform 0.15s ease;
}

.dropdown li:hover .opt-icon {
    color: #dc2626;
    transform: scale(1.08);
}

.dropdown li.selected .opt-icon {
    color: #dc2626;
}

/* Иконка только в закрытом селекте — компактнее */
.selected-text .opt-icon {
    width: 35px;
    height: 35px;
    flex-shrink: 0;
    border-radius: 3px;
    background: #ffffff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    50% {
        opacity: 0.8;
        transform: translateY(-1.5px);
    }
}

/* ===== СЕТКА ПОЛЕЙ ===== */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 10px;
}

/* ===== ПОЛЯ ВВОДА ===== */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.field>span {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(79, 70, 229, 0.7);
    font-weight: 600;
    transition: color 0.3s ease;
    padding-left: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.field:focus-within>span {
    color: #6366f1;
}

.field-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.75;
}

/* ===== ИНПУТЫ ===== */
.field input {
    width: 100%;
    padding: 14px 16px;
    background: #f9fafb;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    color: #111827;
    font-size: 16px;
    font-weight: 400;
    font-family: 'Segoe UI', system-ui, sans-serif;
    outline: none;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
}

.field input::placeholder {
    color: rgba(0, 0, 0, 0.25);
    font-weight: 300;
}

.field input:focus {
    border-color: #818cf8;
    background: rgba(129, 140, 248, 0.03);
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.1), 0 2px 8px rgba(129, 140, 248, 0.06);
    transform: translateY(-1px);
}

.field input[type="number"]::-webkit-inner-spin-button,
.field input[type="number"]::-webkit-outer-spin-button {
    opacity: 0.4;
    height: 28px;
}

.field input[type="number"] {
    -moz-appearance: textfield;
}

/* ===== КАСТОМНЫЙ СЕЛЕКТ ===== */
.custom-select {
    position: relative;
    display: block;
    width: 100%;
}

.select-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 16px;
    background: #f9fafb;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #111827;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.select-btn:hover {
    background: #f3f4f6;
    border-color: rgba(129, 140, 248, 0.4);
}

.field:focus-within .select-btn {
    border-color: #818cf8;
    background: rgba(129, 140, 248, 0.03);
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.1), 0 2px 8px rgba(129, 140, 248, 0.06);
    transform: translateY(-1px);
}

.selected-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    color: #111827;
}

.arrow {
    font-size: 12px;
    transition: transform 0.25s ease;
    color: rgba(99, 102, 241, 0.5);
    line-height: 1;
}

.custom-select.open .arrow {
    transform: rotate(180deg);
}

/* ===== ВЫПАДАЮЩИЙ СПИСОК ===== */
.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 1.5px solid rgba(129, 140, 248, 0.2);
    border-radius: 20px;
    padding: 6px 0;
    margin: 0;
    list-style: none;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.94) translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0.2s;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.05);
    z-index: 20;
}

.custom-select.open .dropdown {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0s;
}

.dropdown li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 400;
    color: #4b5563;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, padding-left 0.15s;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.dropdown li:first-child {
    border-top: none;
}

.dropdown li:hover {
    background: rgba(129, 140, 248, 0.08);
    color: #111827;
    padding-left: 24px;
}

.dropdown li.selected {
    background: rgba(129, 140, 248, 0.1);
    color: #111827;
    font-weight: 500;
}

/* ===== СКРЫТОЕ ПОЛЕ ДЛЯ КОЭФФИЦИЕНТА ===== */
.field.hidden {
    display: none;
}

/* ===== КНОПКИ ===== */
.actions {
    display: flex;
    gap: 14px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 36px;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', system-ui, sans-serif;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn.primary {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
    flex: 1;
    position: relative;
    overflow: hidden;
}

.btn.primary::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: rotate(45deg) translateX(-100%);
    transition: 0.6s;
}

.btn.primary:hover::before {
    transform: rotate(45deg) translateX(100%);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.btn.primary:active {
    transform: scale(0.98);
}

.btn.secondary {
    background: rgba(99, 102, 241, 0.06);
    color: #6366f1;
    border: 1.5px solid rgba(99, 102, 241, 0.15);
}

.btn.secondary:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
}

.btn-icon {
    width: 18px;
    height: 18px;
}

/* ===== ОШИБКА ===== */
.error {
    color: #dc2626;
    font-size: 13px;
    padding: 12px 16px;
    background: rgba(220, 38, 38, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(220, 38, 38, 0.12);
    margin-top: 12px;
}

.error[hidden] {
    display: none;
}

/* ===== РЕЗУЛЬТАТЫ ===== */
#output {
    margin-top: 0;
}

#output h2 {
    font-size: 18px;
    font-weight: 300;
    color: #111827;
    margin-bottom: 24px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

#output h2::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, #ef4444, #c084fc, #818cf8, #3b82f6);
    margin-top: 8px;
    border-radius: 2px;
    margin-left: 10px;
}

.title-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.result-block {
    background: #f9fafb;
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 16px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    position: relative;
}

.result-block:hover {
    border-color: rgba(129, 140, 248, 0.15);
    background: rgba(129, 140, 248, 0.03);
}

.result-block h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(99, 102, 241, 0.7);
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.block-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.result-block:hover .block-icon {
    transform: scale(1.1) rotate(8deg);
}

.result-block .block-icon.fan-spin {
    animation: spin 2s linear infinite;
}

.result-block dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
}

.result-block dl div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.result-block dt {
    color: rgba(0, 0, 0, 0.45);
    font-size: 13px;
    font-weight: 400;
}

.result-block dd {
    color: #111827;
    font-size: 15px;
    font-weight: 500;
    text-align: right;
}

.totals {
    display: flex;
    justify-content: flex-end;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.06), rgba(167, 139, 250, 0.04));
    border-radius: 16px;
    border: 1px solid rgba(129, 140, 248, 0.12);
    margin-top: 8px;
    transition: all 0.3s ease;
}

.totals:hover {
    border-color: rgba(129, 140, 248, 0.2);
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.08), rgba(167, 139, 250, 0.06));
}

.totals>div {
    display: flex;
    align-items: center;
    gap: 20px;
}

.totals span {
    color: rgba(99, 102, 241, 0.6);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.totals strong {
    font-size: 32px;
    font-weight: 300;
    color: #111827;
    font-family: 'SF Mono', 'Segoe UI', monospace;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===== ПОДВАЛ ===== */
.footnote {
    text-align: center;
    color: rgba(0, 0, 0, 0.4);
    font-size: 11px;
    margin-top: 24px;
    letter-spacing: 0.5px;
}

/* ===== АНИМАЦИЯ ===== */
#output:not([hidden]) {
    animation: fadeSlide 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== АДАПТИВ ===== */
@media (max-width: 768px) {
    .card {
        padding: 24px;
        border-radius: 24px;
    }

    .card-header {
        flex-direction: column-reverse;
        align-items: center;
        text-align: center;
        gap: 14px;
    }

    .card h1::after {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-illustration {
        width: 104px;
        height: 104px;
        border-radius: 18px;
    }

    .hero-svg {
        width: 76px;
        height: 76px;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .card h1 {
        font-size: 24px;
    }

    .result-block dl {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .result-block dl div {
        padding: 4px 0;
    }

    .totals {
        flex-direction: column;
        align-items: stretch;
        padding: 16px 20px;
    }

    .totals>div {
        justify-content: space-between;
    }

    .totals strong {
        font-size: 24px;
    }

    .actions {
        flex-direction: column;
    }

    .btn {
        text-align: center;
        padding: 16px;
    }

    .field>span {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 18px;
        border-radius: 20px;
    }

    .hero-illustration {
        width: 92px;
        height: 92px;
        border-radius: 16px;
    }

    .hero-svg {
        width: 68px;
        height: 68px;
    }

    .field input,
    .select-btn {
        padding: 12px 14px;
        font-size: 15px;
    }

    .field>span {
        font-size: 10px;
    }
}