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

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
            color: #333;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
        }

        header {
            text-align: center;
            color: white;
            margin-bottom: 30px;
            padding: 20px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 15px;
            backdrop-filter: blur(10px);
        }

        header h1 {
            font-size: 2.5em;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
        }

        .main-content {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 25px;
            align-items: start;
        }

        .visualization-panel,
        .calculator-panel {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
        }

        .visualization-panel h2,
        .calculator-panel h2 {
            color: #667eea;
            margin-bottom: 25px;
            font-size: 1.8em;
            border-bottom: 3px solid #667eea;
            padding-bottom: 10px;
        }

        .window-display {
    background: linear-gradient(180deg, #87CEEB 0%, #E0F6FF 100%);
    border-radius: 10px;
    padding: 20px;
    height: 550px;
    display: flex;
    flex-direction: column; /* Ставить вікно над розмірами */
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#windowVisualization {
    transition: width 0.2s ease, height 0.2s ease;
    display: flex;
}

        .window-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1; /* Займає всю верхню частину */
}

        .dimensions-display {
    margin-top: 15px; /* Відступ під вікном */
    background: white;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

        .results-panel {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 10px;
            padding: 25px;
            color: white;
            margin-top: 25px;
        }

        .results-panel h3 {
            margin-bottom: 20px;
            font-size: 1.5em;
            border-bottom: 2px solid rgba(255, 255, 255, 0.3);
            padding-bottom: 10px;
        }

        .result-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            padding: 12px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 8px;
        }

        .result-value {
            font-size: 1.2em;
            font-weight: bold;
        }

        .result-value.highlight {
            color: #ffd700;
            font-size: 1.4em;
        }

        .division-config {
            margin-top: 25px;
            padding: 20px;
            background: #f7fafc;
            border-radius: 10px;
        }

        .division-config h3 {
            color: #2d3748;
            margin-bottom: 15px;
            font-size: 1.3em;
        }

        .division-buttons {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
            margin-bottom: 20px;
        }

        .division-btn {
            padding: 15px 10px;
            background: white;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            font-size: 0.9em;
            color: #4a5568;
            position: relative;
        }

        .division-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            background: #edf2f7;
        }

        .division-btn:disabled:hover::after {
            content: attr(title);
            position: absolute;
            bottom: 105%;
            left: 50%;
            transform: translateX(-50%);
            background: #2d3748;
            color: white;
            padding: 5px 10px;
            border-radius: 4px;
            font-size: 0.8em;
            white-space: nowrap;
            z-index: 100;
        }

        .division-btn:hover:not(:disabled) {
            border-color: #667eea;
            transform: translateY(-2px);
        }

        .division-btn.active {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-color: #667eea;
        }

        .division-icon {
            font-size: 1.5em;
            font-weight: bold;
        }

        .opening-config {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .section-config {
            background: white;
            padding: 15px;
            border-radius: 8px;
            border-left: 4px solid #667eea;
        }

        .section-config h4 {
            color: #2d3748;
            margin-bottom: 10px;
            font-size: 1em;
        }

        .opening-types {
            display: grid;
            grid-template-columns: repeat(3, 1fr); /* 3 в ряд */
            gap: 8px;
        }

        .opening-btn {
            padding: 10px 5px;
            background: #f7fafc;
            border: 2px solid #e2e8f0;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
            font-size: 0.75em;
            color: #4a5568;
        }

        .opening-btn:disabled {
            opacity: 0.3;
            cursor: not-allowed;
        }

        .opening-btn.active {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        /* Стилі вікна та ліній */
        .window-section {
            position: relative;
            background: #2d3748;
            border: 4px solid #4a5568;
            padding: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .glass-pane {
            background: linear-gradient(135deg, #a0c4ff 0%, #e0f6ff 100%);
            width: 100%;
            height: 100%;
            position: relative;
        }

        /* Малювання ліній відкривання */
        .opening-svg {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 5;
        }

        /* Стиль для ліній відкривання (SVG) */
.opening-svg polyline {
    fill: none;
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 2;
    stroke-dasharray: 6,4;
    stroke-linejoin: round;
}

.window-handle.top {
    top: 15px; /* Відступ від верхнього краю */
    left: 50%;
    transform: translateX(-50%) rotate(90deg); /* Повертаємо ручку горизонтально */
}
        .window-handle {
            position: absolute;
            width: 8px;
            height: 35px;
            background: #cbd5e0;
            border: 1px solid #718096;
            border-radius: 2px;
            z-index: 10;
        }

        .window-handle.left { left: 10px; top: 50%; transform: translateY(-50%); }
        .window-handle.right { right: 10px; top: 50%; transform: translateY(-50%); }

        .form-section {
            margin-bottom: 30px;
            padding: 20px;
            background: #f7fafc;
            border-radius: 10px;
            border-left: 4px solid #667eea;
        }

        .form-section h3 {
            color: #2d3748;
            margin-bottom: 15px;
            font-size: 1.3em;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
            color: #4a5568;
            font-weight: 600;
        }

        .dimension-input {
            width: 100px;
            padding: 6px;
            border: 2px solid #e2e8f0;
            border-radius: 6px;
            text-align: center;
            font-weight: bold;
        }

        /* Стилізація Range з заливкою */
        input[type="range"] {
            -webkit-appearance: none;
            width: 100%;
            height: 8px;
            background: #e2e8f0;
            border-radius: 5px;
            background-image: linear-gradient(#667eea, #667eea);
            background-repeat: no-repeat;
        }

        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            height: 20px;
            width: 20px;
            border-radius: 50%;
            background: #667eea;
            cursor: pointer;
            box-shadow: 0 0 2px 0 rgba(0,0,0,0.5);
        }

        select {
            width: 100%;
            padding: 12px;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            background: white;
        }

        .profile-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
        }

        .profile-card {
            padding: 12px;
            background: white;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            cursor: pointer;
        }

        .profile-card.active {
            border-color: #667eea;
            background: #eef2ff;
        }

        .profile-name { font-weight: bold; }
        .profile-specs { font-size: 0.85em; color: #718096; }

        .btn-calculate {
            width: 100%;
            padding: 18px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 1.2em;
            font-weight: bold;
            cursor: pointer;
        }

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