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

body {
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    touch-action: none;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* Typografie */
h1 {
    font-size: 3em;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 10px;
}

h2 {
    font-size: 1.8em;
    color: #5a67d8;
    margin-bottom: 20px;
}

h3 {
    font-size: 1.4em;
    color: #4a5568;
    margin-bottom: 15px;
    text-align: center;
}

.subtitle {
    font-size: 1.3em;
    color: #f7fafc;
    margin-bottom: 40px;
}

/* Settings Box */
.settings-box {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 500px;
    margin-bottom: 30px;
}

.setting-group {
    margin-bottom: 25px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #4a5568;
}

.setting-group input[type="number"] {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
}

.setting-group input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

/* Radio Buttons */
.radio-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px;
    margin-top: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

.radio-label input[type="radio"] {
    margin-right: 8px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 15px 40px;
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn:active {
    transform: scale(0.95);
}

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

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

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 6px 12px rgba(72, 187, 120, 0.4);
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9em;
}

/* Exercise Screen */
.header {
    background: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.progress-info {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
}

/* Main Container - 3 Spalten nebeneinander */
.main-container {
    display: flex;
    gap: 20px;
    padding: 20px;
    height: calc(100vh - 80px);
    align-items: stretch;
}

.section {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.section h3 {
    margin-bottom: 15px;
    font-size: 1.4em;
    color: #4a5568;
}

/* Teil 1 & 2: Canvas Bereiche */
.template-section,
.drawing-section {
    min-width: 300px;
    max-width: 450px;
}

/* Template Container */
.template-container {
    width: 100%;
    max-width: 400px;
    height: 400px;
    border: 3px dashed #cbd5e0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7fafc;
}

.template-container img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* Drawing Canvas */
#drawCanvas {
    border: 3px solid #667eea;
    border-radius: 10px;
    cursor: crosshair;
    background: white;
    touch-action: none;
    max-width: 400px;
    width: 100%;
    height: 400px;
}

.canvas-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.btn-info {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
}

.btn-info:hover {
    box-shadow: 0 6px 12px rgba(66, 153, 225, 0.4);
}

/* Teil 3: Info Section */
.info-section {
    min-width: 280px;
    max-width: 350px;
    justify-content: center;
}

.info-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    text-align: center;
}

.info-box.success {
    background: linear-gradient(135deg, #c6f6d5 0%, #9ae6b4 100%);
    border-radius: 15px;
    padding: 30px 20px;
}

.info-box.warning {
    background: linear-gradient(135deg, #fef5e7 0%, #fbd38d 100%);
    border-radius: 15px;
    padding: 30px 20px;
}

.info-box.error {
    background: linear-gradient(135deg, #fed7d7 0%, #fc8181 100%);
    border-radius: 15px;
    padding: 30px 20px;
}

.feedback-icon {
    font-size: 4em;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.feedback-text {
    font-size: 1.2em;
    font-weight: bold;
    color: #2d3748;
    line-height: 1.5;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    margin: 20px 0;
}

.progress-label {
    font-size: 1em;
    font-weight: bold;
    color: #4a5568;
    margin-bottom: 8px;
    text-align: center;
}

.progress-bar-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 8px;
}

.progress-bar-bg {
    width: 100%;
    height: 40px;
    background: #e2e8f0;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
    border-radius: 20px;
    transition: width 0.8s ease, background 0.3s ease;
    position: relative;
    z-index: 1;
}

.progress-bar.low {
    background: linear-gradient(90deg, #fc8181 0%, #f56565 100%);
}

.progress-bar.medium {
    background: linear-gradient(90deg, #f6ad55 0%, #ed8936 100%);
}

.progress-bar.high {
    background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
}

.progress-target {
    position: absolute;
    left: 70%;
    top: 0;
    width: 3px;
    height: 100%;
    background: #2d3748;
    z-index: 2;
}

.progress-target::before {
    content: '70%';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85em;
    font-weight: bold;
    color: #2d3748;
    white-space: nowrap;
}

.progress-target::after {
    content: '▼';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7em;
    color: #2d3748;
}

.progress-text {
    font-size: 1.1em;
    font-weight: bold;
    color: #4a5568;
    text-align: center;
}

.similarity-score {
    font-size: 2.5em;
    font-weight: bold;
    color: #667eea;
    margin: 10px 0;
}

.button-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.button-area .btn {
    display: inline-block !important;
}

.btn-large {
    width: 100%;
    font-size: 1.3em;
    padding: 18px 20px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-content h2 {
    margin-bottom: 20px;
}

#resultText {
    font-size: 1.3em;
    margin: 20px 0;
    color: #4a5568;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-container {
        flex-direction: column;
        height: auto;
        gap: 15px;
    }
    
    .section {
        max-width: 100%;
        width: 100%;
    }
    
    .template-container,
    #drawCanvas {
        max-width: 400px;
        width: 100%;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }
    
    .main-container {
        padding: 10px;
    }
    
    .section {
        padding: 15px;
    }
    
    .template-container,
    #drawCanvas {
        max-width: 100%;
        height: 350px;
    }
    
    .feedback-icon {
        font-size: 3em;
    }
    
    .feedback-text {
        font-size: 1.1em;
    }
    
    .similarity-score {
        font-size: 2em;
    }
    
    .btn-large {
        font-size: 1.1em;
        padding: 15px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-buttons .btn {
        width: 100%;
    }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Name Button */
.template-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.template-section button {
    margin-top: 15px;
}

/* Name Modal */
.name-modal {
    position: relative;
    text-align: center;
    padding: 40px;
    min-width: 300px;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #666;
    width: 40px;
    height: 40px;
    padding: 0;
    line-height: 1;
}

.close-modal:hover {
    color: #333;
}

.letter-name-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.letter-name-icon {
    font-size: 3em;
}

.letter-name-text {
    font-size: 5em;
    font-weight: bold;
    color: #667eea;
    text-transform: uppercase;
}

.letter-name-audio {
    font-size: 1.2em;
    color: #4a5568;
}
