﻿/* ============================================
   KOKO - Cute & Modern Language Learning App
   Warm peach/coral/purple palette with playful feel
   ============================================ */

/* CSS Custom Properties */
:root {
    --primary: #FF6B8A;
    --primary-light: #FF8FA3;
    --primary-dark: #E8547A;
    --secondary: #7C5CFC;
    --secondary-light: #9B82FC;
    --accent: #FFB347;
    --accent-light: #FFCC80;
    --mint: #56D9B3;
    --mint-light: #7EEAC9;
    --sky: #64B5F6;
    --bg-gradient-start: #FFF0F3;
    --bg-gradient-end: #F3E8FF;
    --bg-chat: #FDF8FF;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-shadow: 0 8px 32px rgba(255, 107, 138, 0.12);
    --text-primary: #2D1B4E;
    --text-secondary: #6B5B8A;
    --text-muted: #9B8FB8;
    --border-soft: rgba(124, 92, 252, 0.12);
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --font-main: 'Nunito', 'Segoe UI', 'Helvetica Neue', sans-serif;
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Load Nunito font */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap');

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}
.skip-link:focus { top: 0; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(145deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 50%, #E8F5FF 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* ============================================
   Floating decorative bubbles (background)
   ============================================ */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
}
body::before {
    width: 400px; height: 400px;
    background: radial-gradient(circle, var(--primary-light), transparent 70%);
    top: -100px; right: -100px;
    animation: floatBubble 20s ease-in-out infinite;
}
body::after {
    width: 300px; height: 300px;
    background: radial-gradient(circle, var(--secondary-light), transparent 70%);
    bottom: -80px; left: -80px;
    animation: floatBubble 25s ease-in-out infinite reverse;
}
@keyframes floatBubble {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 15px) scale(0.95); }
}

/* ============================================
   LANGUAGE SELECTION PAGE
   ============================================ */
.language-selection-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
}

.app-header {
    text-align: center;
    margin-bottom: 32px;
    color: var(--text-primary);
}

/* Hide the old logo image */
.app-logo { display: none !important; }

.app-header h1 {
    font-size: 2.6rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.app-header p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.language-form {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    padding: 36px;
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow), 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-soft);
    max-width: 460px;
    width: 100%;
}

.language-form h2 {
    text-align: center;
    color: var(--secondary);
    margin-bottom: 6px;
    font-size: 1.5rem;
    font-weight: 700;
}

.language-form > p {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 28px;
    font-size: 0.92rem;
}

.language-group {
    margin-bottom: 22px;
}

.language-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.language-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-soft);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: var(--font-main);
    font-weight: 500;
    background: white;
    color: var(--text-primary);
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237C5CFC' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}

.language-select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(124, 92, 252, 0.12);
}

.start-button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 17px;
    font-weight: 700;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 16px;
    box-shadow: 0 6px 20px rgba(255, 107, 138, 0.3);
    letter-spacing: 0.3px;
}

.start-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 107, 138, 0.4);
}

.start-button:active:not(:disabled) {
    transform: translateY(-1px);
}

.start-button:disabled {
    background: #D4CCEB;
    cursor: not-allowed;
    box-shadow: none;
}

/* ============================================
   MAIN PAGE
   ============================================ */
.main-header {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-soft);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

/* Hide the old header logo image */
.header-logo { display: none !important; }

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#languageInfo {
    font-weight: 700;
    color: var(--secondary);
    font-size: 0.95rem;
}

.icon-button {
    background: none;
    border: none;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.icon-button:hover {
    background: rgba(124, 92, 252, 0.1);
    color: var(--secondary);
    transform: scale(1.1);
}

.main-layout {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    gap: 24px;
    padding: 24px;
    flex: 1;
}

/* ============================================
   SIDEBAR (Topics + Countdown)
   ============================================ */
.sidebar {
    width: 320px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 24px;
    height: fit-content;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-soft);
}

.topic-info h3 {
    color: var(--secondary);
    margin-bottom: 14px;
    font-size: 1.1rem;
    font-weight: 700;
}

.topic-card {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    box-shadow: 0 6px 20px rgba(255, 107, 138, 0.25);
    position: relative;
    overflow: hidden;
}

.topic-day {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 6px;
    font-weight: 600;
}

.topic-text {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.5;
}

.next-topic, .countdown { margin-top: 0; }

/* Bubble sections */
.bubble-section {
    background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(243,232,255,0.5));
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin: 16px 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.bubble-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--mint), var(--accent));
    background-size: 200% 100%;
    animation: bubble-gradient 4s ease-in-out infinite;
}

.bubble-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.bubble-title {
    color: var(--text-primary) !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    margin-bottom: 10px !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bubble-content {
    background: rgba(255,255,255,0.7) !important;
    border: 1px solid rgba(124,92,252,0.1);
    border-radius: var(--radius-md) !important;
    padding: 14px !important;
    font-size: 0.95rem !important;
    color: var(--text-secondary) !important;
    font-weight: 500;
}

.timer.bubble-content {
    font-family: 'Courier New', monospace;
    font-size: 1.3rem !important;
    font-weight: 700;
    text-align: center;
    color: var(--primary-dark) !important;
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,240,243,0.6)) !important;
    border: 2px solid rgba(255,107,138,0.2);
}

@keyframes bubble-gradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.timer {
    font-family: 'Courier New', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    background: #FFF5F7;
    padding: 10px;
    border-radius: var(--radius-sm);
}

.topic-list { margin-top: 24px; }

.topic-scroll {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

.topic-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: #FFF7F9;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid transparent;
}
.topic-item:hover {
    background: #FFF0F3;
    border-color: var(--border-soft);
}
.topic-item.current {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: transparent;
}

.topic-item-day { font-weight: 700; margin-right: 10px; min-width: 50px; }
.topic-item-text { font-size: 0.88rem; flex: 1; }

/* ============================================
   MAIN CONTENT - Activity Cards
   ============================================ */
.main-content {
    flex: 1;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 36px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-soft);
}

.menu-container h2 {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 36px;
    font-size: 1.8rem;
    font-weight: 800;
}

.activity-grid {
    display: grid;
    gap: 18px;
    max-width: 560px;
    margin: 0 auto;
}

.activity-card {
    display: flex;
    align-items: center;
    padding: 22px;
    background: white;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.35s ease;
    text-align: left;
    width: 100%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    position: relative;
    overflow: hidden;
}

.activity-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    border-radius: 4px 0 0 4px;
    transition: width 0.3s ease;
}

/* Chat card - coral accent */
#chatButton::before { background: var(--primary); }
#chatButton:hover { border-color: rgba(255,107,138,0.3); }
#chatButton .card-icon { color: var(--primary); }

/* Quiz card - purple accent */
#quizButton::before { background: var(--secondary); }
#quizButton:hover { border-color: rgba(124,92,252,0.3); }
#quizButton .card-icon { color: var(--secondary); }

/* Vocab card - mint accent */
#vocabularyButton::before { background: var(--mint); }
#vocabularyButton:hover { border-color: rgba(86,217,179,0.3); }
#vocabularyButton .card-icon { color: var(--mint); }

.activity-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.08);
}
.activity-card:hover::before { width: 6px; }

.card-icon {
    font-size: 2.2rem;
    margin-right: 18px;
    min-width: 56px;
    display: flex;
    justify-content: center;
}

.card-content { flex: 1; }

.card-content h3 {
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 1.15rem;
    font-weight: 700;
}

.card-content p {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.4;
}

.quiz-status, .vocab-status {
    margin-top: 6px;
    font-size: 0.82rem;
    font-weight: 600;
}

.card-arrow {
    font-size: 1rem;
    color: var(--text-muted);
    margin-left: 12px;
    transition: transform 0.3s ease;
}
.activity-card:hover .card-arrow { transform: translateX(4px); }

/* ============================================
   CHAT PAGE
   ============================================ */
.chat-layout {
    display: flex;
    height: 100vh;
}

.chat-sidebar {
    width: 280px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(16px);
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid var(--border-soft);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
}

.chat-right-panel {
    width: 280px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(16px);
    padding: 20px;
    border-left: 1px solid var(--border-soft);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(16px);
}

/* Hide old chat logo */
.chat-logo { display: none !important; }

.chat-header-info {
    display: flex;
    align-items: center;
}

.back-button {
    background: none;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-size: 0.92rem;
    font-weight: 600;
    font-family: var(--font-main);
}
.back-button:hover {
    background: rgba(124,92,252,0.08);
}

.chat-controls { display: flex; gap: 8px; }

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 78%;
    animation: msgFadeIn 0.3s ease-out;
}
@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user-message {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 3px 10px rgba(255,107,138,0.3);
}

.user-message .message-avatar {
    background: linear-gradient(135deg, var(--mint), var(--sky));
    box-shadow: 0 3px 10px rgba(86,217,179,0.3);
}

.message-content {
    background: white;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: relative;
    line-height: 1.6;
    font-size: 0.95rem;
}

.message-content p {
    white-space: pre-wrap;
    margin: 0;
    word-wrap: break-word;
}

.ai-message .message-content {
    border-bottom-left-radius: 6px;
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--secondary), var(--primary-dark));
    color: white;
    border-bottom-right-radius: 6px;
}

.message-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.tts-button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.88rem;
    transition: all 0.3s ease;
}
.tts-button:hover {
    background: rgba(124,92,252,0.08);
    color: var(--secondary);
}

.coffee-link {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.06);
}
.coffee-link a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}
.coffee-link a:hover { text-decoration: underline; }

.chat-input-container {
    padding: 16px 20px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-soft);
}

.input-group {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: 760px;
    margin: 0 auto;
}

#messageInput {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border-soft);
    border-radius: var(--radius-lg);
    resize: none;
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.4;
    color: var(--text-primary);
    transition: all 0.3s ease;
    background: white;
}
#messageInput:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(124,92,252,0.1);
}

.input-buttons { display: flex; gap: 6px; }

.voice-button, .send-button {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.voice-button {
    background: var(--mint);
    color: white;
}
.voice-button:hover {
    background: #45C9A3;
    transform: scale(1.08);
}

.send-button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(255,107,138,0.3);
}
.send-button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(255,107,138,0.4);
}
.send-button:disabled {
    background: #D4CCEB;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Grammar Panel */
.grammar-panel h3 {
    color: var(--secondary);
    margin-bottom: 14px;
    font-size: 1.1rem;
    font-weight: 700;
}

.grammar-content {
    background: #FFF7FA;
    padding: 16px;
    border-radius: var(--radius-md);
    min-height: 180px;
}

.grammar-placeholder {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    margin-top: 40px;
    font-size: 0.9rem;
}

.grammar-suggestion {
    background: white;
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border-left: 4px solid var(--accent);
}

.grammar-correction {
    background: white;
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border-left: 4px solid var(--primary);
}

/* ============================================
   QUIZ PAGE
   ============================================ */
.quiz-container, .vocabulary-container {
    max-width: 880px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
}

.quiz-header, .vocabulary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1.2rem 1.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    box-shadow: var(--card-shadow);
}

.quiz-header h2, .vocabulary-header h2 {
    color: var(--secondary);
    font-weight: 800;
    font-size: 1.4rem;
}

.quiz-progress, .vocabulary-progress {
    background: rgba(124,92,252,0.08);
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 700;
    color: var(--secondary);
    font-size: 0.9rem;
}

.quiz-content, .vocabulary-content {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    padding: 32px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-soft);
    box-shadow: var(--card-shadow);
}

.quiz-question { margin-bottom: 24px; }

.question-text {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 18px;
    color: var(--text-primary);
    line-height: 1.5;
}

.quiz-options {
    display: grid;
    gap: 0.8rem;
    margin: 1.2rem 0;
}

.quiz-option {
    padding: 1rem 1.2rem;
    border: 2px solid var(--border-soft);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
    font-family: var(--font-main);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-primary);
}

.quiz-option:hover {
    border-color: var(--secondary);
    background: rgba(124,92,252,0.04);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124,92,252,0.1);
}

.quiz-option.selected {
    border-color: var(--secondary);
    background: rgba(124,92,252,0.08);
}

.quiz-option.correct, .quiz-option.correct-answer {
    border-color: var(--mint);
    background: rgba(86,217,179,0.1);
}

.quiz-option.incorrect, .quiz-option.incorrect-answer {
    border-color: var(--primary);
    background: rgba(255,107,138,0.08);
}

.option-letter {
    font-weight: 700;
    color: var(--secondary);
    min-width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(124,92,252,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
}

.quiz-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
}

.quiz-button {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-main);
    transition: all 0.3s ease;
}

.primary-button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(255,107,138,0.2);
}
.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(255,107,138,0.3);
}
.primary-button:disabled { background: #D4CCEB; cursor: not-allowed; box-shadow: none; }

.secondary-button { background: var(--text-muted); color: white; }
.secondary-button:hover { background: var(--text-secondary); }

.danger-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
}
.danger-button:hover { background: var(--primary-dark); }

.quiz-results { text-align: center; padding: 28px; }

.results-score {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.results-message {
    font-size: 1.1rem;
    margin-bottom: 24px;
    color: var(--text-secondary);
}

.daily-limit-message {
    background: linear-gradient(135deg, var(--mint), #20C9A0);
    color: white;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin: 16px 0;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(86,217,179,0.3);
}

.quiz-completed-today { text-align: center; padding: 28px; color: var(--text-secondary); }
.quiz-completed-today h3 { color: var(--mint); margin-bottom: 12px; }

/* ============================================
   VOCABULARY STYLES
   ============================================ */
.vocab-word-card {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 28px;
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(255,107,138,0.25);
    position: relative;
    overflow: hidden;
}

.vocab-word { font-size: 2.4rem; font-weight: 800; margin-bottom: 8px; }
.vocab-pronunciation { font-size: 1.15rem; opacity: 0.9; margin-bottom: 12px; }
.vocab-definition { font-size: 1.05rem; line-height: 1.5; }

.vocab-examples {
    margin-top: 1.5rem;
    background: linear-gradient(135deg, #FFF7F9, #F3E8FF);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    border-left: 4px solid var(--primary);
}

.vocab-examples h4 {
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vocab-example {
    background: rgba(255,255,255,0.85);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.6rem;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    border-left: 3px solid var(--primary-light);
    transition: all 0.3s ease;
}
.vocab-example:hover { transform: translateX(4px); }
.vocab-example:last-child { margin-bottom: 0; }

/* Vocabulary Display */
.vocabulary-display-container { max-width: 880px; margin: 0 auto; padding: 20px; }
.vocab-main-header { text-align: center; margin-bottom: 24px; }

.vocab-section-title {
    color: white;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.vocab-word-section {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-soft);
}

.word-title-section { text-align: center; margin-bottom: 20px; border-bottom: 2px solid #F0E8F7; padding-bottom: 18px; }
.word-title-label { color: var(--text-muted); font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
.word-title-display { color: var(--text-primary); font-size: 2.8rem; font-weight: 800; margin: 0; }

.pronunciation-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 20px;
    padding: 14px;
    background: #FFF7FA;
    border-radius: var(--radius-md);
}

.pronunciation-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255,107,138,0.25);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pronunciation-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(255,107,138,0.35); }

.phonetic-display, .phonetic {
    font-family: 'Courier New', monospace;
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.definition-section, .translation-section { margin-bottom: 16px; padding: 12px 0; }

.definition-label, .translation-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.definition-text { font-size: 1.05rem; line-height: 1.6; color: var(--text-primary); }
.translation-text { font-size: 1.1rem; line-height: 1.5; color: var(--mint); font-weight: 600; }

.interactive-learning-section {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-soft);
}

.learning-section-title {
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.usage-examples-title { color: var(--text-muted); font-size: 1rem; font-weight: 600; margin-bottom: 12px; }

.example-item {
    background: linear-gradient(135deg, #FFF7FA, #F3E8FF);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border-left: 4px solid var(--secondary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.example-text { font-style: italic; color: var(--text-secondary); font-size: 0.98rem; line-height: 1.6; margin: 0; }

.vocab-quiz-section {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-soft);
}

.quiz-section {
    margin-bottom: 24px;
    padding: 18px;
    background: #FFF7FA;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-soft);
}

.quiz-title {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quiz-feedback {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-align: center;
}

.vocab-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    padding: 18px 22px;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-soft);
    margin-top: 16px;
}

.vocab-info { color: var(--text-muted); font-weight: 600; }
.vocab-buttons { display: flex; gap: 12px; align-items: center; }

.vocab-button {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.3s ease;
}

.vocab-button.primary-button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(255,107,138,0.25);
}
.vocab-button.primary-button:hover { transform: translateY(-2px); }

.loading-exercises { text-align: center; padding: 32px 20px; }

.loading-dots { display: inline-flex; gap: 6px; margin-bottom: 12px; }
.loading-dots span {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--secondary);
    display: inline-block;
    animation: loading-bounce 1.4s ease-in-out both infinite;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes loading-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(45, 27, 78, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    max-width: 460px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(0,0,0,0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-soft);
}
.modal-header h3 { color: var(--secondary); font-size: 1.2rem; font-weight: 700; }

.close-button {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.3s ease;
}
.close-button:hover { background: #FFF0F3; color: var(--primary); }

.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.setting-group { margin-bottom: 18px; }
.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.92rem;
}
.setting-group input[type="checkbox"] { margin-right: 10px; }

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(45, 27, 78, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.loading-content { text-align: center; color: white; }

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .main-layout { flex-direction: column; padding: 16px; gap: 16px; }
    .sidebar { width: 100%; margin-bottom: 12px; }

    .chat-layout { flex-direction: column; height: auto; min-height: 100vh; }
    .chat-sidebar, .chat-right-panel { width: 100%; order: 2; }
    .chat-main { order: 1; min-height: 70vh; }

    .app-header h1 { font-size: 2rem; }

    .language-form { margin: 16px; padding: 28px; }

    .quiz-container, .vocabulary-container { padding: 16px; }
    .quiz-content, .vocabulary-content { padding: 20px; }

    .activity-grid { padding: 0 8px; }
    .activity-card { padding: 18px; }
    .card-icon { font-size: 1.8rem; min-width: 48px; margin-right: 14px; }

    .message { max-width: 90%; }

    .input-group { flex-direction: column; gap: 10px; }
    .input-buttons { justify-content: center; }

    .menu-container h2 { font-size: 1.5rem; margin-bottom: 24px; }
    .main-content { padding: 24px; }

    .bubble-section { padding: 14px; margin: 12px 0; }
}

@media (max-width: 480px) {
    .app-header h1 { font-size: 1.7rem; }
    .language-form { padding: 20px; }
    .start-button { padding: 14px; font-size: 16px; }

    .activity-card { flex-direction: column; text-align: center; padding: 20px 16px; }
    .card-icon { margin-right: 0; margin-bottom: 10px; }
    .card-arrow { display: none; }

    .quiz-header, .vocabulary-header { flex-direction: column; gap: 12px; text-align: center; }
    .quiz-controls { flex-direction: column; gap: 12px; }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ============================================
   ANIMATIONS
   ============================================ */
.fade-in { animation: fadeIn 0.4s ease-out; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in-left { animation: slideInLeft 0.4s ease-out; }
@keyframes slideInLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } }

.slide-in-right { animation: slideInRight 0.4s ease-out; }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* Focus Styles */
button:focus, select:focus, textarea:focus, input:focus {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}

/* High Contrast */
@media (prefers-contrast: high) {
    .activity-card { border-width: 3px; }
    .message-content { border: 1px solid var(--text-primary); }
    .quiz-option { border-width: 3px; }
}

/* ============================================
   ENHANCED VOCABULARY (large dataset styles)
   ============================================ */
.word-info { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }

.word-rank {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
}

.vocab-rank {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: white;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    margin-top: 8px;
}

.dataset-info {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 14px;
    border-radius: var(--radius-md);
    margin: 16px 0;
    text-align: center;
    box-shadow: 0 4px 16px rgba(255,107,138,0.2);
}
.dataset-info h4 { margin: 0 0 4px 0; font-size: 1rem; }
.dataset-info p { margin: 0; font-size: 0.88rem; opacity: 0.9; }

.vocabulary-options { display: grid; gap: 8px; margin: 16px 0; }

.vocab-option {
    background: white;
    border: 2px solid var(--secondary);
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-family: var(--font-main);
}
.vocab-option:hover {
    background: var(--secondary);
    color: white;
    transform: translateY(-2px);
}
.vocab-option:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Word Header */
.word-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-soft);
}
.word-header h2 { color: var(--text-primary); font-size: 1.8rem; font-weight: 700; margin: 0; }

.pronunciation {
    background: linear-gradient(135deg, #FFF7FA, #F3E8FF);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.2rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 500;
    border-left: 4px solid var(--secondary);
    text-align: center;
}

.word-meanings {
    background: linear-gradient(135deg, #FAFFF7, #F1F8F4);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    border-left: 4px solid var(--mint);
    margin-bottom: 1.2rem;
}

.original-definition, .native-translation {
    margin-bottom: 0.8rem;
    padding: 0.6rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.7);
}
.original-definition:last-child, .native-translation:last-child { margin-bottom: 0; }

/* Modern Exercise Grid */
.modern-exercise-grid { display: grid; gap: 1.2rem; grid-template-columns: 1fr; margin: 1.2rem 0; }

.exercise-tile {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-soft);
    overflow: hidden;
    transition: all 0.35s ease;
    position: relative;
}
.exercise-tile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}
.exercise-tile:hover { transform: translateY(-4px); box-shadow: 0 12px 36px rgba(0,0,0,0.1); }

.example-tile:hover::before { background: linear-gradient(90deg, var(--mint), #2ECDA0); }
.practice-tile:hover::before { background: linear-gradient(90deg, var(--accent), #FF9500); }
.memory-tile:hover::before { background: linear-gradient(90deg, var(--secondary), var(--primary)); }
.quiz-tile:hover::before { background: linear-gradient(90deg, var(--sky), var(--secondary)); }

.tile-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1.2rem 1.2rem 0.8rem;
}

.tile-icon {
    font-size: 1.6rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFF7FA;
    border-radius: var(--radius-sm);
}
.tile-header h3 { margin: 0; color: var(--text-primary); font-size: 1rem; font-weight: 700; }

.tile-content { padding: 0 1.2rem 1.2rem; }

.example-sentence {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin: 0.6rem 0;
    padding: 0.6rem;
    background: rgba(86,217,179,0.06);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--mint);
}

.example-number {
    background: var(--mint);
    color: white;
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.example-sentence p { margin: 0; color: var(--text-secondary); line-height: 1.5; font-size: 0.92rem; }

.practice-prompt {
    background: rgba(255,179,71,0.1);
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.8rem;
    border-left: 3px solid var(--accent);
    color: #8B6914;
    font-weight: 500;
    font-size: 0.92rem;
}

.practice-textarea {
    width: 100%;
    min-height: 70px;
    padding: 0.8rem;
    border: 2px solid var(--border-soft);
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.92rem;
    resize: vertical;
    transition: all 0.3s ease;
}
.practice-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,179,71,0.15);
}

.check-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.3s ease;
}
.check-btn:hover { background: #F0A030; transform: translateY(-1px); }

.memory-section { display: flex; flex-direction: column; gap: 0.6rem; }
.memory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem;
    background: rgba(124,92,252,0.04);
    border-radius: 8px;
}
.memory-label { font-weight: 600; color: var(--text-muted); font-size: 0.85rem; }
.word-highlight { color: var(--secondary); font-size: 1.05rem; font-weight: 700; }
.translation-highlight { color: var(--mint); font-size: 1.05rem; font-weight: 600; }

.frequency-badge { padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.78rem; font-weight: 700; color: white; }
.frequency-badge.rank-very-high { background: var(--primary); }
.frequency-badge.rank-high { background: var(--accent); }
.frequency-badge.rank-medium { background: var(--accent-light); color: var(--text-primary); }
.frequency-badge.rank-low { background: var(--text-muted); }

/* Quiz options in vocab */
.quiz-option.selected-correct { border-color: var(--mint); background: rgba(86,217,179,0.1); color: #155724; }
.quiz-option.selected-wrong { border-color: var(--primary); background: rgba(255,107,138,0.08); color: #721C24; }
.quiz-option.show-correct { border-color: var(--mint); background: rgba(86,217,179,0.12); }

/* Chinese vocabulary styles */
.chinese-vocab .chinese-word-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-soft);
    margin: 16px 0;
}

.chinese-characters-section {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.simplified-chinese, .traditional-chinese { text-align: center; flex: 1; min-width: 180px; }

.simplified-chinese h4, .traditional-chinese h4 {
    color: var(--secondary);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chinese-character-large {
    font-size: 3.5rem !important;
    font-weight: 300;
    color: var(--text-primary);
    margin: 8px 0;
    font-family: 'Microsoft YaHei', 'SimHei', sans-serif;
}

.pinyin-section {
    text-align: center;
    margin: 24px 0;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-lg);
    color: white;
    box-shadow: 0 6px 18px rgba(255,107,138,0.25);
}
.pinyin-section h4 { color: white; font-size: 0.78rem; font-weight: 700; margin-bottom: 8px; opacity: 0.9; }

.pinyin-display { font-size: 2.2rem !important; font-weight: 400; margin: 12px 0; }

.meaning-section {
    margin: 24px 0;
    padding: 20px;
    background: linear-gradient(135deg, #E8FFF5, #FFF0F3);
    border-radius: var(--radius-lg);
    border-left: 5px solid var(--secondary);
}
.meaning-section h4 { color: var(--text-primary); font-size: 0.92rem; font-weight: 700; margin-bottom: 12px; }
.meaning-text { font-size: 1.05rem; color: var(--text-secondary); line-height: 1.6; margin: 0; }

.level-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 12px;
    background: linear-gradient(135deg, #FFF5EB, #FFE8D6);
    border-radius: var(--radius-sm);
}

.hsk-badge {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: white;
    padding: 6px 14px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.level-section small { color: #8B6914; font-size: 0.78rem; }

@media (max-width: 768px) {
    .chinese-characters-section { flex-direction: column; gap: 12px; }
    .chinese-character-large { font-size: 2.8rem !important; }
    .pinyin-display { font-size: 1.8rem !important; }
    .chinese-word-card { padding: 18px; margin: 8px; }

    .vocabulary-display-container { padding: 12px; }
    .vocab-word-section, .interactive-learning-section, .vocab-quiz-section { padding: 18px 14px; }
    .word-title-display { font-size: 2.2rem; }
    .pronunciation-section { flex-direction: column; gap: 8px; }
    .vocab-controls { flex-direction: column; gap: 12px; text-align: center; }
    .vocab-buttons { width: 100%; justify-content: center; }
}

@media (min-width: 768px) {
    .modern-exercise-grid { grid-template-columns: 1fr 1fr; }
    .example-tile { grid-column: 1 / -1; }
}
@media (min-width: 1200px) {
    .modern-exercise-grid { grid-template-columns: 1fr 1fr 1fr; }
    .example-tile { grid-column: 1 / -1; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Recording */
.recording-controls { text-align: center; }
.recording-status { font-size: 1rem; margin-bottom: 16px; color: var(--text-muted); }
.recording-visual {
    width: 80px; height: 80px;
    border: 3px solid var(--border-soft);
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.recording-visual.active { border-color: var(--primary); animation: pulse 1s infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

.recording-buttons { display: flex; justify-content: center; gap: 12px; margin-bottom: 16px; }
.record-button { background: var(--primary); color: white; border: none; padding: 10px 18px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.95rem; font-family: var(--font-main); }
.record-button:hover { background: var(--primary-dark); }
.stop-button { background: var(--text-muted); color: white; border: none; padding: 10px 18px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.95rem; font-family: var(--font-main); }
.stop-button:hover { background: var(--text-secondary); }
.transcription { background: #FFF7FA; padding: 14px; border-radius: var(--radius-sm); min-height: 50px; font-style: italic; color: var(--text-muted); }

/* Touch optimizations */
@media (hover: none) and (pointer: coarse) {
    .icon-button { min-width: 44px; min-height: 44px; padding: 12px; }
    .activity-card { min-height: 90px; }
    .quiz-option { min-height: 50px; }
    .activity-card:hover { transform: none; }
    .quiz-option:hover { transform: none; }
    .start-button, .primary-button, .quiz-button { min-height: 50px; font-size: 16px; }
}

/* iOS fix */
@supports (-webkit-touch-callout: none) {
    .page { min-height: -webkit-fill-available; }
    .chat-layout { height: -webkit-fill-available; }
}

/* Print */
@media print {
    body { background: white; }
    .main-header, .icon-button, .back-button, .chat-input-container, .coffee-button, .coffee-section { display: none !important; }
}

/* Vocab lock screen */
.vocabulary-locked-screen {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    color: white;
    border-radius: var(--radius-xl);
    margin: 2rem 0;
}
.lock-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.vocabulary-locked-screen h3 { margin: 0 0 1rem; font-size: 1.6rem; }

.daily-progress-summary { background: rgba(255,255,255,0.1); padding: 1.2rem; border-radius: var(--radius-lg); margin: 1.2rem 0; }
.progress-bar-large { background: rgba(255,255,255,0.2); height: 16px; border-radius: 8px; overflow: hidden; margin: 0.8rem 0; }
.progress-fill-large { background: linear-gradient(90deg, var(--mint), #20C9A0); height: 100%; border-radius: 8px; transition: width 0.5s ease; }

.next-session-info { background: rgba(255,255,255,0.1); padding: 1.2rem; border-radius: var(--radius-lg); margin: 1.2rem 0; }

.locked-tips { background: rgba(255,255,255,0.1); padding: 1.2rem; border-radius: var(--radius-lg); margin: 1.2rem 0; text-align: left; }
.locked-tips ul { list-style: none; padding: 0; }
.locked-tips li { padding: 0.4rem 0 0.4rem 1.4rem; position: relative; }

.vocabulary-results {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-radius: var(--radius-xl);
    margin: 2rem 0;
}
.daily-progress { background: rgba(255,255,255,0.1); padding: 1.2rem; border-radius: var(--radius-lg); margin: 1.2rem 0; }
.progress-bar { background: rgba(255,255,255,0.2); height: 12px; border-radius: 6px; overflow: hidden; margin: 0.8rem 0; }
.progress-fill { background: linear-gradient(90deg, var(--mint), #20C9A0); height: 100%; border-radius: 6px; transition: width 0.5s ease; }

.vocabulary-locked { background: rgba(255,255,255,0.1); padding: 1.2rem; border-radius: var(--radius-lg); margin: 1.2rem 0; }
.vocabulary-locked h4 { margin: 0 0 0.8rem; color: var(--accent); }

/* ===== Lesson Completion Prompt ===== */
.complete-lesson-container {
    display: flex;
    justify-content: center;
    margin: 16px 0;
    padding: 0 10px;
}

.lesson-complete-prompt {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-xl);
    padding: 20px 24px;
    text-align: center;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 8px 28px rgba(255,107,138,0.3);
    animation: slideUp 0.4s ease-out;
}
.lesson-complete-prompt p { color: #fff; margin: 0 0 10px; font-size: 0.92rem; line-height: 1.5; }
.lesson-complete-prompt .lesson-hint { font-size: 0.78rem; opacity: 0.85; margin-top: 8px; margin-bottom: 0; }

.complete-lesson-button {
    background: white;
    color: var(--secondary);
    border: none;
    padding: 12px 24px;
    border-radius: 28px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}
.complete-lesson-button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.16); background: #F8F0FF; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tablet responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    .main-layout { gap: 18px; padding: 18px; }
    .sidebar { width: 260px; }
    .main-content { padding: 28px; }
    .menu-container h2 { font-size: 1.6rem; }
    .chat-sidebar { width: 240px; }
    .chat-right-panel { width: 240px; }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .main-layout { padding: 8px; }
    .sidebar { padding: 14px; }
    .main-content { padding: 14px; }
}
