/* Reset and Base Styles */
* {
    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;
    color: #333;
    line-height: 1.6;
}

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

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.offline-indicator.online::before {
    content: '🌐 ';
}

.offline-indicator.offline::before {
    content: '📵 ';
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

h1 {
    color: white;
    text-align: center;
    margin-bottom: 24px;
    font-size: 32px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

h2 {
    font-size: 24px;
    margin-bottom: 16px;
    color: #2c3e50;
}

h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #34495e;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: inline-block;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-primary {
    background: #2196F3;
    color: white;
}

.btn-primary:hover {
    background: #1976D2;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

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

.btn-danger:hover {
    background: #c0392b;
}

.btn-large {
    width: 100%;
    padding: 16px 24px;
    font-size: 18px;
}

.btn-back {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 16px;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-link {
    background: none;
    border: none;
    color: white;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    padding: 8px;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.button-group .btn {
    flex: 1;
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.category-btn {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-btn:hover {
    background: #e9ecef;
    border-color: #2196F3;
    transform: translateX(4px);
}

.category-btn h3 {
    margin: 0 0 8px 0;
    color: #2196F3;
}

.category-btn p {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
}

.category-btn .set-count {
    font-size: 12px;
    color: #95a5a6;
    margin-top: 4px;
}

/* Settings */
.setting-group {
    margin-bottom: 24px;
}

.radio-group label,
.checkbox-group label {
    display: block;
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.radio-group label:hover,
.checkbox-group label:hover {
    background: #e9ecef;
}

.radio-group input[type="radio"],
.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
}

.indent {
    margin-left: 24px;
}

/* Cache Info */
.cache-info {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
}

.cache-info p {
    margin: 4px 0;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 24px;
    background: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2196F3, #21CBF3);
    transition: width 0.3s ease;
    width: 0%;
}

/* Question Screen */
.question-header {
    display: flex;
    justify-content: space-between;
    color: white;
    font-weight: 600;
    margin-bottom: 16px;
    font-size: 14px;
}

.audio-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.btn-audio {
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 50%;
    width: 120px;
    height: 120px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.btn-audio:hover {
    background: #1976D2;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(33, 150, 243, 0.4);
}

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

.btn-audio svg {
    margin-bottom: 4px;
}

.btn-audio span {
    font-size: 12px;
    font-weight: 600;
}

.question-prompt {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 24px;
}

/* Answer Options */
.answer-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.answer-option {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    text-align: center;
}

.answer-option:hover {
    background: #e9ecef;
    border-color: #2196F3;
    transform: translateX(4px);
}

.answer-option.selected {
    background: #2196F3;
    color: white;
    border-color: #2196F3;
}

.answer-option.correct {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
}

.answer-option.incorrect {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

/* Feedback Screen */
.feedback-result {
    text-align: center;
    padding: 24px;
    margin-bottom: 24px;
    border-radius: 8px;
}

.feedback-result.correct {
    background: #d4edda;
    color: #155724;
}

.feedback-result.incorrect {
    background: #f8d7da;
    color: #721c24;
}

.feedback-result h2 {
    font-size: 32px;
    margin-bottom: 8px;
}

.comparison-audio {
    text-align: center;
    margin-bottom: 24px;
}

.comparison-labels {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.comparison-label {
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.comparison-label:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.comparison-label.correct {
    background: #d4edda;
    color: #155724;
    font-weight: 600;
}

.comparison-label.correct:hover {
    background: #c3e6cb;
}

.comparison-label.playing {
    background: #667eea;
    color: white;
    font-weight: 600;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

/* Session Stats */
.session-stats {
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    padding-top: 16px;
    border-top: 1px solid #dee2e6;
}

/* Keyboard Hints */
.keyboard-hint {
    text-align: center;
    color: #868e96;
    font-size: 12px;
    margin-top: 12px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', monospace;
}

/* Results Screen */
.results-score {
    text-align: center;
    margin: 24px 0;
}

.score-large {
    font-size: 64px;
    font-weight: 700;
    color: #2196F3;
}

.score-percent {
    font-size: 32px;
    color: #6c757d;
    margin-top: -8px;
}

.results-message {
    font-size: 18px;
    color: #27ae60;
    font-weight: 600;
    margin-top: 16px;
}

.results-details {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin: 24px 0;
}

.results-details p {
    margin: 8px 0;
}

/* Hints */
.hint {
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    margin-top: 16px;
}

/* Settings Link */
.settings-link {
    text-align: center;
    margin-top: 32px;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 12px;
    }

    h1 {
        font-size: 24px;
    }

    .card {
        padding: 16px;
    }

    .btn-audio {
        width: 100px;
        height: 100px;
    }

    .score-large {
        font-size: 48px;
    }

    .button-group {
        flex-direction: column;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: white;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}
