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

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 300;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.setup-section {
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

.form-group input:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.form-group input[type="range"] {
    padding: 0;
    height: 6px;
    background: #e9ecef;
    outline: none;
    border-radius: 3px;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #4facfe;
    border-radius: 50%;
    cursor: pointer;
}

.form-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4facfe;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#wpm-display {
    font-weight: bold;
    color: #4facfe;
    margin-left: 10px;
}

.practice-section {
    padding: 40px 30px;
    text-align: center;
}

.character-display {
    margin-bottom: 40px;
}

.current-character-label {
    font-size: 1.2em;
    color: #6c757d;
    margin-bottom: 15px;
}

.current-character {
    font-size: 6em;
    font-weight: bold;
    color: #4facfe;
    background: #f8f9fa;
    border: 3px solid #e9ecef;
    border-radius: 15px;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.input-section {
    margin-bottom: 30px;
}

.voice-input {
    margin-bottom: 25px;
}

.voice-button {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    min-width: 200px;
}

.voice-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.3);
}

.voice-button.listening {
    background: linear-gradient(135deg, #2ed573 0%, #1e90ff 100%);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(46, 213, 115, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 213, 115, 0);
    }
}

.voice-hint {
    margin-top: 10px;
    font-size: 0.9em;
    color: #6c757d;
}

.voice-tip {
    margin-top: 5px;
    font-size: 0.85em;
    color: #28a745;
    font-style: italic;
}

.gain-indicator {
    font-size: 0.8em;
    color: #007bff;
    font-weight: normal;
    font-style: italic;
}

.mic-guide {
    font-size: 0.75em;
    color: #6c757d;
    margin-top: 5px;
    text-align: center;
    line-height: 1.2;
}

.mic-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin: 8px 0;
    font-size: 0.85em;
    justify-content: center;
}

.gain-control {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #495057;
    cursor: pointer;
}

.gain-control input[type="checkbox"] {
    margin: 0;
}

.gain-control input[type="range"] {
    width: 80px;
    margin: 0 5px;
}

#gain-speed-display {
    font-size: 0.8em;
    color: #007bff;
    font-weight: 500;
}

.agc-warning {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    font-size: 0.8em;
    color: #856404;
    text-align: center;
}

.agc-warning strong {
    color: #d63031;
}

.text-input-group {
    display: flex;
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.text-input-group input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
}

.text-input-group input:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

.submit-button {
    background: #4facfe;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.submit-button:hover {
    background: #3a8fe3;
    transform: translateY(-1px);
}

.transcription {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-style: italic;
    color: #6c757d;
    min-height: 25px;
}

.status {
    padding: 15px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1em;
    margin: 20px 0;
    min-height: 25px;
}

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

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

.stats-section {
    padding: 30px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.score {
    font-size: 1.3em;
    font-weight: bold;
    color: #495057;
}

.reset-button, .test-button {
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.reset-button {
    background: #6c757d;
}

.reset-button:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.test-button {
    background: #17a2b8;
}

.test-button:hover {
    background: #138496;
    transform: translateY(-1px);
}

.replay-button {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 15px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.replay-button:hover {
    background: #218838;
    transform: translateY(-1px);
}

.start-button {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 15px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.start-button:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.stop-button {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin: 5px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.stop-button:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.skip-button {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin: 5px;
    font-size: 0.9em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.skip-button:hover {
    background: linear-gradient(135deg, #e0a800 0%, #d39e00 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
}

.mic-activity {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.mic-label {
    font-size: 0.9em;
    color: #495057;
    margin-bottom: 8px;
    font-weight: 600;
}

.mic-level-container {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.mic-level-bar {
    height: 100%;
    width: 0%;
    background: #dc3545;
    border-radius: 4px;
    transition: width 0.1s ease;
    position: relative;
}

.mic-level-bar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    background: rgba(255,255,255,0.8);
    box-shadow: 1px 0 2px rgba(0,0,0,0.3);
}

.timing-chart {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.timing-chart h4 {
    margin-bottom: 15px;
    color: #495057;
    text-align: center;
}

.timing-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timing-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timing-bar {
    height: 25px;
    border-radius: 4px;
    position: relative;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.timing-value {
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

.timing-label {
    font-weight: 600;
    min-width: 120px;
    color: #495057;
    font-size: 0.9em;
}

.timing-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8em;
    color: #495057;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}

.lesson-goal {
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background: #e3f2fd;
    border-radius: 8px;
    color: #1565c0;
    font-weight: 600;
    border-left: 4px solid #2196f3;
}

.instructions {
    padding: 30px;
    background: #fff;
}

.instructions h3 {
    margin-bottom: 15px;
    color: #495057;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
}

.instructions li:before {
    content: "•";
    color: #4facfe;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.browser-support {
    padding: 20px 30px;
    background: #fff3cd;
    border-top: 1px solid #ffeaa7;
    color: #856404;
    font-size: 0.9em;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .current-character {
        font-size: 4em;
        width: 120px;
        height: 120px;
    }
    
    .text-input-group {
        flex-direction: column;
        max-width: 100%;
    }
    
    .stats-section {
        flex-direction: column;
        text-align: center;
    }
    
    .setup-section,
    .practice-section,
    .instructions {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .voice-button {
        min-width: auto;
        padding: 12px 20px;
        font-size: 1em;
    }
    
    .current-character {
        font-size: 3em;
        width: 100px;
        height: 100px;
    }
}
