/* Fluent Ear — DRMA Ear Training */
/* Dark theme, warm accents, mobile-first */

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

:root {
    --bg: #0f1115;
    --surface: #16181f;
    --surface-2: #1e2028;
    --border: #2a2c35;
    --text: #f4f1ec;
    --text-dim: #9a9aaa;
    --accent: #e6b65c;
    --accent-glow: #e6b65c30;
    --correct: #4ecdc4;
    --correct-glow: #4ecdc440;
    --wrong: #ff6b6b;
    --wrong-glow: #ff6b6b40;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 28px;
    color: var(--accent);
}

.brand h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.icon-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 20px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Main */
main {
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    padding: 20px;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 8px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Level Progress */
.level-progress {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
}

.level-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

#level-name {
    font-weight: 600;
    color: var(--text);
}

#level-progress-text {
    color: var(--text-dim);
}

.progress-bar {
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #e8c76a);
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}

.level-requirement {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 6px;
    text-align: center;
}

/* Game Screens */
.game-screen {
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Level Select */
.level-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 20px;
}

.level-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-btn:hover:not(.locked) {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.level-btn.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.level-btn.current {
    border-color: var(--accent);
    background: var(--surface-2);
}

.level-btn .level-title {
    font-weight: 600;
    font-size: 15px;
}

.level-btn .level-desc {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}

.level-btn .level-status {
    font-size: 20px;
}

/* Play Button */
.play-button {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #c49530);
    border: none;
    color: var(--bg);
    font-size: 18px;
    cursor: pointer;
    margin: 30px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
    box-shadow: 0 4px 30px var(--accent-glow);
}

.play-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 40px var(--accent-glow);
}

.play-button:active {
    transform: scale(0.95);
}

.play-button.playing {
    animation: pulse 0.8s ease-in-out;
}

.play-icon {
    font-size: 32px;
}

.play-text {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 30px var(--accent-glow); }
    50% { box-shadow: 0 4px 60px var(--accent); }
}

/* Interval Display */
.interval-display {
    margin-bottom: 10px;
}

.note-label {
    font-size: 16px;
    color: var(--text-dim);
    font-weight: 500;
}

/* Answer Buttons */
.answer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 24px;
}

.answer-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 12px;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 56px;
}

.answer-btn:hover {
    border-color: var(--accent);
    background: var(--surface-2);
}

.answer-btn:active {
    transform: scale(0.97);
}

.answer-btn.correct {
    border-color: var(--correct);
    background: var(--correct-glow);
    color: var(--correct);
}

.answer-btn.wrong {
    border-color: var(--wrong);
    background: var(--wrong-glow);
    color: var(--wrong);
    animation: shake 0.4s ease;
}

.answer-btn.reveal {
    border-color: var(--correct);
    background: var(--correct-glow);
    color: var(--correct);
    opacity: 0.7;
}

.answer-btn.disabled {
    pointer-events: none;
    opacity: 0.5;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Feedback */
.feedback {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 15px;
}

.feedback.correct {
    background: var(--correct-glow);
    color: var(--correct);
    border: 1px solid var(--correct);
}

.feedback.wrong {
    background: var(--wrong-glow);
    color: var(--wrong);
    border: 1px solid var(--wrong);
}

/* Next Button */
.next-button {
    margin-top: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 32px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.next-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Level Up Screen */
.levelup-content {
    padding: 40px 20px;
}

.levelup-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.levelup-content h2 {
    font-size: 28px;
    color: var(--accent);
    margin-bottom: 12px;
}

.levelup-content p {
    color: var(--text-dim);
    font-size: 16px;
    margin-bottom: 24px;
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, var(--accent), #c49530);
    border: none;
    color: var(--bg);
    padding: 12px 32px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn:hover {
    transform: scale(1.02);
}

.danger-btn {
    background: none;
    border: 1px solid var(--wrong);
    color: var(--wrong);
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.danger-btn:hover {
    background: var(--wrong-glow);
}

/* Settings Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    width: 100%;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--accent);
}

.setting-row {
    margin-bottom: 16px;
}

.setting-row label {
    display: block;
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.setting-row input[type="number"],
.setting-row input[type="range"] {
    width: 100%;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
}

.setting-row input[type="checkbox"] {
    margin-right: 8px;
}

.setting-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
}

/* Footer */
footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 480px) {
    main {
        padding: 12px;
    }

    .stats-bar {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .stat {
        padding: 8px 4px;
    }

    .stat-value {
        font-size: 20px;
    }

    .play-button {
        width: 100px;
        height: 100px;
        margin: 20px auto;
    }

    .answer-btn {
        padding: 14px 10px;
        font-size: 14px;
    }
}
