/* 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: #0f1419;
    background-image:
        radial-gradient(at 20% 30%, rgba(255, 107, 53, 0.12) 0px, transparent 50%),
        radial-gradient(at 80% 70%, rgba(52, 211, 153, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(168, 85, 247, 0.05) 0px, transparent 50%);
    min-height: 100vh;
    color: #e5e7eb;
    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(31, 41, 55, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    color: #e5e7eb;
}

.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: rgba(31, 41, 55, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 20px;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.3),
        0 10px 30px rgba(0, 0, 0, 0.2);
}

h1 {
    color: #ffffff;
    text-align: center;
    margin-bottom: 32px;
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #34d399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #f9fafb;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #e5e7eb;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

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

.btn-primary {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
    background: rgba(107, 114, 128, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(107, 114, 128, 1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.8);
    color: white;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 1);
}

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

.btn-back {
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: rgba(31, 41, 55, 0.8);
    border-color: rgba(255, 107, 53, 0.3);
    color: #ff6b35;
    transform: translateX(-2px);
}

.nav-header {
    margin-bottom: 20px;
}

.btn-back-home {
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.btn-back-home:hover {
    background: rgba(31, 41, 55, 0.8);
    border-color: rgba(255, 107, 53, 0.3);
    color: #ff6b35;
    transform: translateX(-2px);
}

.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: 16px;
}

.category-btn {
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.category-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b35, #f7931e, #34d399);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-btn:hover::before {
    opacity: 1;
}

.category-btn:hover {
    background: rgba(31, 41, 55, 0.8);
    border-color: rgba(255, 107, 53, 0.3);
    transform: translateX(8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.category-btn h3 {
    margin: 0 0 8px 0;
    color: #ff6b35;
    font-weight: 700;
}

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

.category-btn .set-count {
    font-size: 12px;
    color: #6b7280;
    margin-top: 8px;
}

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

.radio-group label,
.checkbox-group label {
    display: block;
    padding: 14px 16px;
    margin-bottom: 10px;
    background: rgba(31, 41, 55, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #e5e7eb;
}

.radio-group label:hover,
.checkbox-group label:hover {
    background: rgba(31, 41, 55, 0.6);
    border-color: rgba(255, 107, 53, 0.3);
}

.radio-group input[type="radio"]:checked + label,
.checkbox-group input[type="checkbox"]:checked + label {
    border-color: rgba(255, 107, 53, 0.5);
    background: rgba(255, 107, 53, 0.1);
}

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

.indent {
    margin-left: 24px;
}

/* Cache Info */
.cache-info {
    background: rgba(31, 41, 55, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px;
    border-radius: 12px;
    margin: 16px 0;
}

.cache-info p {
    margin: 4px 0;
    color: #9ca3af;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 28px;
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b35, #f7931e);
    transition: width 0.3s ease;
    width: 0%;
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
}

/* Question Screen */
.question-header {
    display: flex;
    justify-content: space-between;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 14px;
    padding: 12px 20px;
    background: rgba(31, 41, 55, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

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

.btn-audio {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 140px;
    height: 140px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.btn-audio::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn-audio:hover::before {
    width: 200px;
    height: 200px;
}

.btn-audio:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(255, 107, 53, 0.5);
}

.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: #e5e7eb;
    margin-bottom: 24px;
}

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

.answer-option {
    background: rgba(31, 41, 55, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 24px;
    text-align: center;
    color: #e5e7eb;
    position: relative;
    overflow: hidden;
}

.answer-option::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.answer-option:hover::before {
    width: 400px;
    height: 400px;
}

.answer-option:hover {
    background: rgba(31, 41, 55, 0.6);
    border-color: rgba(255, 107, 53, 0.4);
    transform: translateX(8px);
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.2);
}

.answer-option.selected {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.3) 0%, rgba(247, 147, 30, 0.3) 100%);
    color: white;
    border-color: rgba(255, 107, 53, 0.6);
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.3);
}

.answer-option.correct {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.3) 0%, rgba(16, 185, 129, 0.3) 100%);
    color: white;
    border-color: rgba(52, 211, 153, 0.8);
    box-shadow: 0 0 32px rgba(52, 211, 153, 0.5);
    animation: pulse 0.5s ease;
}

.answer-option.incorrect {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(220, 38, 38, 0.3) 100%);
    color: white;
    border-color: rgba(239, 68, 68, 0.8);
    box-shadow: 0 0 32px rgba(239, 68, 68, 0.4);
}

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

/* Feedback Screen */
.feedback-result {
    text-align: center;
    padding: 32px;
    margin-bottom: 24px;
    border-radius: 16px;
    border: 2px solid;
    backdrop-filter: blur(12px);
}

.feedback-result.correct {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.15) 0%, rgba(16, 185, 129, 0.15) 100%);
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.5);
    box-shadow: 0 0 40px rgba(52, 211, 153, 0.3);
}

.feedback-result.incorrect {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.15) 100%);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.2);
}

.feedback-result h2 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.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: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 16px;
    color: #e5e7eb;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    font-weight: 500;
}

.comparison-label:hover {
    background: rgba(31, 41, 55, 0.8);
    border-color: rgba(255, 107, 53, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.comparison-label.correct {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.2) 0%, rgba(16, 185, 129, 0.2) 100%);
    border-color: rgba(52, 211, 153, 0.6);
    color: #34d399;
    font-weight: 700;
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.3);
}

.comparison-label.correct:hover {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.3) 0%, rgba(16, 185, 129, 0.3) 100%);
}

.comparison-label.playing {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    border-color: rgba(255, 107, 53, 0.8);
    color: white;
    font-weight: 700;
    transform: scale(1.08);
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.5);
}

/* Session Stats */
.session-stats {
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Keyboard Hints */
.keyboard-hint {
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
    margin-top: 12px;
    padding: 10px 16px;
    background: rgba(31, 41, 55, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', monospace;
}

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

.score-large {
    font-size: 96px;
    font-weight: 800;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #34d399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    text-shadow: 0 0 60px rgba(255, 107, 53, 0.3);
}

.score-percent {
    font-size: 36px;
    color: #9ca3af;
    margin-top: -8px;
    font-weight: 600;
}

.results-message {
    font-size: 24px;
    color: #34d399;
    font-weight: 700;
    margin-top: 20px;
    text-shadow: 0 0 20px rgba(52, 211, 153, 0.5);
}

.results-details {
    background: rgba(31, 41, 55, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 24px;
    border-radius: 16px;
    margin: 24px 0;
}

.results-details p {
    margin: 12px 0;
    color: #e5e7eb;
    font-size: 16px;
}

/* Hints */
.hint {
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    margin-top: 16px;
    padding: 12px;
    background: rgba(31, 41, 55, 0.3);
    border-radius: 10px;
}

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

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

    h1 {
        font-size: 32px;
    }

    h2 {
        font-size: 24px;
    }

    .card {
        padding: 24px;
    }

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

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

    .answer-option {
        font-size: 20px;
        padding: 16px;
    }

    .feedback-result h2 {
        font-size: 36px;
    }

    .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: '...'; }
}
