:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%);
    --accent-color: #667eea;
    --text-dark: #2c3e50;
    --text-light: #718096;
    --surface: #ffffff;
    --border-radius: 16px;
    --shadow-soft: 0 10px 40px rgba(0,0,0,0.08);
    --shadow-strong: 0 20px 60px rgba(0,0,0,0.15);
    --animation-duration: 0.3s;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    overflow-x: hidden;
}

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

.animate-in {
    animation: fadeInUp 0.8s ease-out forwards;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 1rem 0;
    transition: all var(--animation-duration) ease;
}

.navbar__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar__logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

.navbar__nav {
    display: flex;
    gap: 1rem;
    list-style: none;
}

.navbar__link {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--animation-duration) ease;
}

.navbar__link:hover {
    color: var(--accent-color);
}

.hero {
    background: var(--primary-gradient);
    min-height: 60vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding-top: 80px;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
}

.hero__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero__title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    color: white;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero__subtitle {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    color: rgba(255,255,255,0.9);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.breadcrumb {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    margin-bottom: 2rem;
    color: rgba(255,255,255,0.9);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 3rem 0;
    background: var(--surface);
    margin: 2rem 0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    transition: all var(--animation-duration) ease;
}

.section:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-strong);
}

.section__title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.section__content {
    padding: 0 2rem;
}

.demo-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.demo-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.3s ease;
    text-align: center;
}

.demo-btn:hover {
    transform: translateY(-5px);
}

.demo-btn.special {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57);
    background-size: 300% 300%;
    animation: gradientShift 3s ease infinite;
    position: relative;
    overflow: hidden;
}

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

.demo-btn.special:hover::before {
    left: 100%;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.debug-btn {
    background: #dc3545;
}

.clear-btn {
    background: #ff6b35;
    animation: pulse 2s infinite;
}

.clear-btn:hover {
    background: #e55a2e;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 107, 53, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0); }
}

.test-btn {
    background: #28a745;
}

.chain-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.chain-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.advanced-btn {
    background: #fd7e14;
}

.behavior-btn {
    background: #6f42c1;
}

.isolation-badge {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
    margin: 10px 0;
}

.isolation-test {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
}

.isolation-test h3 {
    margin-top: 0;
    color: #856404;
}

.status {
    margin: 20px 0;
    padding: 15px;
    border-radius: 5px;
}

.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.log {
    background: #000;
    color: #0f0;
    padding: 15px;
    border-radius: 5px;
    font-family: monospace;
    max-height: 300px;
    overflow-y: auto;
    margin: 20px 0;
}

.tall-content {
    height: 1000px;
    background: linear-gradient(to bottom, #e9ecef, #f8f9fa);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 20px 0;
    border-radius: 10px;
}

.target-block {
    background: #d4edda;
    padding: 40px;
    margin: 20px 0;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #c3e6cb;
}

/* Специально добавляем конфликтующие стили для тестирования изоляции */
.modal-overlay {
    background: red !important;
    z-index: 1 !important;
}
.modal {
    background: yellow !important;
}
.modal-close {
    color: purple !important;
}

.position-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr auto 1fr;
    gap: 20px;
    margin: 30px 0;
    min-height: 300px;
    padding: 20px;
    border: 2px dashed #667eea;
    border-radius: 15px;
    background: rgba(102, 126, 234, 0.05);
    position: relative;
}

.position-grid::before {
    content: "Экран браузера";
    position: absolute;
    top: -10px;
    left: 20px;
    background: white;
    padding: 0 10px;
    color: #667eea;
    font-size: 0.9rem;
    font-weight: bold;
}

.position-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    font-weight: 500;
}

.position-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.center-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%);
    font-size: 1.1rem;
    font-weight: bold;
}

.position-placeholder {
    /* Пустые ячейки для правильного позиционирования в сетке */
    display: block;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .position-grid {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 10px;
        min-height: 250px;
        padding: 15px;
    }
    
    .position-btn {
        padding: 12px 8px;
        font-size: 0.8rem;
        min-height: 50px;
    }
    
    .center-btn {
        font-size: 0.9rem;
    }
}