* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.2);
    --text-color: #ffffff;
    --accent-color: #4ecdc4;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--primary-bg);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px 0;
}

.title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 300;
    margin-bottom: 8px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #ffa726);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    opacity: 0.9;
    font-weight: 300;
    line-height: 1.5;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Увеличиваем высоту холста на десктопе */
#canvas-container {
    flex: 1;
    min-height: 60vh; /* Минимальная высота на мобиле */
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border: 2px solid var(--card-border);
    background: rgba(0, 0, 0, 0.2);
    position: relative;
}

/* На десктопе делаем холст выше */
@media (min-width: 768px) {
    #canvas-container {
        min-height: 120vh; /* Большая высота на десктопе */
    }
    
    .header {
        margin-bottom: 30px;
    }
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 20px;
}

.controls-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.control-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    padding: 12px 20px;
    border-radius: 15px;
    cursor: pointer;
    font-size: clamp(0.8rem, 2vw, 1rem);
    transition: all 0.3s ease;
    min-width: 140px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
}

.control-btn:active {
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 1.1em;
}

.btn-text {
    flex: 1;
    text-align: center;
}

.footer {
    text-align: center;
    padding: 15px 0;
    opacity: 0.7;
    font-size: 0.9rem;
    border-top: 1px solid var(--card-border);
    margin-top: 20px;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal-content {
    background: var(--primary-bg);
    border: 1px solid var(--card-border);
    border-radius: 25px;
    padding: 30px;
    max-width: 600px;
    margin: 30px auto;
    position: relative;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}

.modal-content h3 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.4rem;
    font-weight: 300;
}

.modal-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.modal-option {
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 15px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.modal-option:hover {
    transform: translateY(-5px) scale(1.05);
    border-color: var(--accent-color);
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.modal-option.active {
    border-color: var(--accent-color);
    background: rgba(78, 205, 196, 0.2);
    transform: scale(1.05);
}

.color-option {
    aspect-ratio: 1;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.color-option::after {
    content: attr(data-name);
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.8rem;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

/* Загрузочный экран */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 15px;
    padding: 15px 25px;
    color: var(--text-color);
    z-index: 1001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .controls-panel {
        padding: 15px;
    }
    
    .controls-row {
        gap: 10px;
    }
    
    .control-btn {
        min-width: 120px;
        padding: 10px 15px;
        flex: 1;
    }
    
    .btn-text {
        font-size: 0.9rem;
    }
    
    .modal-content {
        margin: 20px auto;
        padding: 20px 15px;
    }
    
    .modal-options {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .modal-option {
        padding: 12px;
        font-size: 0.9rem;
        min-height: 80px;
    }
}

@media (max-width: 480px) {
    .control-btn {
        min-width: 100px;
        padding: 8px 12px;
    }
    
    .btn-text {
        font-size: 0.8rem;
    }
    
    .modal-option {
        padding: 10px;
        font-size: 0.8rem;
        min-height: 70px;
    }
}