/* Стиль golos.rureef.ru / tools.rureef.ru */
:root {
    --primary: #4a6fa5;
    --primary-light: #6b8cbe;
    --accent: #7eb8da;
    --aqua: #5ba3b0;
    --bg: #f4f5f6;
    --card: #fafbfc;
    --text: #374151;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --success: #4caf50;
    --warning: #d97706;
    --danger: #dc2626;
    --coral: #e07a7a;
    --bubble: rgba(74, 111, 165, 0.08);
    --transition: all 0.3s ease;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    --radius: 16px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --safe-top: env(safe-area-inset-top, 0);
    --safe-bottom: env(safe-area-inset-bottom, 0);
    --touch-min: 44px;
    /* совместимость со старыми классами */
    --primary-gradient: linear-gradient(135deg, #4a6fa5 0%, #5ba3b0 100%);
    --secondary-gradient: linear-gradient(135deg, #6b8cbe 0%, #7eb8da 100%);
    --accent-color: var(--primary);
    --text-primary: var(--text);
    --text-secondary: var(--text-light);
    --bg-primary: var(--card);
    --bg-secondary: var(--bg);
    --bg-card: var(--card);
    --bg-overlay: var(--bubble);
    --shadow-md: var(--shadow);
    --shadow-lg: 0 6px 16px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 10px 24px rgba(0, 0, 0, 0.08);
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --success-color: var(--success);
    --warning-color: var(--warning);
    --danger-color: var(--danger);
}

[data-theme="dark"] {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --bg: #0f172a;
    --card: #1e293b;
    --text: #e2e8f0;
    --text-light: #94a3b8;
    --border: #334155;
    --bubble: rgba(30, 58, 138, 0.2);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.25);
    --shadow-xl: 0 10px 28px rgba(0, 0, 0, 0.35);
    --primary-gradient: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    --secondary-gradient: linear-gradient(135deg, #3b82f6 0%, #5ba3b0 100%);
    --accent-color: var(--aqua);
}

/* Сброс и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding: var(--spacing-sm);
    padding-top: calc(var(--spacing-sm) + var(--safe-top));
    padding-left: calc(var(--spacing-sm) + env(safe-area-inset-left));
    padding-right: calc(var(--spacing-sm) + env(safe-area-inset-right));
    padding-bottom: calc(var(--spacing-sm) + var(--safe-bottom));
    position: relative;
    width: 100%;
    overflow-x: hidden;
}

/* Анимации */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes wave {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

/* Фоновые элементы */
.wave-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 40px;
    background: radial-gradient(circle at 10% 50%, transparent 45%, var(--aqua) 50%),
        radial-gradient(circle at 30% 50%, transparent 45%, var(--aqua) 50%),
        radial-gradient(circle at 50% 50%, transparent 45%, var(--aqua) 50%),
        radial-gradient(circle at 70% 50%, transparent 45%, var(--aqua) 50%),
        radial-gradient(circle at 90% 50%, transparent 45%, var(--aqua) 50%);
    background-size: 20% 100%;
    animation: wave 8s linear infinite;
    opacity: 0.12;
}
[data-theme="dark"] .wave { opacity: 0.2; }

.bubble {
    position: fixed;
    border-radius: 50%;
    background: var(--bubble);
    z-index: -1;
    pointer-events: none;
    animation: float 6s ease-in-out infinite;
}

.bubble:nth-child(2) { width: 60px; height: 60px; top: 10%; left: 5%; animation-delay: 0s; }
.bubble:nth-child(3) { width: 80px; height: 80px; bottom: 15%; right: 7%; animation-delay: 1s; }
.bubble:nth-child(4) { width: 40px; height: 40px; top: 50%; left: 10%; animation-delay: 2s; }
.bubble:nth-child(5) { width: 50px; height: 50px; bottom: 30%; right: 15%; animation-delay: 3s; }

/* Основной контейнер — по ширине с общим блоком (golos) */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
    min-width: 0;
}

/* Виджет перевода и тема — в одной строке с блоком названия сервиса */
.header-widgets {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-left: auto;
}
.lang-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}
.lang-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0.5;
}
.lang-btn:hover {
    opacity: 0.85;
    border-color: var(--primary);
    background: rgba(74, 111, 165, 0.08);
}
/* Выбранный язык — заметная подсветка */
.lang-btn-active {
    opacity: 1;
    border: 2px solid var(--primary);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.35), inset 0 0 0 1px rgba(74, 111, 165, 0.15);
}
[data-theme="dark"] .lang-btn {
    background: var(--card);
    border-color: var(--border);
}
[data-theme="dark"] .lang-btn:hover {
    border-color: var(--aqua);
    background: rgba(91, 163, 176, 0.15);
}
[data-theme="dark"] .lang-btn-active {
    border: 2px solid var(--aqua);
    background: rgba(91, 163, 176, 0.25);
    box-shadow: 0 0 0 3px rgba(91, 163, 176, 0.4), inset 0 0 0 1px rgba(91, 163, 176, 0.2);
}
.theme-toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.theme-icon { font-size: 1rem; color: var(--text-light); pointer-events: none; }
.theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-moon { display: inline-block; color: var(--aqua); }
.theme-toggle {
    background: var(--card);
    border: 1px solid var(--border);
    width: 52px;
    height: 26px;
    border-radius: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 2px;
    transition: var(--transition);
    flex-shrink: 0;
}
.toggle-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    transition: transform 0.3s;
}
[data-theme="dark"] .toggle-thumb {
    transform: translateX(26px);
    background: #94a3b8;
}
/* Шапка — в стиле golos */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--aqua) 100%);
    border-radius: 14px;
    padding: 12px 16px 14px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
    color: #fff;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
[data-theme="dark"] .header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--aqua) 100%);
    border-color: rgba(255, 255, 255, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}

.logo i {
    font-size: 1.4rem;
    color: white;
}

.header-text {
    flex: 1;
    min-width: 200px;
}

.header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: #fff;
}

.header .tagline {
    font-size: 0.9rem;
    opacity: 0.95;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.95);
}

.protection-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 4px 10px;
    background: var(--accent);
    color: #2c5282;
    border-radius: 14px;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}
[data-theme="dark"] .protection-badge { color: #e3f2fd; }

/* Основной контент */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
    width: 100%;
}

@media (min-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
    }
}

/* Карточки — стиль golos */
.card {
    background: var(--card);
    border-radius: 14px;
    padding: 18px 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
    margin-bottom: 14px;
    width: 100%;
    overflow: hidden;
}

@media (hover: hover) {
    .card:hover {
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    }
}
[data-theme="dark"] .card:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); }

/* Заголовки секций — golos */
.section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}
[data-theme="dark"] .section-icon { background: var(--aqua); color: #0f172a; }

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
}
[data-theme="dark"] .section-title { color: var(--aqua); }

.section-description {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 14px;
    line-height: 1.5;
}
.recommendations {
    background: rgba(74, 111, 165, 0.04);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--border);
}
[data-theme="dark"] .recommendations { background: rgba(30, 58, 138, 0.1); }

.recommendation-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid var(--border);
}

.recommendation-item:last-child {
    border-bottom: none;
}

.recommendation-item i {
    color: var(--success-color);
    font-size: 1rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.recommendation-item span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Адаптация идеальных параметров для большего количества карточек */
@media (min-width: 768px) {
    .ideal-params-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .ideal-params-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .ideal-param-card {
        min-height: 75px;
    }
}

@media (min-width: 1200px) {
    .ideal-params-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .ideal-param-card {
        flex-direction: column;
        text-align: center;
        padding: 0.75rem;
    }
    
    .ideal-param-icon {
        margin-bottom: 0.5rem;
    }
    
    .recommendation-item {
        font-size: 0.85rem;
    }
}

/* Параметры - идеальные значения */
.ideal-params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: var(--spacing-lg);
}

.ideal-param-card {
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    min-height: 70px;
}

@media (hover: hover) {
    .ideal-param-card:hover {
        background: var(--bg-overlay);
        transform: translateX(2px);
        border-color: rgba(30, 144, 255, 0.2);
    }
}

.ideal-param-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
}
[data-theme="dark"] .ideal-param-icon { background: var(--aqua); color: #0f172a; }

.ideal-param-info h3 {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.ideal-param-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}
[data-theme="dark"] .ideal-param-value { color: var(--aqua); }

/* Текущие параметры */
.current-params {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    border: 1px solid rgba(30, 144, 255, 0.1);
}

.current-param {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(30, 144, 255, 0.1);
}

.current-param:last-child {
    border-bottom: none;
}

.param-name {
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.param-value {
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent-color);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.good {
    background: var(--success-color);
    box-shadow: 0 0 0 2px rgba(50, 205, 50, 0.2);
}

.status-indicator.warning {
    background: var(--warning-color);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2);
}

.status-indicator.danger {
    background: var(--danger-color);
    box-shadow: 0 0 0 2px rgba(255, 99, 71, 0.2);
}

/* Форма калькулятора */
.calculator-form {
    margin-bottom: var(--spacing-lg);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-label i {
    color: var(--primary);
    width: 16px;
    text-align: center;
}
[data-theme="dark"] .form-label i { color: var(--aqua); }

.input-hint {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.input-hint i {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Исправление для полей ввода с стрелками */
.input-with-unit {
    position: relative;
    width: 100%;
}

.input-with-unit input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
    -moz-appearance: textfield;
    min-height: 44px;
}

/* Скрываем стандартные стрелки в Chrome, Safari, Edge */
.input-with-unit input::-webkit-outer-spin-button,
.input-with-unit input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Показываем наши кастомные стрелки */
.input-with-unit::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e90ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 15l-6-6-6 6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    opacity: 0.5;
}

.input-with-unit input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--card);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.15);
    padding-right: 40px;
}
[data-theme="dark"] .input-with-unit input:focus { border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(91, 163, 176, 0.2); }

.input-unit {
    position: absolute;
    right: 40px; /* Сдвигаем единицы измерения левее */
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-weight: 500;
    pointer-events: none;
    background: transparent;
    padding: 0 4px;
    font-size: 0.9rem;
    z-index: 2;
}

/* Стили для select */
.form-select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%231e90ff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    min-height: 44px;
    touch-action: manipulation;
}

/* Адаптивность для мобильных */
@media (max-width: 640px) {
    .input-with-unit input {
        padding: 14px 44px 14px 16px;
        font-size: 16px; /* Предотвращает зум при фокусе на iOS */
        min-height: 48px;
    }
    
    .input-unit {
        right: 44px;
        font-size: 0.85rem;
    }
    
    .input-with-unit::after {
        right: 12px;
        width: 18px;
        height: 18px;
    }
    
    .form-select {
        padding: 14px 44px 14px 16px;
        background-position: right 16px center;
        font-size: 16px;
        min-height: 48px;
    }
}

/* Очень маленькие экраны (узкие телефоны) */
@media (max-width: 380px) {
    .input-with-unit input {
        padding: 12px 36px 12px 12px;
        font-size: 16px;
        min-height: 48px;
    }
    
    .input-unit {
        right: 36px;
        font-size: 0.8rem;
    }
    
    .input-with-unit::after {
        right: 10px;
        width: 16px;
        height: 16px;
    }
    
    .form-select {
        padding: 12px 36px 12px 12px;
        font-size: 16px;
        background-position: right 12px center;
        min-height: 48px;
    }
    
    .header h1 {
        font-size: 1rem;
    }
    
    .ideal-params-grid {
        grid-template-columns: 1fr;
    }
    
    .ideal-param-card {
        flex-direction: row;
        min-height: 52px;
        padding: 0.5rem;
    }
}

/* Кнопка расчета — golos */
.calculate-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    width: 100%;
    margin-top: var(--spacing-md);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    box-shadow: var(--shadow);
}
[data-theme="dark"] .calculate-btn { background: var(--aqua); color: #0f172a; }

@media (hover: hover) {
    .calculate-btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
        border-color: rgba(255, 255, 255, 0.3);
    }
}

.calculate-btn:active {
    transform: scale(0.98);
    opacity: 0.95;
}

/* Результаты */
/* Обновляем стили для результатов в столбик */
.results-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: var(--spacing-md);
}

.result-card {
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    width: 100%;
    overflow: hidden;
}

@media (hover: hover) {
    .result-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
        border-color: rgba(30, 144, 255, 0.2);
    }
}

.result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
}
[data-theme="dark"] .result-icon { background: var(--aqua); color: #0f172a; }

.result-info {
    flex: 1;
    min-width: 0; /* Ключевое свойство для ограничения ширины */
    overflow: hidden;
}

.result-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}
[data-theme="dark"] .result-value { color: var(--aqua); }

/* Специальные стили для поля "Требуемое изменение" */
#change-needed {
    font-size: 0.95rem;
    line-height: 1.4;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
    display: block;
}

/* Улучшенные стили для мобильных устройств */
@media (max-width: 640px) {
    .results-grid {
        gap: 0.5rem;
    }
    
    .result-card {
        padding: 0.875rem;
        gap: 0.625rem;
    }
    
    .result-icon {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .result-label {
        font-size: 0.75rem;
    }
    
    .result-value {
        font-size: 0.9rem;
    }
    
    #change-needed {
        font-size: 0.85rem;
        line-height: 1.3;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 380px) {
    .result-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .result-icon {
        align-self: flex-start;
    }
    
    .result-info {
        width: 100%;
    }
    
    .result-value {
        font-size: 0.85rem;
    }
}

.dosage-instructions {
    background: var(--card);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    border-left: 4px solid var(--coral);
    border: 1px solid var(--border);
}

.dosage-instructions h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
    font-size: 1rem;
}

.dosage-instructions ul {
    padding-left: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.dosage-instructions li {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

/* Примечания */
.note {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
    background: rgba(74, 111, 165, 0.05);
    border: 1px solid var(--border);
}
[data-theme="dark"] .note { background: rgba(30, 58, 138, 0.1); }

.note.warning {
    background: rgba(217, 119, 6, 0.1);
    border: 1px solid rgba(217, 119, 6, 0.25);
}

.note p {
    margin: 0;
    line-height: 1.5;
    font-size: 0.9rem;
}

.note-icon {
    font-size: 1rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.note .note-icon {
    color: var(--primary);
}
[data-theme="dark"] .note .note-icon { color: var(--aqua); }
.note.warning .note-icon {
    color: var(--warning);
}

/* Футер — одна строка в стиле golos */
.footer {
    text-align: center;
    padding: 12px 16px;
    padding-bottom: calc(14px + var(--safe-bottom));
    margin-top: auto;
    flex-shrink: 0;
    border-top: 1px solid var(--border);
}

.footer-line {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-light);
    max-width: 100%;
    overflow-wrap: break-word;
}

.footer-social-btn {
    display: inline;
    padding: 2px 6px;
    background: transparent;
    color: var(--primary) !important;
    font-weight: 600;
    font-size: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    border-radius: 4px;
    white-space: nowrap;
    vertical-align: baseline;
}
.footer-social-btn:hover { text-decoration: underline; background: rgba(74, 111, 165, 0.1); }
.footer-social-btn .fab { margin-right: 4px; font-size: 1em; vertical-align: -0.1em; }
[data-theme="dark"] .footer-social-btn { color: var(--aqua) !important; }
[data-theme="dark"] .footer-social-btn:hover { background: rgba(91, 163, 176, 0.15); }

.footer-main-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.footer-main-link:hover { text-decoration: underline; }
[data-theme="dark"] .footer-main-link { color: var(--aqua); }

#protection-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: var(--spacing-lg);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    z-index: 10000;
    box-shadow: var(--shadow-xl);
    border: 2px solid var(--danger);
    min-width: 280px;
    text-align: center;
}

#protection-message i {
    font-size: 2.5rem;
    color: var(--danger);
}

#protection-message span {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

#protection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

/* Toast уведомления */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    min-width: 280px;
    max-width: 400px;
    animation: fadeIn 0.3s ease;
    border-left: 4px solid var(--accent-color);
}

.toast-success { border-left-color: var(--success-color); }
.toast-warning { border-left-color: var(--warning-color); }
.toast-error { border-left-color: var(--danger-color); }
.toast-info { border-left-color: var(--accent-color); }

.toast-icon i {
    color: inherit;
    font-size: 1.1rem;
}

.toast-success .toast-icon i { color: var(--success-color); }
.toast-warning .toast-icon i { color: var(--warning-color); }
.toast-error .toast-icon i { color: var(--danger-color); }
.toast-info .toast-icon i { color: var(--accent-color); }

.toast-message {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    font-size: 0.9rem;
    transition: color 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Мобильные стили — юзабельная версия */
@media (max-width: 640px) {
    body {
        padding: 0.5rem;
        padding-left: calc(0.5rem + env(safe-area-inset-left));
        padding-right: calc(0.5rem + env(safe-area-inset-right));
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
        font-size: 15px;
    }
    
    .container {
        min-width: 0; /* Предотвращает overflow на узких экранах */
    }
    
    .header {
        padding: 0.875rem 1rem;
        padding-top: calc(0.875rem + env(safe-area-inset-top));
        margin-bottom: 0.75rem;
        border-radius: var(--radius-md);
    }
    
    .header-content {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
    }
    
    .header-text {
        width: 100%;
        min-width: 0;
        flex: 1 1 auto;
    }
    
    .logo {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }
    
    .logo i {
        font-size: 1.25rem;
    }
    
    .protection-badge {
        margin-left: auto;
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .header h1 {
        font-size: 1.1rem;
        line-height: 1.3;
        margin-bottom: 0.15rem;
    }
    
    .header .tagline {
        font-size: 0.8rem;
        opacity: 0.95;
        line-height: 1.35;
    }
    
    .main-content {
        gap: 0.75rem;
    }
    
    .card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }
    
    .section-header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    
    .section-description {
        font-size: 0.875rem;
        margin-bottom: 0.75rem;
    }
    
    .ideal-params-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .ideal-param-card {
        min-height: 60px;
        padding: 0.625rem;
        gap: 0.5rem;
    }
    
    .ideal-param-icon {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .ideal-param-info h3 {
        font-size: 0.7rem;
    }
    
    .ideal-param-value {
        font-size: 0.9rem;
    }
    
    .recommendations {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .recommendation-item {
        font-size: 0.85rem;
        padding: 0.4rem 0;
    }
    
    .calculator-form {
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    .form-label {
        font-size: 0.875rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .calculate-btn {
        min-height: 52px;
        font-size: 1rem;
        margin-top: 0.5rem;
    }
    
    .footer {
        padding: 10px 12px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        margin-top: 0.75rem;
    }
    
    .footer-line {
        font-size: 0.8rem;
    }
    
    .toast {
        left: calc(0.5rem + env(safe-area-inset-left));
        right: calc(0.5rem + env(safe-area-inset-right));
        max-width: none;
        min-width: 0;
        top: calc(0.5rem + env(safe-area-inset-top));
    }
    
    .input-hint {
        font-size: 0.8rem;
        margin-top: 0.25rem;
    }
    
    .note, .note.warning {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    .dosage-instructions {
        padding: 0.75rem;
    }
    
    .dosage-instructions h4 {
        font-size: 0.95rem;
    }
    
    .dosage-instructions li {
        font-size: 0.85rem;
    }
    
    #protection-message {
        left: 50%;
        margin-left: -140px;
        width: calc(100% - 2rem);
        max-width: 280px;
    }
}

/* Планшетные стили */
@media (min-width: 641px) and (max-width: 1023px) {
    .header h1 {
        font-size: 1.375rem;
    }
    
    .ideal-params-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Отключение анимаций при предпочтении уменьшенного движения */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}