/* ==========================================================================
   TIBETAN SARA BOOK & AI ASSISTANT - LUXURY BUDDHIST THEME
   Palette: Nâu trầm (#1A1210) • Đỏ đô (#56130D / #7D1B13) • Vàng Hoàng Kim (#D4AF37)
   Font: UTM Avo / Montserrat & Noto Serif Tibetan
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Noto+Sans+Tibetan:wght@500;600;700;800&family=Noto+Serif+Tibetan:wght@600;700;900&display=swap');

:root {
    /* Luxury Buddhist Color Palette */
    --bg-dark: #160E0C;
    --bg-surface: #221513;
    --bg-card: rgba(43, 25, 21, 0.85);
    --bg-card-hover: rgba(58, 32, 27, 0.95);
    
    --burgundy-dark: #380C08;
    --burgundy: #56130D;
    --burgundy-bright: #7D1B13;
    
    --gold: #D4AF37;
    --gold-light: #FCE794;
    --gold-bright: #F59E0B;
    --gold-dim: #A8892D;
    --gold-border: rgba(212, 175, 55, 0.28);
    --gold-border-hover: rgba(212, 175, 55, 0.65);
    --gold-glow: 0 0 16px rgba(212, 175, 55, 0.25);
    
    --text-primary: #FDFBF7;
    --text-secondary: #D4C3B7;
    --text-muted: #9E897C;
    
    --pdf-canvas-bg: #261916;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'UTM Avo', 'Avo', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
    font-family: 'UTM Avo', 'Avo', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tibetan-text {
    font-family: "Noto Serif Tibetan", "Noto Sans Tibetan", "Microsoft Himalaya", "Tibetan Machine Uni", serif;
    font-weight: 700;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    color: #FFF9E8;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.7);
    letter-spacing: 0.3px;
}

/* SVG Vector Icons General Styling */
.svg-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.gold-icon {
    color: var(--gold);
}

/* ==========================================================================
   1. TOP TOOLBAR (THANH ĐIỀU KHIỂN ĐỌC SÁCH THƯỢNG HẠNG)
   ========================================================================== */
.pdf-top-toolbar {
    background: linear-gradient(180deg, #2E1511 0%, #1D0E0C 100%);
    color: var(--text-primary);
    padding: 6px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gold-border);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
    flex-shrink: 0;
    z-index: 50;
    height: 52px;
}

.toolbar-left, .toolbar-center, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-tool {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--gold-border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-tool:hover {
    background: rgba(212, 175, 55, 0.14);
    border-color: var(--gold);
    color: var(--gold-light);
    box-shadow: var(--gold-glow);
    transform: translateY(-1px);
}

.btn-icon-only {
    width: 36px;
    height: 36px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 7px;
}

.btn-icon-only svg {
    margin: 0 !important;
}

.doc-title-badge {
    font-size: 13px;
    font-weight: 700;
    color: var(--gold-light);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 6px;
    letter-spacing: 0.2px;
}

.doc-title-text {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--gold-light);
}

.toolbar-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.page-jump-input {
    background: rgba(15, 8, 7, 0.85);
    border: 1px solid var(--gold-border);
    color: var(--gold-light);
    width: 44px;
    text-align: center;
    padding: 4px 6px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 12px;
    transition: border-color 0.2s;
}

.page-jump-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: rgba(212, 175, 55, 0.2);
    margin: 0 4px;
}

.zoom-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--gold-light);
    min-width: 42px;
    text-align: center;
}

/* Snip Tool Button */
.btn-crop-tool {
    background: linear-gradient(135deg, #7D1B13 0%, #4D0E08 100%);
    border: 1px solid var(--gold);
    color: var(--gold-light);
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(125, 27, 19, 0.4);
}

.btn-crop-tool:hover {
    background: linear-gradient(135deg, #962218 0%, #61130B 100%);
    border-color: var(--gold-light);
    box-shadow: 0 0 14px rgba(212, 175, 55, 0.45);
}

.hotkey-badge {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(212, 175, 55, 0.35);
    color: var(--gold-light);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 3px;
}

/* Speed Selector */
.speed-selector-group {
    display: flex;
    background: rgba(15, 8, 7, 0.85);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid var(--gold-border);
}

.btn-speed-opt {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-speed-opt:hover {
    color: var(--gold-light);
}

.btn-speed-opt.active {
    background: var(--gold);
    color: #1A0D0B;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.3);
}

/* Multi-Engine Voice Selector */
.voice-selector-container {
    position: relative;
    display: inline-block;
}

.btn-voice-select {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid var(--gold-border);
    border-radius: 6px;
    color: var(--gold-light);
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-voice-select:hover {
    background: rgba(212, 175, 55, 0.22);
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.35);
}

.voice-label-text {
    font-size: 11px;
    font-weight: 800;
    color: var(--gold-light);
    white-space: nowrap;
}

.voice-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 290px;
    background: linear-gradient(180deg, #2B1512 0%, #170C0A 100%);
    border: 1.5px solid var(--gold-border);
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.25);
    padding: 8px;
    z-index: 10005;
    animation: modalPop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.voice-menu-header {
    font-size: 10px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.5px;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    margin-bottom: 4px;
}

.voice-opt-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.voice-opt-item:hover {
    background: rgba(212, 175, 55, 0.15);
}

.voice-opt-item.active {
    background: rgba(212, 175, 55, 0.25);
    border: 1px solid var(--gold-border);
}

.voice-opt-icon {
    font-size: 16px;
    margin-top: 1px;
}

.voice-opt-info {
    flex: 1;
}

.voice-opt-title {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--gold-light);
    margin-bottom: 2px;
}

.voice-opt-desc {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.35;
}

/* Wacom Button */
.btn-wacom-tool {
    background: linear-gradient(135deg, rgba(86, 19, 13, 0.8) 0%, rgba(56, 12, 8, 0.8) 100%);
    border-color: var(--gold-border);
    color: var(--gold-light);
}

.btn-wacom-tool:hover {
    background: linear-gradient(135deg, #7D1B13 0%, #4D0E08 100%);
    border-color: var(--gold);
}

/* AI Assistant Trigger Button */
.btn-ai-slider-trigger {
    background: linear-gradient(135deg, #F59E0B 0%, #D4AF37 50%, #B45309 100%);
    color: #160E0C;
    border: 1px solid var(--gold-light);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 12px rgba(212, 175, 55, 0.4);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-ai-slider-trigger:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
}

/* ==========================================================================
   2. MAIN PDF WORKSPACE & TABLE OF CONTENTS
   ========================================================================== */
.pdf-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    background-color: var(--pdf-canvas-bg);
}

/* Collapsible Table of Contents Sidebar */
.pdf-toc-sidebar {
    width: 290px;
    background: linear-gradient(180deg, #201311 0%, #150B09 100%);
    border-right: 1px solid var(--gold-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    z-index: 20;
}

.pdf-toc-sidebar.collapsed {
    width: 0;
    border-right: none;
}

.toc-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gold-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.toc-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.5px;
}

.toc-tag-origin {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(212, 175, 55, 0.15);
}

.toc-items-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.toc-items-container::-webkit-scrollbar {
    width: 5px;
}

.toc-items-container::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.2);
    border-radius: 4px;
}

.toc-page-row {
    padding: 8px 10px;
    border-radius: 7px;
    cursor: pointer;
    margin-bottom: 4px;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.02);
}

.toc-page-row:hover {
    background: rgba(212, 175, 55, 0.08);
    border-color: var(--gold-border);
    transform: translateX(2px);
}

.toc-page-row.active {
    background: linear-gradient(135deg, rgba(125, 27, 19, 0.7) 0%, rgba(86, 19, 13, 0.7) 100%);
    border-color: var(--gold);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.toc-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.toc-page-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-light);
}

.toc-topic-tag {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    max-width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toc-page-row.active .toc-topic-tag {
    color: var(--gold-light);
}

.toc-row-title {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: "Noto Serif Tibetan", "UTM Avo", serif;
}

/* Main PDF Viewport (Hỗ trợ kéo di chuyển Pan & Zoom mượt mà) */
.pdf-viewport {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 24px;
    position: relative;
    background: radial-gradient(circle at center, #2C1B18 0%, #160D0B 100%);
    cursor: default;
    transition: padding-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.slider-active .pdf-viewport {
    padding-right: 430px;
}

.pdf-viewport.space-pan-ready,
.pdf-viewport.space-pan-ready * {
    cursor: grab !important;
}

.pdf-viewport.is-panning,
.pdf-viewport.is-panning * {
    cursor: grabbing !important;
    user-select: none !important;
}

.pdf-viewport::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.pdf-viewport::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 4px;
}

.pdf-viewport::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}

.pdf-page-container {
    position: relative;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(212, 175, 55, 0.15);
    border-radius: 4px;
    overflow: hidden;
    background-color: #FFFFFF;
    margin: auto;
    flex-shrink: 0;
    transition: box-shadow 0.2s ease;
}

#pdfCanvas {
    display: block;
}

/* PDF.js Text Layer for text selection */
.textLayer {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 0.25;
    line-height: 1.0;
}

.textLayer > span {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
}

.textLayer ::selection {
    background: rgba(212, 175, 55, 0.45);
}

/* ==========================================================================
   3. FLOATING AI ASSISTANT PILL (KHI BÔI ĐEN CHỮ TRÊN PDF)
   ========================================================================== */
.floating-ai-toolbar {
    position: absolute;
    display: none;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #2D1410 0%, #1A0B09 100%);
    border: 1px solid var(--gold);
    border-radius: 30px;
    padding: 4px 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 16px rgba(212, 175, 55, 0.3);
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: fadeInPill 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInPill {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.float-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    padding: 0 !important;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.18s ease;
}

.float-btn:hover {
    background: rgba(212, 175, 55, 0.25);
    color: var(--gold-light);
    transform: scale(1.12);
}

.float-btn-ai {
    background: linear-gradient(135deg, #F59E0B 0%, #D4AF37 100%);
    color: #1A0D0B;
}

.float-btn-ai:hover {
    background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
    color: #000;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
    transform: scale(1.15);
}

.float-divider {
    width: 1px;
    height: 16px;
    background: rgba(212, 175, 55, 0.25);
    margin: 0 2px;
}

.float-close-btn {
    padding: 5px 7px;
    color: var(--text-muted);
}

.float-close-btn:hover {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.15);
}

/* ==========================================================================
   4. SNIP / CROP RECTANGLE SCANNER (SPACE + D)
   ========================================================================== */
.crop-overlay-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9999;
    display: none;
    cursor: crosshair;
    backdrop-filter: blur(2px);
}

.crop-guide-banner {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2D1410 0%, #1A0B09 100%);
    border: 1px solid var(--gold);
    color: var(--gold-light);
    padding: 10px 22px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(212, 175, 55, 0.35);
}

.crop-selection-box {
    position: absolute;
    border: 2px dashed var(--gold);
    background: rgba(212, 175, 55, 0.15);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.35);
    pointer-events: none;
    display: none;
}

/* ==========================================================================
   5. RIGHT ASSISTANT DRAWER PANEL (TRỢ LÝ ẢO TIẾNG TẠNG)
   ========================================================================== */
.assistant-slider-panel {
    position: fixed;
    top: 52px;
    right: -750px;
    width: 440px;
    height: calc(100vh - 52px);
    background: linear-gradient(180deg, #241411 0%, #180D0B 100%);
    border-left: 1px solid var(--gold-border);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.65);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: right 0.32s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
}

.assistant-slider-panel.open {
    right: 0;
}

.assistant-slider-panel.expanded {
    width: 700px;
    max-width: 85vw;
}

.slider-resizer {
    position: absolute;
    left: -5px;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: ew-resize;
    z-index: 105;
    background: transparent;
    transition: background 0.2s ease;
}

.slider-resizer:hover {
    background: rgba(212, 175, 55, 0.4);
}

.slider-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #380C08 0%, #200E0C 100%);
    border-bottom: 1px solid var(--gold-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    color: var(--gold-light);
    letter-spacing: 0.3px;
}

.slider-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.slider-expand-btn,
.slider-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--gold-border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}

.slider-expand-btn:hover {
    color: var(--gold-light);
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.2);
    transform: scale(1.08);
}

.slider-close-btn:hover {
    color: #EF4444;
    border-color: #EF4444;
    background: rgba(239, 68, 68, 0.15);
}

.slider-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.slider-body::-webkit-scrollbar {
    width: 6px;
}

.slider-body::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.2);
    border-radius: 3px;
}

/* Cropped Preview */
.crop-preview-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--gold-border);
    border-radius: 8px;
    padding: 8px 10px;
}

.crop-preview-img {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
    margin: 4px auto 0;
    background: #FFF;
}

/* Target Tibetan Input Area */
.slider-target-box {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.slider-target-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-light);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.slider-tibetan-edit-container {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 8px;
}

.slider-tibetan-textarea {
    flex: 1;
    background: rgba(15, 8, 7, 0.9);
    border: 1.5px solid var(--gold-border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--gold-light);
    font-size: 28px !important;
    line-height: 1.7 !important;
    resize: vertical;
    min-height: 72px;
    white-space: pre-wrap;
    word-break: break-word;
    transition: all 0.2s ease;
}

.slider-tibetan-textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: var(--gold-glow);
}

.btn-reanalyze {
    background: linear-gradient(135deg, #7D1B13 0%, #4D0E08 100%);
    border: 1px solid var(--gold-border);
    color: var(--gold-light);
    width: 44px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-reanalyze:hover {
    border-color: var(--gold);
    background: linear-gradient(135deg, #962218 0%, #61130B 100%);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.35);
    transform: scale(1.05);
}

.slider-wylie-text {
    font-size: 12px;
    color: var(--gold-dim);
    font-style: italic;
    margin-bottom: 10px;
    word-break: break-word;
}

/* Quick Action Bar */
.slider-action-bar {
    display: flex;
    gap: 8px;
}

.btn-slider-act {
    flex: 1;
    height: 38px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--gold-border);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-slider-act:hover {
    background: rgba(212, 175, 55, 0.18);
    border-color: var(--gold);
    color: var(--gold-light);
    transform: translateY(-1px);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.btn-slider-tts {
    background: linear-gradient(135deg, rgba(86, 19, 13, 0.8) 0%, rgba(56, 12, 8, 0.8) 100%);
    border-color: rgba(212, 175, 55, 0.4);
    color: var(--gold-light);
}

.btn-slider-coach {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2) 0%, rgba(180, 83, 9, 0.2) 100%);
    border-color: rgba(212, 175, 55, 0.4);
    color: var(--gold-light);
}

/* Navigation Tabs */
.slider-nav-tabs {
    display: flex;
    background: rgba(15, 8, 7, 0.85);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid var(--gold-border);
    gap: 4px;
}

.slider-tab-btn {
    flex: 1;
    height: 38px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.slider-tab-btn:hover {
    color: var(--gold-light);
    background: rgba(212, 175, 55, 0.12);
}

.slider-tab-btn.active {
    background: linear-gradient(135deg, #7D1B13 0%, #56130D 100%);
    border: 1px solid var(--gold);
    color: var(--gold-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), var(--gold-glow);
}

/* Tab Views & Cards */
.slider-tab-view {
    display: none;
}

.slider-tab-view.active {
    display: block;
    animation: fadeInTab 0.2s ease;
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.slider-card {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: 9px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.slider-card-title {
    font-size: 11px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.slider-meaning-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--gold-light);
    margin-bottom: 4px;
    line-height: 1.4;
}

.slider-pos-text {
    font-size: 11px;
    color: var(--text-muted);
}

.slider-usage-text {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.buddhist-card-highlight {
    background: linear-gradient(135deg, rgba(86, 19, 13, 0.6) 0%, rgba(45, 23, 20, 0.7) 100%);
    border-color: var(--gold);
}

/* Spelling decomposition syllable card */
.syllable-breakdown-card {
    background: rgba(20, 12, 10, 0.85);
    border: 1px solid var(--gold-border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.syllable-breakdown-card:hover {
    border-color: var(--gold);
    box-shadow: var(--gold-glow);
}

.syllable-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gold-light);
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.syllable-wylie {
    font-size: 12px;
    color: var(--gold-dim);
    font-weight: 600;
}

.syllable-anatomy {
    font-size: 11px;
    color: var(--text-secondary);
    margin: 4px 0 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}

.syllable-steps {
    font-size: 11px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* AI Chatbox in Slider */
.ai-chat-box {
    display: flex;
    flex-direction: column;
    height: 380px;
}

.ai-chat-box-title {
    font-size: 11px;
    font-weight: 800;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.ai-chat-history {
    flex: 1;
    overflow-y: auto;
    background: rgba(15, 8, 7, 0.85);
    border: 1px solid var(--gold-border);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1.5;
}

.ai-chat-history::-webkit-scrollbar {
    width: 5px;
}

.ai-chat-history::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.2);
    border-radius: 3px;
}

.ai-chat-input-row {
    display: flex;
    gap: 6px;
}

.ai-chat-input-row input {
    flex: 1;
    background: rgba(15, 8, 7, 0.9);
    border: 1px solid var(--gold-border);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text-primary);
    font-size: 12px;
}

.ai-chat-input-row input:focus {
    outline: none;
    border-color: var(--gold);
}

.btn-ai-send {
    background: linear-gradient(135deg, #F59E0B 0%, #D4AF37 100%);
    border: none;
    color: #1A0D0B;
    padding: 0 14px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-ai-send:hover {
    box-shadow: var(--gold-glow);
    transform: translateY(-1px);
}

/* ==========================================================================
   6. PRONUNCIATION STUDIO MODAL (PHÒNG LUYỆN PHÁT ÂM)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.modal-card {
    background: linear-gradient(180deg, #241411 0%, #180D0B 100%);
    border: 1.5px solid var(--gold);
    border-radius: 12px;
    width: 90%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), var(--gold-glow);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 14px 18px;
    background: linear-gradient(135deg, #380C08 0%, #200E0C 100%);
    border-bottom: 1px solid var(--gold-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header h2 {
    font-size: 13px;
    font-weight: 800;
    color: var(--gold-light);
    letter-spacing: 0.5px;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--gold-border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    color: #EF4444;
    border-color: #EF4444;
    background: rgba(239, 68, 68, 0.15);
}

.modal-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.studio-target-card {
    background: rgba(15, 8, 7, 0.9);
    border: 1px solid var(--gold-border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.studio-tibetan {
    font-size: 32px;
    color: var(--gold-light);
    margin-bottom: 6px;
}

.studio-phonetics {
    font-size: 13px;
    color: var(--text-secondary);
}

.recorder-section {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}

.recorder-guide-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.recorder-status {
    font-size: 11px;
    color: var(--gold-dim);
    min-height: 18px;
    margin-bottom: 8px;
}

.record-btn-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.btn-record-action {
    border: none;
    padding: 8px 18px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-rec-start {
    background: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%);
    color: #FFF;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-rec-start:hover {
    transform: scale(1.03);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.5);
}

.btn-rec-stop {
    background: linear-gradient(135deg, #10B981 0%, #047857 100%);
    color: #FFF;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.side-by-side-audio {
    display: flex;
    gap: 10px;
}

.audio-box-card {
    flex: 1;
    background: rgba(15, 8, 7, 0.8);
    border: 1px solid var(--gold-border);
    border-radius: 8px;
    padding: 10px;
}

.audio-box-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 6px;
}

.btn-play-audio {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--gold-border);
    color: var(--text-primary);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    transition: all 0.2s ease;
}

.btn-play-audio:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--gold);
    color: var(--gold-light);
}

/* Score Assessment Card */
.score-assessment-card {
    background: linear-gradient(135deg, rgba(86, 19, 13, 0.8) 0%, rgba(45, 23, 20, 0.8) 100%);
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 14px;
}

.score-badge {
    font-size: 14px;
    font-weight: 800;
    color: var(--gold-light);
    text-align: center;
    margin-bottom: 4px;
}

.score-summary-text {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: #34D399;
    margin-bottom: 10px;
}

.score-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.score-item {
    font-size: 11px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 8px;
    border-radius: 5px;
    border: 1px solid rgba(212, 175, 55, 0.15);
}

/* Toast Message */
.toast-msg {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(50px);
    background: linear-gradient(135deg, #2D1410 0%, #1A0B09 100%);
    border: 1px solid var(--gold);
    color: var(--gold-light);
    padding: 10px 22px;
    border-radius: 25px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), var(--gold-glow);
    z-index: 99999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.toast-msg.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    border-top-color: var(--gold);
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 5px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   6. 3-COLUMN VOCABULARY TABLE & FULL SENTENCE TRANSLATION (NEW)
   ========================================================================== */
.full-trans-card {
    background: linear-gradient(135deg, rgba(86, 19, 13, 0.9) 0%, rgba(45, 23, 20, 0.95) 100%) !important;
    border: 1.5px solid var(--gold) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), var(--gold-glow);
}

.full-trans-quote {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--gold-light);
    line-height: 1.65;
    font-style: italic;
    padding: 4px 0 2px 0;
}

.table-scroll-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.25);
    background: rgba(18, 9, 8, 0.7);
}

.tibetan-vocab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
    text-align: left;
}

.tibetan-vocab-table thead {
    background: linear-gradient(135deg, rgba(139, 29, 21, 0.95) 0%, rgba(86, 19, 13, 0.95) 100%);
    border-bottom: 1.5px solid var(--gold);
}

.tibetan-vocab-table th {
    padding: 8px 10px;
    color: var(--gold-light);
    font-weight: 800;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tibetan-vocab-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.12);
    vertical-align: top;
}

.tibetan-vocab-table tbody tr:hover {
    background: rgba(212, 175, 55, 0.08);
}

.col-tibetan {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 26px !important;
    color: #FFF8E7 !important;
    font-weight: 700;
    line-height: 1.65;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.btn-table-play {
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--gold);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.btn-table-play:hover {
    background: var(--gold);
    color: #1A0D0B;
    transform: scale(1.15);
}

.col-phonetic {
    line-height: 1.4;
}

.phonetic-ipa {
    color: #34D399;
    font-weight: 700;
    font-size: 11.5px;
}

.phonetic-wylie {
    color: var(--text-muted);
    font-size: 10px;
    font-family: monospace;
}

.col-meaning {
    line-height: 1.45;
}

.meaning-vn {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 11.5px;
}

.badge-pos {
    display: inline-block;
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold-light);
    border: 1px solid rgba(212, 175, 55, 0.25);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 9.5px;
    font-weight: 700;
    margin-top: 3px;
}

/* Color-coded badges for Syllable breakdown */
.spelling-intro-banner {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 7px;
    padding: 8px 11px;
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 10px;
}

.syllable-title-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.syllable-badges-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 8px 0;
}

.badge-part {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.badge-part b {
    font-size: 18px !important;
    font-weight: 700;
}

.badge-root {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #FBBF24;
}

.badge-prefix {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #93C5FD;
}

.badge-suffix {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6EE7B7;
}

.badge-vowel {
    background: rgba(236, 72, 153, 0.15);
    border: 1px solid rgba(236, 72, 153, 0.4);
    color: #F472B6;
}

.monastery-formula-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(212, 175, 55, 0.22);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 8px;
}

.formula-title {
    font-size: 10.5px;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.formula-desc-note {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.spelling-step-row {
    font-size: 11.5px;
    color: var(--text-primary);
    padding: 3px 0;
    line-height: 1.5;
}

.syllable-lg {
    font-size: 36px !important;
    font-weight: 700;
    color: var(--gold-light) !important;
    line-height: 1.2;
}

/* Buddhist Sutra & Chanting Styles */
.buddhist-sutra-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 6px;
}

.sutra-tibetan-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--gold-light);
    line-height: 1.8;
    margin-bottom: 6px;
    border-bottom: 1px dashed rgba(212, 175, 55, 0.25);
    padding-bottom: 6px;
}

.sutra-chanting-label, .sutra-trans-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--gold);
    margin-top: 6px;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.sutra-chanting-text {
    font-size: 11.5px;
    color: #34D399;
    font-weight: 600;
    line-height: 1.5;
}

.sutra-trans-text {
    font-size: 12px;
    color: var(--text-primary);
    font-style: italic;
    line-height: 1.6;
}

/* AI Chat Suggestion Pills */
.ai-quick-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.ai-pill-btn {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.25);
    color: var(--gold-light);
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-pill-btn:hover {
    background: var(--gold);
    color: #1A0D0B;
    border-color: var(--gold);
    transform: translateY(-1px);
}

.ai-user-bubble {
    margin-bottom: 8px;
    color: var(--gold-light);
    font-size: 11.5px;
    background: rgba(212, 175, 55, 0.08);
    padding: 6px 10px;
    border-radius: 8px;
    border-left: 2px solid var(--gold);
}

.ai-bot-bubble {
    margin-bottom: 12px;
    background: rgba(36, 20, 17, 0.9);
    border: 1px solid var(--gold-border);
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--gold);
}

.ai-bot-header {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 4px;
}

.ai-bot-content {
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.65;
}

/* ==========================================================================
   PRACTICAL USAGE & REAL-WORLD DIALOGUE CARDS
   ========================================================================== */
.usage-practical-card {
    background: linear-gradient(135deg, rgba(42, 20, 16, 0.95) 0%, rgba(26, 12, 10, 0.95) 100%);
    border: 1px solid var(--gold-border);
}

.usage-situation-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 7px;
    padding: 9px 11px;
    margin-bottom: 10px;
}

.usage-situation-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 11.5px;
    line-height: 1.55;
}

.usage-tag {
    font-weight: 800;
    color: var(--gold-light);
    white-space: nowrap;
    font-size: 10.5px;
}

.usage-text {
    color: var(--text-secondary);
}

.usage-dialogues-container {
    background: rgba(0, 0, 0, 0.4);
    border: 1px dashed rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
}

.dialogues-header-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.dialogue-card-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dialogue-card-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.dialogue-speaker-badge {
    font-size: 10px;
    font-weight: 800;
    color: var(--gold);
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 4px;
    padding: 2px 5px;
    height: fit-content;
    white-space: nowrap;
}

.dialogue-content {
    flex: 1;
}

.dialogue-tibetan-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.dialogue-tibetan {
    font-size: 22px !important;
    font-weight: 700;
    color: var(--gold-light);
    line-height: 1.6;
}

.dialogue-wylie {
    font-size: 11px;
    color: #34D399;
    font-style: italic;
    margin-bottom: 2px;
}

.dialogue-vn {
    font-size: 11.5px;
    color: var(--text-primary);
    line-height: 1.45;
}

/* ==========================================================================
   🎴 FLASHCARD VOCABULARY MEMORIZATION MODAL & 3D FLIP STYLES
   ========================================================================== */
.btn-flashcard-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    width: auto;
    min-width: 36px;
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid var(--gold-border);
}

.btn-flashcard-trigger:hover {
    background: rgba(212, 175, 55, 0.25);
    border-color: var(--gold);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}

.vocab-badge-count {
    font-size: 11px;
    font-weight: 800;
    color: var(--gold-light);
    background: rgba(0, 0, 0, 0.4);
    padding: 1px 6px;
    border-radius: 10px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.flashcard-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.flashcard-modal-card {
    background: linear-gradient(180deg, #2A1512 0%, #170C0A 100%);
    border: 1.5px solid var(--gold-border);
    border-radius: 16px;
    width: 580px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 25px rgba(212, 175, 55, 0.25);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: modalPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.flashcard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gold-border);
    padding-bottom: 12px;
}

.flashcard-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    color: var(--gold-light);
    letter-spacing: 0.5px;
}

.flashcard-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Progress bar */
.flashcard-progress-bar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.flashcard-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

.flashcard-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    overflow: hidden;
}

.flashcard-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #D4AF37 0%, #10B981 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* 3D Flip Card Scene */
.flashcard-3d-scene {
    perspective: 1200px;
    width: 100%;
    height: 270px;
    cursor: pointer;
    user-select: none;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flashcard-inner.is-flipped {
    transform: rotateY(180deg);
}

.flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 12px;
    border: 1.5px solid rgba(212, 175, 55, 0.35);
    background: radial-gradient(circle at center, #351915 0%, #1B0D0B 100%);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.flashcard-front {
    gap: 12px;
}

.flashcard-back {
    transform: rotateY(180deg);
    gap: 8px;
    background: radial-gradient(circle at center, #261715 0%, #140B0A 100%);
    border-color: rgba(52, 211, 153, 0.4);
}

.fc-hint-tag {
    font-size: 9.5px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.85;
}

.fc-tibetan-text {
    font-size: 48px !important;
    font-weight: 800;
    color: #FFFDF5 !important;
    line-height: 1.35;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.6), 0 2px 6px rgba(0, 0, 0, 0.9);
    letter-spacing: 0.5px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.fc-back-tibetan {
    font-size: 26px !important;
    font-weight: 700;
    color: var(--gold-light);
}

.fc-phonetic-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fc-ipa {
    font-size: 14px;
    font-weight: 700;
    color: #34D399;
}

.fc-wylie {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.fc-meaning-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 90%;
    line-height: 1.5;
}

.fc-pos-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--gold-light);
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 2px 8px;
    border-radius: 12px;
}

.fc-click-guide {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.fc-btn-sound {
    background: rgba(212, 175, 55, 0.18);
    border: 1px solid var(--gold-border);
    color: var(--gold-light);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fc-btn-sound:hover {
    background: var(--gold);
    color: #1A0D0B;
    transform: scale(1.15);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.6);
}

/* Flashcard Controls */
.flashcard-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 4px;
}

.fc-ctrl-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid var(--gold-border);
    color: var(--gold-light);
    transition: all 0.2s ease;
}

.fc-ctrl-btn:hover {
    transform: translateY(-2px) scale(1.08);
}

.fc-btn-prev:hover, .fc-btn-next:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.2);
}

.fc-btn-flip {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #7D1B13 0%, #4D0E08 100%);
    border-color: var(--gold);
    color: #FFF;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.fc-btn-flip:hover {
    background: var(--gold);
    color: #1A0D0B;
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.6);
}

.fc-btn-wrong:hover {
    border-color: #EF4444;
    color: #EF4444;
    background: rgba(239, 68, 68, 0.2);
}

.fc-btn-correct:hover {
    border-color: #10B981;
    color: #10B981;
    background: rgba(16, 185, 129, 0.2);
}

/* ==========================================================================
   🎉 15-WORD MILESTONE CELEBRATION MODAL
   ========================================================================== */
.milestone-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.milestone-card {
    background: linear-gradient(180deg, #3A1713 0%, #1A0A08 100%);
    border: 2px solid var(--gold);
    border-radius: 18px;
    width: 480px;
    max-width: 95vw;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 35px rgba(212, 175, 55, 0.4);
    padding: 26px 28px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: modalPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.milestone-badge-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.3) 0%, rgba(212, 175, 55, 0.05) 100%);
    border: 1.5px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.milestone-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--gold-light);
    margin: 0;
    letter-spacing: 0.5px;
}

.milestone-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.milestone-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 6px;
}

.btn-milestone-review {
    flex: 2;
    background: linear-gradient(135deg, #D4AF37 0%, #AA820A 100%);
    border: 1px solid var(--gold-light);
    color: #1A0D0B;
    font-size: 13px;
    font-weight: 800;
    padding: 11px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.btn-milestone-review:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
}

.btn-milestone-later {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 11px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-milestone-later:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.12);
}

/* =========================================================================
   🎛️ NÚT NỔI MỞ TRỢ LÝ AI (SIDEPANEL TOGGLE BUTTON BÊN PHẢI MÀN HÌNH)
   ========================================================================= */
.floating-sidepanel-btn {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 998;
    background: linear-gradient(135deg, #7A1C14 0%, #430E09 100%);
    color: #F2C14E;
    border: 1.5px solid rgba(242, 193, 78, 0.7);
    border-right: none;
    border-radius: 12px 0 0 12px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: -4px 0 25px rgba(0, 0, 0, 0.75), 0 0 15px rgba(242, 193, 78, 0.25);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.floating-sidepanel-btn:hover {
    background: linear-gradient(135deg, #9E241A 0%, #5E140E 100%);
    color: #FFE5A3;
    padding-right: 14px;
    box-shadow: -6px 0 30px rgba(242, 193, 78, 0.5);
    transform: translateY(-50%) translateX(-2px);
}

.floating-sidepanel-btn svg {
    margin-bottom: 2px;
    filter: drop-shadow(0 0 4px rgba(242, 193, 78, 0.6));
}


