* {
    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: 5vh 5vw; /* 5% padding from all sides */
}

.app-container {
    width: 100%;
    height: 90vh; /* Use 90% of viewport height */
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 10px 30px; /* Reduced from 20px to 10px */
}

.header-content {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px; /* Reduced from 15px to 10px */
}

.logo-icon {
    font-size: 1.8em; /* Reduced from 2.5em */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.logo-text h1 {
    font-size: 1.5em; /* Reduced from 2em */
    margin-bottom: 2px; /* Reduced from 5px */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.logo-text p {
    font-size: 0.8em; /* Reduced from 1em */
    opacity: 0.9;
}

/* Main Content */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0;
    height: 100%;
}

/* Left Panel - Question and Answer */
.left-panel {
    padding: 20px; /* Reduced from 30px */
    display: flex;
    flex-direction: column;
    gap: 15px; /* Reduced from 20px */
    background: #f8f9fa;
    border-right: 2px solid #e9ecef;
}

.question-area {
    flex: 2; /* Reduced from 3 to 2 (about 30% smaller) */
    background: white;
    padding: 20px; /* Reduced from 30px */
    border-radius: 15px;
    border-left: 5px solid #4facfe;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.question-area h2 {
    font-size: 1.5em; /* Reduced from 1.8em */
    color: #333;
    line-height: 1.3; /* Reduced from 1.4 */
    margin-bottom: 15px; /* Reduced from 20px */
    min-height: 80px; /* Reduced from 120px */
}

.question-info {
    color: #666;
    font-size: 0.9em;
    text-align: right;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.answer-area {
    flex: 2; /* Increased from 1 to 2 to give more space */
    background: white;
    padding: 20px; /* Reduced from 25px */
    border-radius: 15px;
    border-left: 5px solid #28a745;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 15px; /* Increased for better spacing */
}

.answer-input {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #dee2e6;
}

.answer-input h4 {
    color: #333;
    font-size: 1em;
    margin-bottom: 10px;
    font-weight: bold;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 8px;
}

#answer-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    transition: all 0.3s ease;
}

#answer-input:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 5px rgba(79, 172, 254, 0.3);
}

#answer-input.voice-input {
    border-color: #28a745;
    background: #f0fff4;
}

.input-help {
    font-size: 0.8em;
    color: #666;
    margin: 0;
    font-style: italic;
}

.submit-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: #28a745;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.submit-btn:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.feedback {
    padding: 15px;
    border-radius: 10px;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
}

.submit-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: #28a745;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.submit-btn:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.feedback {
    padding: 15px;
    border-radius: 10px;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

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

/* Right Panel - Controls */
.right-panel {
    padding: 20px; /* Reduced from 30px */
    background: white;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Reduced from 25px */
}

/* Removed .quiz-controls h3 styles since we removed the heading */

/* Media Player Controls */
.media-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.control-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: #6c757d;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover:not(:disabled) {
    background: #5a6268;
    transform: scale(1.1);
}

.control-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

.play-btn {
    width: 70px;
    height: 70px;
    border: none;
    border-radius: 50%;
    background: #28a745;
    color: white;
    font-size: 2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.play-btn:hover {
    background: #218838;
    transform: scale(1.1);
}

.play-btn.pause {
    background: #dc3545;
}

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

/* Speak Question Button */
.speak-btn {
    width: 100%;
    padding: 12px; /* Reduced from 15px */
    border: none;
    border-radius: 10px;
    background: #17a2b8;
    color: white;
    font-size: 1em; /* Reduced from 1.1em */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px; /* Reduced from 20px */
}

.speak-btn:hover:not(:disabled) {
    background: #138496;
    transform: translateY(-2px);
}

.speak-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Microphone Section */
.microphone-section {
    text-align: center;
    padding: 15px; /* Reduced from 25px */
    background: #f8f9fa;
    border-radius: 15px;
    border: 2px solid #dee2e6;
    margin-bottom: 15px; /* Reduced from 20px */
}

.mic-btn {
    background: none;
    border: 3px solid #dc3545;
    border-radius: 50%;
    width: 60px; /* Reduced from 80px */
    height: 60px; /* Reduced from 80px */
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px; /* Reduced from 15px */
}

.mic-btn:hover:not(:disabled) {
    transform: scale(1.1);
    border-color: #c82333;
}

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

.mic-btn.recording {
    border-color: #28a745;
    animation: pulse 1.5s infinite;
}

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

#mic-icon {
    width: 30px; /* Reduced from 40px */
    height: 30px; /* Reduced from 40px */
}

#mic-status {
    color: #666;
    font-weight: bold;
    font-size: 0.8em; /* Reduced from 0.9em */
    margin-bottom: 10px; /* Reduced from 15px */
}

/* Voice Mode Toggle */
.mic-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #28a745;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.toggle-label {
    font-size: 0.9em;
    color: #666;
    font-weight: bold;
}

/* Language and Speed Sections */
.language-section, .speed-section {
    margin-bottom: 15px; /* Reduced from 20px */
}

.language-section label, .speed-section label {
    display: block;
    margin-bottom: 5px; /* Reduced from 8px */
    font-weight: bold;
    color: #333;
    font-size: 0.9em; /* Added smaller font size */
}

#language-select, #speed-select {
    width: 100%;
    padding: 8px; /* Reduced from 12px */
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.9em; /* Reduced from 1em */
    background: white;
}

/* Score Section */
.score-section {
    background: #e9ecef;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
}

.score-display h4 {
    color: #333;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.score-display p {
    color: #666;
    font-size: 0.9em;
}

/* Results Section */
.results-section {
    background: #d4edda;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #28a745;
    text-align: center;
}

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

.final-score p {
    color: #155724;
    font-size: 1.1em;
    margin-bottom: 8px;
    font-weight: bold;
}

.restart-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    background: #28a745;
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.restart-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 3vh 3vw;
    }
    
    .app-container {
        height: 94vh;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 2fr 1fr;
    }
    
    .left-panel, .right-panel {
        padding: 20px;
    }
    
    .question-area {
        padding: 20px;
    }
    
    .question-area h2 {
        font-size: 1.4em;
        min-height: 80px;
    }
    
    .answer-area {
        padding: 20px;
    }
    
    .voice-answer, .written-answer {
        padding: 12px;
    }
    
    .input-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .submit-btn {
        padding: 12px;
    }
    
    .media-controls {
        gap: 10px;
    }
    
    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 1em;
    }
    
    .play-btn {
        width: 60px;
        height: 60px;
        font-size: 1.5em;
    }
    
    .mic-btn {
        width: 70px;
        height: 70px;
    }
    
    #mic-icon {
        width: 35px;
        height: 35px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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