@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css');

/* ==========================================================================
   Chinese108 - Modern Pastel Warm Aesthetic Design System (สบายตา อบอุ่น เป็นกันเอง)
   Colors: Soft Terracotta Coral (#D86658), Warm Blush (#BA4F42), Honey Gold (#E8B86D)
   ========================================================================== */

:root {
    --primary: #D86658;
    --primary-dark: #BA4F42;
    --primary-light: #E88B80;
    --primary-soft: #FDF0EE;
    --gold: #E8B86D;
    --gold-dark: #C99446;
    --gold-light: #FEF8ED;
    --gold-glow: rgba(232, 184, 109, 0.22);
    
    --bg-page: #FAF7F4;
    --bg-surface: #FFFFFF;
    --bg-alt: #F4EFEB;
    
    --text-main: #2D3748;
    --text-muted: #718096;
    --text-light: #A0AEC0;
    --text-chinese: #1A202C;
    
    --border-color: #EAE2D8;
    --border-accent: #F4DCD5;
    
    --shadow-sm: 0 2px 8px rgba(186, 79, 66, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 6px 18px rgba(186, 79, 66, 0.08), 0 2px 6px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 14px 30px rgba(186, 79, 66, 0.10), 0 4px 10px rgba(0, 0, 0, 0.04);
    --shadow-gold: 0 6px 18px rgba(232, 184, 109, 0.22);
    
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --font-zh: "Noto Serif SC", "PingFang SC", "Microsoft YaHei", serif;
    --font-main: "Prompt", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}
a:hover {
    color: var(--primary-light);
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   Navigation Bar (Pastel Warm Theme)
   ========================================================================== */
.topbar {
    background: linear-gradient(90deg, #FDEAE6 0%, #FFF3EC 50%, #FDEEE9 100%);
    color: #8C4336;
    font-size: 13px;
    padding: 8px 0;
    border-bottom: 1px solid #F5D5CD;
}
.topbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1320px;
}
.topbar-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #FFFFFF;
    padding: 3px 12px;
    border-radius: var(--radius-full);
    color: var(--primary-dark);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(186, 79, 66, 0.08);
}

.navbar {
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-accent);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}
.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
    max-width: 1320px;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 21px;
    color: var(--primary);
    flex-shrink: 0;
}
.brand-seal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #E27B70, #D86658);
    color: #FFFFFF;
    border: 2px solid #FDE4D8;
    border-radius: 12px;
    font-family: var(--font-zh);
    font-size: 21px;
    font-weight: 900;
    box-shadow: 0 3px 8px rgba(216, 102, 88, 0.22);
    flex-shrink: 0;
}
.brand-text small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.5px;
}

.navbar nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    margin: 0 16px;
}
.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 6px;
    margin: 0;
    padding: 0;
}
.nav-links li {
    display: flex;
    align-items: center;
}
.nav-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-main);
    font-weight: 500;
    font-size: 14.5px;
    padding: 7px 14px;
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
}
.nav-links a:hover {
    color: var(--primary);
    background: var(--primary-soft);
}
.nav-links a.active {
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 600;
}

.nav-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    background: #FFF3D6;
    color: #9A6A15;
    border: 1px solid #F0C36D;
    border-radius: 4px;
    line-height: 1.3;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.lang-switch {
    display: inline-flex;
    background: var(--bg-alt);
    padding: 3px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}
.lang-btn {
    padding: 4px 10px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    transition: all 0.2s;
    text-decoration: none;
}
.lang-btn.active {
    background: var(--primary);
    color: #FFFFFF;
    box-shadow: 0 2px 4px rgba(139, 0, 0, 0.2);
}

.nav-admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-full);
    background: var(--bg-alt);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.nav-admin-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary-light);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--primary);
    cursor: pointer;
    padding: 6px;
}

/* ==========================================================================
   Hero Section with Chinese Brush Painting & Warm Atmosphere
   ========================================================================== */
.hero {
    position: relative;
    background-color: #FAF5F0;
    background-image: url('../images/hero-chinese-bg.webp');
    background-position: center 35%;
    background-size: cover;
    background-repeat: no-repeat;
    color: var(--text-main);
    padding: 68px 0 76px;
    overflow: hidden;
    border-bottom: 1px solid var(--border-accent);
}
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 253, 250, 0.72) 0%,
        rgba(255, 248, 243, 0.55) 45%,
        rgba(254, 238, 232, 0.85) 100%
    );
    pointer-events: none;
}
.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 840px;
    margin: 0 auto;
}
.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid #F5D3CA;
    color: var(--primary-dark);
    padding: 6px 18px;
    border-radius: var(--radius-full);
    font-size: 14px;
    margin-bottom: 16px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(186, 79, 66, 0.08);
    backdrop-filter: blur(4px);
}
.hero-title {
    font-size: 40px;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 14px;
    color: #1F2937;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}
.hero-title span {
    color: var(--primary);
}
.hero-desc {
    font-size: 18px;
    color: #4A5568;
    margin-bottom: 28px;
    line-height: 1.6;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
}

/* Hero Search Bar */
.hero-search {
    max-width: 620px;
    margin: 0 auto;
    position: relative;
}
.search-form {
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-full);
    padding: 6px;
    box-shadow: 0 10px 30px rgba(186, 79, 66, 0.12);
    border: 2px solid #F3DDD6;
    backdrop-filter: blur(6px);
}
.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 20px;
    font-size: 15px;
    font-family: inherit;
    border-radius: var(--radius-full) 0 0 var(--radius-full);
}
.search-btn {
    background: linear-gradient(135deg, #E27B70, #D86658);
    color: #FFFFFF;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 3px 8px rgba(216, 102, 88, 0.22);
}
.search-btn:hover {
    background: linear-gradient(135deg, #D86658, #BA4F42);
    box-shadow: 0 4px 12px rgba(186, 79, 66, 0.3);
}

/* ==========================================================================
   Free Translator Box (Red Card Component)
   ========================================================================== */
.translator-section {
    margin-top: -36px;
    position: relative;
    z-index: 10;
    margin-bottom: 48px;
}
.translator-card {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-accent);
    overflow: hidden;
}
.translator-header {
    background: linear-gradient(90deg, #FDF7F5, #FFFFFF);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.translator-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.lang-selector-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.lang-select {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #FFFFFF;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
}
.swap-btn {
    background: var(--primary-soft);
    border: 1px solid var(--border-accent);
    color: var(--primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.swap-btn:hover {
    background: var(--primary);
    color: #FFFFFF;
    transform: rotate(180deg);
}

.translator-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 180px;
}
.translator-pane {
    padding: 20px;
    display: flex;
    flex-direction: column;
}
.translator-pane.source {
    border-right: 1px solid var(--border-color);
}
.translator-pane.target {
    background: #FAF7F5;
}
.translate-textarea {
    width: 100%;
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 17px;
    color: var(--text-main);
    background: transparent;
    line-height: 1.6;
    min-height: 110px;
}
.translate-output {
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-chinese);
    font-family: var(--font-zh);
    min-height: 70px;
    white-space: pre-wrap;
}
.pinyin-preview {
    font-family: var(--font-main);
    font-size: 14px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 6px;
    min-height: 20px;
}

.translator-footer {
    padding: 12px 24px;
    background: #FFFFFF;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pane-tools {
    display: flex;
    gap: 8px;
}
.tool-btn {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.tool-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}
.btn-translate-action {
    background: linear-gradient(135deg, #E27B70, #D86658);
    color: #FFFFFF;
    border: none;
    padding: 10px 28px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 8px rgba(216, 102, 88, 0.22);
}
.btn-translate-action:hover {
    background: linear-gradient(135deg, #D86658, #BA4F42);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(186, 79, 66, 0.3);
}

/* ==========================================================================
   Section Headers & UI Cards
   ========================================================================== */
.section {
    padding: 48px 0;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
}
.section-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 24px;
    background: var(--gold);
    border-radius: 3px;
}
.section-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}
.view-more-link {
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.category-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 22px;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}
.category-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--gold));
    opacity: 0;
    transition: opacity 0.25s;
}
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-accent);
}
.category-card:hover::before {
    opacity: 1;
}
.category-icon {
    font-size: 36px;
    margin-bottom: 14px;
}
.category-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 6px;
}
.category-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
    margin-bottom: 14px;
}
.category-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

/* ==========================================================================
   Vocabulary Header Hero (Chinese Brush Painting & Archive Theme)
   ========================================================================== */
.vocab-hero {
    position: relative;
    background-color: #FAF6F1;
    background-image: url('../images/vocab-hero-bg.webp');
    background-position: center bottom;
    background-size: cover;
    background-repeat: no-repeat;
    border-bottom: 1px solid var(--border-accent);
    padding: 50px 0 44px;
    overflow: hidden;
}
.vocab-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 253, 250, 0.75) 0%,
        rgba(255, 249, 244, 0.60) 50%,
        rgba(254, 240, 235, 0.85) 100%
    );
    pointer-events: none;
}
.vocab-hero-content {
    position: relative;
    z-index: 1;
    max-width: 820px;
    margin: 0 auto;
    text-align: center;
}
.vocab-hero-title {
    font-size: 34px;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 12px 0 10px;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}
.vocab-hero-desc {
    font-size: 16px;
    color: #4A5568;
    line-height: 1.6;
    margin-bottom: 0;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
}

/* ==========================================================================
   Vocabulary Cards
   ========================================================================== */
.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 22px;
}
.vocab-card {
    background: #FFFFFF;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}
.vocab-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-accent);
}
.vocab-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.vocab-hanzi {
    font-family: var(--font-zh);
    font-size: 34px;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.1;
}
.vocab-pinyin {
    font-size: 15px;
    color: var(--gold-dark);
    font-weight: 600;
    margin-top: 4px;
}
.vocab-badges {
    display: flex;
    gap: 6px;
}
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}
.badge-hsk {
    background: var(--gold-light);
    color: var(--gold-dark);
    border: 1px solid rgba(212, 175, 55, 0.4);
}
.badge-pos {
    background: var(--primary-soft);
    color: var(--primary);
}

.vocab-meaning {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
}
.vocab-example {
    background: #FAF7F4;
    border-left: 3px solid var(--gold);
    padding: 10px 14px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
    margin-top: auto;
}
.example-zh {
    font-family: var(--font-zh);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-chinese);
    margin-bottom: 3px;
}
.example-py {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 3px;
}
.example-th {
    color: var(--text-main);
    font-size: 13px;
}

.audio-btn {
    background: var(--primary-soft);
    border: 1px solid var(--border-accent);
    color: var(--primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.audio-btn:hover {
    background: var(--primary);
    color: #FFFFFF;
    transform: scale(1.08);
}

/* ==========================================================================
   Dialogues Header Hero (Chinese Brush Painting & Tea Pavilion Theme)
   ========================================================================== */
.dialogues-hero {
    position: relative;
    background-color: #FAF6F1;
    background-image: url('../images/dialogues-hero-bg.webp');
    background-position: center 30%;
    background-size: cover;
    background-repeat: no-repeat;
    border-bottom: 1px solid var(--border-accent);
    padding: 56px 0 48px;
    overflow: hidden;
}
.dialogues-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 253, 250, 0.75) 0%,
        rgba(255, 249, 244, 0.60) 50%,
        rgba(254, 240, 235, 0.85) 100%
    );
    pointer-events: none;
}
.dialogues-hero > .container {
    position: relative;
    z-index: 2;
}
.dialogues-hero-content {
    position: relative;
    z-index: 2;
    max-width: 820px;
    margin: 0 auto;
    text-align: center;
}
.dialogues-hero-title {
    font-size: 34px;
    font-weight: 800;
    color: #7F1D1D;
    margin: 12px 0 10px;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}
.dialogues-hero-desc {
    font-size: 16px;
    color: #1E293B;
    line-height: 1.6;
    margin-bottom: 0;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
}
.dialogues-hero-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #FFFFFF;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 14px;
    border: 1.5px solid var(--primary);
    padding: 9px 20px;
    border-radius: var(--radius-full);
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(186, 79, 66, 0.15);
    transition: all 0.2s ease;
    cursor: pointer;
}
.dialogues-hero-back-btn i {
    color: var(--primary);
    transition: transform 0.2s ease, color 0.2s ease;
}
.dialogues-hero-back-btn:hover {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(186, 79, 66, 0.28);
}
.dialogues-hero-back-btn:hover i {
    color: #FFFFFF;
    transform: translateX(-3px);
}

/* ==========================================================================
   Situational Dialogues Components
   ========================================================================== */
.dialogues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
}
.dialogue-card {
    background: #FFFFFF;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
}
.dialogue-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-accent);
}
.dialogue-card-header {
    background: linear-gradient(135deg, #E27B70, #D86658);
    color: #FFFFFF;
    padding: 16px 20px;
}
.dialogue-category-pill {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.25);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    display: inline-block;
    margin-bottom: 6px;
    color: #FFFFFF;
    font-weight: 600;
}
.dialogue-card-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}
.dialogue-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.dialogue-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
}
.dialogue-lines-preview {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.dialogue-bubble {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
}
.dialogue-bubble.speaker-a {
    background: #FFF4F1;
    border-left: 3px solid var(--primary-light);
    align-self: flex-start;
}
.dialogue-bubble.speaker-b {
    background: #FEF9ED;
    border-left: 3px solid var(--gold);
    align-self: flex-start;
}
.bubble-speaker {
    font-weight: 700;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.bubble-zh {
    font-family: var(--font-zh);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-chinese);
}

/* ==========================================================================
   Articles Header Hero (Chinese Brush Painting Theme)
   ========================================================================== */
.articles-hero {
    position: relative;
    background-color: #FAF6F1;
    background-image: url('../images/vocab-hero-bg.webp');
    background-position: center bottom;
    background-size: cover;
    background-repeat: no-repeat;
    border-bottom: 1px solid var(--border-accent);
    padding: 50px 0 44px;
    overflow: hidden;
}
.articles-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 253, 250, 0.75) 0%,
        rgba(255, 249, 244, 0.60) 50%,
        rgba(254, 240, 235, 0.85) 100%
    );
    pointer-events: none;
}
.articles-hero-content {
    position: relative;
    z-index: 1;
    max-width: 820px;
    margin: 0 auto;
    text-align: center;
}
.articles-hero-title {
    font-size: 34px;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 12px 0 10px;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}
.articles-hero-desc {
    font-size: 16px;
    color: #4A5568;
    line-height: 1.6;
    margin-bottom: 0;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
}

/* ==========================================================================
   Longtail SEO & AEO Article Page Styles
   ========================================================================== */
.article-container {
    max-width: 860px;
    margin: 0 auto;
    background: #FFFFFF;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}
.article-header {
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 20px;
}
.article-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1.3;
    margin-bottom: 12px;
}
.article-meta {
    display: flex;
    gap: 18px;
    font-size: 13px;
    color: var(--text-muted);
}

/* AEO Quick Answer Box (Crucial for Perplexity / ChatGPT / Google AI Overviews) */
.quick-answer-box {
    background: linear-gradient(135deg, #FFF9EB, #FFF3DE);
    border: 2px solid #F5D399;
    border-radius: var(--radius-md);
    padding: 22px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-gold);
}
.quick-answer-title {
    font-size: 16px;
    font-weight: 800;
    color: #92580E;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.quick-answer-content {
    font-size: 16px;
    line-height: 1.7;
    color: #4A3A20;
}

/* Article Body Content */
.article-body {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-main);
}
.article-body h2 {
    font-size: 24px;
    color: var(--primary-dark);
    margin: 32px 0 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}
.article-body h3 {
    font-size: 19px;
    color: var(--primary);
    margin: 24px 0 12px;
}
.article-body p {
    margin-bottom: 16px;
}
.article-body ul, .article-body ol {
    margin: 0 0 20px 24px;
}
.article-body li {
    margin-bottom: 8px;
}

/* Vocab Table inside articles */
.vocab-table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.vocab-table th {
    background: linear-gradient(135deg, #E27B70, #D86658);
    color: #FFFFFF;
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
}
.vocab-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: #FFFFFF;
}
.vocab-table tr:nth-child(even) td {
    background: #FCFAF8;
}

/* FAQ Accordion Section */
.faq-section {
    margin-top: 40px;
    border-top: 2px dashed var(--border-color);
    padding-top: 30px;
}
.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    overflow: hidden;
    background: #FFFFFF;
}
.faq-question {
    padding: 16px 20px;
    font-weight: 700;
    font-size: 16px;
    color: var(--primary-dark);
    background: #FAF7F5;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.faq-answer {
    padding: 16px 20px;
    font-size: 15px;
    color: var(--text-main);
    line-height: 1.7;
    border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Footer Component
   ========================================================================== */
.footer {
    background: #2D333B;
    color: #CBD5E1;
    margin-top: auto;
    padding: 56px 0 24px;
    border-top: 3px solid var(--gold);
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 36px;
    margin-bottom: 40px;
}
.footer h4 {
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 18px;
    position: relative;
    padding-bottom: 8px;
}
.footer h4::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 28px;
    height: 2px;
    background: var(--gold);
}
.footer ul {
    list-style: none;
}
.footer li {
    margin-bottom: 10px;
}
.footer a {
    color: #94A3B8;
    font-size: 14px;
}
.footer a:hover {
    color: #F8D596;
}
.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #94A3B8;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast-msg {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1F2937;
    color: #FFFFFF;
    padding: 12px 22px;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast-msg.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Course System & Interactive Learning (HSK 1 Beginner Course)
   ========================================================================== */
.course-hero {
    position: relative;
    background-color: #FAF6F1;
    background-image: url('../images/course-hero-bg.webp');
    background-position: center bottom;
    background-size: cover;
    background-repeat: no-repeat;
    border-bottom: 1px solid var(--border-accent);
    padding: 50px 0 42px;
    overflow: hidden;
}
.course-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 253, 250, 0.72) 0%,
        rgba(255, 249, 244, 0.58) 50%,
        rgba(254, 240, 235, 0.85) 100%
    );
    pointer-events: none;
}
.course-hero-content {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0 auto;
    text-align: center;
}
.course-hero-title {
    font-size: 34px;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 12px 0 10px;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}
.course-hero-desc {
    font-size: 16px;
    color: #4A5568;
    line-height: 1.6;
    margin-bottom: 24px;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
}

/* Course Progress Tracker Card */
.course-progress-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #F2DDD5;
    border-radius: var(--radius-md);
    padding: 16px 22px;
    box-shadow: 0 8px 24px rgba(186, 79, 66, 0.09);
    max-width: 580px;
    margin: 0 auto;
    backdrop-filter: blur(6px);
}
.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}
.progress-label {
    font-weight: 600;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.progress-percent {
    background: var(--primary-soft);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
}
.progress-stats {
    font-size: 13px;
    color: var(--text-muted);
}
.progress-bar-track {
    width: 100%;
    height: 9px;
    background: var(--bg-alt);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold) 0%, var(--primary) 100%);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

/* 4-Stage Stepper */
.stages-stepper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 36px;
}
.stage-step-card {
    background: #FFFFFF;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 16px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: all 0.25s ease;
    text-decoration: none;
    color: var(--text-main);
}
.stage-step-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stage-step-card.active {
    border-color: var(--primary);
    background: #FFFAF8;
    box-shadow: 0 4px 16px rgba(216, 102, 88, 0.12);
}
.step-num {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: var(--radius-md);
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.25s ease;
}
.stage-step-card.active .step-num {
    background: var(--primary);
    color: #FFFFFF;
}
.step-info {
    overflow: hidden;
}
.step-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gold-dark);
    display: block;
    margin-bottom: 2px;
}
.step-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-chinese);
    line-height: 1.35;
    margin-bottom: 4px;
}
.step-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Course Layout: Sidebar + Main Area */
.course-layout {
    display: grid;
    grid-template-columns: 310px 1fr;
    gap: 32px;
    align-items: start;
}

/* Sidebar Navigation */
.course-sidebar {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 90px;
}
.sidebar-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.sidebar-header p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}
.lesson-nav-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lesson-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.lesson-nav-item:hover {
    background: var(--bg-alt);
}
.lesson-nav-item.active {
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 600;
    border-color: var(--border-accent);
}
.lesson-status-icon {
    font-size: 15px;
    color: var(--text-light);
    display: flex;
    align-items: center;
}
.lesson-status-icon .status-done {
    display: none;
    color: #38A169;
}
.lesson-nav-item.is-completed .lesson-status-icon .status-pending {
    display: none;
}
.lesson-nav-item.is-completed .lesson-status-icon .status-done {
    display: inline-block;
}
.lesson-nav-text {
    flex: 1;
    overflow: hidden;
}
.lesson-nav-title {
    display: block;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lesson-nav-time {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.sidebar-other-stages {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}
.sidebar-other-stages h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.stage-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.stage-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--bg-alt);
    color: var(--text-main);
    text-decoration: none;
}
.stage-pill:hover, .stage-pill.current {
    background: var(--primary);
    color: #FFFFFF;
}

/* Main Lesson Article */
.lesson-article {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 34px 40px;
    box-shadow: var(--shadow-sm);
}
.lesson-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.lesson-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 8px;
    line-height: 1.3;
}
.lesson-subtitle {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 22px;
}
.lesson-summary-box {
    background: linear-gradient(135deg, #FFF9EB 0%, #FFF3DE 100%);
    border-left: 4px solid var(--gold);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 16px 20px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 34px;
}
.summary-icon {
    font-size: 20px;
    color: var(--gold-dark);
    margin-top: 2px;
}
.lesson-summary-box strong {
    font-size: 14px;
    color: var(--gold-dark);
}
.lesson-summary-box p {
    font-size: 14px;
    color: var(--text-main);
    margin-top: 3px;
    line-height: 1.5;
}

.section-subheading {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 28px 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid var(--border-accent);
    padding-bottom: 8px;
}

/* Pinyin Soundboard Styles */
.pinyin-group-block {
    margin-bottom: 26px;
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}
.group-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-chinese);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pinyin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}
.pinyin-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}
.pinyin-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.pinyin-letter {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-dark);
    font-family: var(--font-zh);
}
.pinyin-thai {
    font-size: 13px;
    font-weight: 600;
    color: var(--gold-dark);
    margin-bottom: 4px;
}
.pinyin-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    min-height: 32px;
    margin-bottom: 8px;
}
.pinyin-sample {
    font-size: 11px;
    background: var(--bg-alt);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}
.sample-label {
    color: var(--text-muted);
    margin-right: 2px;
}
.sample-text {
    font-weight: 600;
    color: var(--primary);
}
.sound-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}
.pinyin-card:hover .sound-btn {
    background: var(--primary);
    color: #FFFFFF;
}

/* Vowels Grid */
.vowels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.vowel-card {
    background: #FFFFFF;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}
.vowel-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.vowel-card.highlight-special {
    background: #FFFBF5;
    border-color: var(--gold);
}
.vowel-symbol {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1;
    margin-bottom: 4px;
}
.vowel-thai {
    font-size: 14px;
    font-weight: 600;
    color: var(--gold-dark);
    margin-bottom: 8px;
}
.vowel-tip {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 12px;
    background: var(--bg-alt);
    padding: 6px 8px;
    border-radius: 4px;
}
.vowel-sample {
    font-size: 12px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 4px;
}
.compound-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.compound-item {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.compound-item:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.c-py {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-dark);
}
.c-th {
    font-size: 12px;
    color: var(--text-muted);
}
.c-sample {
    font-size: 11px;
    color: var(--gold-dark);
    margin-top: 2px;
}

/* Tone Cards */
.tones-table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}
.tone-card {
    background: #FFFFFF;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.tone-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.tone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.tone-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-alt);
    color: var(--text-main);
}
.tone-mark {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
}
.tone-pitch {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 12px;
}
.tone-sample-box {
    background: var(--bg-alt);
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}
.tone-sample-box .zh {
    font-size: 32px;
    font-weight: 800;
    font-family: var(--font-zh);
    color: var(--primary-dark);
    line-height: 1.1;
}
.tone-sample-box .py {
    font-size: 16px;
    font-weight: 700;
    color: var(--gold-dark);
}
.tone-sample-box .meaning {
    font-size: 12px;
    color: var(--text-muted);
}
.tone-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    min-height: 48px;
    margin-bottom: 12px;
}

/* Sandhi Rules */
.sandhi-rules-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.sandhi-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}
.sandhi-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 6px;
}
.sandhi-desc {
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.5;
    margin-bottom: 14px;
}
.sandhi-examples-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sandhi-example-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-alt);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}
.ex-orig .tag, .ex-pron .tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #E2E8F0;
    color: #4A5568;
    margin-right: 6px;
}
.ex-pron .tag.ok {
    background: #C6F6D5;
    color: #22543D;
}
.ex-arrow {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
}
.ex-pron {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ex-pron .meaning {
    font-size: 12px;
    color: var(--text-muted);
}

/* Distinctions */
.distinctions-container {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.distinction-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}
.pair-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pair-rule {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.pair-samples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}
.sample-pair-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-alt);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    gap: 12px;
}
.sub-sample {
    flex: 1;
    cursor: pointer;
    text-align: center;
}
.sub-sample .zh {
    font-size: 26px;
    font-weight: 800;
    font-family: var(--font-zh);
    color: var(--primary-dark);
}
.sub-sample .py {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold-dark);
}
.sub-sample .meaning {
    font-size: 11px;
    color: var(--text-muted);
}
.vs-divider {
    font-size: 12px;
    font-weight: 800;
    color: var(--primary);
    background: #FFFFFF;
    padding: 4px 8px;
    border-radius: var(--radius-full);
}

/* General Phrases Grid */
.phrases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.phrase-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}
.phrase-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.phrase-zh {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-chinese);
    font-family: var(--font-zh);
}
.phrase-py {
    font-size: 13px;
    font-weight: 600;
    color: var(--gold-dark);
    margin: 2px 0 4px;
}
.phrase-meaning {
    font-size: 13px;
    color: var(--text-muted);
}
.audio-btn-mini {
    background: var(--primary-soft);
    color: var(--primary);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    margin-left: 6px;
}
.phrase-card:hover .audio-btn-mini {
    background: var(--primary);
    color: #FFFFFF;
}

/* Numbers Grid */
.numbers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}
.number-cell {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.number-cell:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.num-arabic {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}
.num-zh {
    font-size: 26px;
    font-weight: 800;
    font-family: var(--font-zh);
    color: var(--primary-dark);
    line-height: 1.2;
}
.num-py {
    font-size: 13px;
    font-weight: 600;
    color: var(--gold-dark);
}
.num-th {
    font-size: 12px;
    color: var(--text-muted);
}

/* S-V-O Sentence Builder */
.svo-builder-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.svo-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.svo-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.svo-blocks {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.svo-block {
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    text-align: center;
}
.block-s {
    background: #EBF8FF;
    border: 1px solid #BEE3F8;
    color: #2B6CB0;
}
.block-v {
    background: #FFF5F5;
    border: 1px solid #FED7D7;
    color: var(--primary-dark);
}
.block-o {
    background: #F0FFF4;
    border: 1px solid #C6F6D5;
    color: #22543D;
}
.svo-tag {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}
.svo-word {
    font-size: 16px;
    font-weight: 700;
}
.svo-plus {
    font-weight: 800;
    color: var(--text-light);
}
.svo-full {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}
.svo-full .zh {
    font-size: 22px;
    font-family: var(--font-zh);
    color: var(--primary-dark);
}
.svo-full .py {
    font-size: 14px;
    font-weight: 600;
    color: var(--gold-dark);
}
.svo-full .th {
    font-size: 14px;
    color: var(--text-main);
}

/* Pronouns Table */
.pronouns-table-wrap {
    overflow-x: auto;
}
.pronoun-table {
    width: 100%;
    border-collapse: collapse;
}
.pronoun-table th, .pronoun-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    font-size: 14px;
}
.pronoun-table th {
    background: var(--bg-alt);
    font-weight: 700;
    color: var(--text-chinese);
}
.zh-cell {
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-zh);
    color: var(--primary-dark);
    cursor: pointer;
}

/* Question Patterns */
.questions-pattern-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.q-pattern-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}
.q-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
}
.q-word {
    font-size: 24px;
    font-weight: 800;
    font-family: var(--font-zh);
    color: var(--primary-dark);
}
.q-meaning {
    font-size: 14px;
    font-weight: 600;
    color: var(--gold-dark);
}
.q-usage {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.q-dialogue-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-alt);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
}
.q-ask, .q-ans {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}
.role-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}
.role-badge.q {
    background: #FED7D7;
    color: #C53030;
}
.role-badge.a {
    background: #C6F6D5;
    color: #22543D;
}
.q-ask .zh, .q-ans .zh {
    font-size: 18px;
    font-family: var(--font-zh);
    color: var(--text-chinese);
}
.q-ask .py {
    font-size: 12px;
    color: var(--gold-dark);
}
.q-ask .th {
    font-size: 12px;
    color: var(--text-muted);
}

/* Measure Words */
.formula-banner {
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 700;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 15px;
    text-align: center;
}
.measure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.measure-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}
.mw-word {
    font-size: 26px;
    font-weight: 800;
    font-family: var(--font-zh);
    color: var(--primary-dark);
    margin-bottom: 4px;
}
.mw-use {
    font-size: 13px;
    color: var(--text-main);
    margin-bottom: 8px;
}
.mw-ex {
    font-size: 12px;
    color: var(--primary);
    background: var(--bg-alt);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
}

/* Strokes Grid */
.strokes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.stroke-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    text-align: center;
}
.stroke-shape-display {
    font-size: 52px;
    font-family: var(--font-zh);
    color: var(--primary-dark);
    line-height: 1;
    margin-bottom: 8px;
}
.stroke-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-chinese);
}
.stroke-thai {
    font-size: 12px;
    color: var(--gold-dark);
    margin-bottom: 6px;
}
.stroke-dir {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    line-height: 1.4;
}
.stroke-ex {
    font-size: 12px;
    background: var(--bg-alt);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Stroke Rules */
.stroke-rules-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.stroke-rule-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.rule-number-badge {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
}
.rule-title-zh {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-dark);
    font-family: var(--font-zh);
}
.rule-title-th {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-chinese);
    margin-bottom: 4px;
}
.rule-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.rule-chars {
    font-size: 13px;
    color: var(--primary);
    background: var(--bg-alt);
    padding: 4px 10px;
    border-radius: 4px;
    display: inline-block;
}

/* Radicals Grid */
.radicals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.radical-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
}
.radical-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.radical-symbol {
    font-size: 38px;
    font-family: var(--font-zh);
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1;
}
.radical-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-chinese);
}
.radical-origin {
    font-size: 11px;
    color: var(--text-muted);
}
.radical-meaning {
    font-size: 13px;
    color: var(--text-main);
    margin-bottom: 12px;
}
.radical-examples-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.r-ex-item {
    background: var(--bg-alt);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.r-ex-item .zh {
    font-weight: 700;
    color: var(--primary-dark);
    font-family: var(--font-zh);
    font-size: 15px;
}
.r-ex-item .py {
    color: var(--gold-dark);
}
.r-ex-item .th {
    color: var(--text-muted);
}

/* Practice Quiz Container */
.lesson-quiz-container {
    background: linear-gradient(135deg, #FFFAF8 0%, #FFF5F2 100%);
    border: 2px solid var(--border-accent);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 40px;
}
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.quiz-badge {
    background: var(--primary);
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--radius-full);
}
.quiz-hint {
    font-size: 12px;
    color: var(--text-muted);
}
.quiz-question {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-chinese);
    margin-bottom: 16px;
}
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.quiz-option-btn {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-main);
    transition: all 0.2s ease;
}
.quiz-option-btn:hover {
    border-color: var(--primary);
    background: #FFFAF8;
}
.opt-letter {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-alt);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}
.quiz-option-btn.selected-correct {
    background: #F0FFF4;
    border-color: #38A169;
    color: #22543D;
}
.quiz-option-btn.selected-correct .opt-letter {
    background: #38A169;
    color: #FFFFFF;
}
.quiz-option-btn.selected-wrong {
    background: #FFF5F5;
    border-color: #E53E3E;
    color: #742A2A;
}
.quiz-option-btn.selected-wrong .opt-letter {
    background: #E53E3E;
    color: #FFFFFF;
}
.quiz-feedback {
    margin-top: 16px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: #FFFFFF;
    border: 1px solid var(--border-color);
}
.feedback-msg {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}
.feedback-msg.correct {
    color: #38A169;
}
.feedback-msg.wrong {
    color: #E53E3E;
}
.feedback-explanation {
    font-size: 13px;
    color: var(--text-muted);
}

/* Lesson Footer Actions */
.lesson-footer-actions {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.btn-complete-lesson {
    background: #FFFFFF;
    border: 2px solid var(--primary);
    color: var(--primary-dark);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.btn-complete-lesson:hover {
    background: var(--primary-soft);
}
.btn-complete-lesson.completed {
    background: #38A169;
    border-color: #38A169;
    color: #FFFFFF;
}
.lesson-pagination {
    display: flex;
    gap: 10px;
}
.page-nav-btn {
    background: var(--bg-alt);
    color: var(--text-main);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}
.page-nav-btn:hover {
    background: var(--primary);
    color: #FFFFFF;
}

/* Content Bridges */
.content-bridge-card {
    margin-top: 28px;
    background: linear-gradient(135deg, #FFF9EB 0%, #FFF3DE 100%);
    border: 1px solid #F5D399;
    border-radius: var(--radius-md);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.bridge-icon {
    font-size: 24px;
    color: var(--gold-dark);
}
.bridge-text {
    flex: 1;
}
.bridge-text h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-chinese);
    margin-bottom: 2px;
}
.bridge-text p {
    font-size: 12px;
    color: var(--text-muted);
}
.bridge-btn {
    background: var(--gold-dark);
    color: #FFFFFF;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}
.bridge-btn:hover {
    background: var(--gold);
    color: #FFFFFF;
}

/* Hub Welcome View */
.course-hub-welcome {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
}
.hub-stages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.hub-stage-card {
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 22px;
}
.hub-stage-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}
.hub-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.hub-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-dark);
    display: block;
}
.hub-stage-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-dark);
}
.hub-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 14px;
}
.hub-lessons-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.hub-lesson-link {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.hub-lesson-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}
.hub-lesson-link .time {
    color: var(--text-muted);
    font-size: 11px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1140px) {
    .nav-admin-text {
        display: none;
    }
    .nav-links {
        gap: 3px;
    }
    .nav-links a {
        padding: 6px 10px;
        font-size: 14px;
    }
}

@media (max-width: 992px) {
    .mobile-toggle {
        display: block;
    }
    .navbar nav {
        margin: 0;
        flex: 0;
    }
    .nav-links {
        display: none;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        background: #FFFFFF;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 16px 20px;
        box-shadow: var(--shadow-lg);
        border-bottom: 2px solid var(--primary);
        z-index: 999;
    }
    .nav-links.active {
        display: flex;
    }
    .nav-links a {
        padding: 10px 14px;
        border-radius: var(--radius-sm);
    }
    .stages-stepper {
        grid-template-columns: 1fr 1fr;
    }
    .course-layout {
        grid-template-columns: 1fr;
    }
    .course-sidebar {
        position: static;
    }
}

@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
    .translator-body {
        grid-template-columns: 1fr;
    }
    .translator-pane.source {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

@media (max-width: 768px) {
    .topbar .container {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }
    .hero-title,
    .course-hero-title,
    .vocab-hero-title,
    .dialogues-hero-title,
    .articles-hero-title {
        font-size: 26px;
    }
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .article-container {
        padding: 24px;
    }
    .word-layout {
        grid-template-columns: 1fr !important;
    }
    .stages-stepper {
        grid-template-columns: 1fr;
    }
    .lesson-article {
        padding: 20px;
    }
    .lesson-title {
        font-size: 22px;
    }
    .dialogues-hero {
        background-position: center bottom;
        padding: 40px 0 32px;
    }
}

/* ==========================================================================
   SEO-Friendly Lazy Loading & Rendering Performance
   ========================================================================== */

/* Modern content-visibility for offscreen elements to optimize INP & rendering */
@supports (content-visibility: auto) {
    /* For cards strictly below the initial fold (skip above-the-fold) */
    .vocab-grid .vocab-card:nth-child(n+7) {
        content-visibility: auto;
        contain-intrinsic-size: auto 220px;
    }
    
    .dialogue-card:nth-child(n+2) {
        content-visibility: auto;
        contain-intrinsic-size: auto 450px;
    }

    #articlesGrid .category-card:nth-child(n+7),
    .related-articles-section {
        content-visibility: auto;
        contain-intrinsic-size: auto 240px;
    }
}

/* Lazy Sentinel & Loading Animations */
.lazy-sentinel {
    width: 100%;
    min-height: 20px;
    margin: 20px 0;
    clear: both;
}

.lazy-loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.lazy-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid rgba(179, 39, 39, 0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: lazySpin 0.75s linear infinite;
}

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

/* Item entrance animation when appended by lazy load */
.item-lazy-appended {
    animation: lazyFadeInUp 0.35s ease-out forwards;
}

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

/* Responsive Image handling with lazy loading in articles */
.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: block;
    margin: 24px auto;
    transition: opacity 0.3s ease;
}

/* SEO & Accessibility Pagination Bar */
.seo-pagination-bar {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.seo-pagination-info {
    font-size: 13.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.seo-pagination-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.seo-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: #FFFFFF;
    color: var(--text-main);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.seo-page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.seo-page-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
}

.seo-page-link.prev,
.seo-page-link.next {
    padding: 0 14px;
}

.seo-page-dots {
    color: var(--text-light);
    padding: 0 4px;
}

/* When progressive infinite scroll is active */
.has-lazy-scroll .seo-pagination-bar {
    opacity: 0.85;
    margin-top: 36px;
}

