* {
    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;
    color: #333;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

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

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

.test-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    margin-bottom: 15px;
    overflow: hidden;
}

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

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 20px;
}

.image-frame {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
}

#canvas-container {
    display: inline-block;
    position: relative;
}

#canvas-container canvas {
    border: 4px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    height: auto;
}

#canvas-container:-webkit-full-screen canvas {
    max-width: 90vh;
    max-height: 90vh;
}

.canvas-controls {
    position: absolute;
    top: 10px;
    right: 10px;
}

.image-info {
    margin-top: 15px;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.colorblind-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.preview-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.answer-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.answer-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.answer-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.btn {
    padding: 15px 25px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

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

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

.btn-primary:hover {
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #eee;
    color: #666;
}

.btn-secondary:hover {
    background: #ddd;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-sm {
    padding: 8px 15px;
    font-size: 0.85rem;
}

.btn-icon {
    padding: 10px;
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-icon:hover {
    background: #667eea;
    color: white;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.timer {
    text-align: center;
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.timer.warning {
    color: #f39c12;
}

.timer.danger {
    color: #e74c3c;
}

.result-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.result-container.hidden {
    display: none;
}

.result-card {
    text-align: center;
}

.result-card h2 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: #333;
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.score-value {
    font-size: 2.5rem;
    font-weight: bold;
}

.score-label {
    font-size: 0.8rem;
    opacity: 0.9;
}

.score-details p {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #666;
}

.score-details span {
    font-weight: bold;
    color: #333;
}

.result-message {
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 1.1rem;
    line-height: 1.6;
}

.result-message.normal {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.result-message.red-green {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.result-message.anomaly {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.disclaimer {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.disclaimer p {
    font-size: 0.85rem;
    color: #666;
    text-align: left;
}

.results-breakdown {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.results-breakdown h3 {
    margin-bottom: 15px;
    color: #333;
}

.plates-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.plate-item {
    padding: 10px;
    text-align: center;
    border-radius: 8px;
    font-size: 0.9rem;
}

.plate-item.correct {
    background: #d4edda;
    color: #155724;
}

.plate-item.incorrect {
    background: #f8d7da;
    color: #721c24;
}

.plate-item.skipped {
    background: #f8f9fa;
    color: #666;
}

.plate-item.demo {
    background: #e7f3ff;
    color: #0c63e4;
}

.expert-advice,
.test-history {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    background: #fafafa;
    padding: 20px;
    border-radius: 12px;
}

.expert-advice h4,
.test-history h4 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1.2rem;
}

.expert-advice h5 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1rem;
}

.advice-section {
    margin-bottom: 20px;
}

.advice-section:last-child {
    margin-bottom: 0;
}

.advice-section ul {
    margin: 0;
    padding-left: 20px;
}

.advice-section li {
    margin-bottom: 8px;
    color: #666;
    font-size: 0.95rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #eee;
}

.history-date {
    color: #666;
    font-size: 0.9rem;
}

.history-score {
    font-weight: bold;
    color: #667eea;
}

@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

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

    .test-container,
    .result-container {
        padding: 20px;
    }

    .image-frame canvas {
        max-width: 100%;
        height: auto;
    }

    .input-section {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .score-display {
        flex-direction: column;
        gap: 20px;
    }

    .plates-summary {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

.footer {
    margin-top: 20px;
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.about-section h3 {
    color: #667eea;
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.about-section p {
    color: #666;
    line-height: 1.5;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.footer-link-group h4 {
    color: #333;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.footer-link-group ul {
    list-style: none;
    padding: 0;
}

.footer-link-group li {
    margin-bottom: 5px;
}

.footer-link-group a {
    color: #667eea;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s;
}

.footer-link-group a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.contact-section h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1rem;
}

.contact-section p {
    color: #666;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.contact-section a {
    color: #667eea;
    text-decoration: none;
}

.contact-section a:hover {
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    padding-top: 10px;
}

.footer-bottom p {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 5px;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 20px;
    }
}