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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* ==================== LANDING SCREEN ==================== */
.landing-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.landing-screen.has-nav {
    min-height: calc(100vh - 56px);
    background: #f0f4f8;
}

.landing-container {
    max-width: 700px;
    width: 100%;
    text-align: center;
}

.landing-header {
    margin-bottom: 40px;
}

.landing-header h1 {
    font-size: 2.5rem;
    color: #2d3748;
    margin-bottom: 12px;
}

.landing-header .subtitle {
    font-size: 1.1rem;
    color: #718096;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.mode-card-link {
    text-decoration: none;
}

.mode-card.large {
    background: white;
    border-radius: 16px;
    padding: 32px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 2px solid transparent;
}

.mode-card.large:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.mode-card.large .mode-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.mode-card.large .mode-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 12px;
}

.mode-card.large .mode-desc {
    font-size: 0.95rem;
    color: #718096;
    line-height: 1.5;
}

.landing-footer {
    color: #a0aec0;
    font-size: 0.85rem;
}

.landing-footer a {
    color: #667eea;
    text-decoration: none;
}

.landing-footer a:hover {
    text-decoration: underline;
}

/* Setup Mode Badge */
.setup-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    margin-bottom: 8px;
    font-weight: 600;
}

.setup-mode-badge .mode-icon {
    font-size: 1.2rem;
}

/* Practice Hint */
.practice-hint {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 8px;
}

@media (max-width: 600px) {
    .mode-cards {
        grid-template-columns: 1fr;
    }

    .landing-header h1 {
        font-size: 1.8rem;
    }
}

/* ==================== SETUP SCREEN ==================== */
.setup-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.setup-screen.has-nav {
    min-height: calc(100vh - 56px);
    background: #f0f4f8;
}

.setup-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    overflow: hidden;
}

.setup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px 30px;
    text-align: center;
}

.setup-header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.setup-header .subtitle {
    opacity: 0.8;
    font-size: 0.95rem;
}

.setup-content {
    padding: 30px;
}

.setup-section {
    margin-bottom: 24px;
}

.setup-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #2d3748;
}

.setup-section input,
.setup-section select,
.setup-section textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

.setup-section textarea {
    resize: none;
    line-height: 1.5;
}

.setup-section input:focus,
.setup-section select:focus,
.setup-section textarea:focus {
    outline: none;
    border-color: #667eea;
}

.setup-section textarea::placeholder {
    color: #a0aec0;
}


.topic-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.suggestion {
    padding: 6px 14px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.voice-description {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #718096;
    font-style: italic;
}

/* Level Selection */
.level-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.level-option {
    flex: 1;
    cursor: pointer;
}

.level-option input[type="radio"] {
    display: none;
}

.level-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f7fafc;
    transition: all 0.2s;
}

.level-option input[type="radio"]:checked + .level-card {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.level-option:hover .level-card {
    border-color: #a0aec0;
}

.level-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.level-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.level-desc {
    font-size: 0.75rem;
    color: #718096;
    text-align: center;
}

/* Role Selection */
.role-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.role-option {
    cursor: pointer;
}

.role-option input[type="radio"] {
    display: none;
}

.role-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #f7fafc;
    transition: all 0.2s;
}

.role-option input[type="radio"]:checked + .role-card {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.role-option:hover .role-card {
    border-color: #a0aec0;
}

.role-icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.role-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.8rem;
    text-align: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.hint-text {
    text-align: center;
    margin-top: 16px;
    color: #718096;
    font-size: 0.9rem;
}

.hint-text kbd {
    background: #e2e8f0;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
    color: #4a5568;
}

.btn-end {
    padding: 8px 16px;
    font-size: 0.85rem;
    background: #e53e3e;
    color: white;
}

.btn-end:hover:not(:disabled) {
    background: #c53030;
}

.btn-start {
    padding: 8px 16px;
    font-size: 0.85rem;
    background: #38a169;
    color: white;
}

.btn-start:hover:not(:disabled) {
    background: #2f855a;
}

.btn-home {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s;
}

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

.btn-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s;
    margin-left: auto;
}

.btn-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-nav svg {
    opacity: 0.9;
}

/* Settings Section */
.settings-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
    margin-top: 10px;
}

.settings-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 0;
}

.settings-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #4a5568;
}

.settings-icon {
    font-size: 1.1rem;
}

.toggle-arrow {
    color: #718096;
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.toggle-arrow.open {
    transform: rotate(180deg);
}

.settings-content {
    padding: 15px 0 5px;
}

.checkbox-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    background: #f7fafc;
}

.checkbox-option:hover {
    background: #edf2f7;
}

.checkbox-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.checkbox-title {
    font-weight: 500;
    color: #2d3748;
}

.checkbox-desc {
    font-size: 0.85rem;
    color: #718096;
}

/* Settings Page */
.settings-group {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.settings-group:last-of-type {
    border-bottom: none;
}

.settings-group-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.settings-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.settings-actions .btn {
    flex: 1;
    text-align: center;
    text-decoration: none;
}

.field-hint {
    font-size: 0.8rem;
    color: #718096;
    margin-top: 6px;
}

.level-options.compact {
    gap: 8px;
}

.level-card.compact {
    padding: 10px 12px;
}

.level-card.compact .level-desc {
    display: none;
}

.settings-link {
    display: inline-block;
    color: #667eea;
    text-decoration: none;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.settings-link:hover {
    text-decoration: underline;
}

.setup-footer {
    padding: 20px;
    text-align: center;
    background: #f7fafc;
    font-size: 0.8rem;
    color: #718096;
}

.setup-footer a {
    color: #667eea;
    text-decoration: none;
}

/* ==================== APP SCREEN ==================== */
.app-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Navigation Bar */
.app-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-decoration: none;
    color: white;
}

a.nav-brand:hover {
    opacity: 0.9;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.nav-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Hamburger Menu Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    padding: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Navigation */
@media (max-width: 600px) {
    .app-nav {
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 12px 16px;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding-top: 12px;
        margin-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-link {
        width: 100%;
        padding: 12px 8px;
        justify-content: flex-start;
    }
}

.nav-tabs {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px;
    border-radius: 12px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nav-tab .tab-icon {
    font-size: 1.1rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.current-info {
    font-size: 0.9rem;
    opacity: 0.9;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
}

.app-nav .btn-end {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.app-nav .btn-end:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Main Content Wrapper */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Main Area */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f7fafc;
    min-width: 0;
    overflow: auto;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-header h1 {
    font-size: 1.2rem;
    color: #2d3748;
}

.current-topic {
    font-size: 0.85rem;
    color: #718096;
    margin-left: 12px;
}

/* Recording Area */
.recording-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 30px;
    min-height: 400px;
}

/* Centered conversation layout */
.conversation-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.teacher-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Status Dot - Single element with 3 states */
.status-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-top: 12px;
}

.status-dot[data-state="idle"] {
    background: #a0aec0;
    animation: dot-idle 2s infinite ease-in-out;
}

.status-dot[data-state="thinking"] {
    background: #667eea;
    animation: dot-thinking 0.6s infinite ease-in-out;
}

.status-dot[data-state="speaking"] {
    background: #38a169;
    animation: dot-speaking 0.5s infinite ease-in-out;
}

@keyframes dot-idle {
    0%, 100% {
        opacity: 0.5;
        transform: scale(0.9);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes dot-thinking {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

@keyframes dot-speaking {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
}


.teacher-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.teacher-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.teacher-avatar.thinking {
    animation: pulse-avatar 1.5s ease-in-out infinite;
}

@keyframes pulse-avatar {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}


.teacher-text {
    background: white;
    padding: 16px 20px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    font-size: 1.05rem;
    line-height: 1.6;
    color: #2d3748;
}

/* Teaching Board */
.teaching-board {
    width: 100%;
    min-height: 350px;
    background: #2d3a3a;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), inset 0 2px 4px rgba(255, 255, 255, 0.05);
    border: 8px solid #8b7355;
    overflow: hidden;
}

.board-header {
    background: #8b7355;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.board-title {
    color: #f5f5dc;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.board-content {
    padding: 20px 24px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    color: #f5f5dc;
    font-family: 'Comic Sans MS', 'Chalkboard', cursive;
    font-size: 1.3rem;
    line-height: 1.8;
    white-space: pre-wrap;
}

.board-content:empty::before {
    content: 'Ready to learn!';
    color: rgba(245, 245, 220, 0.4);
    font-style: italic;
}

.board-content .word {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 6px;
    margin: 4px;
    font-weight: 600;
    color: #90EE90;
}

.board-content .example {
    display: block;
    margin-top: 12px;
    padding-left: 16px;
    border-left: 3px solid #90EE90;
    font-style: italic;
    color: #d4d4aa;
    font-size: 1.1rem;
}

.board-content .board-image {
    display: block;
    max-width: 100%;
    max-height: 200px;
    margin: 12px auto;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Mic Button - Simple 2 states: grey (disabled) or red (enabled) */
.mic-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: #e53e3e;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(229, 62, 62, 0.4);
}

.mic-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mic-btn:not(:disabled):hover {
    transform: scale(1.05);
}

.mic-btn:not(:disabled):active {
    transform: scale(0.95);
}

.mic-icon {
    width: 32px;
    height: 32px;
}

/* Mic button states for practice page */
.mic-btn.analyzing {
    background: #a0aec0;
    cursor: wait;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.mic-btn.ready {
    background: #718096;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mic-btn.ready:hover {
    background: #e53e3e;
    box-shadow: 0 4px 15px rgba(229, 62, 62, 0.4);
}

.mic-btn.recording {
    background: #e53e3e;
    box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.7);
    animation: mic-pulse 1.5s infinite;
}

@keyframes mic-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(229, 62, 62, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0);
    }
}

/* Auto-Stop Toggle Button */
.auto-stop-toggle {
    position: absolute;
    top: 50%;
    right: -90px;
    transform: translateY(-50%);
    padding: 8px 12px;
    border-radius: 16px;
    border: 2px solid #e2e8f0;
    background: #f0f4f8;
    color: #718096;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.auto-stop-toggle:hover {
    background: #e2e8f0;
}

.auto-stop-toggle.active {
    background: #48bb78;
    border-color: #48bb78;
    color: white;
}

.auto-stop-toggle.active:hover {
    background: #38a169;
    border-color: #38a169;
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 30px;
    position: relative;
}

/* Text Input Container */
.text-input-container {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 400px;
}

.text-input-container[hidden] {
    display: none;
}

.text-input-container input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.text-input-container input:focus {
    border-color: #667eea;
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: #667eea;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.send-btn:hover {
    background: #5a67d8;
}

/* Action Row */
.action-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: #f0f4f8;
    color: #4a5568;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover:not(:disabled) {
    background: #e2e8f0;
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.icon-btn.primary {
    background: #667eea;
    color: white;
}

.icon-btn.primary:hover {
    background: #5a67d8;
}

.icon-btn.active {
    background: #667eea;
    color: white;
}

/* Action Button (Start/End Session) */
.action-btn {
    padding: 10px 20px;
    border-radius: 20px;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn.primary {
    background: #667eea;
    color: white;
}

.action-btn.primary:hover {
    background: #5a67d8;
}

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

.action-btn.danger:hover {
    background: #c53030;
}

/* Feedback Panel */
.feedback-panel {
    background: white;
    border-radius: 16px;
    padding: 20px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.feedback-score {
    text-align: center;
    margin-bottom: 16px;
}

.score-value {
    display: block;
    font-size: 3rem;
    font-weight: 700;
    color: #667eea;
}

.score-label {
    font-size: 0.85rem;
    color: #718096;
    text-transform: uppercase;
}

.feedback-text p {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 8px;
}

.feedback-tip {
    background: #ebf8ff;
    padding: 10px 14px;
    border-left: 3px solid #3182ce;
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
    color: #2c5282;
}

/* Ideas Panel */
.ideas-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid #e2e8f0;
    width: 400px;
    max-width: 90%;
    z-index: 1000;
}

.ideas-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.ideas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    color: #4a5568;
}

.close-ideas-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #a0aec0;
    cursor: pointer;
    line-height: 1;
}

.close-ideas-btn:hover {
    color: #718096;
}

.ideas-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.idea-item {
    padding: 12px 16px;
    background: #f7fafc;
    border-radius: 8px;
    color: #2d3748;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1rem;
    line-height: 1.5;
    border-left: 3px solid #667eea;
}

.idea-item:hover {
    background: #edf2f7;
}

.ideas-loading {
    text-align: center;
    color: #718096;
    padding: 20px;
}

.toggle-details {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 12px;
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #667eea;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-details:hover {
    background: #f7fafc;
}

.feedback-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    max-height: 400px;
    overflow-y: auto;
}

.score-section {
    margin-bottom: 16px;
}

.score-section h4 {
    font-size: 0.85rem;
    color: #4a5568;
    margin-bottom: 8px;
    font-weight: 600;
}

.transcript {
    background: #f7fafc;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #2d3748;
}

.ai-transcript {
    border-left: 3px solid #667eea;
}

.user-transcript {
    border-left: 3px solid #48bb78;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.score-item {
    text-align: center;
    padding: 10px;
    background: #f7fafc;
    border-radius: 8px;
}

.score-item .score-label {
    display: block;
    font-size: 0.75rem;
    color: #718096;
    margin-bottom: 4px;
}

.score-item .score-num {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.score-num.excellent {
    color: #276749;
}

.score-num.good {
    color: #975a16;
}

.score-num.needs-work {
    color: #c53030;
}

.fluency-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
    color: #4a5568;
}

.fluency-stats span {
    background: #f7fafc;
    padding: 6px 10px;
    border-radius: 6px;
}

.word-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.word-score {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.word-score.excellent {
    background: #c6f6d5;
    color: #276749;
}

.word-score.good {
    background: #fefcbf;
    color: #975a16;
}

.word-score.needs-work {
    background: #fed7d7;
    color: #c53030;
}

.word-score span {
    font-size: 0.7rem;
    opacity: 0.8;
    margin-left: 4px;
}

.phoneme-word {
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.phoneme {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
    margin: 2px;
}

.phoneme.excellent {
    background: #c6f6d5;
    color: #276749;
}

.phoneme.good {
    background: #fefcbf;
    color: #975a16;
}

.phoneme.needs-work {
    background: #fed7d7;
    color: #c53030;
}

/* Comparison layout */
.comparison-section {
    background: #f7fafc;
    border-radius: 8px;
    padding: 12px;
}

.comparison-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 8px;
}

.comparison-header h4 {
    margin: 0;
    text-align: center;
}

.comparison-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.comparison-col {
    min-width: 0;
}

.comparison-col .transcript {
    font-size: 0.85rem;
    margin: 0;
}

/* Score comparison table */
.score-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.score-table th,
.score-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.score-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
}

.score-table th:first-child,
.score-table td:first-child {
    text-align: left;
}

.score-table tbody tr:last-child td {
    border-bottom: none;
}

.score-table .score-num {
    font-weight: 700;
    font-size: 1.1rem;
}

/* ==================== VERTICAL LAYOUT ==================== */
.main-content-vertical {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-content-vertical .main-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
}

/* ==================== CHAT HISTORY BOTTOM PANEL ==================== */
.chat-history-panel {
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    max-height: 40vh;
    transition: max-height 0.3s ease;
}

.chat-history-panel.collapsed {
    max-height: 48px;
}

.history-header {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    user-select: none;
}

.history-header:hover {
    background: #f1f5f9;
}

.history-header span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
}

.history-header .chevron-icon {
    width: 20px;
    height: 20px;
    color: #64748b;
    transition: transform 0.3s ease;
}

.chat-history-panel.collapsed .chevron-icon {
    transform: rotate(180deg);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-history-panel.collapsed .chat-history {
    display: none;
}

/* Chat Messages */
.chat-message {
    max-width: 90%;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.teacher {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
}

.chat-message .message-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-message.teacher .message-bubble {
    background: #f7fafc;
    color: #2d3748;
    border-bottom-left-radius: 4px;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message .message-score {
    font-size: 0.75rem;
    margin-top: 4px;
    opacity: 0.8;
}

/* Message Images */
.chat-message .message-image {
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
    max-width: 320px;
}

.chat-message .message-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.chat-message .message-image img:hover {
    transform: scale(1.02);
    cursor: pointer;
}

.chat-message.teacher .message-image {
    margin-left: 0;
}

.chat-message.user .message-image {
    margin-left: auto;
}

/* Scrollbar */
.chat-history::-webkit-scrollbar {
    width: 6px;
}

.chat-history::-webkit-scrollbar-track {
    background: transparent;
}

.chat-history::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

/* ==================== LOADING OVERLAY ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-modal {
    background: white;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-message {
    color: #4a5568;
    font-size: 1rem;
    margin: 0;
}

/* ==================== SUMMARY MODAL ==================== */
.summary-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.summary-modal {
    background: white;
    border-radius: 16px;
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.summary-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    text-align: center;
}

.summary-header h2 {
    margin-bottom: 8px;
}

.summary-header .overall-grade {
    font-size: 3rem;
    font-weight: 700;
}

.summary-content {
    padding: 24px;
}

.summary-section {
    margin-bottom: 20px;
}

.summary-section h3 {
    font-size: 0.9rem;
    color: #4a5568;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.summary-stat {
    text-align: center;
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px;
}

.summary-stat .value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
}

.summary-stat .label {
    font-size: 0.7rem;
    color: #718096;
    text-transform: uppercase;
}

.summary-feedback {
    background: #f7fafc;
    padding: 16px;
    border-radius: 8px;
    line-height: 1.6;
    color: #4a5568;
}

/* Grammar Analysis Styles */
.grammar-issues {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grammar-issue {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fff5f5;
    border-radius: 8px;
    border-left: 3px solid #e53e3e;
}

.issue-original {
    color: #c53030;
    text-decoration: line-through;
}

.issue-arrow {
    color: #718096;
    font-weight: bold;
}

.issue-correction {
    color: #38a169;
    font-weight: 600;
}

.grammar-suggestions {
    list-style: none;
    padding: 0;
    margin: 0;
}

.grammar-suggestions li {
    padding: 10px 14px;
    background: #f0fff4;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid #38a169;
    color: #276749;
}

.grammar-suggestions li:last-child {
    margin-bottom: 0;
}

.summary-actions {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
}

.summary-actions .btn {
    flex: 1;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover:not(:disabled) {
    background: #cbd5e0;
}

/* Sentence Scores */
.sentence-scores {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sentence-score-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f7fafc;
    border-radius: 8px;
}

.sentence-num {
    font-size: 0.75rem;
    font-weight: 600;
    color: #718096;
    min-width: 24px;
}

.sentence-text {
    flex: 1;
    font-size: 0.9rem;
    color: #2d3748;
    line-height: 1.4;
}

.sentence-score {
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 36px;
    text-align: center;
}

.sentence-score.excellent {
    color: #276749;
}

.sentence-score.good {
    color: #975a16;
}

.sentence-score.needs-work {
    color: #c53030;
}

/* Word Stress Display */
.word-stress {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    margin: 1px;
    font-size: 0.9rem;
}

.word-stress.excellent {
    background: #c6f6d5;
    color: #276749;
}

.word-stress.good {
    background: #fefcbf;
    color: #975a16;
}

.word-stress.needs-work {
    background: #fed7d7;
    color: #c53030;
}

.word-stress .syl {
    display: inline;
}

.word-stress .syl.primary {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 1em;
}

.word-stress .syl.secondary {
    font-weight: 600;
}

/* ==================== ANALYSIS PAGE ==================== */
.analysis-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f0f4f8;
}

.analysis-content {
    flex: 1;
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.analysis-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.analysis-loading[hidden] {
    display: none;
}

.analysis-results {
    animation: fadeIn 0.3s ease;
}

.analysis-header {
    display: flex;
    align-items: center;
    gap: 24px;
    background: white;
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex-shrink: 0;
}

.score-circle .score-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
}

.score-circle.excellent {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

.score-circle.good {
    background: linear-gradient(135deg, #d69e2e 0%, #b7791f 100%);
}

.score-circle.needs-work {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}

.score-details h1 {
    font-size: 1.5rem;
    color: #2d3748;
    margin-bottom: 8px;
}

.score-meta {
    color: #718096;
    font-size: 0.95rem;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.stat-card .stat-icon {
    color: #667eea;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.analysis-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.analysis-section {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.analysis-section h2 {
    font-size: 1.1rem;
    color: #4a5568;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* Chat History */
.chat-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #f7fafc;
}

.chat-msg.teacher-msg {
    background: #ebf8ff;
}

.chat-msg.user-msg {
    background: #f0fff4;
}

.chat-msg .msg-role {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #718096;
    min-width: 40px;
}

.chat-msg .msg-text {
    flex: 1;
    color: #2d3748;
    line-height: 1.5;
}

/* Fluency Details */
.fluency-details {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.fluency-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f7fafc;
    padding: 16px 24px;
    border-radius: 8px;
    min-width: 120px;
}

.fluency-metric .metric-label {
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.fluency-metric .metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4f46e5;
}

.fluency-metric .metric-unit {
    font-size: 0.7rem;
    color: #a0aec0;
    margin-top: 2px;
}

.analysis-actions {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    justify-content: center;
}

.analysis-actions .btn {
    min-width: 150px;
    text-align: center;
    text-decoration: none;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
    .app-screen {
        flex-direction: column;
    }

    .chat-sidebar {
        width: 100%;
        height: 200px;
        border-left: none;
        border-top: 1px solid #e2e8f0;
    }

    .recording-area {
        padding: 20px;
    }
}

@media (max-width: 500px) {
    .setup-screen {
        padding: 0;
    }

    .setup-container {
        border-radius: 0;
        min-height: 100vh;
    }

    /* Analysis page responsive */
    .analysis-header {
        flex-direction: column;
        text-align: center;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .analysis-actions {
        flex-direction: column;
    }

    .analysis-actions .btn {
        width: 100%;
    }
}

/* ==================== PRACTICE MODE ==================== */

/* Mode Selection */
.mode-options {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.mode-option {
    flex: 1;
    cursor: pointer;
}

.mode-option input[type="radio"] {
    display: none;
}

.mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f7fafc;
    transition: all 0.2s;
}

.mode-option input[type="radio"]:checked + .mode-card {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.mode-option:hover .mode-card {
    border-color: #a0aec0;
}

.mode-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.mode-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 1rem;
    margin-bottom: 4px;
}

.mode-desc {
    font-size: 0.8rem;
    color: #718096;
    text-align: center;
}

/* Practice Text Input */
#practiceInputSection textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

#practiceInputSection textarea:focus {
    outline: none;
    border-color: #667eea;
}

#practiceInputSection textarea::placeholder {
    color: #a0aec0;
}

.practice-hint {
    color: #667eea !important;
    font-style: italic;
}

/* Practice Target Display */
.practice-target {
    background: linear-gradient(135deg, #f6f8fb 0%, #e9ecf5 100%);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
    text-align: center;
    border: 2px solid #e2e8f0;
}

.practice-label {
    font-size: 0.9rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.practice-text {
    font-size: 1.8rem;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.4;
    margin-bottom: 20px;
    word-wrap: break-word;
}

.practice-stress {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f0f4f8;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.stress-label {
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stress-display {
    font-size: 1.4rem;
    line-height: 1.6;
    color: #2d3748;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.stress-display .word {
    display: inline-block;
    margin-right: 8px;
}

.stress-display .syllable {
    display: inline;
}

.stress-display .syllable.primary {
    font-weight: 700;
    color: #667eea;
    text-transform: uppercase;
    font-size: 1.1em;
}

.stress-display .syllable.secondary {
    font-weight: 600;
    color: #805ad5;
}

.stress-display .syllable-separator {
    color: #a0aec0;
    margin: 0 1px;
}

.practice-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.practice-controls .btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    font-size: 1.2rem;
}

.attempt-counter {
    font-size: 0.9rem;
    color: #718096;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}

/* Practice Action Buttons */
.practice-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.practice-actions .btn {
    min-width: 140px;
}

/* Secondary Button Style */
.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

/* Mic Permission Section */
.mic-permission-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.mic-permission-section .btn-secondary.mic-ready {
    background: #38a169;
    color: white;
    border-color: #38a169;
}

.mic-status {
    font-size: 14px;
    color: #718096;
}

.mic-status.error {
    color: #e53e3e;
}

/* Practice History Item in Sidebar */
.practice-attempt {
    padding: 12px;
    background: white;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.practice-attempt.excellent {
    border-left-color: #38a169;
}

.practice-attempt.good {
    border-left-color: #d69e2e;
}

.practice-attempt.needs-work {
    border-left-color: #e53e3e;
}

.practice-attempt .attempt-number {
    font-size: 0.75rem;
    color: #718096;
    margin-bottom: 4px;
}

.practice-attempt .attempt-score {
    font-size: 1.5rem;
    font-weight: 700;
}

.practice-attempt .attempt-score.excellent {
    color: #38a169;
}

.practice-attempt .attempt-score.good {
    color: #d69e2e;
}

.practice-attempt .attempt-score.needs-work {
    color: #e53e3e;
}

/* Responsive Practice Mode */
@media (max-width: 600px) {
    .mode-options {
        flex-direction: column;
    }

    .practice-text {
        font-size: 1.4rem;
    }

    .practice-controls {
        flex-direction: column;
        gap: 12px;
    }

    .practice-actions {
        flex-direction: column;
    }

    .practice-actions .btn {
        width: 100%;
    }
}

/* ==================== PRACTICE PAGE (within setup-screen) ==================== */

/* Practice buttons section */
.setup-section.practice-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 20px 0;
}

.setup-section.practice-buttons .mic-btn {
    width: 70px;
    height: 70px;
}

/* Analysis status indicator */
.analysis-status {
    text-align: center;
    color: #6366f1;
    font-size: 14px;
    font-weight: 500;
    padding: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Feedback panel in setup */
.setup-content .feedback-panel {
    background: #f7fafc;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.setup-content .feedback-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 12px;
}

.setup-content .score-value {
    font-size: 3rem;
    font-weight: 700;
}

.setup-content .score-value.excellent { color: #38a169; }
.setup-content .score-value.good { color: #d69e2e; }
.setup-content .score-value.needs-work { color: #e53e3e; }

.setup-content .score-label {
    font-size: 0.9rem;
    color: #718096;
}

.setup-content .feedback-text p {
    margin: 8px 0;
}

.setup-content #feedbackText {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

.setup-content #feedbackTip {
    font-size: 0.9rem;
    color: #718096;
}

.setup-content .toggle-details {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 8px;
}

.setup-content .toggle-details:hover {
    text-decoration: underline;
}

.setup-content .feedback-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    text-align: left;
}

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

.modal-overlay[hidden] {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #a0aec0;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #4a5568;
}

.modal-content .feedback-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}

.modal-content .score-value {
    font-size: 4rem;
    font-weight: 700;
}

.modal-content .score-value.excellent { color: #38a169; }
.modal-content .score-value.good { color: #d69e2e; }
.modal-content .score-value.needs-work { color: #e53e3e; }

.modal-content .score-label {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 4px;
}

.modal-content .feedback-text p {
    margin: 8px 0;
}

.modal-content #feedbackText {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
}

.modal-content #feedbackTip {
    font-size: 0.95rem;
    color: #718096;
}

.modal-content .feedback-details {
    margin: 20px 0;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.modal-content #tryAgainBtn {
    margin-top: 20px;
    width: 100%;
}

/* Level badges */
.level-badges {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.level-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: white;
}

.level-badge.ielts {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.level-badge.cefr {
    background: linear-gradient(135deg, #38a169, #2f855a);
}

.level-badge strong {
    margin-left: 4px;
}

/* Metrics grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 20px 0;
}

.metric-card {
    background: #f7fafc;
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
}

.metric-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
}

.metric-label {
    display: block;
    font-size: 0.7rem;
    color: #718096;
    margin-top: 2px;
    text-transform: uppercase;
}

/* Section titles */
.modal-content .section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 0 8px;
    text-align: left;
}

/* Phoneme details */
.phoneme-details {
    text-align: left;
    margin-bottom: 12px;
}

.phoneme-score {
    display: inline-block;
    padding: 6px 12px;
    margin: 4px;
    border-radius: 8px;
    font-size: 0.85rem;
    background: #fff5f5;
    color: #c53030;
}

.phoneme-score.good {
    background: #fffff0;
    color: #975a16;
}

.phoneme-score.needs-work {
    background: #fff5f5;
    color: #c53030;
}

.phoneme-score small {
    display: block;
    font-size: 0.7rem;
    color: #a0aec0;
    margin-top: 2px;
}

/* Mobile responsive for metrics */
@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .level-badges {
        flex-direction: column;
        align-items: center;
    }
}

/* Word scores in feedback */
.word-score {
    display: inline-block;
    padding: 4px 10px;
    margin: 4px;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
}

.word-score.excellent {
    background: #c6f6d5;
    color: #276749;
}

.word-score.good {
    background: #fefcbf;
    color: #975a16;
}

.word-score.needs-work {
    background: #fed7d7;
    color: #c53030;
}

/* ==================== AUDIO NOTIFICATION ==================== */
.audio-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: notificationSlideDown 0.3s ease;
}

@keyframes notificationSlideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.notification-icon {
    font-size: 1.5rem;
}

.notification-text {
    font-size: 0.95rem;
    font-weight: 500;
}

.notification-btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.notification-btn:hover {
    transform: scale(1.05);
}

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

.notification-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 4px;
}

.notification-close:hover {
    color: white;
}

@media (max-width: 600px) {
    .audio-notification {
        top: auto;
        bottom: 100px;
        left: 10px;
        right: 10px;
        transform: none;
        flex-wrap: wrap;
        justify-content: center;
    }
}
