﻿/* ============================================================
   KOKO LANGUAGE LEARNING APP - styles.css
   Built from scratch - Version 2.0
   Color Palette: Coral #FF6B8A, Purple #7C5CFC, Mint #56D9B3
   Font: Nunito (Google Fonts)
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --primary: #FF6B8A;
    --primary-light: #FF8FA8;
    --primary-dark: #E5527A;
    --secondary: #7C5CFC;
    --secondary-light: #9B82FF;
    --secondary-dark: #6344E0;
    --mint: #56D9B3;
    --mint-light: #7AE6C8;
    --mint-dark: #3EC49E;
    --bg-main: #F8F6FF;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.6);
    --text-dark: #2D2B3D;
    --text-mid: #5A577A;
    --text-light: #8E8BA8;
    --text-on-primary: #FFFFFF;
    --border: rgba(124, 92, 252, 0.15);
    --shadow-sm: 0 2px 8px rgba(124, 92, 252, 0.08);
    --shadow-md: 0 4px 20px rgba(124, 92, 252, 0.12);
    --shadow-lg: 0 8px 40px rgba(124, 92, 252, 0.16);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 50px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Nunito', sans-serif;
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
    --gradient-mint: linear-gradient(135deg, var(--mint), var(--secondary));
    --gradient-warm: linear-gradient(135deg, var(--primary), var(--mint));
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-main);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Background decoration */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -30%;
    width: 80vw;
    height: 80vw;
    background: radial-gradient(circle, rgba(124, 92, 252, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    bottom: -40%;
    left: -20%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(255, 107, 138, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

/* --- Utility Classes --- */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* --- Page Container --- */
.app-container {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

/* --- Glass Card --- */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* ============================================================
   PAGE: Language Selection
   ============================================================ */
#languageSelectionPage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 20px;
}

/* Logo */
.app-logo {
    width: 90px;
    height: 90px;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    color: white;
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 12px;
    box-shadow: var(--shadow-lg);
    letter-spacing: -2px;
}

.app-title {
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.app-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 32px;
}

/* Language Selection Steps */
.language-step {
    width: 100%;
    max-width: 400px;
    margin-bottom: 24px;
}

.step-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-mid);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-number {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    font-size: 13px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Language Button List */
.lang-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 400px;
}

.lang-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 16px;
    min-width: 90px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
}

.lang-chip:hover {
    border-color: var(--secondary);
    box-shadow: var(--shadow-sm);
}

.lang-chip.selected {
    border-color: var(--secondary);
    background: rgba(124, 92, 252, 0.10);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.12);
}

.lang-chip-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.lang-chip.selected .lang-chip-name {
    color: var(--secondary);
}

.lang-chip-eng {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-light);
}

/* Start Button */
.start-btn {
    width: 100%;
    max-width: 400px;
    padding: 16px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    font-family: var(--font);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    margin-top: 8px;
    letter-spacing: 0.3px;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.start-btn:active {
    transform: translateY(0);
}

.start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   PAGE: Main / Dashboard
   ============================================================ */
#mainPage {
    padding: 20px 16px 100px;
}

/* Header */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    margin-bottom: 20px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--gradient-primary);
    color: white;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-title {
    font-size: 22px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.settings-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-mid);
}

.settings-btn:hover {
    background: var(--bg-glass);
    border-color: var(--secondary);
}

/* Day & Topic Card */
.topic-card {
    padding: 24px;
    margin-bottom: 20px;
    text-align: center;
}

.topic-day {
    font-size: 13px;
    font-weight: 700;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.topic-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.topic-subtitle {
    font-size: 14px;
    color: var(--text-light);
}

.topic-translated {
    font-size: 16px;
    font-weight: 600;
    color: var(--secondary);
    margin-top: 6px;
    font-style: italic;
    opacity: 0.85;
}

/* Streak display */
.streak-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}

.streak-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    min-width: 90px;
}

.streak-value {
    font-size: 24px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.streak-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Navigation Cards */
.nav-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-family: var(--font);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.nav-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--secondary);
}

.nav-card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.nav-card-icon.class-icon {
    background: linear-gradient(135deg, rgba(255, 107, 138, 0.15), rgba(124, 92, 252, 0.15));
}

.nav-card-icon.quiz-icon {
    background: linear-gradient(135deg, rgba(124, 92, 252, 0.15), rgba(86, 217, 179, 0.15));
}

.nav-card-icon.vocab-icon {
    background: linear-gradient(135deg, rgba(86, 217, 179, 0.15), rgba(255, 107, 138, 0.15));
}

.nav-card-info {
    flex: 1;
}

.nav-card-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.nav-card-desc {
    font-size: 13px;
    color: var(--text-light);
}

.nav-card-arrow {
    font-size: 18px;
    color: var(--text-light);
    transition: var(--transition);
}

.nav-card:hover .nav-card-arrow {
    color: var(--secondary);
    transform: translateX(3px);
}

/* Locked state for nav cards */
.nav-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.nav-card.locked:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border);
}

.nav-card .lock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 107, 138, 0.12);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

/* Footer */
.main-footer {
    text-align: center;
    margin-top: 32px;
    padding: 16px 0;
    font-size: 12px;
    color: var(--text-light);
}

.main-footer a {
    color: var(--secondary);
    text-decoration: none;
    transition: var(--transition);
}

.main-footer a:hover {
    color: var(--primary);
}

/* ============================================================
   PAGE: Chat / Koko Class
   ============================================================ */
#chatPage {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.back-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-mid);
}

.back-btn:hover {
    border-color: var(--secondary);
    background: rgba(124, 92, 252, 0.05);
}

.chat-header-info {
    flex: 1;
}

.chat-header-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
}

.chat-header-subtitle {
    font-size: 12px;
    color: var(--text-light);
}

.chat-counter {
    background: var(--secondary);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    min-width: 40px;
    text-align: center;
}

.chat-counter.done {
    background: var(--accent);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.chat-message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    font-size: 15px;
    line-height: 1.55;
    animation: messageIn 0.3s ease;
    position: relative;
    word-wrap: break-word;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.ai {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 6px;
    color: var(--text-dark);
}

.chat-message.user {
    align-self: flex-end;
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 6px;
}

.chat-message .msg-speaker {
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Message body formatting */
.msg-body {
    line-height: 1.6;
}

.msg-point {
    padding: 4px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.msg-point:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.msg-point:first-child {
    padding-top: 0;
}

.msg-label {
    display: inline-block;
    background: linear-gradient(135deg, rgba(124, 92, 252, 0.12), rgba(255, 107, 138, 0.12));
    color: var(--secondary);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 4px;
}

.msg-translation {
    color: var(--text-light);
    font-size: 13px;
    font-style: italic;
}

.msg-wrong {
    color: #e74c3c;
    text-decoration: line-through;
    text-decoration-color: rgba(231, 76, 60, 0.4);
}

.msg-correct {
    color: #27ae60;
    font-weight: 600;
}

.chat-message.ai strong {
    color: var(--secondary);
    font-weight: 700;
}

/* Smart inline word TTS */
.tts-word {
    display: inline;
    cursor: pointer;
    color: var(--secondary);
    font-weight: 600;
    background: linear-gradient(135deg, rgba(124, 92, 252, 0.08), rgba(255, 107, 138, 0.06));
    padding: 1px 6px;
    border-radius: 4px;
    transition: var(--transition);
    border-bottom: 1.5px dashed rgba(124, 92, 252, 0.3);
}

.tts-word:hover {
    background: linear-gradient(135deg, rgba(124, 92, 252, 0.15), rgba(255, 107, 138, 0.12));
    border-bottom-color: var(--secondary);
}

.tts-word:active {
    transform: scale(0.97);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 16px 20px;
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 6px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary);
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Complete Lesson Button (appears in chat) */
.complete-lesson-btn {
    align-self: center;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--gradient-mint);
    color: white;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    animation: messageIn 0.3s ease;
}

.complete-lesson-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Chat Input */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
}

.chat-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-main);
    font-family: var(--font);
    font-size: 15px;
    color: var(--text-dark);
    outline: none;
    transition: var(--transition);
}

.chat-input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.1);
}

.chat-input::placeholder {
    color: var(--text-light);
}

.send-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--gradient-primary);
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   PAGE: Quiz
   ============================================================ */
#quizPage {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.quiz-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.quiz-header-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    flex: 1;
}

.quiz-score {
    font-size: 14px;
    font-weight: 700;
    color: var(--secondary);
}

.quiz-content {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.quiz-question-card {
    width: 100%;
    max-width: 420px;
    padding: 28px 24px;
    text-align: center;
    margin-bottom: 24px;
}

.quiz-question-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.quiz-question-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.4;
}

/* Quiz Options */
.quiz-options {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    padding: 16px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
}

.quiz-option:hover {
    border-color: var(--secondary);
    transform: translateX(4px);
}

.quiz-option .option-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(124, 92, 252, 0.1);
    color: var(--secondary);
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quiz-option.correct {
    border-color: var(--mint);
    background: rgba(86, 217, 179, 0.1);
}

.quiz-option.correct .option-letter {
    background: var(--mint);
    color: white;
}

.quiz-option.wrong {
    border-color: var(--primary);
    background: rgba(255, 107, 138, 0.1);
}

.quiz-option.wrong .option-letter {
    background: var(--primary);
    color: white;
}

.quiz-option:disabled {
    cursor: default;
    transform: none;
}

/* Quiz feedback */
.quiz-feedback {
    width: 100%;
    max-width: 420px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-top: 16px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    animation: messageIn 0.3s ease;
}

.quiz-feedback.correct {
    background: rgba(86, 217, 179, 0.12);
    color: var(--mint-dark);
    border: 1px solid rgba(86, 217, 179, 0.3);
}

.quiz-feedback.wrong {
    background: rgba(255, 107, 138, 0.12);
    color: var(--primary-dark);
    border: 1px solid rgba(255, 107, 138, 0.3);
}

.quiz-next-btn {
    margin-top: 20px;
    padding: 12px 32px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.quiz-next-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Quiz complete state */
.quiz-complete {
    text-align: center;
    padding: 32px 20px;
}

.quiz-complete-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.quiz-complete-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.quiz-complete-score {
    font-size: 16px;
    color: var(--text-mid);
    margin-bottom: 24px;
}

/* ============================================================
   PAGE: Vocabulary
   ============================================================ */
#vocabularyPage {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.vocab-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.vocab-header-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    flex: 1;
}

.vocab-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--mint);
}

.vocab-content {
    flex: 1;
    padding: 20px 16px;
}

/* Vocabulary word card */
.vocab-word-card {
    padding: 20px;
    margin-bottom: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.vocab-word-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.vocab-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.vocab-word {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-dark);
    cursor: pointer;
}

.vocab-word-cjk {
    font-size: 36px;
    line-height: 1.2;
}

.vocab-word:hover {
    color: var(--secondary);
}

.vocab-speak-btn {
    background: none;
    border: 2px solid var(--secondary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
    transition: var(--transition);
    flex-shrink: 0;
}

.vocab-speak-btn:hover {
    background: var(--secondary);
    color: white;
}

.vocab-traditional {
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.vocab-pronunciation {
    font-size: 15px;
    color: var(--secondary);
    font-weight: 600;
    margin-bottom: 6px;
}

.vocab-level {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: var(--secondary);
    background: rgba(124, 92, 252, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.vocab-meaning {
    font-size: 14px;
    color: var(--text-mid);
    margin-bottom: 8px;
    line-height: 1.5;
}

.vocab-example {
    font-size: 13px;
    color: var(--text-light);
    padding: 10px 14px;
    background: rgba(124, 92, 252, 0.04);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--secondary);
    line-height: 1.5;
    margin-bottom: 6px;
}

/* Vocab locked screen */
.vocab-locked, .quiz-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    flex: 1;
}

.lock-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.lock-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.lock-text {
    font-size: 14px;
    color: var(--text-light);
    max-width: 280px;
    line-height: 1.5;
}

.lock-go-btn {
    margin-top: 20px;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.lock-go-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Vocab daily limit reached */
.vocab-limit {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 14px;
}

/* ============================================================
   MODAL: Settings
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(45, 43, 61, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.settings-modal {
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    background: var(--bg-main);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    padding: 24px 20px;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.settings-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
}

.settings-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-mid);
}

.settings-close:hover {
    background: rgba(255, 107, 138, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* Settings sections */
.settings-section {
    margin-bottom: 20px;
}

.settings-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.settings-row-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.settings-row-value {
    font-size: 14px;
    color: var(--text-mid);
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 28px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #D1CDE6;
    border-radius: 28px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--gradient-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Reset / Change language button */
.settings-action-btn {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 8px;
}

.settings-action-btn:hover {
    border-color: var(--secondary);
    background: rgba(124, 92, 252, 0.05);
}

.settings-action-btn.danger {
    color: var(--primary);
    border-color: rgba(255, 107, 138, 0.3);
}

.settings-action-btn.danger:hover {
    background: rgba(255, 107, 138, 0.08);
    border-color: var(--primary);
}

/* ============================================================
   MODAL: Weakness Analysis
   ============================================================ */
.analysis-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(45, 43, 61, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.analysis-card {
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 28px 24px;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.analysis-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 4px;
    text-align: center;
}

.analysis-subtitle {
    font-size: 13px;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 20px;
}

.analysis-section {
    margin-bottom: 16px;
}

.analysis-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.analysis-text {
    font-size: 14px;
    color: var(--text-mid);
    line-height: 1.6;
}

.analysis-close-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 16px;
}

.analysis-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================================
   LOADING STATES
   ============================================================ */
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(124, 92, 252, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 92, 252, 0.4);
}

/* ============================================================
   RESPONSIVE / MOBILE
   ============================================================ */
@media (max-width: 480px) {
    .app-container {
        max-width: 100%;
    }

    .topic-title {
        font-size: 19px;
    }

    .chat-message {
        max-width: 90%;
        font-size: 14px;
        padding: 12px 14px;
    }

    .settings-modal {
        max-height: 90vh;
    }
}

@media (max-width: 360px) {
    .streak-display {
        flex-direction: column;
        gap: 8px;
    }

    .streak-item {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }
}

/* Safe area for notched phones */
@supports (padding-top: env(safe-area-inset-top)) {
    .chat-header, .quiz-header, .vocab-header {
        padding-top: calc(14px + env(safe-area-inset-top));
    }

    .chat-input-area {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
}
