
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --bg-color-start: #0f0c29;
    --bg-color-mid: #302b63;
    --bg-color-end: #24243e;
    
    --primary-accent-start: #00c6ff;
    --primary-accent-end: #0072ff;
    
    --secondary-accent-start: #da22ff;
    --secondary-accent-end: #9733ee;

    --success-color: #00ff7f; /* Spring Green */
    --recording-color-start: #fceabb;
    --recording-color-end: #f8b500;
    
    --text-light: #e0e0e0;
    --text-medium: #a0a0a0;
    --text-dark: #6b6b6b;
    
    --glass-bg: rgba(30, 30, 45, 0.5);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    --shadow-color: rgba(0, 0, 0, 0.3);
}

@keyframes animated-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(-45deg, var(--bg-color-start), var(--bg-color-mid), var(--bg-color-end));
    background-size: 400% 400%;
    animation: animated-gradient 15s ease infinite;
    color: var(--text-light);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    text-align: center;
    overflow-x: hidden;
}

.container {
    width: 90%;
    max-width: 700px;
    padding: 2.5em;
}

header h1 {
    font-weight: 700;
    font-size: 3.8em;
    margin-bottom: 0.1em;
    background: linear-gradient(to right, #fff, #b0b0b0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    letter-spacing: -1px;
}

header p {
    color: var(--text-medium);
    font-weight: 300;
    font-size: 1.2em;
    margin-top: 0.5em;
}

.coach-container {
    background: var(--glass-bg);
    border-radius: 25px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 2.5em;
    margin-top: 2em;
    position: relative;
    box-shadow: 0 8px 32px 0 var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.coach-container:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 40px 0 rgba(0,0,0,0.4);
}

.language-selector {
    display: flex;
    justify-content: center;
    margin-bottom: 2em;
}

.language-selector button {
    background: transparent;
    border: 2px solid var(--text-dark);
    color: var(--text-medium);
    padding: 0.8em 1.8em;
    margin: 0 0.5em;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.language-selector button:hover:not(.active) {
    border-color: var(--primary-accent-start);
    color: var(--primary-accent-start);
    text-shadow: 0 0 5px var(--primary-accent-start);
}

.language-selector button.active {
    background: linear-gradient(to right, var(--primary-accent-start), var(--primary-accent-end));
    color: white;
    border-color: transparent;
    box-shadow: 0 0 20px rgba(0, 198, 255, 0.5);
    transform: scale(1.05);
}

.sentence-box {
    background-color: rgba(0,0,0,0.2);
    padding: 2em;
    border-radius: 15px;
    margin: 2em 0;
    min-height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
}

#sentence-to-read {
    font-size: 1.6em;
    font-weight: 400;
    color: #fff;
    line-height: 1.6;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

#new-sentence-btn {
    background: linear-gradient(to right, var(--secondary-accent-start), var(--secondary-accent-end));
    color: white;
    padding: 1.2em 2.8em;
    border: none;
    border-radius: 10px;
    font-size: 1.15em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 2em;
    box-shadow: 0 0 20px rgba(218, 34, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

#new-sentence-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 0 30px rgba(218, 34, 255, 0.6);
}

.mic-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2em;
}

#record-btn {
    background: linear-gradient(145deg, var(--primary-accent-start), var(--primary-accent-end));
    color: white;
    border: none;
    border-radius: 50%;
    width: 100px;
    height: 100px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 25px var(--primary-accent-end);
    transition: all 0.3s ease;
}

#record-btn:hover {
    box-shadow: 0 0 35px var(--primary-accent-start);
    transform: scale(1.05);
}

#record-btn.recording {
    background: linear-gradient(to right, var(--recording-color-start), var(--recording-color-end));
    box-shadow: 0 0 40px var(--recording-color-end);
    animation: breathing 2s ease-in-out infinite;
}

@keyframes breathing {
    0% { transform: scale(1); box-shadow: 0 0 40px var(--recording-color-end); }
    50% { transform: scale(1.1); box-shadow: 0 0 50px var(--recording-color-start); }
    100% { transform: scale(1); box-shadow: 0 0 40px var(--recording-color-end); }
}

#record-btn i {
    font-size: 2.5em;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

#status-message {
    color: var(--text-medium);
    font-size: 1em;
    min-height: 25px;
    transition: color 0.3s ease;
    font-weight: 500;
}

#status-message.error {
    color: #ff6b6b;
    font-weight: 600;
}

#accuracy-container.hidden {
    display: none;
}

#accuracy-container {
    margin-top: 2.5em;
    padding: 2.5em;
    background: var(--glass-bg);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 var(--shadow-color);
    transition: all 0.5s ease-out;
}

#accuracy-container h2 {
    font-size: 2em;
    margin-bottom: 1em;
    background: linear-gradient(to right, #fff, #b0b0b0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.score-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    margin: 0 auto 1.8em;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.score-circle::before, .score-circle::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
}

.score-circle::before { /* BG Ring */
    background: conic-gradient(from 0deg, var(--primary-accent-start) 0%, var(--secondary-accent-start) 50%, var(--primary-accent-start) 100%);
    filter: blur(10px);
}

.score-circle::after { /* Score fill */
    background: conic-gradient(from 90deg, var(--success-color) var(--score, 0%), transparent var(--score, 0%));
    transition: background 1.5s ease-out;
}

#accuracy-score {
    font-size: 3em;
    font-weight: 700;
    position: relative;
    z-index: 2;
    color: #fff;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
}

.score-circle .inner-circle {
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    background: #2c2c3e;
    border-radius: 50%;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

.result-text p, #accent-result p {
    margin: 1em 0;
    font-size: 1.25em;
    line-height: 1.7;
}

#accent-result p {
    font-weight: 600;
    color: var(--primary-accent-start);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .container {
        padding: 1.5em;
    }
    header h1 {
        font-size: 2.8em;
    }
    header p {
        font-size: 1em;
    }
    .coach-container {
        padding: 1.8em;
    }
    .language-selector button {
        padding: 0.7em 1.2em;
        font-size: 0.9em;
    }
    #sentence-to-read {
        font-size: 1.2em;
    }
    #new-sentence-btn {
        padding: 1em 2em;
        font-size: 1em;
    }
    #record-btn {
        width: 80px;
        height: 80px;
    }
    #record-btn i {
        font-size: 2em;
    }
    .score-circle {
        width: 120px;
        height: 120px;
    }
    #accuracy-score {
        font-size: 2em;
    }
    .result-text p, #accent-result p {
        font-size: 1em;
    }
}
