:root {
    --light-blue: #f9f7ff;
    --white: #FFFFFF;
    --text-dark: #1E293B;
    --text-light: #64748B;
    --border-soft: #E5E7EB;
    --shadow-soft: rgba(100, 116, 139, 0.08);
    --score-low: #EF4444;
    --primary-color: #885df1;
    --success-color: #34c68c;
}

.pronunciation-tool-body {
    background: #f8fafc;
    padding: 5rem 0;
}
#pronunciation-main-container {
    width: 100%;
    display: flex;
    gap: 2rem;
    margin: auto;
    transition: all 0.3s ease;
    max-width: 1000px;
}
.pronunciation-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}
#control-panel, #feedback-panel {
    background-color: var(--white);
    padding: 2.5rem;
    border-radius: 24px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 4px 12px var(--shadow-soft);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
#control-panel {
    text-align: center;
    justify-content: center;
    overflow-x: hidden;
}
#control-panel p {
    font-size: 1rem;
    color: var(--text-light);
    margin: 0 0 0.5rem 0;
    font-weight: 500;
}
#target-phrase {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.1;
    margin: 0 0 1.5rem 0;
    word-wrap: break-word;
    min-height: 80px;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}
#tts-controls {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}
.tts-button {
    background: #F1F5F9; border: 1px solid var(--border-soft); border-radius: 50%; width: 44px; height: 44px; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: all 0.2s ease; color: var(--text-light);
}
.tts-button:hover { background: var(--light-blue); color: var(--primary-color); }
#tts-mobile-btn {
    display: none; background-color: #F1F5F9; border: 1px solid var(--border-soft); color: var(--text-dark); padding: 5px 15px; justify-content: center; font-size: 13px; font-weight: 600; border-radius: 12px; cursor: pointer; transition: background-color 0.2s ease; width: auto; margin: 0 auto 2.5rem auto;
}
#tts-mobile-btn:hover { background-color: var(--border-soft); }
#tts-mobile-btn i { margin-right: 0.5rem; display: block; margin-top: 3px; }
#mic-button-wrapper {
    position: relative; width: 120px; height: 120px; margin: 0 auto;
}
#mic-button {
    width: 100%; height: 100%; border-radius: 50%; background-color: var(--white); border: 2px solid var(--primary-color); color: var(--primary-color); cursor: pointer; display: flex; justify-content: center; align-items: center; transition: all 0.2s ease-in-out; position: relative; z-index: 2;
}
#mic-button:hover { transform: translateY(-3px) scale(1.05); }
#mic-button.recording {
    background: var(--score-low); border-color: var(--score-low); color: var(--white); animation: pulse-red 1.5s infinite;
}
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); } 70% { box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
#mic-icon { width: 40px; height: 40px; }
#action-footer { margin-top: 1.5rem; }
#status-text { font-size: 1.1rem; font-weight: 600; color: var(--primary-color); min-height: 25px; }
#feedback-panel { gap: 1.5rem; }
#overall-score-container { text-align: center; }
#overall-score-container h3 { font-size: 1.25rem; font-weight: 600; color: var(--text-dark); margin: 0 0 0.5rem 0; }
#score-dial-wrapper { position: relative; width: 100%; max-width: 250px; margin: 0 auto; padding-top: 1rem; }
#score-dial-svg { width: 100%; height: auto; }
.dial-track, .dial-indicator { fill: none; stroke-width: 10; stroke-linecap: round; }
.dial-track { stroke: var(--border-soft); }
.dial-indicator { stroke: url(#score-gradient); stroke-dasharray: 141.37; stroke-dashoffset: 141.37; transition: stroke-dashoffset 1.5s cubic-bezier(0.65, 0, 0.35, 1); }
#overall-score-value { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); font-size: clamp(2.5rem, 8vw, 3.5rem); font-weight: 700; color: var(--text-dark); margin-bottom: 20px; }
#overall-score-label { font-size: 1rem; font-weight: 600; color: var(--text-light); margin-top: -10px; }
#user-transcript-container { padding: 1rem 1.5rem; background: var(--light-blue); border-radius: 12px; font-style: italic; color: #5024ba; border: 1px solid #aa95f1; font-weight: 500; font-size: 15px; }
#detailed-scores-container { display: flex; flex-direction: column; gap: 1rem; }
.result-card { display: grid; grid-template-columns: 1fr 150px 60px; gap: 1rem; align-items: center; }
.result-card .label { font-weight: 600; font-size: 1rem; }
.result-card .score-value { font-size: 1.1rem; font-weight: 700; text-align: right; }
.label i { color: #662eed; margin-right: 5px; }
.progress-bar-container { width: 100%; height: 12px; background-color: var(--border-soft); border-radius: 6px; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; border-radius: 6px; background-image: linear-gradient(to right, #EF4444, #A855F7, #4ADE80); transition: width 1s ease-out; }
#reset-button { margin-top: 1rem; padding: 0.85rem 1.5rem; font-size: 1rem; font-weight: 600; border: none; border-radius: 12px; background-color: var(--primary-color); color: white; cursor: pointer; transition: background-color 0.2s ease, transform 0.2s ease; display: none; width: 100%; }
#reset-button:hover { transform: translateY(-2px); }
#challenge-mode-btn { display: flex; margin: auto; align-items: center; gap: 0.5rem; background-color: transparent; border: 1px solid var(--primary-color); color: var(--primary-color); padding: 8px 15px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; margin-bottom: 1rem; transition: all 0.2s ease; width: auto; }
#challenge-mode-btn:hover { background-color: var(--primary-color); color: var(--white); }
#word-navigation-controls { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.nav-arrow-btn { background: #F1F5F9; border: 1px solid var(--border-soft); border-radius: 50%; width: 44px; height: 44px; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: all 0.2s ease; color: var(--text-light); font-size: 1rem; }
.nav-arrow-btn:hover { background: var(--light-blue); color: var(--primary-color); }
.nav-arrow-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#autospeak-toggle-container { display: flex; align-items: center; gap: 0.5rem; color: var(--text-light); font-weight: 500; font-size: 0.9rem;}
.autospeak-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.autospeak-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: .4s; border-radius: 22px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--success-color); }
input:checked + .slider:before { transform: translateX(18px); }
#toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.toast-notification { background-color: var(--text-dark); color: var(--white); padding: 12px 20px; border-radius: 8px; font-size: 1rem; font-weight: 500; box-shadow: 0 4px 15px rgba(0,0,0,0.2); opacity: 0; transform: translateY(20px); transition: all 0.4s cubic-bezier(0.21, 1.05, 0.58, 1.2); display: flex; align-items: center; gap: 10px; }
.toast-notification.visible { opacity: 1; transform: translateY(0); }
.toast-notification .fa-leaf { color: var(--success-color); }
@media (max-width: 480px) { #toast-container { width: 100% !important; } }
.challenge-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(136, 93, 241, 0.2); backdrop-filter: blur(5px); display: none; justify-content: center; align-items: center; z-index: 1000; padding: 1rem; box-sizing: border-box; }
.challenge-modal-overlay.visible { display: flex; }
.challenge-modal-content { background: var(--white); padding: 2.5rem; border-radius: 24px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); width: 100%; max-width: 600px; position: relative; text-align: center; }
#close-challenge-btn { position: absolute; top: 1rem; right: 1rem; background: var(--border-soft); color: var(--text-light); border: none; border-radius: 20px; width: 56px; height: 36px; font-size: 1.5rem; font-weight: 600; line-height: 0.4; cursor: pointer; transition: all 0.2s ease; }
#close-challenge-btn:hover { background-color: var(--score-low); color: var(--white); }
.challenge-header { display: flex; align-items: center; margin-bottom: 1rem; border-bottom: 1px solid var(--border-soft); padding-bottom: 1rem; }
.challenge-header h2 { margin: 0; color: var(--text-dark); font-size: 18px; }
#challenge-progress { font-size: 1.1rem; font-weight: 600; background: var(--light-blue); color: var(--primary-color); padding: 0.5rem 1rem; border-radius: 8px; margin-left: 10px; }
#challenge-phrase { font-size: clamp(2rem, 5vw, 2.5rem); font-weight: 700; color: var(--text-dark); min-height: 120px; display: flex; justify-content: center; align-items: center; padding: 1rem; transition: opacity 0.3s ease, transform 0.3s ease; }
#challenge-phrase.sliding-out { opacity: 0; transform: translateY(-20px); }
#challenge-mic-wrapper { margin: 1.5rem auto; width: 70px; }
#challenge-status { color: var(--text-light); font-weight: 500; min-height: 24px; }
#challenge-results-screen { display: none; }
.chart-container { margin: 2rem 0; }
#challenge-summary { font-size: 1.25rem; font-weight: 500; }
#challenge-summary strong { font-weight: 700; }
#avg-score { font-weight: 700; color: var(--primary-color); }
.ipa-practice-section { width: 100%; margin-top: 2rem; background-color: var(--white); border-radius: 24px; padding: 2.5rem; border: 1px solid var(--border-soft); box-shadow: 0 4px 12px var(--shadow-soft); max-width: 1000px; margin-left: auto; margin-right: auto; box-sizing: border-box;}
.level-tabs { display: flex; gap: 1rem; justify-content: center; border-bottom: 2px solid var(--border-soft); margin-bottom: 2rem; }
.level-tab-btn { padding: 1rem 1.5rem; font-size: 1.1rem; font-weight: 600; color: var(--text-light); background: transparent; border: none; border-bottom: 3px solid transparent; cursor: pointer; transition: all 0.2s ease-in-out; display: flex; align-items: center; gap: 0.75rem; margin-bottom: -2px; }
.level-tab-btn:hover { color: var(--success-color); background: none; }
.level-tab-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.level-tab-btn:focus { background: none !important; }
.word-table { display: none; gap: 1rem; }
.word-table.active { display: grid; }
.word-table.beginner { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important; }
.word-table.intermediate { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; }
.word-table.master { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.word-cell { background-color: #f7f8fa; border: 1px solid var(--border-soft); border-radius: 12px; padding: 5px 15px 5px 15px !important; display: flex; justify-content: space-between; align-items: center; text-transform: capitalize; font-size: 0.95rem; font-weight: 500; color: #4f5c70 !important; cursor: pointer; transition: all 0.2s ease; }
.word-cell:hover { transform: translateY(-3px); border-color: var(--primary-color); }
.word-cell span { flex-grow: 1; }
.tts-word-btn { background: transparent; border: none; color: var(--text-light); cursor: pointer; font-size: 1.2rem; padding: 0.5rem; border-radius: 50%; width: 36px; height: 36px; display: flex; justify-content: center; align-items: center; transition: background-color 0.2s; margin-left: 0.5rem; }
.tts-word-btn:hover { background-color: var(--light-blue); color: var(--primary-color); }

@media (max-width: 900px) {
    #pronunciation-main-container { flex-direction: column; max-width: 100%; padding: 0 1rem; box-sizing: border-box; }
    .ipa-practice-section { padding: 1.5rem; margin-top: 1rem; }
	.word-cell {
		padding: 6px 15px 6px 15px !important; color: #4f5c70 !important;
	font-size: 14px !important;
	}
}


@media (max-width: 768px) {
    #tts-controls { display: none; }
    #tts-mobile-btn { display: inline-flex; }
    .result-card { grid-template-columns: 1fr auto; }
    .progress-bar-container { grid-column: 1 / -1; order: 3; margin-top: 0.25rem; }
}
@media (max-width: 480px) {
    #control-panel, #feedback-panel { padding: 1.5rem; }
    .level-tabs { flex-direction: column; align-items: stretch; border-bottom: none; gap: 0.5rem; }
    .level-tab-btn { justify-content: center; border-bottom: 3px solid transparent; }
}