@font-face {
    font-family: "SVN Secesja Pro";
    src: url("fonts/SVN-Secesja%20Pro.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "SVN Nexa Rush Slab Black Shadow";
    src: url("fonts/SVN-Nexa%20Rush%20Slab%20Black%20Shadow.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "SVN-Secesja Pro";
    src: url("fonts/SVN-Secesja%20Pro.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Root scope: mọi quy tắc giao diện của plugin chỉ tác động bên trong wrapper này. */
.xito-app {
    font-family: 'Merriweather', 'Roboto', serif;
    font-weight: 400;
    text-rendering: optimizeLegibility;
    min-width: 0;
    /* iOS chỉ tôn trọng text-size-adjust khi gắn gần gốc cây (html/body/wrapper),
       không phải khi chỉ gắn trên phần tử flex con. */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* =============================================================
   FONT RESET MẠNH: Loại bỏ font inline bị copy vào editor
   CSS !important trong stylesheet thắng cả inline style
   ============================================================= */

/* Vùng nội dung chuẩn: đặt font gốc */
.xito-app .x-body,
.xito-app .prayer-content,
.xito-app .reading,
.xito-app .xito-content {
    font-family: 'Merriweather', 'Roboto', serif !important;
}

/* Tất cả phần tử con kế thừa font — ngăn inline font-family ghi đè */
.xito-app .x-body *,
.xito-app .prayer-content *,
.xito-app .reading *,
.xito-app .xito-content * {
    font-family: inherit !important;
}

/* Ngoại lệ: thẻ code/pre giữ monospace */
.xito-app .x-body code, .xito-app .x-body pre,
.xito-app .prayer-content code, .xito-app .prayer-content pre,
.xito-app .reading code, .xito-app .reading pre,
.xito-app .xito-content code, .xito-app .xito-content pre {
    font-family: 'Courier New', Courier, monospace !important;
}

/* Header styles */
.xito-app .xito-header {
    background: #7a110d;
    padding: 8px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    /* Header phải nằm trên các widget/theme/plugin ngoài phạm vi Giờ Kinh. */
    z-index: 99999 !important;
}
.xito-app .xito-header-inner {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 5%;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}
.xito-app .xito-header-left {
    display: flex;
    gap: 20px;
    align-items: center;
}
.xito-app .xito-header-right {
    display: flex;
    gap: 20px;
    align-items: center;
}
.xito-app .xito-header-center {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin: 0 20px;
    gap: 15px;
}

/* Desktop header content - visible on desktop */
.xito-app .desktop-header-content {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.xito-app .header-nav-arrow {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.3);
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    transition: all 0.3s;
    flex-shrink: 0;
    text-align: center;
    line-height: 1;
    user-select: none;
}
.xito-app .header-nav-arrow:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: scale(1.1);
}
.xito-app .header-nav-arrow:active {
    transform: scale(0.95);
}
.xito-app .header-center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.3s;
}
.xito-app .header-center-content:hover {
    background: rgba(255,255,255,0.1);
}

/* Calendar month view popup */
.xito-app .calendar-month-popup {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    background: #fff;
    border: 2px solid #7a110d;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    display: none;
    min-width: 320px;
    z-index: 2000;
}
.xito-app .calendar-month-popup.show {
    display: block;
}
.xito-app .calendar-month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #7a110d;
}
.xito-app .calendar-month-title {
    font-weight: bold;
    color: #7a110d;
    font-size: 16px;
}
.xito-app .calendar-month-nav {
    display: flex;
    gap: 10px;
}
.xito-app .calendar-month-nav button {
    width: 30px;
    height: 30px;
    background: #7a110d;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.3s;
}
.xito-app .calendar-month-nav button:hover {
    opacity: 0.8;
}
.xito-app .calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 5px;
}
.xito-app .calendar-weekday {
    text-align: center;
    font-weight: bold;
    color: #7a110d;
    font-size: 12px;
    padding: 5px;
}
.xito-app .calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}
.xito-app .calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    background: #f5f5f5;
    color: #333;
}
.xito-app .calendar-day:hover {
    background: #7a110d;
    color: #fff;
    transform: scale(1.1);
}
.xito-app .calendar-day.other-month {
    color: #ccc;
    background: #fafafa;
}
.xito-app .calendar-day.today {
    background: #5c8db8;
    color: #fff;
    font-weight: bold;
}
.xito-app .calendar-day.selected {
    background: #7a110d;
    color: #fff;
    font-weight: bold;
}
.xito-app .header-liturgy-info {
    text-align: center;
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
}
.xito-app .header-liturgy-title {
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 3px;
}
.xito-app .header-liturgy-reading {
    font-size: 12px;
    opacity: 0.9;
}
.xito-app .header-clock {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    margin-top: 5px;
    font-family: monospace;
}
.xito-app .xito-header-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 24px;
    padding: 8px;
    border-radius: 5px;
    transition: background 0.3s;
    text-decoration: none;
    border: 0;
    background: transparent;
    font-family: inherit;
    line-height: 1;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
}
.xito-app .xito-header-icon:hover {
    background: rgba(255,255,255,0.2);
}
.xito-app .xito-header-icon:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.xito-app .xito-header-icon svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

/* Icon Kinh Thánh dùng nét viền để dấu Thánh Giá không bị chìm vào bìa sách. */
.xito-app #bibleIcon svg {
    fill: none;
    stroke: currentColor;
}

/* Mobile calendar icon - hidden on desktop */
.xito-app .mobile-calendar-icon {
    display: none;
}

/* Mobile calendar navigation container */
.xito-app .mobile-calendar-nav {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 0 0 auto;
}

/* Show the calendar icon inside mobile nav */
.xito-app .mobile-calendar-nav .mobile-calendar-icon {
    display: flex;
    position: relative;
}

/* Mobile navigation arrows */
.xito-app .mobile-nav-arrow {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.3);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    transition: all 0.3s;
    flex-shrink: 0;
    line-height: 1;
    user-select: none;
}

.xito-app .mobile-nav-arrow:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

.xito-app .mobile-nav-arrow:active {
    transform: scale(0.95);
    background: rgba(255,255,255,0.4);
}

/* Mobile popup overlay */
.xito-app .mobile-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}
.xito-app .mobile-popup-overlay.show {
    display: block;
}

/* Make sure our button is visible */
.xito-app .back-to-top#backToTop {
    display: none;
}
.xito-app .back-to-top#backToTop.show {
    display: flex;
}

/* Calendar dropdown */
.xito-app .calendar-dropdown {
    position: absolute;
    top: 45px;
    left: 0;
    background: #fff;
    border: 2px solid #7a110d;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: none;
    min-width: 320px;
    z-index: 1001;
}
.xito-app .calendar-dropdown.show {
    display: block;
}
.xito-app .calendar-nav-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}
.xito-app .calendar-nav-btn {
    width: 36px;
    height: 36px;
    background: #7a110d;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: opacity 0.3s;
}
.xito-app .calendar-nav-btn:hover {
    opacity: 0.8;
}
.xito-app .calendar-dropdown input[type="date"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}
.xito-app .calendar-current-date {
    text-align: center;
    color: #7a110d;
    font-weight: bold;
    margin-top: 8px;
    font-size: 14px;
}

/* Central Prayer Menu Dropdown */
.xito-app .prayer-menu-container {
    text-align: center;
    padding: 2px 0 4px 0;
    background: #f8f8f8;
    border-bottom: 2px solid #7a110d;
}
.xito-app .prayer-menu-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.xito-app .today-button {
    background: #d32f2f;
    border: 2px solid #b71c1c;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    color: #fff9c4;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    white-space: nowrap;
    display: inline-block;
}
.xito-app .today-button:hover {
    background: #c62828;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(211, 47, 47, 0.4);
}
.xito-app .today-button:active {
    transform: translateY(0);
}
.xito-app .prayer-menu-dropdown {
    position: relative;
    display: inline-block;
}
.xito-app .prayer-menu-button {
    background: #fff;
    border: 2px solid #ddd;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    min-width: 250px;
    justify-content: space-between;
}
.xito-app .prayer-menu-button:hover {
    border-color: #7a110d;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}
.xito-app .prayer-menu-button .arrow {
    font-size: 12px;
    transition: transform 0.3s;
}
.xito-app .prayer-menu-button.open .arrow {
    transform: rotate(180deg);
}
.xito-app .prayer-menu-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #7a110d;
    border-radius: 8px;
    margin-top: 2px;
    padding: 5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: none;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}
.xito-app .prayer-menu-list.show {
    display: block;
}
.xito-app .prayer-menu-item {
    padding: 12px 15px;
    cursor: pointer;
    color: #333;
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 18px;
    border-radius: 5px;
    transition: all 0.2s;
    text-align: left;
    background: #f5f5f5;
}
.xito-app .prayer-menu-item:hover {
    filter: brightness(0.92);
}
.xito-app .prayer-menu-item.current {
    background: #ff0000;
    color: #fff;
}
.xito-app .prayer-menu-item.past {
    background: #898989;
    color: #fff;
}
.xito-app .prayer-menu-item.future {
    background: #fbf7df;
    color: #0b2d3c;
}

/* Events dropdown */
.xito-app .events-dropdown {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    background: #fbf7df;
    border: 2px solid #7a110d;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: none;
    min-width: 240px;
    max-width: min(340px, calc(100vw - 20px));
    z-index: 1001;
}
.xito-app .events-dropdown.show {
    display: block;
}
/* Ngoại Lịch menu styles */
.xito-app .ngoai-lich-menu-title {
    font-weight: bold;
    color: #630703;
    font-size: 15px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0d0d0;
}
.xito-app .ngoai-lich-menu {
    list-style: none;
    margin: 10px -15px -15px -15px;
    padding: 0;
}
.xito-app .ngoai-lich-menu-item {
    border-bottom: 1px solid #e8d8b0;
}
.xito-app .ngoai-lich-menu-item:last-child {
    border-bottom: none;
}
.xito-app .ngoai-lich-menu-item a {
    display: block;
    padding: 10px 2px;
    background: #fbf7df;
    color: #630703;
    text-decoration: none;
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
    font-size: 18px;
    transition: background 0.2s, color 0.2s;
    border-radius: 0;
}
.xito-app .ngoai-lich-menu-item a:hover {
    background: #d0d0d0;
    color: #630703;
}
@media (max-width: 900px) {
    .xito-app .ngoai-lich-menu-item a {
        font-size: 16px;
    }
}
.xito-app .events-content {
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}
.xito-app .events-title {
    font-weight: bold;
    color: #7a110d;
    margin-bottom: 8px;
    font-size: 16px;
}
.xito-app .event-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}
.xito-app .event-item:last-child {
    border-bottom: none;
}

/* Settings dropdown */
.xito-app .settings-dropdown {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 2px solid #7a110d;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: none;
    min-width: 280px;
    max-width: min(400px, calc(100vw - 20px));
    z-index: 1001;
    text-align: left;
    box-sizing: border-box;
}
.xito-app .settings-dropdown.show {
    display: block;
}
/* Căn mọi hàng điều khiển theo lề trái (cùng trục với nhãn), tránh flex cha căn giữa */
.xito-app .settings-dropdown .font-size-control,
.xito-app .settings-dropdown .theme-buttons,
.xito-app .settings-dropdown .bold-toggle,
.xito-app .settings-dropdown .scroll-speed-control {
    margin-left: 0 !important;
    margin-right: 0 !important;
}
.xito-app .setting-group {
    margin-bottom: 20px;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}
.xito-app .setting-group:last-child {
    margin-bottom: 0;
}
.xito-app .setting-label {
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    margin-left: 0;
    padding-left: 0;
    display: block;
    font-size: 14px;
    text-align: left;
    width: 100%;
}
.xito-app .theme-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}
.xito-app .theme-btn {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s;
}
.xito-app .theme-btn.active {
    border-color: #7a110d;
    border-width: 3px;
}
.xito-app .theme-btn:hover {
    border-color: #7a110d;
}
/* Theme color previews */
.xito-app .theme-btn[data-theme="white"] {
    background: #fff;
    color: #333;
}
.xito-app .theme-btn[data-theme="dark"] {
    background: #3a3a3a;
    color: #f2f2f2;
}
.xito-app .theme-btn[data-theme="paper"] {
    background: #f4e8d0;
    color: #2c2416;
}
.xito-app .scroll-speed-control {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 10px;
    margin-left: 0;
    padding-left: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.xito-app .scroll-speed-control input[type="range"] {
    flex: 1;
    min-width: 0;
    margin: 0;
}
.xito-app .scroll-speed-value {
    font-weight: bold;
    font-size: 14px;
    color: #7a110d;
    min-width: 1.25em;
    flex-shrink: 0;
    text-align: center;
    line-height: 1;
}
.xito-app .scroll-speed-label {
    font-size: 12px;
    color: #666;
    min-width: 44px;
    flex-shrink: 0;
    text-align: left;
    margin: 0;
    padding: 0;
}
.xito-app .scroll-speed-label:last-child {
    text-align: right;
    min-width: 44px;
}

/* Main content wrapper to account for fixed header */
.xito-app .xito-main-wrapper {
    margin-top: 20px;
    min-height: calc(100vh - 20px);
}

/* Back to top button */
.xito-app .back-to-top {
    position: fixed;
    bottom: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: rgba(122, 17, 13, 0.8);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 999;
    transition: all 0.2s;
}
.xito-app .back-to-top.show {
    display: flex;
}
.xito-app .back-to-top:hover {
    background: rgba(154, 22, 16, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}
.xito-app .back-to-top:active {
    transform: translateY(0);
}

/* Nhóm nổi: pause + chỉnh tốc độ — chỉ hiện khi tự động cuộn bật */
.xito-app .auto-scroll-floating-group {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 998;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
}
.xito-app .auto-scroll-floating-group > * {
    pointer-events: auto;
}
.xito-app .auto-scroll-floating-group.show {
    display: flex;
}
/* Desktop: + trên, pause giữa, − dưới (DOM: −, pause, + → order) */
@media (min-width: 769px) {
    .xito-app .auto-scroll-floating-group .auto-scroll-speed-plus { order: 1; }
    .xito-app .auto-scroll-floating-group .auto-scroll-stop-btn { order: 2; }
    .xito-app .auto-scroll-floating-group .auto-scroll-speed-minus { order: 3; }
}

.xito-app .auto-scroll-speed-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 19px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    background: rgba(74, 144, 226, 0.42);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    font-family: 'Roboto', sans-serif;
}
.xito-app .auto-scroll-speed-btn:hover:not(:disabled) {
    background: rgba(74, 144, 226, 0.62);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22);
}
.xito-app .auto-scroll-speed-btn:active:not(:disabled) {
    transform: scale(0.96);
}
.xito-app .auto-scroll-speed-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Floating pause — cùng kích thước / palette với nút ± */
.xito-app .auto-scroll-stop-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    background: rgba(74, 144, 226, 0.42);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.xito-app .auto-scroll-stop-btn:hover {
    background: rgba(74, 144, 226, 0.62);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22);
}
.xito-app .auto-scroll-stop-btn:active {
    transform: scale(0.96);
}

@media (max-width: 768px) {
    .xito-app .auto-scroll-floating-group {
        left: 50%;
        top: auto;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 4px);
        transform: translateX(-50%);
        flex-direction: row;
        gap: 10px;
    }
    .xito-app .auto-scroll-floating-group .auto-scroll-speed-plus,
    .xito-app .auto-scroll-floating-group .auto-scroll-speed-minus,
    .xito-app .auto-scroll-floating-group .auto-scroll-stop-btn {
        order: 0;
    }
    .xito-app .auto-scroll-stop-btn,
    .xito-app .auto-scroll-speed-btn {
        color: #8f3f47;
        background: rgba(143, 63, 71, 0.12);
        box-shadow: none;
    }
    .xito-app .auto-scroll-stop-btn:hover,
    .xito-app .auto-scroll-speed-btn:hover:not(:disabled) {
        background: rgba(143, 63, 71, 0.22);
        box-shadow: none;
    }
    .xito-app .auto-scroll-stop-btn:active,
    .xito-app .auto-scroll-speed-btn:active:not(:disabled) {
        transform: scale(0.96);
    }
}

.xito-app .font-size-control {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}
.xito-app .font-size-control input[type="range"] {
    flex: 1;
}
.xito-app .font-size-value {
    font-weight: bold;
    color: #7a110d;
    min-width: 45px;
}
.xito-app .font-size-reset-btn {
    margin-top: 8px;
    padding: 6px 10px;
    border: 1px solid #bbb;
    border-radius: 5px;
    background: #f7f7f7;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.xito-app .font-size-reset-btn:hover {
    border-color: #7a110d;
    color: #7a110d;
    background: #fff;
}
.xito-app .bold-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    align-content: flex-start;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
.xito-app .bold-toggle-label {
    font-size: 12px;
    color: #555;
    line-height: 1.2;
    flex: 0 0 auto;
    white-space: nowrap;
    margin: 0;
    padding: 0;
}
.xito-app .toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    flex: 0 0 auto;
    margin: 0;
    background: #ccc;
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.3s;
}
.xito-app .toggle-switch.active {
    background: #7a110d;
}
.xito-app .toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}
.xito-app .toggle-switch.active .toggle-slider {
    transform: translateX(24px);
}

/* Theme backgrounds */
.xito-app.theme-white .x-box,
.xito-app.theme-white .x-body {
    background: #fff;
    color: #000;
}
/* Ban đêm: nền đen nhạt; chữ đen → trắng; gạch đầu dòng trắng; đỏ → đỏ nhạt */
.xito-app.theme-dark .x-box,
.xito-app.theme-dark .x-body {
    background: #3a3a3a;
    color: #f2f2f2 !important;
}
.xito-app.theme-dark .x-body p,
.xito-app.theme-dark .x-body li,
.xito-app.theme-dark .x-body div,
.xito-app.theme-dark .x-body td,
.xito-app.theme-dark .x-body th,
.xito-app.theme-dark .x-body blockquote,
.xito-app.theme-dark .x-body label,
.xito-app.theme-dark .x-body h1,
.xito-app.theme-dark .x-body h2,
.xito-app.theme-dark .x-body h3,
.xito-app.theme-dark .x-body h4,
.xito-app.theme-dark .x-body h5,
.xito-app.theme-dark .x-body h6 {
    color: #f2f2f2 !important;
}
.xito-app.theme-dark .x-body a {
    color: #e8e8e8 !important;
    text-decoration: underline;
}
.xito-app.theme-dark .x-body a:hover {
    color: #fff !important;
}
/* Gạch đầu dòng dạng "-" (::before trong plugin) */
.xito-app.theme-dark .x-body ul li::before {
    color: #f2f2f2 !important;
}
/* Danh sách dùng marker mặc định */
.xito-app.theme-dark .x-body ul li::marker,
.xito-app.theme-dark .x-body ol li::marker {
    color: #f2f2f2 !important;
}
/* Chữ đen / xám đậm set inline trong editor */
.xito-app.theme-dark .x-body [style*="color:#000"],
.xito-app.theme-dark .x-body [style*="color: #000"],
.xito-app.theme-dark .x-body [style*="color:#000000"],
.xito-app.theme-dark .x-body [style*="color: #000000"],
.xito-app.theme-dark .x-body [style*="color:black"],
.xito-app.theme-dark .x-body [style*="color: black"],
.xito-app.theme-dark .x-body [style*="rgb(0, 0, 0)"],
.xito-app.theme-dark .x-body [style*="rgb(0,0,0)"],
.xito-app.theme-dark .x-body [style*="#333"],
.xito-app.theme-dark .x-body [style*="#333333"] {
    color: #f2f2f2 !important;
}
.xito-app.theme-dark .x-body font[color="#000000"],
.xito-app.theme-dark .x-body font[color="#000"],
.xito-app.theme-dark .x-body font[color="black"] {
    color: #f2f2f2 !important;
}
.xito-app.theme-dark .x-body font[color="#ff0000"],
.xito-app.theme-dark .x-body font[color="#b70102"],
.xito-app.theme-dark .x-body font[color="#d83131"],
.xito-app.theme-dark .x-body font[color="#7a110d"] {
    color: #ff9a9a !important;
}
/* Màu đỏ phụng vụ / plugin → đỏ nhạt (ghi đè cả block .x-body strong|span bên dưới) */
.xito-app.theme-dark .x-body strong[style*="#ff0000"],
.xito-app.theme-dark .x-body strong[style*="#FF0000"],
.xito-app.theme-dark .x-body strong[style*="#b70102"],
.xito-app.theme-dark .x-body strong[style*="#B70102"],
.xito-app.theme-dark .x-body strong[style*="#d83131"],
.xito-app.theme-dark .x-body strong[style*="#D83131"],
.xito-app.theme-dark .x-body strong[style*="#7a110d"],
.xito-app.theme-dark .x-body strong[style*="#7A110D"],
.xito-app.theme-dark .x-body span[style*="#ff0000"],
.xito-app.theme-dark .x-body span[style*="#FF0000"],
.xito-app.theme-dark .x-body span[style*="#b70102"],
.xito-app.theme-dark .x-body span[style*="#B70102"],
.xito-app.theme-dark .x-body span[style*="#d83131"],
.xito-app.theme-dark .x-body span[style*="#D83131"],
.xito-app.theme-dark .x-body span[style*="#7a110d"],
.xito-app.theme-dark .x-body span[style*="#7A110D"],
.xito-app.theme-dark .x-body p[style*="#ff0000"],
.xito-app.theme-dark .x-body p[style*="#b70102"],
.xito-app.theme-dark .x-body p[style*="#d83131"],
.xito-app.theme-dark .x-body p[style*="#7a110d"],
.xito-app.theme-dark .x-body [style*="rgb(255, 0, 0)"],
.xito-app.theme-dark .x-body [style*="rgb(183, 1, 2)"],
.xito-app.theme-dark .x-body [style*="rgb(216, 49, 49)"],
.xito-app.theme-dark .x-body [style*="color: red"],
.xito-app.theme-dark .x-body [style*="color:red"],
.xito-app.theme-dark .x-body [style*="#c00"],
.xito-app.theme-dark .x-body [style*="#C00"],
.xito-app.theme-dark .x-body [style*="#d32f2f"],
.xito-app.theme-dark .x-body [style*="#dc3545"] {
    color: #ff9a9a !important;
}
.xito-app.theme-paper .x-box,
.xito-app.theme-paper .x-body {
    background: #f4e8d0;
    color: #2c2416;
}

@media (max-width: 768px) {
    /* Mobile specific styles */
    
    .xito-app .xito-header {
        padding: 8px 10px;
    }
    .xito-app .xito-header-inner {
        justify-content: space-between;
        gap: 15px;
    }
    
    /* Keep header center for layout but hide desktop content */
    .xito-app .xito-header-center {
        display: flex;
        margin: 0 10px;
    }
    
    /* Hide desktop header content on mobile */
    .xito-app .desktop-header-content {
        display: none;
    }
    
    /* Show mobile calendar navigation with arrows */
    .xito-app .mobile-calendar-nav {
        display: flex;
        visibility: visible;
        opacity: 1;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }
    
    /* Make mobile nav arrows more visible on small screens */
    .xito-app .mobile-nav-arrow {
        display: flex;
        visibility: visible;
        opacity: 1;
        width: 34px;
        height: 34px;
        font-size: 18px;
        background: rgba(255,255,255,0.25);
        border: 2px solid rgba(255,255,255,0.4);
        color: #fff;
    }
    
    .xito-app .mobile-calendar-nav .mobile-calendar-icon {
        display: flex;
        visibility: visible;
        opacity: 1;
    }
    
    /* Arrange icons */
    .xito-app .xito-header-left,
    .xito-app .xito-header-right {
        gap: 0;
        flex: 0 0 auto;
    }
    
    .xito-app .xito-header-icon svg {
        width: 26px;
        height: 26px;
    }
    
    .xito-app .mobile-calendar-nav .xito-header-icon svg {
        width: 28px;
        height: 28px;
    }
    
    /* Popups centered on mobile */
    .xito-app .calendar-dropdown,
    .xito-app .events-dropdown,
    .xito-app .settings-dropdown,
    .xito-app .download-dropdown {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        min-width: 280px;
        max-width: 90vw;
        max-height: 80vh;
        overflow-y: auto;
        z-index: 9999;
    }
    
    .xito-app .calendar-month-popup {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        min-width: 280px;
        max-width: 90vw;
        margin-top: 0;
        z-index: 9999;
    }
    
    .xito-app .prayer-menu-button {
        min-width: 200px;
        padding: 10px 20px;
        font-size: 14px;
    }
    .xito-app .prayer-menu-container {
        padding: 3px 0;
    }
    .xito-app .prayer-menu-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        width: 100%;
    }
    .xito-app .today-button {
        padding: 10px 20px;
        font-size: 14px;
        min-width: auto;
    }
    .xito-app .xito-main-wrapper {
        margin-top: 5px;
    }
    
    /* Content box full width on mobile */
    .xito-app .x-box { 
        padding: 0 0 20px 0 !important; 
        box-shadow: none;
        margin: 0;
    }
    .xito-app .x-box h1 {
        padding: 10px 15px;
    }
    .xito-app .x-box .xito-post-title {
        font-size: 33px !important;
        font-weight: 400 !important;
    }
    .xito-app .x-body { 
        padding-left: 15px !important; 
        padding-right: 15px !important; 
    }
    
    .xito-app .back-to-top {
        bottom: 15px;
        right: 15px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

.xito-app .x-box { 
    max-width: 100%; 
    margin: 0 auto; 
    background: #fff; 
    padding: 0 20px 20px 20px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.1); 
}

.xito-app .x-box .xito-post-title {
    font-family: "SVN Secesja Pro", "SVN-Secesja Pro", serif !important;
    font-weight: 500 !important;
    font-style: normal !important;
    font-size: 40px !important;
}

/* Popup Bài đọc Thánh lễ */
.xito-app .bible-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.75);
    animation: xito-bible-fade-in 0.3s ease;
}

.xito-app .bible-popup-overlay.show {
    display: flex;
}

@keyframes xito-bible-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.xito-app .bible-popup-card {
    position: relative;
    width: 100%;
    max-width: 500px;
    padding: 40px 30px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    text-align: center;
    animation: xito-bible-slide-up 0.3s ease;
}

@keyframes xito-bible-slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.xito-app .bible-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
    font-size: 20px;
    transition: background 0.2s, color 0.2s;
}

.xito-app .bible-popup-close:hover {
    background: #e0e0e0;
    color: #000;
}

.xito-app .bible-popup-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff0000 0%, #7a110d 100%);
}

.xito-app .bible-popup-icon svg {
    width: 45px;
    height: 45px;
    fill: #fff;
}

.xito-app .bible-popup-title {
    margin-bottom: 12px;
    color: #ff0000;
    font-size: 24px;
    font-weight: bold;
}

.xito-app .bible-popup-description {
    margin-bottom: 30px;
    color: #666;
    font-size: 15px;
    line-height: 1.6;
}

.xito-app .bible-popup-button {
    display: inline-block;
    padding: 16px 40px;
    border-radius: 30px;
    background: linear-gradient(135deg, #ff0000 0%, #7a110d 100%);
    box-shadow: 0 4px 15px rgba(183, 1, 2, 0.3);
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
}

.xito-app .bible-popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(183, 1, 2, 0.4);
    color: #fff;
}

@media (max-width: 768px) {
    .xito-app .bible-popup-card {
        max-width: 90%;
        padding: 30px 20px;
    }

    .xito-app .bible-popup-title {
        font-size: 20px;
    }

    .xito-app .bible-popup-description {
        font-size: 14px;
    }
}

/* Download dropdown */
.xito-app .download-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    background: #fff;
    border: 2px solid #7a110d;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: none;
    min-width: 320px;
    max-width: min(400px, calc(100vw - 20px));
    z-index: 1001;
}
.xito-app .download-dropdown.show {
    display: block;
}
.xito-app .download-group {
    margin-bottom: 15px;
}
.xito-app .download-group:last-child {
    margin-bottom: 0;
}
.xito-app .download-title {
    font-weight: bold;
    color: #7a110d;
    margin-bottom: 8px;
    font-size: 15px;
}
.xito-app .download-description {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 12px;
}
.xito-app .download-days-selector {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 15px;
}
.xito-app .download-day-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    color: #666;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.xito-app .download-day-btn:hover {
    border-color: #7a110d;
    color: #7a110d;
    background: #fff7f7;
}
.xito-app .download-day-btn.selected {
    background: #7a110d;
    border-color: #7a110d;
    color: #fff;
    border-width: 3px;
}
.xito-app .download-action-button {
    width: 100%;
    background: #7a110d;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}
.xito-app .download-action-button:hover:not(:disabled) {
    background: #ff0000;
}
.xito-app .download-action-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}
.xito-app .cache-status {
    padding: 10px;
    background: #E8F5E9;
    color: #2E7D32;
    border-radius: 5px;
    font-size: 12px;
    margin-bottom: 12px;
    display: none;
}
.xito-app .cache-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 12px;
    border-top: 1px solid #e0e0e0;
}
.xito-app .cache-item {
    padding: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
}
.xito-app .cache-item-info {
    flex: 1;
}
.xito-app .cache-item-date {
    font-weight: bold;
    color: #333;
}
.xito-app .cache-item-liturgy {
    color: #999;
    font-size: 11px;
    margin-top: 2px;
}
.xito-app .cache-item-delete {
    background: #f44336;
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
}
.xito-app .cache-item-delete:hover {
    background: #d32f2f;
}
.xito-app .cache-actions {
    padding: 10px 8px 5px;
    text-align: center;
}
.xito-app .cache-clear-all {
    background: #666;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}
.xito-app .cache-clear-all:hover {
    background: #444;
}

/* Popup Offline: đặt SAU CSS desktop để luôn thắng min-width/right của desktop. */
@media (max-width: 768px) {
    .xito-app .download-dropdown {
        position: fixed;
        top: 50%;
        right: auto;
        left: 50%;
        width: 90vw;
        min-width: 0;
        max-width: 90vw;
        max-height: 80vh;
        box-sizing: border-box;
        overflow-y: auto;
        transform: translate(-50%, -50%);
        z-index: 100000;
    }
}

.xito-app .x-nav { display:flex; justify-content:center; gap:5px; border-bottom:3px solid #ff0000; padding-bottom:10px; margin-bottom:20px; flex-wrap:wrap; }
.xito-app .x-btn { padding:8px 12px; background:#f5f5f5; border:1px solid #ddd; cursor:pointer; font-weight:bold; }
.xito-app .x-btn.active { background:#ff0000; color:#fff; border-color:#ff0000; }
/* Tiêu đề Giờ kinh ngoài trang chủ cũng phải Đỏ mận, Đậm, In hoa */
.xito-app .x-head { 
    display: none; /* Ẩn tiêu đề giờ kinh vì đã có ở Menu */
}
.xito-app .x-body { 
    color:#000; 
    font-family: 'Merriweather', serif !important; 
    /* Mobile Portrait mặc định */
    font-size: 16px !important;
    --xito-body-fs: 16px;
    font-weight: bold;
    padding-left: 3%; 
    padding-right: 3%; 
    /* Chống "Text Inflation"/font boosting của trình duyệt Mobile (Safari/Chrome). */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Mobile Landscape (điện thoại xoay ngang) */
@media (max-width: 767px) and (orientation: landscape) {
    .xito-app .x-body {
        font-size: 17px !important;
        --xito-body-fs: 17px;
        font-weight: bold;
    }
}

/* Tablet Portrait nhỏ / iPad đứng */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .xito-app .x-body {
        font-size: 20px !important;
        --xito-body-fs: 20px;
        font-weight: normal;
    }
}

/* Tablet lớn / iPad Pro / màn hình trung bình */
@media (min-width: 768px) and (max-width: 1366px) and (orientation: landscape),
       (min-width: 1025px) and (max-width: 1366px) and (orientation: portrait) {
    .xito-app .x-body {
        font-size: 22px !important;
        --xito-body-fs: 22px;
        font-weight: normal;
    }
}

/* Desktop */
@media (min-width: 1367px) {
    .xito-app .x-body {
        font-size: 26px !important;
        --xito-body-fs: 26px;
        font-weight: normal;
    }
}

/* Chỉ áp dụng cho tiêu đề Giờ Kinh trong phần nội dung chính x-body */
.xito-app .x-body .xito-title-font {
    font-family: "SVN Nexa Rush Slab Black Shadow", serif !important;
    font-weight: 400 !important;
    font-size: 32px !important;
    line-height: 1.2;
    color: #8f1c16 !important;
}

@media (max-width: 900px) {
    .xito-app .x-body .xito-title-font {
        font-size: 24px !important;
    }
}

/* Khoảng cách giữa các paragraph trong Ca vịnh (có gạch đầu dòng) */
.xito-app .x-body p {
    margin-bottom: 12pt;
    margin-top: 0;
}

/* CSS MẠNH: Tô đậm và đỏ các ký hiệu đặc biệt */
.xito-app .x-body strong[style*="color:#ff0000"], .xito-app .x-body strong[style*="color:#b70102"], .xito-app .x-body strong[style*="color:#d83131"] { color: #ff0000 !important; font-weight: bold !important; }
.xito-app .x-body span[style*="color:#ff0000"], .xito-app .x-body span[style*="color:#b70102"], .xito-app .x-body span[style*="color:#d83131"] { color: #ff0000 !important; }

/* Đổi bullets thành gạch đầu dòng ngắn đậm (-) */
.xito-app .x-body ul { list-style-type: none !important; padding-left: 0 !important; margin-left: 3% !important; }
.xito-app .x-body ul li { position: relative; padding-left: calc(0.5% + 0.5em); margin-bottom: 6pt; margin-left: 0.5%; }
.xito-app .x-body ul li::before { 
    content: '-'; 
    font-weight: bold; 
    position: absolute; 
    left: 0; 
    color: #000;
}
/* Xóa gạch đầu dòng cho các dòng Tx */
.xito-app .x-body .no-bullet,
.xito-app .x-body .no-bullet::before { 
    list-style: none !important;
    list-style-type: none !important;
}
.xito-app .x-body .no-bullet::before {
    content: '' !important;
    display: none !important;
}
.xito-app .x-body li.no-bullet {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

/* ── Mobile: giảm thụt lề 3 mục Ca vịnh / Thỉnh ca / Thánh ca Tin Mừng ── */
@media (max-width: 768px) {
    /* ul/li bullet: giảm từ 3% → 1% */
    .xito-app .x-body ul { margin-left: 1% !important; }
    .xito-app .x-body ul li { margin-left: 0 !important; }
    /* Dòng thơ thường trong 3 mục: giảm từ 4% → 2% */
    .xito-app .x-body .x-sect-target { margin-left: 2% !important; }
    /* Dòng bullet trong 3 mục: giảm từ 3% → 1% */
    .xito-app .x-body .x-sect-target.x-sect-bullet { margin-left: 1% !important; }
}
/* Ban đêm: ghi đè block “đỏ đậm” phía trên — đặt cuối (browser hay lưu rgb từ #ff0000) */
.xito-app.theme-dark .x-body strong[style*="color:#ff0000"],
.xito-app.theme-dark .x-body strong[style*="color:#b70102"],
.xito-app.theme-dark .x-body strong[style*="color:#d83131"],
.xito-app.theme-dark .x-body span[style*="color:#ff0000"],
.xito-app.theme-dark .x-body span[style*="color:#b70102"],
.xito-app.theme-dark .x-body span[style*="color:#d83131"],
.xito-app.theme-dark .x-body strong[style*="rgb(255, 0, 0)"],
.xito-app.theme-dark .x-body strong[style*="rgb(183, 1, 2)"],
.xito-app.theme-dark .x-body strong[style*="rgb(216, 49, 49)"],
.xito-app.theme-dark .x-body span[style*="rgb(255, 0, 0)"],
.xito-app.theme-dark .x-body span[style*="rgb(183, 1, 2)"],
.xito-app.theme-dark .x-body span[style*="rgb(216, 49, 49)"] {
    color: #ff9a9a !important;
}

/* ============================================================
   Smart Install Prompt — #xito-install-prompt
   ============================================================ */
.xito-app#xito-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    width: calc(100% - 40px);
    max-width: 480px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(237, 28, 36, 0.12);
    border-left: 5px solid #ed1c24;
    animation: xip-slide-up 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes xip-slide-up {
    from { opacity: 0; transform: translateX(-50%) translateY(30px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0);    }
}

.xito-app .xip-inner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
}

.xito-app .xip-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: #ed1c24;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.xito-app .xip-content {
    flex: 1;
    min-width: 0;
}

.xito-app .xip-message {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.xito-app .xip-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.xito-app .xip-btn {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    transition: opacity 0.2s;
}

.xito-app .xip-btn:hover,
.xito-app .xip-btn:focus {
    opacity: 0.85;
    outline: none;
}

.xito-app .xip-btn-install {
    background: #ed1c24;
    color: #fff;
}

.xito-app .xip-btn-dismiss {
    background: #f0f0f0;
    color: #555;
}

/* Dark mode overrides */
.xito-app.theme-dark#xito-install-prompt {
    background: #2a2a2a;
    border-left-color: #ed1c24;
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.5);
}

.xito-app.theme-dark .xip-message { color: #eee; }

.xito-app.theme-dark .xip-btn-dismiss {
    background: #3a3a3a;
    color: #ccc;
}

/* ============================================================
   Nhóm 4 — Grid hai cột: ký hiệu và nội dung.
   ============================================================ */
.xito-app .x-body .xito-tx-pattern {
    /*
     * !important là có chủ đích: nội dung dán từ Word/TinyMCE có thể mang
     * display/margin/padding inline. Nếu chúng thắng, span prefix/text vẫn tồn
     * tại nhưng không còn chia hai cột và nhìn giống như formatter bị bỏ qua.
     */
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr) !important;
    align-items: start;
    column-gap: clamp(0.25em, 1vw, 0.5em) !important;
    margin: 0 0 12pt 3% !important;
    padding: 0 !important;
    text-indent: 0 !important;
    text-align: left !important;
    width: 97% !important;
    min-width: 0;
    box-sizing: border-box;
}

/*
 * XĐ. / X. / * / Đ. / ĐC: đều được JS gán is-group-align.
 * Trước đây class này không có CSS nên mỗi dòng dùng max-content riêng:
 * cột nội dung sau X. hoặc * bắt đầu sớm hơn XĐ./ĐC:, không thẳng hàng.
 * Dùng chung một độ rộng prefix để toàn bộ phần Xướng đáp có hanging indent
 * và điểm bắt đầu cột nội dung giống hệt Đ./ĐC:.
 */
.xito-app .x-body .xito-tx-pattern.is-group-align {
    /*
     * 2em đủ chứa ký hiệu rộng nhất (XĐ./ĐC:) nhưng không tạo khoảng trống
     * lớn như 3em. Khoảng hở 0.2em giữ chữ không dính sát ký hiệu.
     */
    grid-template-columns: 2em minmax(0, 1fr) !important;
    column-gap: 0.2em !important;
}

/* Prefix giữ nguyên một cụm nhưng chiều rộng luôn do glyph/font thực tế quyết định. */
.xito-app .x-body .xito-prefix-col {
    width: 100%;
    min-width: 0;
    max-width: none;
    white-space: nowrap;
    line-height: inherit;
}

/* min-width và overflow-wrap ngăn chuỗi dài ép vỡ cột nội dung. */
.xito-app .x-body .xito-text-col {
    min-width: 0;
    max-width: 100%;
    text-align: justify !important;
    -moz-text-align-last: left;
    text-align-last: left !important;
    text-justify: inter-word;
    word-spacing: normal;
    overflow-wrap: anywhere;
}

/* Nhóm 5 — luôn 1 hàng ngang. KHÔNG dùng font-size: inherit:
   inherit lấy cỡ của CHA TRỰC TIẾP (td/table/h5 hoặc style Word), không phải .x-body.
   Gắn vào --xito-body-fs do chính .x-body khai báo (và JS slider đồng bộ). */
.xito-app .x-body .xito-citation-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: nowrap !important;
    overflow: hidden;
    gap: clamp(0.2rem, 1.2vw, 0.75rem);
    width: 100%;
    min-width: 0;
    margin-left: 0;
    padding-left: 0;
    text-indent: 0;
    text-align: left;
    font-family: inherit !important;
    font-style: inherit !important;
    line-height: inherit !important;
    font-size: var(--xito-body-fs, 1em) !important;
    -webkit-text-size-adjust: 100% !important;
    -moz-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

.xito-app .x-body .xito-citation-title,
.xito-app .x-body .xito-citation-ref {
    min-width: 0;
    color: #ff0000;
    white-space: nowrap;
    font-family: inherit !important;
    font-style: inherit !important;
    line-height: inherit !important;
    font-size: var(--xito-body-fs, 1em) !important;
    -webkit-text-size-adjust: 100% !important;
    -moz-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

.xito-app .x-body .xito-citation-title {
    /* Tiêu đề không bao giờ co giãn hay bị cắt — giữ trọn vẹn nhãn (vd. "Đoản huấn"). */
    flex: 0 0 auto;
    font-weight: bold;
}

.xito-app .x-body .xito-citation-ref {
    /* Phần trích dẫn co lại trước khi bị đè lên tiêu đề trên màn hình cực hẹp,
       nhưng KHÔNG thu nhỏ font — chỉ giới hạn chiều rộng + ẩn phần dư bằng "…",
       đảm bảo hàng luôn gọn trong 1 dòng thay vì bị đẩy xuống dòng mới. */
    flex: 1 1 auto;
    min-width: 0;
    margin-left: auto;
    font-weight: normal;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .xito-app .x-body .xito-tx-pattern {
        margin-left: 1% !important;
        width: 99% !important;
    }

}
