@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600&family=Roboto+Mono:wght@400;500&display=swap');

/* ============================================
   PAPER & EMERALD — hệ sáng đồng bộ web chủ
   (Sơn lại từ tông tối-vàng cũ. Chỉ đổi GIÁ TRỊ,
    giữ nguyên tên biến/class làm móc JS.)
   ============================================ */

:root {
    /* Sáng — giấy ấm + lục bảo trầm */
    --font: 'Manrope', system-ui, -apple-system, sans-serif;
    --font-mono: 'Roboto Mono', monospace;
    --bg-deep: #F6F3EC;
    --text-primary: #1A1714;
    --text-secondary: #6F6760;
    --text-muted: #A39A84;
    --text-shadow: none;
    --heading-shadow: none;

    /* Biến trước đây không định nghĩa (resolve fallback) — nay khai báo sáng */
    --gold: #1B5E4F;
    --heading: #1A1714;
    --border: #DED7C7;

    /* Nút chính — phẳng, lục bảo, BỎ gradient vàng */
    --button-primary: #1B5E4F;
    --button-primary-text: #F6F3EC;
    --button-primary-text-alt: #F6F3EC;

    /* Thẻ — mặt giấy đặc, viền mảnh, không glow, không blur */
    --glass-bg: #FBF9F3;
    --glass-border: 0.5px solid #DED7C7;
    --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    --glass-blur: 0;
    --glass-radius: 8px;
}

body {
    font-family: var(--font);
}

* {
    font-family: var(--font);
}

/* Icon styling - Ensure Font Awesome icons display correctly - MUST come after * selector */
i.fas,
i.fab,
i.far,
i.fal,
i.fad,
i.fa,
[class*="fa-"],
[class^="fa-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 6 Brands", "FontAwesome" !important;
    font-weight: 900 !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-transform: none !important;
    line-height: 1 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

i.fab,
[class*="fab fa-"] {
    font-family: "Font Awesome 6 Brands", "FontAwesome" !important;
    font-weight: 400 !important;
}

/* Ensure icons align properly in buttons */
button i.fas,
button i.fab,
button i.fa,
button [class*="fa-"],
a i.fas,
a i.fab,
a i.fa,
a [class*="fa-"] {
    vertical-align: middle !important;
    line-height: 1 !important;
}

/* Typography - headings stand out on complex background */

h1,
h2,
h3,
.app-title {
    text-shadow: var(--heading-shadow);
    color: #1A1714;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-primary);
    text-shadow: var(--text-shadow);
    min-height: 100vh;
    margin: 0;
}

/* Dark Glass - Oriental Fantasy */
.glass,
#cong-cu-container,
.tool-content,
.bg-gray-900\/50,
.hexagram-container,
.picker-content,
.qr-content,
.history-card,
.chat-msg,
#chat-history,
.notification,
.footer-contact {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--glass-radius);
}

/* Theme overrides - vàng trắng */
#cong-cu-container .text-yellow-500,
#cong-cu-container .text-yellow-400 {
    color: #1A1714 !important;
    text-shadow: var(--text-shadow);
}

#cong-cu-container .text-gray-400 {
    color: var(--text-muted) !important;
    text-shadow: var(--text-shadow);
}

#cong-cu-container .border-gray-700,
#cong-cu-container .border-gray-600,
#cong-cu-container .border-gray-500 {
    border-color: rgba(26, 23, 20, 0.15) !important;
}

#cong-cu-container .bg-gray-900\/50,
#cong-cu-container [class*="bg-gray-900"] {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: none !important;
    box-shadow: none !important;
    border-radius: var(--glass-radius);
}

/* Ô hiển thị Âm lịch - nền đen mờ, thống nhất với ô nhập */
#cong-cu-container .time-display-box.bg-gray-800 {
    background: rgba(0, 0, 0, 0.03) !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0.5rem;
}

#cong-cu-container .bg-gray-800 {
    background: rgba(0, 0, 0, 0.03) !important;
    border: none !important;
    border-radius: 0.5rem;
}

#cong-cu-container {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    border-radius: var(--glass-radius);
    overflow: hidden;
}

/* === APP DOCK NAVIGATION === */
.app-mini-header {
    display: flex;
    justify-content: center;
    margin: 0 0 2rem 0;
    padding: 0;
    background: transparent;
    position: relative;
    z-index: 100;
}

.app-mini-header-wrapper {
    width: 100%;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding: 0.5rem 1rem 1.5rem 1rem;
    margin-bottom: -1.5rem;
    display: flex;
    justify-content: center;
}
.app-mini-header-wrapper::-webkit-scrollbar {
    display: none;
}

@media (max-width: 768px) {
    .app-mini-header-wrapper {
        justify-content: flex-start;
    }
}

.app-dock {
    display: inline-flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0 1rem;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    pointer-events: auto;
    white-space: nowrap;
    border-bottom: 1px solid rgba(26, 23, 20, 0.1);
}

.dock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem 0.75rem 0.25rem;
    border-radius: 0;
    color: rgba(26, 23, 20, 0.5);
    text-decoration: none;
    transition: all 0.2s ease;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    z-index: 101;
    border-bottom: 2px solid transparent;
}

.dock-btn:hover {
    color: #1B5E4F;
    background: transparent;
    transform: none;
    border-bottom-color: rgba(27, 94, 79, 0.4);
}

.dock-btn.active {
    color: #1B5E4F;
    background: transparent;
    box-shadow: none;
    font-weight: 700;
    border-bottom-color: #1B5E4F;
    text-shadow: 0 0 12px rgba(27, 94, 79, 0.3);
}

.dock-divider {
    width: 1px;
    height: 18px;
    background: rgba(26, 23, 20, 0.2);
    margin: 0 0.25rem;
    flex-shrink: 0;
}

/* Gợi ý cuộn ngang: làm mờ mép khi còn app bị che (tự ẩn khi nav vừa khít / cuộn hết) */
.app-mini-header::before,
.app-mini-header::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 105;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.app-mini-header::before {
    left: 0;
    background: linear-gradient(to right, #FBF9F3, rgba(251, 249, 243, 0));
}

.app-mini-header::after {
    right: 0;
    background: linear-gradient(to left, #FBF9F3, rgba(251, 249, 243, 0));
}

.app-mini-header.has-overflow-left::before {
    opacity: 1;
}

.app-mini-header.has-overflow-right::after {
    opacity: 1;
}

.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.app-title {
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--heading);
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    text-shadow: none;
}

.app-slogan {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 1px;
    margin: 0;
    text-shadow: none;
}

/* === MINIMAL APP FOOTER === */
.app-footer-minimal {
    text-align: left;
    padding: 2rem 1.25rem 5.5rem;
    margin-top: 3rem;
    border-top: 1px solid rgba(26, 23, 20, 0.08);
}
.app-footer-minimal p {
    font-size: 0.85rem;
    color: var(--text-muted, #A39A84);
    letter-spacing: 0.5px;
    margin: 0;
}
/* Dòng nút "Liên hệ Zalo · Mời cà phê" (p cuối) căn giữa, trong khi câu cà phê căn trái */
.app-footer-minimal p:last-child {
    text-align: center;
}
.app-footer-minimal a {
    color: var(--gold, #1B5E4F);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}
.app-footer-minimal a:hover {
    color: #1B5E4F;
}

/* === QR DONATE MODAL === */
.qr-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}
.qr-overlay.active {
    display: flex;
}
.qr-box {
    background: #FBF9F3;
    border: 1px solid rgba(27, 94, 79, 0.4);
    border-radius: 16px;
    padding: 2rem;
    max-width: 360px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 0 30px rgba(27, 94, 79, 0.15);
}
.qr-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #6F6760;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}
.qr-close:hover {
    color: #1A1714;
}
.qr-box h3 {
    color: var(--gold, #1B5E4F);
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}
.qr-box > p {
    color: #6F6760;
    font-size: 0.85rem;
    margin: 0 0 1.25rem;
}
.qr-box img {
    width: 220px;
    height: 220px;
    margin: 0 auto 1rem;
    border-radius: 10px;
    border: 1px solid rgba(26, 23, 20, 0.1);
    background: #fff; /* QR phải nền trắng để quét được */
    object-fit: contain;
    display: block;
}
.qr-info {
    font-size: 0.8rem;
    color: #6F6760;
}
.qr-info span {
    color: #DED7C7;
    font-weight: 600;
}

@media (max-width: 768px) {
    .app-title {
        font-size: 1.5rem;
    }
}

/* === BUTTONS - Fire/Light gradient (Oriental Fantasy) === */
#gieoQueBtn,
.main-cta-btn,
.thailuu-ai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--button-primary);
    color: var(--button-primary-text);
    border: none;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1.5px;
    font-family: Arial, sans-serif !important;
    text-transform: uppercase;
    border-radius: 10px;
    transition: all 0.35s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 4px 12px rgba(27, 94, 79, 0.15);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    width: auto;
    min-width: 250px;
    cursor: pointer;
}

#gieoQueBtn::after,
.main-cta-btn::after,
.thailuu-ai-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(26, 23, 20, 0.2), transparent);
    transition: left 0.5s ease;
}

#gieoQueBtn:hover::after,
.main-cta-btn:hover::after,
.thailuu-ai-btn:hover::after {
    left: 100%;
}

#gieoQueBtn:hover,
.main-cta-btn:hover,
.thailuu-ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(27, 94, 79, 0.25),
                0 0 0 3px rgba(27, 94, 79, 0.15),
                inset 0 1px 0 rgba(26, 23, 20, 0.15);
}

.thailuu-ai-btn:disabled {
    opacity: 0.8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pdf-export-btn {
    background: var(--glass-bg);
    color: #1B5E4F;
    border: 1px solid rgba(27, 94, 79, 0.4);
    padding: 0.65rem 1.5rem;
    border-radius: var(--glass-radius);
    font-weight: bold;
    font-family: Arial, sans-serif !important;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--glass-shadow);
}

.pdf-export-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(27, 94, 79, 0.25);
}

.phone-input {
    width: 100%;
    padding: 14px 88px 14px 16px;
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(26, 23, 20, 0.2);
    border-radius: 0.5rem;
    color: #1A1714;
    font-size: 1rem;
}

.sim-timeline-scroll {
    -webkit-overflow-scrolling: touch;
}

.sim-ai-loading {
    text-align: center;
    padding: 1.5rem;
}

.sim-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 3px solid rgba(27, 94, 79, 0.3);
    border-top-color: #1B5E4F;
    border-radius: 50%;
    animation: sim-spin 0.8s linear infinite;
}

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

/* App Sim - Mini header với nút Lịch sử */
.sim-mini-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 2rem;
}

.sim-mini-header .app-mini-header-link {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(26, 23, 20, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: transparent;
    border: none;
    transition: color 0.2s;
}

.sim-mini-header .app-mini-header-link:hover {
    color: #1B5E4F;
}

.sim-mini-header .app-mini-header-link i {
    font-size: 1rem;
}

.sim-history-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: rgba(26, 23, 20, 0.9);
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.sim-history-btn:hover {
    color: #1B5E4F;
}

.sim-history-btn i {
    font-size: 1rem;
}

/* App Sim - Modal Lịch sử */
.sim-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.sim-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.sim-modal-content {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: var(--glass-radius);
    padding: 1.25rem;
    max-width: 400px;
    width: 100%;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--glass-shadow);
}

.sim-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(26, 23, 20, 0.1);
}

.sim-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sim-history-clear-btn {
    display: inline-flex;
    align-items: center;
    font-size: 0.8125rem;
    color: rgba(26, 23, 20, 0.7);
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 0.35rem 0.6rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.sim-history-clear-btn:hover {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.35);
    border-color: rgba(239, 68, 68, 0.6);
}

.sim-modal-close {
    color: rgba(26, 23, 20, 0.6);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
}

.sim-modal-close:hover {
    color: #1B5E4F;
}

.sim-history-modal-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sim-history-modal-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    color: #1A1714;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(26, 23, 20, 0.1);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: border-color 0.2s, background 0.2s;
}

.sim-history-modal-item:hover {
    border-color: rgba(27, 94, 79, 0.4);
    background: rgba(27, 94, 79, 0.08);
}

.sim-history-empty {
    color: rgba(26, 23, 20, 0.5);
    font-size: 0.9rem;
    padding: 1rem;
    text-align: center;
}

/* App Sim - Biểu đồ năng lượng (Energy Bar Chart) */
.sim-score-block {
    margin-bottom: 1.5rem;
}

.sim-score-block.hidden {
    display: none !important;
}

.sim-energy-chart {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(26, 23, 20, 0.1);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
}

.sim-energy-bar {
    margin-bottom: 0.75rem;
}

.sim-energy-bar:last-of-type {
    margin-bottom: 0;
}

.sim-energy-bar--thuThach {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(26, 23, 20, 0.2);
}

.sim-energy-bar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.sim-energy-bar-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: rgba(26, 23, 20, 0.75);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sim-energy-bar-level {
    font-size: 0.6875rem;
    font-weight: 600;
    color: rgba(26, 23, 20, 0.5);
}

.sim-energy-bar-track {
    height: 8px;
    background: #E9F0EC;
    border-radius: 4px;
    overflow: hidden;
}

.sim-energy-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* App Sim - Tiêu đề kết quả: phân tích cặp số, icon huyền học hiện đại */
.sim-result-section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1B5E4F;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 0 0 20px rgba(27, 94, 79, 0.25);
}

.sim-result-section-icon {
    font-size: 1.5rem;
    color: #1B5E4F;
    filter: drop-shadow(0 0 8px rgba(27, 94, 79, 0.5));
    animation: sim-icon-glow 3s ease-in-out infinite;
}

@keyframes sim-icon-glow {

    0%,
    100% {
        opacity: 1;
        filter: drop-shadow(0 0 8px rgba(27, 94, 79, 0.5));
    }

    50% {
        opacity: 0.9;
        filter: drop-shadow(0 0 14px rgba(27, 94, 79, 0.7));
    }
}

/* App Sim - 5 Nguyên tắc vàng (Accordion Tâm Pháp - Luxury) */
.principles-section {
    width: 100%;
}

.principles-details {
    border-radius: 8px;
    overflow: hidden;
}

.principles-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: linear-gradient(to right, #F1ECE1, #F1ECE1);
    border-top: 1px solid rgba(27, 94, 79, 0.3);
    border-bottom: 1px solid rgba(27, 94, 79, 0.3);
    color: #1B5E4F;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.2s ease;
}

.principles-summary::-webkit-details-marker,
.principles-summary::marker {
    display: none;
}

.principles-summary:hover {
    background: linear-gradient(to right, #DED7C7, #F1ECE1);
}

.principles-summary-text {
    text-align: center;
}

.principles-summary-arrow {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.principles-details[open] .principles-summary-arrow {
    transform: rotate(180deg);
}

.principles-content {
    padding: 1.25rem 1.5rem;
    background: rgba(241, 236, 225, 0.6);
    border: 1px solid rgba(26, 23, 20, 0.06);
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.principles-item {
    margin: 0 0 0.75rem 0;
    padding-left: 0.25rem;
    color: rgba(26, 23, 20, 0.88);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.principles-item:last-child {
    margin-bottom: 0;
}

.principles-item strong {
    color: rgba(27, 94, 79, 0.95);
}

.principles-item em {
    color: rgba(26, 23, 20, 0.85);
    font-style: italic;
}

.principles-item-icon {
    color: #1B5E4F;
    margin-right: 0.5rem;
    font-size: 0.75rem;
}

/* App Sim - Card Grid: dãn thẻ theo bề rộng trang, tỷ lệ cân đối */
.sim-timeline-wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    gap: 15px;
    padding: 0.5rem 0 1rem;
    width: 100%;
}

.sim-timeline-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    gap: 15px;
    width: 100%;
    max-width: 100%;
}

.sim-timeline-card {
    width: 120px;
    min-height: 200px;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    box-shadow: none;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.sim-timeline-card:hover {
    opacity: 0.95;
}

.sim-timeline-card--tienTai .hex-seal-wrapper {
    border-color: #1B5E4F;
    box-shadow: 0 0 15px rgba(27, 94, 79, 0.5), inset 0 0 10px rgba(27, 94, 79, 0.15);
}

.sim-timeline-card--tienTai .sim-timeline-card-name {
    color: #1B5E4F;
    text-shadow: 0 0 12px rgba(27, 94, 79, 0.4);
}

.sim-timeline-card--triTue .hex-seal-wrapper {
    border-color: #3B82F6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5), inset 0 0 10px rgba(59, 130, 246, 0.15);
}

.sim-timeline-card--triTue .sim-timeline-card-name {
    color: #3B82F6;
    text-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.sim-timeline-card--nhanSu .hex-seal-wrapper {
    border-color: #8B5CF6;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5), inset 0 0 10px rgba(139, 92, 246, 0.15);
}

.sim-timeline-card--nhanSu .sim-timeline-card-name {
    color: #8B5CF6;
    text-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
}

.sim-timeline-card--binh .hex-seal-wrapper {
    border-color: #6F6760;
    box-shadow: 0 0 12px rgba(111, 103, 96, 0.3), inset 0 0 10px rgba(0, 0, 0, 0.03);
}

.sim-timeline-card--binh .sim-timeline-card-name {
    color: #6F6760;
}

.sim-timeline-card-num {
    font-size: 1.375rem;
    font-weight: 700;
    color: #1A1714;
    margin-bottom: 0.35rem;
    letter-spacing: 0.04em;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sim-timeline-card-canvas {
    margin: 0.2rem 0;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hex-seal-wrapper {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #F6F3EC;
    background: radial-gradient(ellipse at center, #F1ECE1 0%, #F6F3EC 70%);
    border: 1px solid #1B5E4F;
    box-shadow: 0 0 15px rgba(27, 94, 79, 0.3), inset 0 0 10px rgba(27, 94, 79, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

.sim-timeline-card-canvas {
    padding: 0;
    margin: 0.2rem 0;
}

.sim-timeline-card-canvas canvas {
    display: block;
    margin: 0;
}

.sim-timeline-card.meaning-open {
    min-height: auto;
}

.sim-timeline-card-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(26, 23, 20, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: auto;
    line-height: 1.3;
    min-height: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.sim-timeline-card-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 0.35rem;
    flex-wrap: wrap;
}

.sim-card-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Ý nghĩa quẻ dưới mỗi card - bấm expand */
.sim-card-meaning {
    width: 100%;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(26, 23, 20, 0.1);
    padding-top: 0.5rem;
}

.sim-card-meaning-header {
    width: 100%;
    padding: 0.4rem 0;
    background: transparent;
    border: none;
    color: rgba(26, 23, 20, 0.85);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    transition: color 0.2s;
}

.sim-card-meaning-header:hover {
    color: #1B5E4F;
}

.sim-card-meaning-header i {
    font-size: 0.65rem;
    transition: transform 0.25s ease;
}

.sim-timeline-card.meaning-open .sim-card-meaning-header i {
    transform: rotate(180deg);
}

.sim-card-meaning-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sim-timeline-card.meaning-open .sim-card-meaning-body {
    max-height: 280px;
}

.sim-card-meaning-body-inner {
    padding: 0.5rem 0 0;
    color: rgba(26, 23, 20, 0.88);
    font-size: 0.6875rem;
    line-height: 1.5;
    text-align: left;
    overflow-y: auto;
    max-height: 260px;
}

.sim-timeline-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem;
    color: rgba(26, 23, 20, 0.22);
    font-size: 1.125rem;
    width: 24px;
}

/* ===== App Sim - Dịch Tượng (Chánh – Biến) ===== */
.sim-tong-quat-wrap {
    width: 100%;
}

/* Khung gộp chung */
.sim-tq-unified {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(27, 94, 79, 0.25);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Hàng chứa 2 hình quẻ + mũi tên */
.sim-tq-hex-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.sim-tq-hex-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.35rem;
    flex: 1;
}

/* Label CHÁNH / BIẾN */
.sim-tq-label {
    font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(27, 94, 79, 0.85);
}

.sim-tq-label--bien {
    color: rgba(27, 94, 79, 0.85);
}

/* Canvas wrap */
.sim-tq-canvas-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.15rem 0;
}

.hex-seal-wrapper--lg {
    width: 110px;
    height: 110px;
}

/* Tên quẻ dưới hình */
.sim-tq-hex-name {
    font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    color: rgba(26, 23, 20, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.3;
}

/* Mũi tên giữa */
.sim-tq-arrow-mid {
    flex-shrink: 0;
    font-size: 1.5rem;
    color: rgba(27, 94, 79, 0.4);
    line-height: 1;
    padding: 0 0.15rem;
    margin-top: 1rem;
}

/* Hàng ý nghĩa bên dưới */
.sim-tq-interp-row {
    display: flex;
    gap: 0;
    border-top: 1px solid rgba(26, 23, 20, 0.08);
    padding-top: 0.875rem;
}

.sim-tq-interp {
    flex: 1;
    min-width: 0;
    padding: 0 0.75rem;
}

.sim-tq-interp-divider {
    width: 1px;
    background: rgba(26, 23, 20, 0.1);
    flex-shrink: 0;
}

.sim-tq-interp-title {
    font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
    font-size: 0.8125rem;
    font-weight: 700;
    color: rgba(27, 94, 79, 0.9);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sim-tq-interp-title--bien {
    color: rgba(27, 94, 79, 0.9);
}

.sim-tq-interp-body p {
    font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
    margin: 0 0 0.3rem 0;
    font-size: 0.8125rem;
    color: rgba(26, 23, 20, 0.88);
    line-height: 1.5;
}

.sim-tq-interp-body p::before {
    content: '• ';
    color: rgba(27, 94, 79, 0.5);
}

.sim-tq-interp-footer {
    border-top: 1px solid rgba(26, 23, 20, 0.06);
    padding-top: 0.35rem;
    margin-top: 0.25rem;
}

.sim-tq-interp-footer em {
    font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
    font-size: 0.75rem;
    font-style: italic;
    color: #6F6760;
}

/* Responsive: trên mobile nhỏ, stack ý nghĩa */
@media (max-width: 380px) {
    .sim-tq-interp-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    .sim-tq-interp-divider {
        width: 100%;
        height: 1px;
    }
}

/* ===== App Sim - Luận giải chi tiết: list mobile / grid 2 cột desktop ===== */
.sim-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .sim-detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.sim-detail-block {
    border: 1px solid rgba(26, 23, 20, 0.12);
    border-radius: var(--glass-radius);
    background: #FBF9F3;
    padding: 1rem 1.25rem;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.sim-detail-block.sim-detail-block-active {
    background: rgba(27, 94, 79, 0.12);
    border-color: rgba(27, 94, 79, 0.45);
    box-shadow: 0 0 0 1px rgba(27, 94, 79, 0.2);
}

.sim-detail-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 0.75rem;
    margin: 0 0 0.5rem 0;
}

.sim-detail-title {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(26, 23, 20, 0.85);
    font-family: Arial, sans-serif !important;
}

.sim-detail-title--cat {
    color: #1B5E4F;
    text-shadow: 0 0 12px rgba(27, 94, 79, 0.35);
}

.sim-detail-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.sim-detail-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1B5E4F;
    background: transparent;
    border: 1px solid rgba(27, 94, 79, 0.6);
    border-radius: 0.25rem;
    padding: 0.2rem 0.4rem;
    line-height: 1;
}

.sim-detail-content {
    color: rgba(111, 103, 96, 1);
    font-size: 0.9375rem;
    line-height: 1.75;
    margin: 0;
}

/* App Sim - Luận giải chi tiết: Sang trọng, tối giản, học thuật; lưới đồng bộ 3 dòng + footer */
.sim-detail-block {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.detail-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin-top: 0.25rem;
    min-height: 0;
}

.detail-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: rgba(26, 23, 20, 0.92);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.detail-header .pair-badge {
    background: rgba(26, 23, 20, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 800;
    color: #1A1714;
    margin-right: 8px;
}

.detail-header .hex-name {
    color: inherit;
    margin-right: 0.25rem;
}

.detail-header .hex-meaning {
    color: rgba(27, 94, 79, 0.95);
    font-weight: 600;
}

.detail-header .tag {
    margin-left: auto;
    border: 1px solid;
    background: transparent;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    line-height: 1.2;
}

.detail-header .tag-money {
    border-color: #1B5E4F;
    color: #1B5E4F;
}

.detail-header .tag-intellect {
    border-color: #1B5E4F;
    color: #1B5E4F;
}

.detail-header .tag-nhan {
    border-color: #1B5E4F;
    color: #1B5E4F;
}

.detail-header .tag-challenge {
    border-color: #6F6760;
    color: #6F6760;
}

.detail-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 0;
    margin: 0 0 0.5rem 0;
}

.detail-body p {
    margin: 0 0 0.35rem 0;
    color: #1A1714;
    font-size: 0.9375rem;
    line-height: 1.5;
    flex-shrink: 0;
}

.detail-body p:last-child {
    margin-bottom: 0;
}

.detail-footer {
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(26, 23, 20, 0.1);
    flex-shrink: 0;
}

.detail-footer em {
    font-size: 0.8125rem;
    font-style: italic;
    color: #6F6760;
}

/* App Sim - Luận giải chi tiết: accordion cân xứng, thu hút */
.sim-accordion {
    border: var(--glass-border);
    border-radius: var(--glass-radius);
    overflow: hidden;
    background: var(--glass-bg);
    box-shadow: var(--glass-shadow);
}

.sim-accordion-item {
    border-bottom: 1px solid rgba(26, 23, 20, 0.08);
}

.sim-accordion-item:last-child {
    border-bottom: none;
}

.sim-accordion-header {
    width: 100%;
    padding: 1rem 1.25rem;
    text-align: left;
    background: rgba(0, 0, 0, 0.03);
    border: none;
    color: #1B5E4F;
    font-weight: 700;
    font-size: 1rem;
    font-family: Arial, sans-serif !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    transition: background 0.2s, border-color 0.2s;
    border-left: 3px solid transparent;
}

.sim-accordion-header:hover {
    background: rgba(27, 94, 79, 0.08);
}

.sim-accordion-header span {
    flex: 1;
}

.sim-accordion-header i.fa-chevron-down {
    transition: transform 0.25s ease;
    opacity: 0.9;
    flex-shrink: 0;
    color: #1B5E4F;
}

.sim-accordion-item.open .sim-accordion-header {
    background: rgba(27, 94, 79, 0.12);
    border-left-color: #1B5E4F;
}

.sim-accordion-item.open .sim-accordion-header i.fa-chevron-down {
    transform: rotate(180deg);
}

.sim-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.sim-accordion-item.open .sim-accordion-body {
    max-height: 520px;
}

.sim-accordion-body-inner {
    padding: 1.25rem 1.25rem 1.5rem;
    background: rgba(241, 236, 225, 0.5);
    border-top: 1px solid rgba(26, 23, 20, 0.06);
    color: rgba(26, 23, 20, 0.92);
    font-size: 0.9375rem;
    line-height: 1.75;
    text-align: left;
    border-left: 3px solid rgba(27, 94, 79, 0.35);
    margin-left: 0;
}

/* App Sim - Mobile: Card Grid giữ nguyên, chỉ điều chỉnh khoảng cách */
@media (max-width: 480px) {
    .sim-timeline-wrap {
        padding: 0.5rem 0 0.75rem;
        gap: 12px;
    }

    .sim-timeline-inner {
        gap: 12px;
    }

    .sim-timeline-card {
        width: 115px;
        min-height: 195px;
        padding: 0.6rem 0.4rem;
    }

    .sim-timeline-card-num {
        font-size: 18px;
        margin-bottom: 0.35rem;
    }

    .sim-timeline-card-name {
        font-size: 12px;
        letter-spacing: 0.03em;
    }

    .sim-card-meaning-body-inner {
        font-size: 0.625rem;
        max-height: 220px;
    }

    .sim-accordion {
        border-radius: 0.75rem;
    }

    .sim-accordion-header {
        padding: 0.875rem 1rem;
        font-size: 0.9375rem;
        min-height: 48px;
        -webkit-tap-highlight-color: transparent;
    }

    .sim-accordion-body-inner {
        padding: 1rem 1rem 1.25rem;
        font-size: 0.875rem;
        line-height: 1.7;
    }

    .main-cta-btn {
        width: 100%;
        min-width: unset;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 52px;
        border-radius: 0.75rem;
    }

    .thailuu-ai-btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        min-height: 48px;
        border-radius: 0.75rem;
    }

    .pdf-export-btn {
        width: 100%;
        padding: 0.75rem 1.25rem;
        min-height: 48px;
        border-radius: 0.75rem;
    }

    #simResultSection .text-yellow-500.text-xl,
    #simResultSection .text-yellow-500.text-lg {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .sim-timeline-card {
        width: 104px;
        min-height: 180px;
    }

    .sim-accordion-header {
        padding: 0.9375rem 1.125rem;
    }
}

.tab-navigation {
    gap: 1rem;
    padding-top: 0.75rem;
}

.tab-button {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: #1A1714;
    text-shadow: var(--text-shadow);
    border: var(--glass-border);
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: var(--glass-shadow);
    font-family: Arial, sans-serif !important;
}

.tab-button:hover {
    background: rgba(26, 23, 20, 0.25);
    box-shadow: var(--glass-shadow);
}

.tab-button.active {
    background: var(--button-primary) !important;
    color: var(--button-primary-text) !important;
    border: 1px solid rgba(26, 23, 20, 0.25);
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    box-shadow: var(--glass-shadow);
}

.tab-button.active:hover {
    box-shadow: 0 8px 24px rgba(27, 94, 79, 0.35);
}

#thaiLuuBtn {
    background: var(--button-primary);
    color: var(--button-primary-text);
    border: 1px solid rgba(26, 23, 20, 0.25);
    font-weight: bold;
    font-family: Arial, sans-serif !important;
    padding: 0.8rem 2rem;
    border-radius: var(--glass-radius);
    cursor: pointer;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s;
    width: auto;
    margin-top: 1.5rem;
    font-size: 1.1rem;
}

#thaiLuuBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(27, 94, 79, 0.35);
}

#pdfBtn {
    background: #1B5E4F;
    color: #FBF9F3;
    border: 1px solid #0E3B30;
    font-weight: bold;
    font-family: Arial, sans-serif !important;
    padding: 0.6rem 1.2rem;
    border-radius: var(--glass-radius);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(27, 94, 79, 0.3);
}

#pdfBtn:hover {
    background: #0E3B30;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(27, 94, 79, 0.4);
}

#pdfBtn.sim-pdf-btn {
    background: #1B5E4F;
    border-color: #0E3B30;
    box-shadow: 0 4px 12px rgba(27, 94, 79, 0.35);
}

#pdfBtn.sim-pdf-btn:hover {
    background: #0E3B30;
    border-color: #0E3B30;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(27, 94, 79, 0.4);
}

/* Nút Đọc Luận Giải (TTS) - Gieo Quẻ & Luận Sim */
.btn-speak {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--glass-radius, 0.5rem);
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #1B5E4F;
    background: linear-gradient(to right, #1B5E4F, #1B5E4F);
    color: #1A1714;
    box-shadow: 0 4px 12px rgba(27, 94, 79, 0.35);
}

.btn-speak:hover {
    background: linear-gradient(to right, #ea580c, #c2410c);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(27, 94, 79, 0.4);
}

.btn-speak.sim-pdf-btn-style {
    border-color: #b91c1c;
    background: linear-gradient(to right, #dc2626, #b91c1c);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

.btn-speak.sim-pdf-btn-style:hover {
    background: linear-gradient(to right, #ef4444, #dc2626);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

.btn-speak.loading i {
    animation: btn-speak-spin 0.8s linear infinite;
}

@keyframes btn-speak-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Icon đọc từng tin nhắn (Gieo Quẻ & Luận Sim) */
.chat-msg.chat-ai {
    position: relative;
}

.chat-msg-body {
    padding-right: 0;
    width: 100%;
}

.msg-read-btn {
    display: none !important;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(27, 94, 79, 0.4);
    color: #1B5E4F;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.msg-read-btn:hover {
    background: rgba(27, 94, 79, 0.7);
    color: #1B5E4F;
}

.msg-read-btn.playing {
    background: rgba(220, 38, 38, 0.5);
    color: #1A1714;
}

.msg-read-btn.loading i {
    animation: btn-speak-spin 0.8s linear infinite;
}

.tool-content {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--glass-shadow);
}

/* Input & Select (White Glass) */
input,
select,
textarea {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: 0.5rem;
    padding: 12px 16px;
    color: #1A1714;
    width: 100%;
    font-size: 1.05rem;
    font-family: Arial, sans-serif !important;
    text-shadow: var(--text-shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder,
textarea::placeholder {
    color: rgba(26, 23, 20, 0.7);
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(26, 23, 20, 0.5);
    outline: none;
    box-shadow: 0 0 0 2px rgba(26, 23, 20, 0.2);
}

/* Custom styling for the Date Picker Modal */
.picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.picker-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.picker-content {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    padding: 2rem;
    border-radius: var(--glass-radius);
    border: var(--glass-border);
    width: 95%;
    max-width: 500px;
    box-shadow: var(--glass-shadow);
}

.custom-select {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--text-primary);
    border: var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.5rem;
    font-size: 1rem;
    text-align: center;
    width: 100%;
    height: 45px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-select:focus {
    border-color: rgba(26, 23, 20, 0.5);
    outline: none;
    box-shadow: 0 0 0 2px rgba(26, 23, 20, 0.2);
}

.btn-apply {
    background: var(--button-primary);
    color: var(--button-primary-text);
    border: 1px solid rgba(26, 23, 20, 0.25);
    font-weight: bold;
    font-family: Arial, sans-serif !important;
    width: 100%;
    padding: 0.8rem;
    border-radius: var(--glass-radius);
    text-transform: uppercase;
    box-shadow: var(--glass-shadow);
    transition: all 0.2s;
}

.btn-apply:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(27, 94, 79, 0.35);
}

/* Nút VỀ HIỆN TẠI - viền vàng nhẹ, hover sáng lên */
.btn-now-modal {
    background: rgba(246, 243, 236, 0.7);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: #1A1714;
    text-shadow: var(--text-shadow);
    border: 1px solid rgba(27, 94, 79, 0.4);
    font-weight: bold;
    font-family: Arial, sans-serif !important;
    padding: 0.8rem;
    border-radius: var(--glass-radius);
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03), inset 0 1px 0 rgba(26, 23, 20, 0.06);
}

.btn-now-modal:hover {
    background: rgba(241, 236, 225, 0.85);
    border-color: rgba(27, 94, 79, 0.7);
    box-shadow: 0 0 16px rgba(27, 94, 79, 0.25), 0 4px 12px rgba(0, 0, 0, 0.03);
    transform: translateY(-1px);
}

.btn-now-modal:active {
    transform: translateY(0);
}

.btn-now-modal i {
    color: #1B5E4F;
    transition: color 0.3s ease;
}

.btn-now-modal:hover i {
    color: #1B5E4F;
}

/* === KHU VỰC NHẬP LIỆU - Sang trọng & Huyền bí === */
/* 1. Tiêu đề (Labels): Vàng Kim, in đậm */
#cong-cu-container .tool-content label {
    color: #1B5E4F !important;
    font-weight: bold !important;
    letter-spacing: 1px;
    text-shadow: 0 0 12px rgba(27, 94, 79, 0.25);
}

#cong-cu-container .tool-content label i {
    color: #1B5E4F !important;
}

/* 2. Đoạn trích dẫn (Quote): Xám bạc tối, nghiêng, nhẹ làm nền */
.input-section-quote {
    color: #6F6760 !important;
    font-style: italic;
    font-weight: 300;
}

/* Ô Dương lịch + Ô Âm lịch - bán kính đường bao đồng nhất */
.time-display-box,
.time-display-box .trigger-input {
    border-radius: 0.5rem;
}

/* Trigger Input - nền đen mờ, viền xám tối, focus vàng cam phát sáng */
.trigger-input-container {
    position: relative;
    cursor: pointer;
}

.trigger-input {
    cursor: pointer;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid #DED7C7 !important;
    color: #1A1714 !important;
    padding-right: 40px;
    text-align: center;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.trigger-input:focus {
    border-color: #1B5E4F !important;
    box-shadow: 0 0 0 2px rgba(27, 94, 79, 0.35);
    outline: none;
}

.calendar-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #1A1714;
    pointer-events: none;
}

.select-large {
    font-size: 1.1rem;
    height: 54px;
    text-align: center;
    text-align-last: center;
}

.select-large option {
    text-align: center;
}

/* Input Container for Mic - 3. Ô nhập: nền đen mờ, chữ trắng sáng, viền xám tối, focus vàng cam */
.input-wrapper {
    width: 100%;
    margin-top: 8px;
}

.input-inner {
    position: relative;
    width: 100%;
}

.input-inner .question-input {
    margin-top: 0;
}

.question-input {
    width: 100%;
    padding: 14px 88px 14px 16px;
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid #DED7C7 !important;
    border-radius: 0.5rem;
    color: #1A1714 !important;
    font-size: 1rem;
    margin-top: 8px;
    font-family: Arial, sans-serif !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    resize: none;
    overflow-y: hidden;
    min-height: 54px;
    line-height: 1.5;
}

.question-input::placeholder {
    color: rgba(26, 23, 20, 0.6);
}

.question-input:focus {
    border-color: #1B5E4F !important;
    box-shadow: 0 0 0 2px rgba(27, 94, 79, 0.35);
    outline: none;
}

/* 4. Nút Xóa & Micro - nằm trong ô, cố định ở trên, không vòng tròn */
.clear-btn {
    position: absolute;
    top: 8px;
    right: 48px;
    transform: none;
    color: #1A1714;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    z-index: 10;
}

.clear-btn i {
    font-size: 1rem;
    color: #1A1714;
}

.clear-btn:hover {
    color: #1B5E4F;
    transform: scale(1.1);
}

.clear-btn:hover i {
    color: #1B5E4F;
}

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

.mic-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    transform: none;
    color: #1A1714;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    z-index: 10;
}

.mic-btn i {
    font-size: 1.125rem;
    color: #1A1714;
    transition: transform 0.3s ease;
}

.mic-btn:hover {
    color: #1B5E4F;
    transform: scale(1.1);
}

.mic-btn:hover i {
    color: #1B5E4F;
}

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

.mic-btn.listening {
    color: #ef4444 !important;
}

.mic-btn.listening:hover {
    color: #ef4444;
}

.mic-btn.listening i {
    animation: mic-pulse 0.8s ease-in-out infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

label {
    font-weight: 600;
    color: #1A1714;
    text-shadow: var(--text-shadow);
    margin-bottom: 0.4rem;
    display: block;
    font-size: 0.95rem;
    font-family: Arial, sans-serif !important;
}

/* === VISUAL QUẺ (Glass) === */
#resultSection.visible,
#simResultSection.visible {
    animation: fadeIn 0.8s ease-out forwards;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hexagram-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    padding: 1.5rem;
    border-radius: var(--glass-radius);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    height: 100%;
    transition: filter 0.3s, box-shadow 0.3s;
}

.hexagram-container:hover {
    filter: brightness(1.05);
    box-shadow: var(--glass-shadow);
}

.hexagram-visual {
    width: 120px;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hexagram-name {
    text-transform: uppercase;
    font-weight: bold;
    font-size: 1.25rem;
    margin-top: 0.5rem;
    color: #1A1714;
    text-shadow: var(--heading-shadow);
    white-space: nowrap;
    font-family: Arial, sans-serif !important;
}

.hexagram-meaning {
    text-align: left;
    font-size: 1rem;
    color: rgba(26, 23, 20, 0.95);
    line-height: 1.6;
    border-top: var(--glass-border);
    padding-top: 1rem;
    width: 100%;
    font-family: Arial, sans-serif !important;
    text-shadow: var(--text-shadow);
}

/* Chữ nhấn đậm luận giải - màu vàng cam nổi bật */
.meaning-highlight {
    color: #1B5E4F;
    font-weight: 700;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(27, 94, 79, 0.4);
    font-family: Arial, sans-serif !important;
}

.hexagram-meaning strong,
.hexagram-meaning b {
    font-weight: 700;
    color: #1B5E4F;
    text-shadow: 0 0 8px rgba(27, 94, 79, 0.4);
}

/* === CHAT INTERFACE (Glass) === */
#chat-interface {
    margin-top: 2rem;
    border-top: var(--glass-border);
    padding-top: 1.5rem;
}

#chat-history {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--text-primary);
    border: var(--glass-border);
    border-radius: 0.75rem;
    height: 400px;
    overflow-y: auto;
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    box-shadow: var(--glass-shadow);
}

.chat-msg {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 0.8rem 1.2rem;
    border-radius: 0.5rem;
    line-height: 1.7;
    font-size: 1rem;
    font-family: Arial, sans-serif !important;
    font-weight: 400;
    position: relative;
    border: none;
    text-align: justify;
    color: #1A1714;
    text-shadow: var(--text-shadow);
    transition: filter 0.2s, box-shadow 0.2s;
}

.chat-msg:hover {
    filter: brightness(1.03);
}

.chat-ai {
    align-self: flex-start;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-left: none;
    color: #1A1714;
    text-shadow: var(--text-shadow);
}

.chat-ai strong,
.chat-ai b {
    color: #1B5E4F;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(27, 94, 79, 0.35);
}

.chat-user {
    align-self: flex-end;
    background: rgba(26, 23, 20, 0.2);
    border: none;
    color: #1A1714;
    text-shadow: var(--text-shadow);
    font-weight: 500;
}

.chat-input-wrapper {
    display: flex;
    width: 100%;
    align-items: flex-start !important;
    gap: 0.5rem;
}

.chat-input-container {
    position: relative;
    flex: 1;
}

#chatInput {
    background: rgba(0, 0, 0, 0.03) !important;
    color: #1A1714 !important;
    border: 1px solid #DED7C7 !important;
    border-right-color: transparent !important;
    padding: 10px 88px 10px 12px;
    border-radius: 0.5rem 0 0 0.5rem;
    width: 100%;
    min-height: 50px;
    max-height: 200px;
    resize: none;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    line-height: 1.5;
    font-size: 1rem;
    font-family: Arial, sans-serif !important;
    display: block;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#chatInput::-webkit-scrollbar {
    display: none;
}

#chatInput:focus {
    border-color: #1B5E4F !important;
    border-right-color: transparent !important;
    box-shadow: 0 0 0 2px rgba(27, 94, 79, 0.35);
    outline: none;
}

#chatInput::placeholder {
    color: rgba(26, 23, 20, 0.6);
}

.chat-clear-btn {
    position: absolute !important;
    right: 48px !important;
    top: 8px !important;
    bottom: auto !important;
    transform: none !important;
    width: 28px !important;
    height: 28px !important;
    color: #1A1714;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 4px;
    margin: 0 !important;
}

.chat-clear-btn i {
    font-size: 0.95rem;
    color: #1A1714;
}

.chat-clear-btn:hover {
    color: #1B5E4F;
    transform: scale(1.1);
}

.chat-clear-btn:hover i {
    color: #1B5E4F;
}

.chat-mic-btn {
    position: absolute !important;
    right: 8px !important;
    top: 8px !important;
    bottom: auto !important;
    transform: none !important;
    width: 28px !important;
    height: 28px !important;
    color: #1A1714;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    margin: 0 !important;
}

.chat-mic-btn i {
    color: #1A1714;
}

.chat-mic-btn:hover {
    color: #1B5E4F;
    transform: scale(1.1);
}

.chat-mic-btn:hover i {
    color: #1B5E4F;
}

.chat-mic-btn.listening {
    color: #ef4444 !important;
}

#sendBtn {
    background: var(--button-primary);
    color: var(--button-primary-text);
    border: 1px solid rgba(26, 23, 20, 0.25);
    padding: 0 1.5rem;
    border-radius: var(--glass-radius);
    font-weight: bold;
    font-family: Arial, sans-serif !important;
    cursor: pointer;
    height: 50px;
    flex-shrink: 0;
    align-self: flex-start !important;
    white-space: nowrap;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s;
    margin-top: 0;
}

#sendBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(27, 94, 79, 0.35);
}

.contact-glow {
    animation: pulse-glow 3s infinite ease-in-out;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: var(--glass-shadow);
        border-color: rgba(26, 23, 20, 0.3);
    }

    50% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
        border-color: rgba(26, 23, 20, 0.45);
    }
}

.cta-question {
    color: #1A1714;
    text-shadow: var(--text-shadow);
}

.zalo-button {
    display: inline-block;
    background: linear-gradient(to right, #0084ff, #0066cc);
    color: #1A1714;
    padding: 0.6rem 1.5rem;
    border-radius: var(--glass-radius);
    font-weight: bold;
    font-family: Arial, sans-serif !important;
    text-decoration: none;
    border: 1px solid #0084ff;
    box-shadow: 0 4px 12px rgba(0, 132, 255, 0.3);
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.zalo-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 132, 255, 0.4);
}

.zalo-button.zalo-btn-send-mode {
    animation: zalo-shake 2.5s ease-in-out infinite;
}

@keyframes zalo-shake {

    0%,
    90%,
    100% {
        transform: translateY(-2px) translateX(0);
    }

    92% {
        transform: translateY(-2px) translateX(-2px);
    }

    94% {
        transform: translateY(-2px) translateX(2px);
    }

    96% {
        transform: translateY(-2px) translateX(-2px);
    }

    98% {
        transform: translateY(-2px) translateX(2px);
    }
}

/* Nút Mời cà phê - tông vàng cam hài hòa với tổng thể, sọc chéo nhẹ, chữ rõ ràng */
.coffee-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1B5E4F 0%, #1B5E4F 50%, #1B5E4F 100%);
    color: #1A1714 !important;
    padding: 0.65rem 1.5rem;
    border-radius: 9999px;
    font-weight: bold;
    font-family: Arial, sans-serif !important;
    text-decoration: none;
    border: 1px solid rgba(27, 94, 79, 0.5);
    box-shadow: 0 4px 14px rgba(27, 94, 79, 0.4), 0 1px 3px rgba(0, 0, 0, 0.03), inset 0 1px 0 rgba(26, 23, 20, 0.2);
    cursor: pointer;
    transition: all 0.35s ease;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* Sọc chéo nhẹ (vàng cam đậm / sáng) - không che chữ */
.coffee-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(-45deg,
            transparent 0px,
            transparent 5px,
            rgba(26, 23, 20, 0.07) 5px,
            rgba(26, 23, 20, 0.07) 10px);
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}

.coffee-button::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(26, 23, 20, 0.18) 0%, transparent 50%);
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}

.coffee-button>* {
    position: relative;
    z-index: 1;
}

.coffee-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(27, 94, 79, 0.4), 0 2px 8px rgba(0, 0, 0, 0.03);
    filter: brightness(1.08);
}

.coffee-button:active {
    transform: translateY(-1px) scale(1);
}

.coffee-button i {
    color: #1A1714 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease;
}

.coffee-button:hover i {
    transform: scale(1.1);
}

#qrModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#qrModal.active {
    opacity: 1;
    pointer-events: auto;
}

.qr-content {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    padding: 2.5rem;
    border-radius: var(--glass-radius);
    border: var(--glass-border);
    text-align: center;
    max-width: 90%;
    width: 400px;
    position: relative;
    box-shadow: var(--glass-shadow);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #1A1714;
    text-shadow: var(--text-shadow);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: #1A1714;
    filter: brightness(1.1);
}

.close-modal i {
    font-size: 1.5rem;
}

/* History Card (Glass) */
.history-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    box-shadow: var(--glass-shadow);
}

.history-card:hover {
    filter: brightness(1.08);
    box-shadow: var(--glass-shadow);
    border-color: rgba(26, 23, 20, 0.4);
}

.history-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-shadow: var(--text-shadow);
}

.history-question {
    font-weight: bold;
    color: #1A1714;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: var(--text-shadow);
}

.history-result {
    color: #1B5E4F;
    font-size: 0.9rem;
    text-shadow: var(--text-shadow);
}

.btn-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #EF4444;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
    z-index: 10;
}

.btn-delete:hover {
    color: #DC2626;
    transform: scale(1.1);
}

.empty-history {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem;
    text-shadow: var(--text-shadow);
    font-family: Arial, sans-serif !important;
}

/* Actions Row in Chat */
.chat-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
    border-top: var(--glass-border);
    padding-top: 8px;
}

/* Text-to-Speech Button */
.tts-btn {
    background: var(--button-primary);
    color: var(--button-primary-text);
    border: 1px solid rgba(26, 23, 20, 0.25);
    border-radius: var(--glass-radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: Arial, sans-serif !important;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
    min-height: 36px;
    box-shadow: var(--glass-shadow);
}

.tts-btn .tts-label {
    font-size: 0.875rem;
    white-space: nowrap;
}

.tts-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(27, 94, 79, 0.35);
}

.tts-btn:active {
    transform: translateY(0);
}

.tts-btn i {
    font-size: 0.875rem;
}

/* Speaking state */
.chat-msg.speaking {
    border-left: 4px solid #1B5E4F;
    background: #E9F0EC !important;
    animation: speaking-pulse 2s ease-in-out infinite;
}

@keyframes speaking-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(27, 94, 79, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(27, 94, 79, 0);
    }
}

/* Notification (White Glass) */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: #1A1714;
    text-shadow: var(--text-shadow);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    z-index: 10000;
    max-width: 350px;
    font-size: 0.9375rem;
    font-family: Arial, sans-serif !important;
    line-height: 1.5;
    border-left: 4px solid rgba(26, 23, 20, 0.6);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-info {
    border-left-color: #3b82f6;
}

.notification-error {
    border-left-color: #ef4444;
    background: rgba(127, 29, 29, 0.4);
}

.notification-success {
    border-left-color: rgba(26, 23, 20, 0.8);
}

/* Improved Mic Button States - không vòng tròn */
.mic-btn.listening {
    color: #ef4444 !important;
}

.mic-btn.listening i {
    animation: mic-pulse 0.8s ease-in-out infinite;
}

@keyframes mic-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Mobile TTS Button */
@media (max-width: 768px) {
    .tts-btn {
        padding: 0.5rem;
        font-size: 0.8125rem;
        min-height: 40px;
    }

    .tts-btn span {
        display: none;
    }

    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: 100%;
        transform: translateY(-100px);
    }

    .notification.show {
        transform: translateY(0);
    }
}

/* ============================================
   MOBILE OPTIMIZATION - Smartphone Friendly
   ============================================ */

@media (max-width: 768px) {

    /* Base Container */
    body {
        font-size: 16px;
        /* Prevent zoom on iOS */
        -webkit-text-size-adjust: 100%;
    }

    #cong-cu-container {
        padding: 1rem;
        margin: 0.5rem auto;
        border-radius: 0.75rem;
        width: auto !important;
        max-width: calc(100% - 1rem);
    }

    .app-mini-header {
        margin: -1rem -1rem 0.5rem -1rem;
        padding-left: 1rem;
    }

    /* Header */
    .app-header {
        margin: -1rem -1rem 1.5rem -1rem;
        padding: 0.75rem 1rem 1rem;
        border-radius: 0;
    }

    .app-title {
        font-size: 1.5rem !important;
    }

    .app-slogan {
        font-size: 0.875rem !important;
        margin-top: 0.5rem;
    }

    /* Navigation Tabs - 2 hàng, mỗi hàng 2 mục, cân đối tổng thể */
    #cong-cu-container .tab-navigation {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 0.625rem;
        padding: 0.5rem 0 0.75rem;
        margin-bottom: 1rem;
        width: 100%;
        max-width: 100%;
        place-items: stretch;
    }

    #cong-cu-container .tab-navigation .tab-button {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        text-align: center;
        white-space: normal;
        line-height: 1.25;
        box-sizing: border-box;
    }

    #cong-cu-container .tab-navigation .tab-button i {
        font-size: 0.875rem;
        margin-right: 0.375rem;
        flex-shrink: 0;
    }

    /* Tool Content */
    .tool-content {
        padding: 1rem;
        border-radius: 0.5rem;
    }

    .tool-content p {
        font-size: 0.875rem;
        line-height: 1.6;
        margin-bottom: 1rem;
    }

    /* Date Picker Section */
    .bg-gray-900\/50 {
        padding: 1rem !important;
    }

    .flex.flex-col.md\:flex-row {
        flex-direction: column;
        gap: 1rem;
    }

    .w-full.md\:w-1\/2 {
        width: 100%;
    }

    label {
        font-size: 0.8125rem;
        margin-bottom: 0.5rem;
    }

    .trigger-input,
    .bg-gray-800.border {
        height: 48px !important;
        /* Larger touch target */
        font-size: 1rem !important;
        /* Prevent zoom on iOS */
    }

    .calendar-icon {
        width: 24px;
        height: 24px;
        right: 12px;
    }

    /* Input Fields */
    .input-wrapper {
        margin-top: 0.5rem;
    }

    .question-input {
        min-height: 48px !important;
        /* Larger touch target */
        padding: 12px 88px 12px 14px !important;
        font-size: 1rem !important;
        /* Prevent zoom on iOS */
        line-height: 1.5;
    }

    .clear-btn {
        width: 36px;
        height: 36px;
        right: 48px;
        top: 6px;
        transform: none;
    }

    .mic-btn {
        width: 36px;
        height: 36px;
        top: 6px;
        right: 8px;
        transform: none;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mic-btn i {
        font-size: 1.125rem;
    }

    /* Select Dropdowns */
    .select-large,
    .custom-select {
        height: 48px !important;
        font-size: 1rem !important;
        /* Prevent zoom */
        padding: 0.75rem;
    }

    /* Buttons */
    #gieoQueBtn {
        width: 100%;
        min-width: unset;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 52px;
        /* Large touch target */
        border-radius: 0.5rem;
    }

    #thaiLuuBtn {
        width: 100%;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 48px;
        margin-top: 1rem;
    }

    #sendBtn {
        min-height: 48px;
        padding: 0 1.5rem;
        font-size: 0.9375rem;
        align-self: flex-start !important;
    }

    #pdfBtn {
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    /* Result Section */
    #resultSection {
        margin-top: 1.5rem;
    }

    .grid.grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .hexagram-container {
        padding: 1rem;
        border-radius: 0.5rem;
    }

    .hexagram-visual {
        width: 100px;
        margin-bottom: 0.75rem;
    }

    .hexagram-name {
        font-size: 1rem;
        margin-top: 0.5rem;
    }

    .hexagram-meaning {
        font-size: 0.875rem;
        line-height: 1.6;
        padding-top: 0.75rem;
    }

    /* Chat Interface */
    #chat-interface {
        margin-top: 1.5rem;
        padding-top: 1rem;
    }

    #chat-history {
        height: 350px;
        padding: 1rem;
        font-size: 0.9375rem;
        border-radius: 0.5rem;
    }

    .chat-msg {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
        line-height: 1.6;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .chat-input-wrapper {
        flex-direction: row;
        gap: 0.5rem;
        align-items: flex-end;
    }

    .chat-input-container {
        flex: 1;
        position: relative;
    }

    #chatInput {
        width: 100%;
        min-height: 48px;
        padding: 12px 88px 12px 12px;
        font-size: 1rem;
        border-radius: 0.5rem;
    }

    .chat-clear-btn {
        right: 48px !important;
        top: 5px !important;
        bottom: auto !important;
        transform: none !important;
    }

    .chat-mic-btn {
        position: absolute !important;
        right: 8px !important;
        top: 5px !important;
        bottom: auto !important;
        transform: none !important;
        width: 32px !important;
        height: 32px !important;
    }

    /* Date Picker Modal */
    .picker-modal {
        padding: 1rem;
    }

    .picker-content {
        width: 95%;
        max-width: 100%;
        padding: 1.25rem;
        border-radius: 0.75rem;
    }

    .picker-content h3 {
        font-size: 1.125rem;
    }

    .grid.grid-cols-3.gap-3 {
        gap: 0.5rem;
    }

    .grid.grid-cols-2.gap-4 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .btn-apply,
    .btn-now-modal {
        min-height: 48px;
        padding: 0.875rem;
        font-size: 0.9375rem;
    }

    /* QR Modal */
    .qr-content {
        width: 95%;
        max-width: 100%;
        padding: 1.5rem;
        border-radius: 0.75rem;
    }

    .qr-content h3 {
        font-size: 1.125rem;
    }

    .close-modal {
        width: 36px;
        height: 36px;
        top: 8px;
        right: 12px;
    }

    /* History Cards */
    .history-card {
        padding: 0.875rem;
        margin-bottom: 0.75rem;
    }

    .history-time {
        font-size: 0.75rem;
    }

    .history-question {
        font-size: 0.9375rem;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        margin-bottom: 0.375rem;
    }

    .history-result {
        font-size: 0.875rem;
    }

    .btn-delete {
        width: 36px;
        height: 36px;
        font-size: 1.125rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Footer */
    footer {
        margin-top: 2rem;
        padding-top: 1.5rem;
        font-size: 0.875rem;
    }

    footer .flex.flex-wrap.justify-center.gap-4 {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .zalo-button,
    .coffee-button {
        width: 100%;
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
        min-height: 48px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .zalo-button i,
    .coffee-button i {
        margin-right: 0.5rem;
    }

    /* Grid Layouts */
    .grid.grid-cols-1.md\:grid-cols-2.gap-6 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Manual Hexagram Selection */
    .grid.grid-cols-1.md\:grid-cols-2.gap-6.mb-6 {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    /* Result Grid */
    .grid.grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr;
    }

    /* Text Sizes */
    .text-sm {
        font-size: 0.8125rem;
    }

    .text-base {
        font-size: 0.9375rem;
    }

    .text-lg {
        font-size: 1rem;
    }

    /* Spacing Adjustments */
    .mb-8 {
        margin-bottom: 1.5rem;
    }

    .mb-6 {
        margin-bottom: 1.25rem;
    }

    .mb-4 {
        margin-bottom: 1rem;
    }

    .mb-10 {
        margin-bottom: 2rem;
    }

    /* Prevent text selection on buttons for better UX */
    button {
        -webkit-tap-highlight-color: rgba(139, 92, 246, 0.3);
        -webkit-touch-callout: none;
        user-select: none;
        touch-action: manipulation;
        /* Remove 300ms delay */
    }

    /* Smooth scrolling */
    * {
        -webkit-overflow-scrolling: touch;
    }

    /* Improve touch targets */
    a,
    button,
    input,
    select,
    textarea {
        min-height: 44px;
        /* Minimum touch target size */
    }

    /* Better spacing for mobile */
    .mb-8 {
        margin-bottom: 1.5rem !important;
    }

    /* Modal improvements */
    .picker-modal,
    #qrModal {
        padding: 0.5rem;
    }


    /* History list improvements */
    #historyList {
        max-height: 50vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Empty state */
    .empty-history {
        padding: 3rem 1rem;
        font-size: 0.875rem;
    }

    /* Improve readability */
    .text-gray-400 {
        font-size: 0.8125rem;
        line-height: 1.6;
    }

    /* Better form field spacing */
    .mb-6 {
        margin-bottom: 1.25rem !important;
    }

    /* Result section spacing */
    #resultSection.visible {
        margin-top: 1.5rem;
    }
}

/* Tablet Optimization */
@media (min-width: 481px) and (max-width: 768px) {
    #cong-cu-container {
        padding: 1.25rem;
    }

    header h2 {
        font-size: 2rem !important;
    }

    .tab-button {
        padding: 0.75rem 1.25rem;
    }
}

/* Desktop - Keep original styles */
@media (min-width: 769px) {
    /* Desktop styles remain unchanged */
}

/* ============================================
   LANDING PAGE STYLES
   Trang chủ Hệ sinh thái Dịch Lý
   ============================================ */

.landing-page {
    background-color: #F6F3EC;
    color: #1A1714;
    font-family: Arial, sans-serif !important;
}

/* Header */
.landing-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(246, 243, 236, 0.95);
    border-bottom: 1px solid rgba(27, 94, 79, 0.2);
    padding: 0.75rem 1rem;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1B5E4F;
    text-decoration: none;
    letter-spacing: 0.05em;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-menu .nav-link {
    color: rgba(26, 23, 20, 0.9);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-menu .nav-link:hover {
    color: #1B5E4F;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(26, 23, 20, 0.3);
    color: #1A1714;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
}

/* Hero */
.hero {
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(180deg, #F6F3EC 0%, #F1ECE1 100%);
}

.hero-inner {
    max-width: 700px;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: #1A1714;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-slogan {
    font-size: clamp(1rem, 2.5vw, 1.35rem);
    color: #1B5E4F;
    font-style: italic;
    margin-bottom: 2rem;
    font-weight: 400;
}

.hero-cta {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: linear-gradient(to right, #1B5E4F, #1B5E4F);
    color: #1A1714;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0.5rem;
    box-shadow: 0 4px 14px rgba(27, 94, 79, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.hero-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(27, 94, 79, 0.5);
}

/* About */
.about {
    padding: 4rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.about-inner {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 3rem;
    align-items: center;
}

.about-image-placeholder {
    aspect-ratio: 4/3;
    background: rgba(241, 236, 225, 0.8);
    border: 1px solid rgba(27, 94, 79, 0.3);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: #1B5E4F;
}

.about-content .section-title {
    color: #1B5E4F;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.about-text {
    color: rgba(26, 23, 20, 0.9);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.about-link {
    color: #1B5E4F;
    text-decoration: none;
    font-weight: 600;
}

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

/* Ecosystem */
.ecosystem {
    padding: 4rem 1rem;
    background: rgba(241, 236, 225, 0.5);
}

.ecosystem-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.ecosystem .section-title {
    text-align: center;
    color: #1B5E4F;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.ecosystem-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.ecosystem-card {
    background: rgba(241, 236, 225, 0.6);
    border: 1px solid rgba(26, 23, 20, 0.1);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ecosystem-card-active {
    border-color: #1B5E4F;
    box-shadow: 0 0 20px rgba(27, 94, 79, 0.25);
}

.ecosystem-icon {
    font-size: 2.5rem;
    color: #1B5E4F;
    margin-bottom: 0.75rem;
}

.ecosystem-card-title {
    font-size: 1.1rem;
    color: #1A1714;
    margin-bottom: 0.5rem;
}

.ecosystem-desc {
    font-size: 0.9rem;
    color: rgba(26, 23, 20, 0.8);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.ecosystem-btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: linear-gradient(to right, #1B5E4F, #1B5E4F);
    color: #1A1714;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ecosystem-btn:hover {
    opacity: 0.9;
}

.ecosystem-btn-disabled {
    background: #DED7C7 !important;
    color: #6F6760 !important;
    cursor: not-allowed;
    pointer-events: none;
}

/* Blog */
.blog {
    padding: 4rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.blog .section-title {
    text-align: center;
    color: #1B5E4F;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.blog-card {
    background: rgba(241, 236, 225, 0.6);
    border: 1px solid rgba(26, 23, 20, 0.1);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: border-color 0.2s;
}

.blog-card:hover {
    border-color: rgba(27, 94, 79, 0.3);
}

.blog-card-image {
    aspect-ratio: 16/9;
    background: rgba(222, 215, 199, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #1B5E4F;
}

.blog-card-body {
    padding: 1rem;
}

.blog-card-title {
    font-size: 1rem;
    color: #1A1714;
    margin-bottom: 0.5rem;
}

.blog-card-excerpt {
    font-size: 0.875rem;
    color: rgba(26, 23, 20, 0.8);
    line-height: 1.5;
}

/* Footer */
.landing-footer {
    padding: 2rem 1rem;
    background: #F1ECE1;
    border-top: 1px solid rgba(26, 23, 20, 0.08);
    text-align: center;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-copy {
    font-size: 0.875rem;
    color: rgba(26, 23, 20, 0.7);
    margin-bottom: 0.75rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.footer-link {
    color: #1B5E4F;
    text-decoration: none;
    font-size: 0.95rem;
}

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

/* Landing - Responsive */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: 260px;
        height: 100vh;
        background: #F1ECE1;
        flex-direction: column;
        padding: 4rem 1.5rem 1.5rem;
        gap: 1rem;
        transform: translateX(100%);
        transition: transform 0.3s;
        border-left: 1px solid rgba(27, 94, 79, 0.2);
    }

    .nav-menu-open {
        transform: translateX(0);
    }

    .nav-toggle {
        display: block;
    }

    .about-inner {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-image-placeholder {
        max-width: 320px;
        margin: 0 auto;
    }

    .ecosystem-grid {
        grid-template-columns: 1fr;
    }

    .blog-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .ecosystem-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- TOOLTIP & EMPTY STATE STYLING --- */
.tooltip-icon {
    position: relative;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    color: #1B5E4F;
    border: 1px solid #1B5E4F;
    border-radius: 50%;
    /* Bo tròn 100% */
    font-size: 11px;
    font-weight: bold;
    font-style: normal;
    background: transparent;
    vertical-align: middle;
}

.tooltip-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 150%;
    /* Hiện lên TRÊN để không đè vào ô input bên dưới */
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 260px;
    /* Độ rộng vừa phải */
    background: rgba(246, 243, 236, 0.98);
    border: 1px solid #1B5E4F;
    color: #1A1714;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: normal;
    font-style: italic;
    /* In nghiêng toàn bộ */
    text-transform: none;
    /* Đảm bảo không bị in hoa */
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.5;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

@media (hover: hover) {

    .tooltip-icon:hover::after,
    .tooltip-icon:active::after {
        opacity: 1;
        visibility: visible;
    }
}

.tooltip-icon.show-tooltip::after {
    opacity: 1;
    visibility: visible;
}

/* Xử lý riêng cho Mobile để không lẹm viền phải/trái */
@media (max-width: 768px) {
    .tooltip-icon::after {
        width: 240px;
        /* Dịch nhẹ sang trái một chút để né viền màn hình bên phải */
        transform: translateX(-70%);
    }

    /* Các tooltip bên trong thẻ báo kết quả (nằm lệch mép trái màn hình) cần dịch ngược lại sang phải để tránh lẹm mất chữ */
    .day-card .tooltip-icon::after {
        transform: translateX(-20%);
    }
}

/* Empty State Styling */
.empty-state {
    text-align: center;
    padding: 30px 20px;
    border: 1px dashed rgba(27, 94, 79, 0.5);
    border-radius: 12px;
    background: rgba(27, 94, 79, 0.05);
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

/* Custom Sort Select */
.custom-sort-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: transparent;
    border: 1px solid rgba(27, 94, 79, 0.4);
    /* Viền Vàng Gold mờ */
    color: #1B5E4F;
    /* Chữ Vàng Gold */
    padding: 6px 32px 6px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    /* Chèn icon mũi tên Vàng Gold tùy chỉnh thay cho mũi tên mặc định */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%231B5E4F%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    transition: all 0.3s ease;
}

.custom-sort-select:hover,
.custom-sort-select:focus {
    border-color: #1B5E4F;
    /* Sáng lên khi hover */
    outline: none;
    box-shadow: 0 0 8px rgba(27, 94, 79, 0.2);
}

/* Đổi màu nền của danh sách xổ xuống để không bị trắng lóa */
.custom-sort-select option {
    background-color: #FBF9F3;
    /* Màu nền xanh Navy tối đồng bộ app */
    color: #1B5E4F;
}

/* Modal Tabs Styling */
.tab-btn {
    flex: 1;
    background: transparent;
    color: #6F6760;
    border: none;
    padding: 10px;
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #1B5E4F;
    border-bottom: 2px solid #1B5E4F;
    font-weight: bold;
}

.tab-btn:hover {
    color: #1A1714;
}

/* --- TIMELINE ENERGY BAR --- */
.timeline-wrapper {
    margin-top: 8px;
    margin-bottom: 4px;
    padding: 0;
}

.timeline-bar {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(27, 94, 79, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.timeline-highlight {
    position: absolute;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #1B5E4F 0%, #E9F0EC 100%);
    box-shadow: 0 0 5px #1B5E4F;
    border-radius: 4px;
}

.timeline-glow-dot {
    position: absolute;
    top: 50%;
    left: 0;
    /* JS will adjust this if needed, or it can sit at the left edge of the highlight */
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: #1A1714;
    border-radius: 50%;
    box-shadow: 0 0 10px 3px #1B5E4F;
    z-index: 2;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: rgba(26, 23, 20, 0.4);
    margin-top: 4px;
    position: relative;
}

.timeline-label-major {
    font-weight: bold;
    color: rgba(27, 94, 79, 0.8);
}

.timeline-label-minor {
    font-size: 0.6rem;
    color: rgba(26, 23, 20, 0.3);
}

/* --- CALENDAR OPTIONS POPUP MENU --- */
.calendar-action-wrapper {
    position: relative;
    display: inline-block;
}

/* Fix height alignment for calendar button */
.action-buttons-container .calendar-action-wrapper {
    padding: 0 !important;
}

.action-buttons-container .calendar-action-wrapper>button:first-child {
    padding: 8px 4px;
    width: 100%;
    height: 100%;
}

@media (min-width: 768px) {
    .action-buttons-container .calendar-action-wrapper>button:first-child {
        padding: 6px 16px;
    }
}

.calendar-options-menu {
    position: absolute;
    bottom: calc(100% + 5px);
    right: 0;
    background: rgba(251, 249, 243, 0.95);
    border: 1px solid rgba(27, 94, 79, 0.3);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    padding: 8px;
    min-width: 180px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transform: translateY(10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
}

.calendar-action-wrapper.show-menu .calendar-options-menu {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.calendar-option-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    width: 100%;
    background: transparent;
    border: none;
    color: #1A1714;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.calendar-option-btn:hover {
    background: rgba(27, 94, 79, 0.1);
    color: #1B5E4F;
}

.calendar-option-btn.google-cal {
    color: #4DA8DA;
}

.calendar-option-btn.apple-cal {
    color: #FF6B6B;
}

/* Type Toggle Buttons */
.type-toggle-container {
    display: flex;
    justify-content: center;
    background: rgba(241, 236, 225, 0.5);
    border-radius: 9999px;
    padding: 0.25rem;
    margin: 0 auto 1.5rem auto;
    width: 100%;
    max-width: 340px;
    border: 1px solid rgba(222, 215, 199, 0.5);
}

.toggle-btn {
    flex: 1;
    text-align: center;
    background: transparent;
    color: #6F6760;
    border: none;
    padding: 0.5rem 0;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    color: #1A1714;
}

.toggle-btn.active {
    background: #1B5E4F;
    color: #F1ECE1;
    font-weight: bold;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Input Wrapper — Clear Button đã được định nghĩa ở rule chính (line ~2055).
   Rule .clear-btn legacy ở đây đã xóa vì gây xung đột vị trí với .mic-btn. */
.input-wrapper {
    position: relative;
}

@media (max-width: 640px) {
    .custom-radio input[type="radio"] {
        flex-shrink: 0;
    }
}

@media (max-width: 640px) {

    .custom-radio input[type="radio"],
    .custom-radio input[type="radio"]:checked {
        flex-shrink: 0;
    }
}

input::placeholder {
    font-style: italic;
}

/* Scroll To Top Button */
.scroll-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: rgba(246, 243, 236, 0.75);
    /* Kính mờ màu sẫm đen/navy */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(26, 23, 20, 0.85);
    /* Trắng ngà nhẹ */
    border: 1px solid rgba(26, 23, 20, 0.15);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (max-width: 768px) {
    .scroll-to-top-btn {
        bottom: 80px;
        /* Kéo nút lên cao hơn để không bị lấp bởi bottom bar safari/zalo */
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

.scroll-to-top-btn.show {
    display: flex;
}

.scroll-to-top-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    background: rgba(246, 243, 236, 0.95);
    border-color: rgba(26, 23, 20, 0.3);
}

/* ============================================
   REPORT CTA — dẫn về Báo Cáo Dịch Lý từ 4 app
   Dùng chung trong gieo-que, luan-sim, luan-ten, xem-ngay
   ============================================ */
.report-cta-app {
    margin: 32px auto 12px;
    max-width: 640px;
    padding: 18px 0 0;
    border-top: 1px solid rgba(26, 23, 20, 0.07);
    text-align: left;
}

.report-cta-app .cta-text {
    font-size: 14px;
    line-height: 1.7;
    margin: 0;
    color: rgba(111, 103, 96, 0.75);
}

.report-cta-app .cta-text em {
    font-style: italic;
    color: rgba(111, 103, 96, 0.75);
    display: inline;
}

.report-cta-app .cta-link {
    color: #1B5E4F;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border-bottom: 1px solid rgba(27, 94, 79, 0.35);
    padding-bottom: 1px;
    transition: color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.report-cta-app .cta-link:hover {
    color: #E9F0EC;
    border-bottom-color: rgba(233, 240, 236, 0.6);
}

.report-cta-app .cta-link i {
    margin-left: 4px;
    font-size: 11px;
    transition: transform 0.2s ease;
}

.report-cta-app .cta-link:hover i {
    transform: translateX(3px);
}

@media (max-width: 640px) {
    .report-cta-app {
        margin: 24px 0 8px;
    }
    .report-cta-app .cta-text { font-size: 13px; }
    .report-cta-app .cta-link { font-size: 13px; white-space: normal; }
}

/* ============================================
   PAGE PROGRESS BAR — thanh load đỉnh trang
   Hiện ngay khi trang bắt đầu render
   ============================================ */
#pageProgressBar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: #1B5E4F;
    z-index: 10000;
    animation: pageProgressAnim 1.8s cubic-bezier(0.1, 0.6, 0.4, 1) forwards;
    transition: width 0.3s ease, opacity 0.4s ease;
    pointer-events: none;
}

#pageProgressBar.done {
    width: 100% !important;
    animation: none;
    opacity: 0;
    transition: width 0.2s ease, opacity 0.5s ease 0.1s;
}

@keyframes pageProgressAnim {
    0%   { width: 0; }
    15%  { width: 35%; }
    50%  { width: 65%; }
    100% { width: 82%; }
}

/* ============================================ */
/* AI LOADING — text + progress bar giả lập        */
/* Dùng cho 4 app khi AI đang chạy                */
/* ============================================ */
.ai-loading {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 2px;
}

.ai-loading-text {
    font-style: italic;
    color: #6F6760;
    font-size: 0.92rem;
    line-height: 1.5;
}

.ai-loading-bar {
    width: 100%;
    height: 5px;
    background: rgba(16, 185, 129, 0.10);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.ai-loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #047857 0%, #10b981 35%, #34d399 65%, #10b981 100%);
    background-size: 200% 100%;
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.55), 0 0 4px rgba(52, 211, 153, 0.4) inset;
    animation: ai-loading-shimmer 1.6s linear infinite;
    position: relative;
}

.ai-loading-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(26, 23, 20, 0.45) 50%, transparent 100%);
    animation: ai-loading-glide 1.4s ease-in-out infinite;
    border-radius: 999px;
}

@keyframes ai-loading-shimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes ai-loading-glide {
    0% { transform: translateX(-100%); }
    60%, 100% { transform: translateX(100%); }
}

/* ============================================ */
/* AI ERROR + RETRY — khi AI quá tải hoặc lỗi      */
/* ============================================ */
.ai-error-block {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 4px solid #ef4444;
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
    margin: 4px 0;
}

.ai-error-message {
    color: #fca5a5;
    margin: 0 0 12px 0;
    font-size: 14px;
    line-height: 1.5;
}

.ai-error-message i {
    color: #f87171;
    margin-right: 6px;
}

.ai-retry-btn {
    background: linear-gradient(135deg, #1B5E4F 0%, #1B5E4F 100%);
    color: #F1ECE1;
    border: none;
    padding: 8px 20px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(27, 94, 79, 0.2);
}

.ai-retry-btn:hover {
    box-shadow: 0 4px 14px rgba(27, 94, 79, 0.4);
    transform: translateY(-1px);
}

.ai-retry-btn:active {
    transform: translateY(0);
}

.ai-retry-btn i {
    margin-right: 6px;
}

/* ============================================ */
/* APP LOADING OVERLAY — khi chuyển giữa 4 app     */
/* ============================================ */
.app-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(246, 243, 236, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.app-loading-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.app-loading-overlay .spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(27, 94, 79, 0.2);
    border-top-color: #1B5E4F;
    border-radius: 50%;
    animation: app-loading-spin 0.9s linear infinite;
}

.app-loading-overlay .label {
    color: #1B5E4F;
    font-size: 0.95rem;
    font-style: italic;
    letter-spacing: 0.02em;
}

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

/* ===================================================================
   PHA 2 — ÉP UTILITY/INLINE CŨ VỀ HỆ SÁNG-LỤC-BẢO
   Giữ NGUYÊN tên class (JS dùng làm móc truy vấn), chỉ đổi GIÁ TRỊ hiển thị.
   Dùng !important để thắng Tailwind CDN bất kể thứ tự nạp.
   =================================================================== */
.text-yellow-400, .text-yellow-500, .text-amber-300, .text-amber-400 { color: #1B5E4F !important; }
.text-yellow-100\/70 { color: #6F6760 !important; }
.text-gray-200, .text-gray-300 { color: #3A352E !important; }
.text-gray-400 { color: #6F6760 !important; }
.text-teal-400 { color: #0E3B30 !important; }
.bg-teal-800 { background-color: #1B5E4F !important; }
.text-teal-100 { color: #E9F0EC !important; }
.border-yellow-500 { border-color: #1B5E4F !important; }
.bg-yellow-600 { background-color: #1B5E4F !important; }
.bg-gray-800 { background-color: #F1ECE1 !important; }
.bg-gray-800\/50 { background-color: #F1ECE1 !important; }
.bg-gray-900 { background-color: #FBF9F3 !important; }
.bg-gray-900\/50 { background-color: #FBF9F3 !important; }
.border-gray-700, .border-gray-600, .border-gray-500 { border-color: #DED7C7 !important; }
.border-gray-700\/50 { border-color: #DED7C7 !important; }