﻿/* Сучасні стилі для головної сторінки калькулятора частот */
/* Кольори теми — css/themes.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: auto;
    padding: 0;
    margin: 0;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Головна навігація */
.main-header {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    box-shadow: var(--shadow-primary);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid var(--border-accent);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
    animation: fadeInUp 1s ease-out 0.9s both;
}

.main-logo {
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.3));
    transition: all 0.3s ease;
}

.main-logo:hover {
    filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.6));
    transform: scale(1.05);
}

.main-header h1 {
    margin: 0;
    font-size: 1.8rem;
    background: var(--text-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* Перемикач теми */
.theme-switcher {
    display: flex;
    align-items: center;
    margin: 0 20px;
}

.theme-toggle-btn {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-primary);
    border-radius: 50px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 60px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.theme-toggle-btn:hover {
    background: var(--bg-button);
    border-color: var(--border-accent);
    transform: scale(1.05);
    box-shadow: var(--shadow-accent);
}

.theme-icon {
    font-size: 1.2rem;
    transition: all 0.3s ease;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-icon-dark {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

.theme-icon-light {
    opacity: 0;
    transform: translateY(20px) rotate(180deg);
}

/* Світла тема - перемикання іконок */
[data-theme="light"] .theme-icon-dark {
    opacity: 0;
    transform: translateY(-20px) rotate(-180deg);
}

[data-theme="light"] .theme-icon-light {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

.main-navigation {
    position: relative;
    display: flex;
    align-items: center;
}

/* Burger Menu Button */
.menu-btn {
    width: 35px;
    height: 35px;
    position: relative;
    cursor: pointer;
    transition: all 0.5s ease-in-out;
    z-index: 1001;
}

.line {
    width: 25px;
    height: 3px;
    background: var(--accent-primary);
    display: block;
    margin: 5px auto;
    transition: all 0.3s ease-in-out;
    border-radius: 2px;
    box-shadow: 0 2px 5px rgba(0, 212, 255, 0.3);
}

.menu-btn.active .line--1 {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-btn.active .line--2 {
    opacity: 0;
}

.menu-btn.active .line--3 {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Navigation Links */
.nav-links {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    min-width: 250px;
    border-radius: 15px;
    box-shadow: var(--shadow-card);
    border: 2px solid var(--border-accent);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    padding: 15px 0;
    margin-top: 10px;
}

.nav-links.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-links .link {
    display: block;
    padding: 12px 25px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

.nav-links .link:hover {
    background: var(--nav-link-hover);
    border-left-color: var(--accent-primary);
    color: var(--text-accent);
    transform: translateX(5px);
}

.nav-links .link.active {
    background: var(--panel-bg-soft);
    border-left-color: var(--accent-primary);
    color: var(--text-accent);
}

@media (max-width: 768px) {
    .header-container {
        justify-content: space-between;
        gap: 15px;
        padding: 15px;
    }

    .main-header h1 {
        font-size: 1.5rem;
    }

    .nav-links {
        min-width: 220px;
        right: -10px;
    }

    .nav-links .link {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .header-container {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .logo-container {
        width: 100%;
        justify-content: center;
    }

    .main-navigation {
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
    }

    .nav-links {
        right: 0;
        left: 0;
        margin: 10px 20px 0;
        min-width: auto;
    }
}

/* Заголовок */
h1, h2 {
    text-align: center;
    font-size: 2.5rem;
    margin: 30px 0;
    background: var(--text-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    text-shadow: var(--shadow-primary);
    animation: fadeInUp 1s ease-out 0.2s both;
}

/* Контейнер калькулятора */
.calculator-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.8s ease-out;
    transition: max-width 0.3s ease;
}


/* Панель вибору груп */
#freq-groups {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 30px 0;
    padding: 0;
    flex-wrap: wrap;
    animation: fadeInUp 1s ease-out 0.4s both;
}

#freq-groups li {
    list-style: none;
    padding: 15px 30px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-primary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-primary);
}

#freq-groups li:hover {
    background: var(--bg-input);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
    border-color: var(--border-accent);
}

#freq-groups li.active {
    background: var(--bg-button);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-accent);
    color: #ffffff;
}

#freq-groups li.active:hover {
    background: var(--bg-button-hover);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px var(--accent-primary);
}



/* Стилі для діапазонів в групах */
.label.g1g3-band {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.2));
    border-left: 3px solid #22c55e;
    color: #22c55e;
}

.label.g3g3-band {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(234, 88, 12, 0.2));
    border-left: 3px solid #f97316;
    color: #f97316;
}

.label.g5g8-band {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.2));
    border-left: 3px solid #3b82f6;
    color: #3b82f6;
}

.label.g6g7-band {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(147, 51, 234, 0.2));
    border-left: 3px solid #a855f7;
    color: #a855f7;
}

/* Стилі для каналів в групах */
.channel.g1g3-group {
    border: 2px solid #22c55e;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(22, 163, 74, 0.1));
}

.channel.g1g3-group:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.2));
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.4);
}

.channel.g1g3-group.selected {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.channel.g3g3-group {
    border: 2px solid #f97316;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(234, 88, 12, 0.1));
}

.channel.g3g3-group:hover {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(234, 88, 12, 0.2));
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.4);
}

.channel.g3g3-group.selected {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
}

.channel.g5g8-group {
    border: 2px solid #3b82f6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.1));
}

.channel.g5g8-group:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.2));
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.channel.g5g8-group.selected {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.channel.g6g7-group {
    border: 2px solid #a855f7;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(147, 51, 234, 0.1));
}

.channel.g6g7-group:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(147, 51, 234, 0.2));
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.channel.g6g7-group.selected {
    background: linear-gradient(135deg, #a855f7, #9333ea);
    color: white;
}


/* Панель вибору частот */
#freq-select-wrap {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 40px 0;
    flex-wrap: wrap;
}


/* Легенда кольорів */
.color-legend {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid var(--border-card);
    box-shadow: var(--shadow-card);
    margin: 30px auto;
    max-width: 800px;
    animation: fadeInUp 1s ease-out 0.5s both;
}

.color-legend h3 {
    color: var(--heading-accent);
    margin: 0 0 20px 0;
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
    background: var(--text-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--panel-bg-soft);
    border-radius: 8px;
    border: 1px solid var(--border-card);
    transition: background 0.3s ease, transform 0.3s ease;
}

.legend-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(5px);
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid var(--border-primary);
}

.g1g3-color {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.g3g3-color {
    background: linear-gradient(135deg, #f97316, #ea580c);
}

.g5g8-color {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.g6g7-color {
    background: linear-gradient(135deg, #a855f7, #9333ea);
}

.legend-item span {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.freq-label {
    color: var(--heading-accent);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
    background: var(--text-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
}

.freq-select {
    background: rgba(30, 30, 46, 0.8);
    backdrop-filter: blur(15px);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 1s ease-out 0.6s both;
}

.freq-select::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.6), transparent);
    border-radius: 15px 15px 0 0;
}

.freq-select:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(0, 212, 255, 0.3);
}

#freq1-select::before {
    background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.6), transparent);
}

#freq2-select::before {
    background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.6), transparent);
}

/* Стилі для полів вводу */
.freq-select input {
    font-size: 2rem;
    padding: 15px 20px;
    width: 150px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    transition: all 0.3s ease;
    font-weight: 600;
    backdrop-filter: blur(5px);
}

#freq1-select input {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
}

#freq2-select input {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.1);
}

.freq-select input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.1);
    transform: scale(1.05);
}

.freq-select input:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

.freq-select input:invalid {
    border-color: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.15);
}

/* Контейнер для кнопок керування частотами */
.freq-controls {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

/* Кнопки стрілок */
.freq-select-arrow {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: bold;
    backdrop-filter: blur(5px);
    margin: 0 5px;
    min-width: 40px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 0.6s ease-in-out;
}

.freq-select-arrow:hover {
    background: linear-gradient(145deg, rgba(0, 212, 255, 0.3), rgba(0, 212, 255, 0.1));
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.freq-select-arrow:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 212, 255, 0.2);
}

/* Основний контейнер сітки */
#freq-wrap {
    margin: 0;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    background: rgba(30, 30, 46, 0.8);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: auto;
    max-width: 100%;
    max-height: 75vh;
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
    overflow-x: auto;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.6) rgba(255, 255, 255, 0.1);
}

/* Мітки частот */
#freq-labels {
    display: flex;
    flex-direction: column;
    width: 100px;
    margin-top: 50px;
    gap: 20px;
    padding-right: 15px;
    min-height: 4000px; /* Фіксована висота для прокрутки */
}

#freq-labels .label {
    height: 16px;
    width: 70px;
    text-align: right;
    padding-right: 5px;
    font-size: 12px;
    color: #ffffff;
    font-weight: 600;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.1));
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    transition: all 0.3s ease;
}

#freq-labels .label:hover {
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.2));
    color: var(--accent-primary);
    transform: translateX(-5px);
}

/* Контейнер смуг */
#freq-bands-wrap {
    display: flex;
    flex-direction: column;
    min-height: auto;
}

#freq-bands-labels {
    display: flex;
    flex-direction: row;
    height: 25px;
    margin-bottom: 10px;
}

#freq-bands-labels .label {
    height: 25px;
    width: 140px; /* Збільшено з 120px до 140px відповідно до columnWidth */
    text-align: center;
    font-size: 10px; /* Збільшено з 9px до 10px */
    color: #ffffff;
    font-weight: 600;
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.1), transparent);
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#freq-bands-labels .label:hover {
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.2), rgba(0, 212, 255, 0.05));
    color: var(--accent-primary);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

/* Основна сітка частот */
#freqs {
    position: relative;
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    height: 840px;
    width: 1120px;
    /* Розміри будуть змінені JavaScript для групи ALL (збільшено для кращого розриву) */
    transition: width 0.3s ease, height 0.3s ease;
    background: 
        repeating-linear-gradient(0deg, 
            rgba(255, 255, 255, 0.03) 0px 59px, 
            rgba(0, 212, 255, 0.1) 59px 60px),
        repeating-linear-gradient(90deg, 
            rgba(255, 255, 255, 0.03) 0px 79px, 
            rgba(0, 212, 255, 0.1) 79px 80px),
        repeating-linear-gradient(0deg, 
            transparent 0px 14px, 
            rgba(255, 255, 255, 0.05) 14px 15px),
        repeating-linear-gradient(90deg, 
            transparent 0px 19px, 
            rgba(255, 255, 255, 0.05) 19px 20px),
        radial-gradient(circle at center, 
            rgba(0, 212, 255, 0.05) 0%, 
            rgba(30, 30, 46, 0.8) 70%);
    overflow: hidden;
    transition: width 0.3s ease;
}


/* Стилі каналів з сучасними градієнтами */
#freqs .channel-1 { 
    background: linear-gradient(135deg, #7F9FFF, #6B8BFF); 
    color: #000; 
    border-color: #5A7AEF;
}
#freqs .channel-2 { 
    background: linear-gradient(135deg, #A5D8FF, #8FC8FF); 
    color: #000; 
    border-color: #7AB8EF;
}
#freqs .channel-3 { 
    background: linear-gradient(135deg, #B8F2FF, #A2E2FF); 
    color: #000; 
    border-color: #8DD2EF;
}
#freqs .channel-4 { 
    background: linear-gradient(135deg, #BFFFC2, #A9FFA2); 
    color: #000; 
    border-color: #99EF92;
}
#freqs .channel-5 { 
    background: linear-gradient(135deg, #FFF6B3, #FFE693); 
    color: #000; 
    border-color: #EFD683;
}
#freqs .channel-6 { 
    background: linear-gradient(135deg, #FFCBA5, #FFBB85); 
    color: #000; 
    border-color: #EFAB75;
}
#freqs .channel-7 { 
    background: linear-gradient(135deg, #FF9E9E, #FF8E8E); 
    color: #000; 
    border-color: #EF7E7E;
}
#freqs .channel-8 { 
    background: linear-gradient(135deg, #FF8B8B, #FF7B7B); 
    color: #000; 
    border-color: #EF6B6B;
}

/* Основні стилі каналів */
#freqs .channel {
    position: absolute;
    width: 110px;  /* Збільшено з 100px до 110px */
    height: 22px;  /* Збільшено з 20px до 22px */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px; /* Збільшено з 10px до 11px */
    font-weight: 600;
    text-align: center;
    border-radius: 6px;
    z-index: 200;
    border: 2px solid;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    margin: 2px; /* Додано відступ навколо каналу */
}

/* Вибраний канал */
#freqs .channel.selected {
    border: 3px solid var(--accent-primary);
    box-shadow: 
        0 0 20px rgba(0, 212, 255, 0.6),
        0 4px 15px rgba(0, 0, 0, 0.4);
    width: 90px;
    height: 22px;
    margin-left: -5px;
    margin-top: -2px;
    font-size: 13px;
    z-index: 500;
    animation: pulse 2s infinite;
    transform: scale(1.05);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Канали з конфліктами */
#freqs .channel.crossing-1,
#freqs .channel.crossing-2,
#freqs .channel.crossing-imd {
    background-image: 
        repeating-linear-gradient(45deg, 
            rgba(239, 68, 68, 0.3) 0px 4px, 
            transparent 4px 8px),
        repeating-linear-gradient(-45deg, 
            rgba(239, 68, 68, 0.3) 0px 4px, 
            transparent 4px 8px);
    animation: warningPulse 1.5s ease-in-out infinite;
}


@keyframes warningPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

/* Hover ефект для каналів */
#freqs .channel:hover {
    width: 130px;
    height: 36px;
    margin-left: -25px;
    margin-top: -9px;
    font-size: 15px;
    z-index: 1000;
    line-height: 32px;
    box-shadow: 
        0 0 25px rgba(255, 255, 255, 0.4),
        0 8px 25px rgba(0, 0, 0, 0.4);
    transform: scale(1.1);
    border-width: 3px;
}

/* Гармоніки */
#harmonics-wrap {
    position: absolute;
    left: 0;
    top: 0;
    height: 840px;
    width: 1120px;
    /* Розміри будуть змінені JavaScript для групи ALL */
    transition: width 0.3s ease, height 0.3s ease;
    overflow: hidden;
    border-radius: 10px;
    animation: fadeInUp 1s ease-out 0.8s both;
    transition: width 0.3s ease;
}


#harmonics-wrap .harmonic {
    position: absolute;
    z-index: 100;
    width: 100%;
    left: 0;
    opacity: 0.25;
    transition: all 1s ease;
    border-radius: 4px;
}

#harmonics-wrap.invalid-1 .harmonic-freq-1,
#harmonics-wrap.invalid-2 .harmonic-freq-2 {
    display: none;
    top: 9999px !important;
}

#harmonics-wrap .harmonic:hover {
    opacity: 0.45;
    box-shadow: 0 0 15px currentColor;
}

#harmonics-wrap .harmonic.harmonic-freq-1 {
    background: linear-gradient(90deg, 
        rgba(239, 68, 68, 0.3), 
        rgba(239, 68, 68, 0.1), 
        rgba(239, 68, 68, 0.3));
    border-top: 2px solid #ef4444;
    border-bottom: 2px solid #ef4444;
}

#harmonics-wrap .harmonic.harmonic-freq-2 {
    background: linear-gradient(90deg, 
        rgba(34, 197, 94, 0.3), 
        rgba(34, 197, 94, 0.1), 
        rgba(34, 197, 94, 0.3));
    border-top: 2px solid #22c55e;
    border-bottom: 2px solid #22c55e;
}

/* IM продукти */
#harmonics-wrap .imd {
    position: absolute;
    z-index: 100;
    width: 100%;
    left: 0;
    opacity: 0.4;
    transition: all 1s ease;
    background: linear-gradient(90deg, 
        rgba(245, 158, 11, 0.4), 
        rgba(245, 158, 11, 0.1), 
        rgba(245, 158, 11, 0.4));
    border-top: 2px solid #f59e0b;
    border-bottom: 2px solid #f59e0b;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

#harmonics-wrap .imd:hover {
    opacity: 0.6;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}


/* Панель порівняння */
.comparison-panel {
    background: rgba(30, 30, 46, 0.8);
    border-radius: 15px;
    padding: 25px;
    margin: 30px auto;
    max-width: 1200px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.comparison-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.comparison-btn {
    background: linear-gradient(145deg, rgba(0, 212, 255, 0.8), rgba(90, 103, 216, 0.8));
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.comparison-btn:hover {
    background: linear-gradient(145deg, rgba(90, 103, 216, 0.9), rgba(0, 212, 255, 0.9));
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4);
    border-color: var(--accent-primary);
}

.comparison-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.comparison-btn:disabled {
    background: linear-gradient(145deg, rgba(100, 100, 100, 0.5), rgba(80, 80, 80, 0.5));
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    border-color: rgba(255, 255, 255, 0.1);
}

.analysis-link {
    text-align: center;
    margin: 40px 0 20px;
    padding: 30px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(159, 122, 234, 0.1));
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    animation: fadeInUp 1s ease-out 1s both;
}

.analysis-button {
    display: inline-block;
    background: linear-gradient(145deg, var(--accent-primary), #9f7aea);
    color: #ffffff;
    text-decoration: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.analysis-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.analysis-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 212, 255, 0.4);
    background: linear-gradient(145deg, #1ae1ff, #a987d8);
}

.analysis-button:hover::before {
    left: 100%;
}

.analysis-button:active {
    transform: translateY(1px);
}

.analysis-description {
    margin: 15px 0 0;
    color: #b0b3b8;
    font-size: 14px;
    line-height: 1.5;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Результати порівняння */
.comparison-results {
    display: none;
    animation: fadeInUp 0.5s ease-out;
}

.comparison-results.active {
    display: block;
}

.comparison-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.comparison-section:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.comparison-section h3 {
    color: var(--accent-primary);
    margin: 0 0 15px 0;
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 2px solid rgba(0, 212, 255, 0.3);
    padding-bottom: 10px;
}

.comparison-content {
    color: #e8eaed;
    line-height: 1.6;
}

.interference-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    display: grid;
    gap: 10px;
}

.interference-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-primary);
    transition: all 0.3s ease;
    cursor: pointer;
}

.interference-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Інформаційна панель */
.info-panel {
    background: rgba(30, 30, 46, 0.8);
    border-radius: 15px;
    padding: 25px;
    margin: 30px auto;
    max-width: 1000px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.info-panel h3 {
    color: var(--accent-primary);
    margin: 0 0 20px 0;
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
    background: linear-gradient(45deg, var(--accent-primary), #9f7aea);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.info-panel h4 {
    color: #9f7aea;
    margin: 20px 0 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.info-panel p {
    margin: 8px 0;
    color: #e8eaed;
    line-height: 1.6;
    padding-left: 20px;
    position: relative;
}

.info-panel p::before {
    content: '•';
    color: var(--accent-primary);
    position: absolute;
    left: 0;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Контактна інформація (legacy #copy + спільний .site-footer) */
#copy,
.site-footer {
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    padding: 30px 20px;
    background: rgba(30, 30, 46, 0.6);
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#copy p,
.site-footer-inner p {
    margin: 5px 0;
}

/* Анімації */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Скролбари */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.6), rgba(159, 122, 234, 0.6));
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.8), rgba(159, 122, 234, 0.8));
    background-clip: content-box;
}

::-webkit-scrollbar-corner {
    background: rgba(30, 30, 46, 0.8);
}

/* Додаткові стилі для прокрутки */
#freq-wrap {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.6) rgba(255, 255, 255, 0.1);
}

/* Адаптивність */
    @media (max-width: 1400px) {
    .calculator-container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    #freq-wrap {
        overflow: auto;
        padding: 15px;
        max-height: 75vh;
        max-width: 95vw;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.6rem;
        margin: 20px 0;
    }
    
    #freq-groups {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    #freq-groups li {
        width: 80%;
        text-align: center;
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    #freq-select-wrap {
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }
    
    .freq-select {
        flex-direction: column;
        padding: 15px;
        width: 100%;
        max-width: 300px;
    }
    
    .freq-controls {
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
    }
    
    .freq-select input {
        width: 100%;
        font-size: 1.5rem;
    }
    
    .comparison-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .comparison-btn {
        width: 90%;
        max-width: 300px;
    }
    
    .info-panel {
        padding: 20px;
    }
    
    .info-panel p {
        padding-left: 15px;
    }
    
    .analysis-button {
        padding: 14px 24px;
        font-size: 1.1rem;
    }
    
    .analysis-link {
        margin: 30px 0 15px;
        padding: 20px;
    }
    
    
    /* Адаптивність для легенди */
    .legend-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .legend-item {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .calculator-container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.4rem;
    }
    
    .freq-select {
        padding: 10px;
    }
    
    .freq-select input {
        font-size: 1.2rem;
        padding: 10px;
    }
    
    #freq-wrap {
        padding: 15px;
    }
}


/* ── Layout головної сторінки ── */
.calc-header {
    text-align: center;
    margin-bottom: 24px;
}

.calc-header h2 {
    margin-bottom: 8px;
}

.calc-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 560px;
    margin: 0 auto;
}

.calc-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border-primary);
}

.toolbar-actions {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.action-btn {
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-save { border-color: rgba(59, 130, 246, 0.5); background: rgba(59, 130, 246, 0.15); }
.action-save:hover { background: rgba(59, 130, 246, 0.25); }

.action-load { border-color: rgba(34, 197, 94, 0.5); background: rgba(34, 197, 94, 0.12); }
.action-load:hover { background: rgba(34, 197, 94, 0.22); }

.action-export { border-color: rgba(168, 85, 247, 0.5); background: rgba(168, 85, 247, 0.12); }
.action-export:hover { background: rgba(168, 85, 247, 0.22); }

.action-import { border-color: rgba(249, 115, 22, 0.5); background: rgba(249, 115, 22, 0.12); }
.action-import:hover { background: rgba(249, 115, 22, 0.22); }

.action-clear { border-color: rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.12); }
.action-clear:hover { background: rgba(239, 68, 68, 0.22); }

.group-filter-bar {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
}

.group-filter-bar.visible {
    display: flex;
}

.filter-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-right: 4px;
}

.group-filter-chip {
    border: 2px solid transparent;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.group-filter-chip:not(.active) {
    opacity: 0.35;
}

.group-filter-chip.g1g3-chip.active { border-color: #22c55e; background: rgba(34, 197, 94, 0.15); }
.group-filter-chip.g3g3-chip.active { border-color: #f97316; background: rgba(249, 115, 22, 0.15); }
.group-filter-chip.g5g8-chip.active { border-color: #3b82f6; background: rgba(59, 130, 246, 0.15); }
.group-filter-chip.g6g7-chip.active { border-color: #a855f7; background: rgba(168, 85, 247, 0.15); }

.calc-workspace {
    display: grid;
    grid-template-columns: 1fr minmax(300px, 360px);
    gap: 20px;
    align-items: start;
    margin-bottom: 24px;
}

.channel-workspace {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.rc-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    margin-bottom: 20px;
    padding: 20px 22px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-primary);
    box-shadow: var(--shadow-card);
}

.rc-panel-intro {
    grid-column: 1 / -1;
    margin-bottom: 4px;
}

.rc-panel-title {
    margin: 0 0 4px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-accent);
    letter-spacing: 0.02em;
}

.rc-panel-desc {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

@media (max-width: 900px) {
    .rc-panel {
        grid-template-columns: 1fr;
    }
}

#rc-impact-summary.rc-impact-summary {
    grid-column: 1 / -1;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
}

.rc-panel .digital-control-block,
.rc-panel .digital-video-block {
    grid-column: 1 / -1;
}

/* ── Картки Радіо 1 / Радіо 2 ── */
.rc-radio-card {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-primary);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.rc-radio-card:hover {
    transform: translateY(-2px);
}

.rc-radio-accent {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.rc-radio-1 {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(30, 30, 46, 0.4) 55%);
    box-shadow: 0 4px 24px rgba(239, 68, 68, 0.08);
}

.rc-radio-1 .rc-radio-accent {
    background: linear-gradient(180deg, #f87171, #ef4444, #dc2626);
}

.rc-radio-1:hover {
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.35);
}

.rc-radio-2 {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(30, 30, 46, 0.4) 55%);
    box-shadow: 0 4px 24px rgba(34, 197, 94, 0.08);
}

.rc-radio-2 .rc-radio-accent {
    background: linear-gradient(180deg, #4ade80, #22c55e, #16a34a);
}

.rc-radio-2:hover {
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.35);
}

[data-theme="light"] .rc-radio-1 {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(255, 255, 255, 0.95) 60%);
}

[data-theme="light"] .rc-radio-2 {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(255, 255, 255, 0.95) 60%);
}

.rc-radio-inner {
    padding: 16px 18px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rc-radio-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rc-radio-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.rc-radio-1 .rc-radio-badge {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.25);
    border: 1px solid rgba(239, 68, 68, 0.45);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.2);
}

.rc-radio-2 .rc-radio-badge {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.25);
    border: 1px solid rgba(34, 197, 94, 0.45);
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.2);
}

.rc-radio-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.rc-radio-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.rc-radio-1 .rc-radio-title { color: #fca5a5; }
.rc-radio-2 .rc-radio-title { color: #86efac; }

[data-theme="light"] .rc-radio-1 .rc-radio-title { color: #dc2626; }
[data-theme="light"] .rc-radio-2 .rc-radio-title { color: #16a34a; }

.rc-radio-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.rc-radio-fields {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px 16px;
}

.rc-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 140px;
    min-width: 0;
}

.rc-field-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.rc-input-wrap {
    display: flex;
    align-items: stretch;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--border-primary);
    background: rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="light"] .rc-input-wrap {
    background: rgba(255, 255, 255, 0.9);
}

.rc-radio-1 .rc-input-wrap {
    border-color: rgba(239, 68, 68, 0.35);
}

.rc-radio-2 .rc-input-wrap {
    border-color: rgba(34, 197, 94, 0.35);
}

.rc-input-wrap:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
}

.rc-radio-1 .rc-input-wrap:focus-within {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.rc-radio-2 .rc-input-wrap:focus-within {
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.rc-step-btn {
    width: 36px;
    flex-shrink: 0;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    line-height: 1;
    padding: 0;
}

.rc-step-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.rc-radio-1 .rc-step-btn:active { background: rgba(239, 68, 68, 0.25); }
.rc-radio-2 .rc-step-btn:active { background: rgba(34, 197, 94, 0.25); }

.rc-radio-card input[type="number"] {
    flex: 1;
    min-width: 0;
    width: auto !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    font-variant-numeric: tabular-nums;
    text-align: center;
    padding: 11px 6px !important;
    color: var(--text-primary) !important;
    transform: none !important;
    -moz-appearance: textfield;
}

.rc-radio-card input[type="number"]::-webkit-outer-spin-button,
.rc-radio-card input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.rc-radio-card input[type="number"]:focus {
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.rc-field-sep {
    width: 1px;
    height: 48px;
    background: linear-gradient(180deg, transparent, var(--border-primary), transparent);
    align-self: center;
    flex-shrink: 0;
}

.rc-field-unit {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    padding-bottom: 12px;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.rc-impact-summary {
    font-size: 0.85rem;
    line-height: 1.45;
}

.rc-ok { color: var(--success); }
.rc-blocked-line { color: var(--error); margin-bottom: 4px; }
.rc-warn-line { color: var(--warning); }

/* legacy compact — не використовується на index */
.freq-select-compact {
    display: none;
}

.picker-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.channel-search {
    flex: 1 1 200px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-primary);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.channel-status-filter {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-primary);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    min-width: 160px;
}

.spectrum-map {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 14px;
    padding: 14px 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.spectrum-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--panel-bg-soft);
    border: 1px solid var(--border-subtle);
}

.spec-leg.r1 { color: #ef4444; }
.spec-leg.r2 { color: #22c55e; }
.spec-leg.imd { color: #f59e0b; }

.spectrum-row {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 10px;
    align-items: start;
    margin-bottom: 10px;
}

.spectrum-track-wrap {
    min-width: 0;
    padding: 22px 2px 6px 0;
    overflow-x: auto;
}

.spectrum-track {
    position: relative;
    min-height: 36px;
    min-width: 280px;
    background: var(--spectrum-track-bg);
    border-radius: 8px;
    border: 1px solid var(--spectrum-track-border);
    box-shadow: var(--spectrum-track-inset);
    overflow: visible;
}

.spectrum-track--stacked::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 23px,
        rgba(255, 255, 255, 0.04) 23px,
        rgba(255, 255, 255, 0.04) 24px
    );
}

[data-theme="light"] .spectrum-track--stacked::before {
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 23px,
        rgba(15, 23, 42, 0.05) 23px,
        rgba(15, 23, 42, 0.05) 24px
    );
}

.spectrum-lane-hint {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.58rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    pointer-events: none;
    z-index: 2;
    padding: 1px 8px;
    border-radius: 4px;
    background: var(--spectrum-scale-bg);
}

.spectrum-scale {
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--spectrum-scale-color);
    pointer-events: none;
    z-index: 2;
}

.spectrum-scale span {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--spectrum-scale-bg);
    line-height: 1.3;
}

.spectrum-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    opacity: var(--spectrum-zone-opacity);
    pointer-events: none;
    border-radius: 4px;
    z-index: 1;
}

.spectrum-zone.zone-r1 { background: #ef4444; }
.spectrum-zone.zone-r2 { background: #22c55e; }
.spectrum-zone.zone-imd { background: #f59e0b; }

.spectrum-dot {
    position: absolute;
    transform: translateX(-50%);
    min-width: 34px;
    height: 22px;
    padding: 0 7px;
    border-radius: 6px;
    border: 2px solid var(--spectrum-dot-border);
    background: var(--spectrum-dot-bg);
    color: var(--text-primary);
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    z-index: 3;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    line-height: 1;
    white-space: nowrap;
    box-shadow: var(--spectrum-dot-shadow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.spectrum-dot.is-stacked {
    min-width: 28px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.6rem;
    border-width: 1.5px;
    opacity: 0.92;
}

.spectrum-dot.is-stacked:hover,
.spectrum-dot.is-stacked.selected,
.spectrum-dot.is-stacked.focused {
    opacity: 1;
    z-index: 5;
}

.spectrum-dot:hover {
    transform: translateX(-50%) scale(1.06);
    z-index: 5;
    border-color: var(--accent-primary);
}

.spectrum-dot.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.35), var(--spectrum-dot-shadow);
}

.spectrum-dot.focused { z-index: 4; }
.spectrum-dot.affected { box-shadow: 0 0 0 2px var(--accent-tertiary), var(--spectrum-dot-shadow); }

.spectrum-dot.status-blocked {
    background: var(--status-bad-bg);
    border-color: var(--status-bad-border);
    color: var(--status-bad-text);
}

.spectrum-dot.status-warning {
    background: var(--status-warn-bg);
    border-color: var(--status-warn-border);
    color: var(--status-warn-text);
}

.spectrum-dot.status-caution {
    background: rgba(234, 179, 8, 0.2);
    border-color: #eab308;
    color: var(--text-primary);
}

.spectrum-dot.status-ok {
    border-color: var(--status-ok-border);
}

.spectrum-row-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    padding-top: 26px;
    letter-spacing: 0.02em;
}

.channel-browser {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 14px;
    padding: 12px;
    max-height: 420px;
    overflow-y: auto;
}

.browser-section { margin-bottom: 14px; }
.browser-section:last-child { margin-bottom: 0; }

.browser-section-title {
    font-size: 0.8rem;
    color: var(--text-accent);
    margin: 0 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-primary);
}

.browser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
}

.channel-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px 8px;
    border-radius: 10px;
    border: 2px solid var(--border-primary);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    text-align: left;
    min-height: 56px;
}

.channel-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    width: 100%;
}

.channel-card:hover {
    transform: translateY(-1px);
}

.channel-card.status-ok:hover {
    border-color: var(--accent-primary);
}

.channel-card.selected {
    border-color: var(--accent-primary);
    background: rgba(34, 211, 238, 0.12);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.3);
    color: var(--text-primary);
}

.channel-card.status-blocked.selected {
    border-color: #ef4444;
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.55), rgba(185, 28, 28, 0.45));
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.5), inset 3px 0 0 #fca5a5;
    color: #fff;
}

.channel-card.status-warning.selected {
    border-color: var(--warning);
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.45), rgba(217, 119, 6, 0.35));
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35), inset 3px 0 0 var(--warning);
    color: #fff;
}

.channel-card.focused { outline: 2px solid rgba(34, 211, 238, 0.5); outline-offset: 2px; }
.channel-card.affected { box-shadow: 0 0 0 2px var(--accent-tertiary); }

.channel-card.status-ok {
    border-color: var(--border-primary);
    background: rgba(255, 255, 255, 0.06);
}

.channel-card.status-blocked {
    border-color: #ef4444;
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.48), rgba(185, 28, 28, 0.38));
    box-shadow: inset 3px 0 0 #fca5a5;
    color: #fff;
}

.channel-card.status-blocked:hover {
    border-color: #f87171;
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.58), rgba(185, 28, 28, 0.48));
}

.channel-card.status-blocked .channel-card-label,
.channel-card.status-blocked .channel-card-freq {
    color: #fff;
}

.channel-card.status-warning {
    border-color: #f59e0b;
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.42), rgba(217, 119, 6, 0.32));
    box-shadow: inset 3px 0 0 #fcd34d;
    color: #fff;
}

.channel-card.status-warning:hover {
    border-color: #fbbf24;
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.52), rgba(217, 119, 6, 0.42));
}

.channel-card.status-warning .channel-card-label,
.channel-card.status-warning .channel-card-freq {
    color: #fff;
}

.channel-card.status-caution {
    border-color: #eab308;
    background: linear-gradient(145deg, rgba(234, 179, 8, 0.35), rgba(202, 138, 4, 0.28));
    box-shadow: inset 3px 0 0 #fde047;
    color: #fff;
}

.channel-card.status-caution .channel-card-label,
.channel-card.status-caution .channel-card-freq {
    color: #fff;
}

[data-theme="light"] .channel-card.status-ok {
    background: #ffffff;
    border-color: var(--border-card);
}

[data-theme="light"] .channel-card.status-blocked {
    background: linear-gradient(145deg, #fecaca, #fca5a5);
    border-color: #dc2626;
    box-shadow: inset 3px 0 0 #dc2626;
    color: #7f1d1d;
}

[data-theme="light"] .channel-card.status-blocked .channel-card-label,
[data-theme="light"] .channel-card.status-blocked .channel-card-freq {
    color: #991b1b;
}

[data-theme="light"] .channel-card.status-blocked:hover {
    background: linear-gradient(145deg, #fca5a5, #f87171);
    border-color: #b91c1c;
}

[data-theme="light"] .channel-card.status-warning {
    background: linear-gradient(145deg, #fde68a, #fcd34d);
    border-color: #d97706;
    box-shadow: inset 3px 0 0 #d97706;
    color: #78350f;
}

[data-theme="light"] .channel-card.status-warning .channel-card-label,
[data-theme="light"] .channel-card.status-warning .channel-card-freq {
    color: #92400e;
}

[data-theme="light"] .channel-card.status-caution {
    background: linear-gradient(145deg, #fef9c3, #fde047);
    border-color: #ca8a04;
    box-shadow: inset 3px 0 0 #ca8a04;
    color: #713f12;
}

[data-theme="light"] .channel-card.status-caution .channel-card-label,
[data-theme="light"] .channel-card.status-caution .channel-card-freq {
    color: #854d0e;
}

.channel-card-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: inherit;
}

.channel-card-freq {
    font-size: 0.72rem;
    color: var(--text-secondary);
    opacity: 0.9;
}

.channel-card.status-ok .channel-card-label {
    color: var(--text-primary);
}

.channel-card.status-ok .channel-card-freq {
    color: var(--text-secondary);
}

.channel-card-status {
    font-size: 0.75rem;
    line-height: 1;
    flex-shrink: 0;
}

.analysis-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}

.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 14px;
    padding: 16px;
}

.sidebar-card h3 {
    font-size: 0.95rem;
    margin: 0 0 10px;
    color: var(--text-accent);
}

.sidebar-hint, .sidebar-empty {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 10px;
    line-height: 1.45;
}

.selected-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.selected-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    font-size: 0.85rem;
    border-left: 3px solid var(--accent-primary);
}

.selected-item span {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.interactions-panel {
    max-height: 220px;
    overflow-y: auto;
}

.interaction-header {
    font-size: 0.85rem;
    margin-bottom: 10px;
    line-height: 1.4;
}

.conflict-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    font-size: 0.72rem;
    font-weight: 600;
}

.interference-item.severity-high { border-left-color: var(--error); }
.interference-item.severity-medium { border-left-color: var(--warning); }
.interference-item.severity-low { border-left-color: var(--info); }

.group-matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
    margin-top: 8px;
    table-layout: fixed;
}

.group-matrix-table th,
.group-matrix-table td {
    padding: 8px 4px;
    text-align: center;
    border: 1px solid var(--border-primary);
    vertical-align: middle;
}

.group-matrix-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.68rem;
}

.matrix-cell {
    cursor: pointer;
    transition: background 0.15s ease;
    line-height: 1.25;
}

.matrix-cell:hover {
    background: var(--bg-tertiary);
}

.matrix-badge {
    display: block;
    font-weight: 700;
    font-size: 0.72rem;
}

.matrix-count {
    display: block;
    font-size: 0.62rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.matrix-cell.matrix-none .matrix-badge { color: var(--text-secondary); opacity: 0.5; }
.matrix-cell.matrix-low .matrix-badge { color: var(--success); }
.matrix-cell.matrix-medium .matrix-badge { color: var(--warning); }
.matrix-cell.matrix-high .matrix-badge { color: var(--error); }

.matrix-legend-hint {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 10px;
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.matrix-legend-hint span {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--bg-tertiary);
}

.leg-low { color: var(--success); }
.leg-med { color: var(--warning); }
.leg-high { color: var(--error); }

.matrix-cell.selected {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
    background: rgba(0, 212, 255, 0.12);
}
.matrix-self { color: var(--text-secondary); opacity: 0.4; }

.group-pair-details {
    margin-top: 12px;
    max-height: 180px;
    overflow-y: auto;
}

.group-pair-details h4 {
    font-size: 0.85rem;
    color: var(--text-accent);
    margin: 0 0 8px;
}

.pair-list .interference-item {
    font-size: 0.78rem;
    padding: 8px 10px;
}

.sidebar-legend {
    margin: 0;
    max-width: none;
    padding: 16px;
}

.sidebar-legend .legend-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.grid-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grid-legend-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: 10px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.legend-chip.harmonic-1::before { content: none; }
.legend-chip.harmonic-1 { color: #ef4444; }
.legend-chip.harmonic-2 { color: #22c55e; }
.legend-chip.imd { color: #f59e0b; }
.legend-chip.affected { color: #a855f7; }

.freq-label-1 { color: #ef4444; }
.freq-label-2 { color: #22c55e; }

.group-separator {
    position: absolute;
    top: 0;
    width: 3px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.25), transparent);
    pointer-events: none;
    z-index: 2;
}

#freqs .channel.affected {
    box-shadow: 0 0 0 2px #a855f7, 0 0 12px rgba(168, 85, 247, 0.5);
    animation: pulse-affected 1.5s ease-in-out infinite;
}

@keyframes pulse-affected {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}

.help-panel {
    max-width: 720px;
    margin: 0 auto 24px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
}

.help-panel summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-accent);
}

.help-content {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.help-content p { margin: 6px 0; }

@media (max-width: 1100px) {
    .calc-workspace {
        grid-template-columns: 1fr;
    }

    .analysis-sidebar {
        position: static;
        max-height: none;
        order: 2;
    }

    .channel-workspace {
        order: 1;
    }
}

@media (max-width: 768px) {
    .calc-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-actions {
        justify-content: center;
    }

    .action-btn {
        flex: 1 1 calc(50% - 8px);
        min-width: 120px;
    }

    #freq-groups {
        justify-content: center;
    }

    .rc-radio-fields {
        flex-direction: column;
        align-items: stretch;
    }

    .rc-field-sep {
        width: 100%;
        height: 1px;
        background: linear-gradient(90deg, transparent, var(--border-primary), transparent);
    }

    .rc-field-unit {
        padding-bottom: 0;
        align-self: flex-start;
    }
}

/* Панель керування в тулбарі */
.control-panel.toolbar-actions {
    display: flex;
    justify-content: flex-end;
    margin: 0;
    animation: none;
}

.control-btn {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.8), rgba(185, 28, 28, 0.8));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.9), rgba(185, 28, 28, 0.9));
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.6);
}

.control-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Медіа-запити для адаптивності */
@media (max-width: 768px) {
    .control-btn {
        padding: 10px 20px;
        font-size: 13px;
        width: 80%;
        max-width: 250px;
    }
}

@media (max-width: 480px) {
    .control-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
}

.control-analysis-button {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.8), rgba(5, 150, 105, 0.8)) !important;
    border-color: rgba(16, 185, 129, 0.6) !important;
}

.control-analysis-button::before {
    background: linear-gradient(45deg, rgba(16, 185, 129, 0.3), rgba(5, 150, 105, 0.3)) !important;
}

.control-analysis-button:hover {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.9), rgba(5, 150, 105, 0.9)) !important;
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.4) !important;
    border-color: rgba(16, 185, 129, 0.8) !important;
}

.control-analysis-button:hover::before {
    background: linear-gradient(45deg, rgba(16, 185, 129, 0.4), rgba(5, 150, 105, 0.4)) !important;
}

/* Splash Screen стилі */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-splash);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    color: var(--text-primary);
}

.logo-animation {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
}

.splash-logo {
    animation: logoFloat 3s ease-in-out infinite, logoRotate 8s linear infinite;
    filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.6));
    transition: all 0.3s ease;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;
    height: 160px;
    border: 2px solid rgba(0, 212, 255, 0.4);
    border-radius: 50%;
    animation: pulse 2s ease-out infinite;
}

.pulse-ring-delay {
    animation-delay: 1s;
}

.splash-title {
    font-size: 3rem;
    font-weight: 700;
    margin: 20px 0;
    background: linear-gradient(45deg, var(--accent-primary), #5a67d8, #9f7aea);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleGlow 2s ease-in-out infinite alternate;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite both;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* Анімації */
@keyframes logoFloat {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}

@keyframes logoRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

@keyframes titleGlow {
    0% { 
        text-shadow: 0 0 20px rgba(0, 212, 255, 0.5); 
        transform: scale(1);
    }
    100% { 
        text-shadow: 0 0 40px rgba(0, 212, 255, 0.8), 0 0 60px rgba(90, 103, 216, 0.3); 
        transform: scale(1.02);
    }
}

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Адаптивні стилі для splash screen */
@media (max-width: 768px) {
    .splash-logo {
        width: 100px;
        height: 100px;
    }
    
    .pulse-ring {
        width: 140px;
        height: 140px;
    }
    
    .splash-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 480px) {
    .splash-logo {
        width: 80px;
        height: 80px;
    }
    
    .pulse-ring {
        width: 120px;
        height: 120px;
    }
    
    .splash-title {
        font-size: 1.8rem;
    }
}