/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow: hidden;
}

/* Система экранов */
.screen {
    display: none;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Контейнеры */
.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 600px;
    width: 90%;
}

/* Главное меню */
#main-menu h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #333;
}

.status {
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
    margin-bottom: 30px;
    font-size: 1.1em;
    color: #666;
}

/* Кнопки */
.btn {
    padding: 15px 30px;
    font-size: 1.1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin: 10px;
    transition: all 0.3s ease;
    font-weight: 600;
    min-width: 200px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

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

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

/* Экран калибровки */
.calibration-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
}

.calibration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(0, 0, 0, 0.05);
    font-size: 1.2em;
    font-weight: 600;
}

.calibration-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#calibration-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.calibration-footer {
    padding: 20px 40px;
    background: rgba(0, 0, 0, 0.05);
    text-align: center;
    font-size: 1.1em;
}

/* Экран обработки */
.progress-container {
    margin: 30px 0;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 15px;
}

.progress-text {
    font-size: 1.2em;
    font-weight: 600;
    color: #667eea;
}

.processing-message {
    color: #666;
    margin-top: 20px;
}

/* Результаты калибровки */
.metrics {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1em;
}

.metric-label {
    font-weight: 600;
    color: #333;
}

.metric-value {
    font-weight: 700;
    color: #667eea;
}

.metric-value.success {
    color: #28a745;
}

.metric-value.warning {
    color: #ffc107;
}

/* Экран демонстрации */
.demo-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
}

.demo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: white;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
}

.stats {
    display: flex;
    gap: 20px;
    font-size: 1.1em;
    font-weight: 600;
}

.demo-content {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.heatmap-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 100px;
    min-height: 100px;
}

#heatmap-canvas {
    width: 100%;
    height: 100%;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

.video-preview-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 200px;
    height: 150px;
    border-radius: 10px;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

#video-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Зеркальное отображение */
}

.demo-footer {
    padding: 15px 30px;
    background: white;
    color: #333;
    text-align: center;
    font-size: 1.1em;
    font-weight: 600;
    border-top: 1px solid #e0e0e0;
}

.gaze-coords {
    color: #333;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    #main-menu h1 {
        font-size: 2em;
    }

    .btn {
        min-width: 150px;
        padding: 12px 20px;
        font-size: 1em;
    }

    .calibration-header,
    .demo-header {
        padding: 10px 20px;
        font-size: 0.9em;
    }

    .video-preview-container {
        width: 150px;
        height: 112px;
    }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen.active .container {
    animation: fadeIn 0.3s ease;
}

/* Скрытые элементы */
#hidden-canvas {
    display: none;
}

