:root {
    --gchat-primary: var(--reader-accent, #d97706);
    --gchat-primary-dark: var(--reader-accent-strong, #b45309);
    --gchat-accent: var(--reader-accent, #f2b400);
    --gchat-bg: var(--reader-page, #f1f5f9);
    --gchat-surface: var(--reader-paper, #ffffff);
    --gchat-surface-soft: var(--reader-paper-soft, #f8fafc);
    --gchat-text: var(--reader-text, #171717);
    --gchat-text-muted: var(--reader-muted, #64748b);
    --gchat-border: color-mix(in srgb, var(--reader-line, #e2e8f0) 100%, rgba(15, 23, 42, 0.04));
    --gchat-bubble-bg: var(--reader-paper, #ffffff);
    --gchat-bubble-border: var(--gchat-border);
    --gchat-bubble-self: color-mix(in srgb, var(--reader-accent, #f59e0b) 20%, var(--reader-paper, #fef3c7));
    --gchat-bubble-self-solid: color-mix(in srgb, var(--reader-accent, #f59e0b) 20%, var(--reader-paper, #fef3c7));
    --gchat-bubble-self-border: color-mix(in srgb, var(--reader-accent, #d97706) 30%, var(--gchat-border));
    --gchat-bubble-self-text: var(--reader-text, #78350f);
    --gchat-send-text: #ffffff;
    --gchat-link: var(--qk-link, #44619d);
}

html[data-reader-theme="night"],
html[data-reader-theme="storyforge-dark"],
html[data-reader-theme="dark"],
html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) {
    --gchat-primary: #f59e0b;
    --gchat-primary-dark: #d97706;
    --gchat-accent: #fbbf24;
    --gchat-bg: #0c111d;
    --gchat-surface: #121929;
    --gchat-surface-soft: #182236;
    --gchat-text: #f1f5f9;
    --gchat-text-muted: #94a3b8;
    --gchat-border: rgba(148, 163, 184, 0.15);
    --gchat-bubble-bg: #172033;
    --gchat-bubble-border: rgba(148, 163, 184, 0.17);
    --gchat-bubble-self: linear-gradient(135deg, rgba(217, 119, 6, 0.25) 0%, rgba(146, 64, 14, 0.20) 100%);
    --gchat-bubble-self-solid: #2b2015;
    --gchat-bubble-self-border: rgba(251, 191, 36, 0.36);
    --gchat-bubble-self-text: #fef3c7;
    --gchat-send-text: #18130a;
    --gchat-link: #60a5fa;
}

#global-chat-btn {
    display: none !important;
}

#global-chat-badge,
.global-chat-badge {
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    z-index: 30 !important;
    min-width: 16px !important;
    height: 16px !important;
    padding: 0 4px !important;
    border-radius: 9999px !important;
    background: #ef4444 !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    border: 1.5px solid var(--surface, #ffffff) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important;
    pointer-events: none !important;
}

#global-chat-badge.hidden,
.global-chat-badge.hidden {
    display: none !important;
}

#global-chat-modal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    z-index: 2147483000;
    background: rgba(4, 7, 15, 0.56);
    overscroll-behavior: contain;
    isolation: isolate;
    contain: strict;
}

html.gchat-open,
body.gchat-open {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: pan-x pan-y;
}

/* Hide floating site controls, lockers and ads when chat is open */
html.gchat-open .ads,
html.gchat-open [id^="_fc"],
html.gchat-open #adbox_show,
html.gchat-open #ads-container,
body.gchat-open .ads,
body.gchat-open [id^="_fc"],
body.gchat-open #adbox_show,
body.gchat-open #ads-container,
html.gchat-open #tts-global-btn,
html.gchat-open #theme-toggle,
html.gchat-open #global-chat-btn,
html.gchat-open #donate,
html.gchat-open #donate-close,
html.gchat-open .vozer-create-fab,
body.gchat-open #tts-global-btn,
body.gchat-open #theme-toggle,
body.gchat-open #global-chat-btn,
body.gchat-open #donate,
body.gchat-open #donate-close,
body.gchat-open .vozer-create-fab,
body.gchat-open .convert-app-dock {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    display: none !important;
}

#gchat-wrapper {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: clamp(500px, 50vw, 720px);
    max-width: 100%;
    height: 100%;
    background: var(--gchat-bg);
    color: var(--gchat-text);
    line-height: 1.45;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.24);
    border-left: 1px solid var(--gchat-border);
    animation: gchat-slide-in 0.14s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
    backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
    min-height: 0;
    overflow: hidden;
    transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, border-color 0.2s ease;
}

#gchat-wrapper.is-wide {
    width: clamp(680px, 72vw, 980px);
}

@keyframes gchat-slide-in {
    from { transform: translate3d(100%, 0, 0); }
    to { transform: translate3d(0, 0, 0); }
}

/* =========================================================================
   Unified Multi-Tab Channel Bar (Compact Single-Row + 100-NPC Avatar Dock)
   ========================================================================= */
#gchat-header.gchat-channel-bar {
    position: relative;
    z-index: 45;
    flex-shrink: 0;
    min-height: 40px;
    padding: max(4px, env(safe-area-inset-top, 0px)) 10px 4px;
    background: var(--gchat-surface);
    color: var(--gchat-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    border-bottom: 1px solid var(--gchat-border);
}

.gchat-channel-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.gchat-tab-world {
    display: inline-flex;
    align-items: center;
    gap: 5.5px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--gchat-border);
    background: var(--gchat-surface-soft);
    color: var(--gchat-text-muted);
    font-size: 11.8px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.16s ease;
}

.gchat-tab-world:hover {
    color: var(--gchat-text);
    border-color: color-mix(in srgb, var(--gchat-primary) 42%, var(--gchat-border));
}

.gchat-tab-world.is-active {
    background: color-mix(in srgb, var(--gchat-primary) 15%, var(--gchat-surface-soft));
    border-color: color-mix(in srgb, var(--gchat-primary) 52%, var(--gchat-border));
    color: var(--gchat-text);
    box-shadow: 0 1px 5px -1px rgba(245, 158, 11, 0.2);
}

html[data-reader-theme="night"] .gchat-tab-world.is-active,
html.dark .gchat-tab-world.is-active,
body.dark .gchat-tab-world.is-active {
    color: #fde68a;
    border-color: rgba(251, 191, 36, 0.45);
}

.gchat-tab-world-icon {
    width: 14px;
    height: 14px;
    color: var(--gchat-primary);
    flex-shrink: 0;
}

.gchat-tab-world-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
}

.gchat-channel-sep {
    width: 1px;
    height: 18px;
    background: var(--gchat-border);
    flex-shrink: 0;
    margin: 0 1px;
}

.gchat-channel-sep[hidden],
.gchat-npc-strip[hidden],
.gchat-npc-more-wrap[hidden] {
    display: none !important;
}

.gchat-npc-strip {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    min-width: 0;
    flex: 0 1 auto;
    padding: 2px 1px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.gchat-npc-strip::-webkit-scrollbar {
    display: none;
}

/* Compact Avatar Dock: inactive NPCs are 28x28 circular avatars; active NPC expands to pill */
.gchat-npc-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 28px;
    height: 28px;
    padding: 1px;
    border-radius: 999px;
    border: 1px solid var(--gchat-border);
    background: var(--gchat-surface-soft);
    color: var(--gchat-text-muted);
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, padding 0.15s ease;
}

.gchat-npc-tab:hover {
    color: var(--gchat-text);
    border-color: color-mix(in srgb, var(--gchat-primary) 50%, var(--gchat-border));
    background: color-mix(in srgb, var(--gchat-primary) 10%, var(--gchat-surface-soft));
    transform: translateY(-1px);
}

.gchat-npc-tab.is-active,
.gchat-npc-tab[data-temp="1"] {
    width: auto;
    gap: 5.5px;
    padding: 2px 8px 2px 2px;
    background: color-mix(in srgb, var(--gchat-primary) 16%, var(--gchat-surface-soft));
    border-color: color-mix(in srgb, var(--gchat-primary) 58%, var(--gchat-border));
    color: var(--gchat-text);
    font-weight: 750;
    box-shadow: 0 1px 6px -1px rgba(245, 158, 11, 0.22);
    transform: none;
}

html[data-reader-theme="night"] .gchat-npc-tab.is-active,
html.dark .gchat-npc-tab.is-active,
body.dark .gchat-npc-tab.is-active {
    color: #fef3c7;
    border-color: rgba(251, 191, 36, 0.48);
}

.gchat-npc-tab-avatar-wrap {
    position: relative;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.gchat-npc-tab-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 1.5px solid rgba(245, 158, 11, 0.48);
    background: var(--gchat-surface);
}

.gchat-npc-tab-name {
    display: none;
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gchat-npc-tab.is-active .gchat-npc-tab-name,
.gchat-npc-tab[data-temp="1"] .gchat-npc-tab-name {
    display: inline-block;
}

.gchat-npc-tab.gchat-story-tab {
    width: auto;
    gap: 5.5px;
    padding: 2px 8px 2px 2px;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.gchat-npc-tab.gchat-story-tab .gchat-npc-tab-name {
    display: inline-block;
}

.gchat-npc-tab-avatar.gchat-story-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 750;
    color: var(--gchat-primary, #d97706);
    background: rgba(245, 158, 11, 0.18);
}

.gchat-npc-tab-temp-dot {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.2);
    color: var(--gchat-primary);
}

.gchat-npc-tab-dismiss {
    display: none;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 9px;
    line-height: 1;
    color: var(--gchat-text-muted);
    transition: opacity 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.gchat-npc-tab.is-active .gchat-npc-tab-dismiss {
    display: inline-flex;
    opacity: 0.75;
}

.gchat-npc-tab:not(.is-active):hover .gchat-npc-tab-dismiss {
    display: inline-flex;
    position: absolute;
    top: -3px;
    right: -3px;
    width: 14px;
    height: 14px;
    background: var(--gchat-surface);
    border: 1px solid var(--gchat-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    opacity: 0.95;
    z-index: 3;
}

.gchat-npc-tab-dismiss:hover {
    opacity: 1 !important;
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
}

/* Searchable NPC Directory Button & Popover (for 100+ NPCs) */
.gchat-npc-more-wrap {
    position: static;
    flex-shrink: 0;
}

.gchat-npc-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--gchat-border);
    background: var(--gchat-surface-soft);
    color: var(--gchat-text-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.gchat-npc-more-btn svg {
    width: 12px;
    height: 12px;
    color: var(--gchat-primary);
    flex-shrink: 0;
}

.gchat-npc-more-btn:hover,
.gchat-npc-more-btn.is-open {
    color: var(--gchat-primary);
    border-color: color-mix(in srgb, var(--gchat-primary) 55%, var(--gchat-border));
    background: color-mix(in srgb, var(--gchat-primary) 10%, var(--gchat-surface-soft));
}

.gchat-npc-directory {
    position: absolute;
    top: calc(100% + 6px);
    left: 10px;
    right: auto;
    width: min(300px, calc(100% - 20px));
    max-height: 350px;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--gchat-primary) 26%, var(--gchat-border));
    background: var(--gchat-surface);
    color: var(--gchat-text);
    line-height: 1.35;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 120;
    overflow: hidden;
}

.gchat-npc-directory[hidden] {
    display: none !important;
}

.gchat-npc-dir-search {
    padding: 8px;
    border-bottom: 1px solid var(--gchat-border);
    background: color-mix(in srgb, var(--gchat-surface-soft) 65%, var(--gchat-surface));
}

.gchat-npc-dir-search input {
    display: block;
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--gchat-border) !important;
    background: var(--gchat-surface) !important;
    color: var(--gchat-text) !important;
    font-size: 12px !important;
    line-height: 30px !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gchat-npc-dir-search input::placeholder {
    color: var(--gchat-text-muted);
    opacity: 0.8;
}

.gchat-npc-dir-search input:focus {
    border-color: var(--gchat-primary) !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--gchat-primary) 18%, transparent) !important;
    outline: none !important;
}

.gchat-npc-dir-list {
    overflow-y: auto;
    max-height: 280px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gchat-npc-dir-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--gchat-text);
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease;
}

.gchat-npc-dir-item:hover,
.gchat-npc-dir-item.is-active {
    background: color-mix(in srgb, var(--gchat-primary) 12%, var(--gchat-surface-soft));
    border-color: color-mix(in srgb, var(--gchat-primary) 24%, transparent);
}

.gchat-npc-dir-item-main {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex: 1 1 auto;
}

.gchat-npc-dir-item-main .gchat-npc-tab-avatar {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 50%;
    object-fit: cover;
}

.gchat-npc-dir-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.gchat-npc-dir-item-name {
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--gchat-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gchat-npc-dir-item-sub {
    font-size: 11px;
    line-height: 1.25;
    color: var(--gchat-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gchat-window-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.gchat-win-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--gchat-text-muted);
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.gchat-win-btn:hover {
    background: color-mix(in srgb, var(--gchat-primary) 14%, transparent);
    color: var(--gchat-primary);
}

@media (max-width: 768px) {
    .gchat-win-btn--wide {
        display: none !important;
    }
}

/* World Subbar & Panels */
.gchat-view-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.gchat-view-panel[hidden] {
    display: none !important;
}

.gchat-world-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    background: color-mix(in srgb, var(--gchat-surface) 75%, var(--gchat-bg));
    border-bottom: 1px solid var(--gchat-border);
    flex-shrink: 0;
}

.gchat-world-subbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 11.5px;
    color: var(--gchat-text-muted);
}

.gchat-world-subbar-left strong {
    color: var(--gchat-text);
    font-weight: 700;
}

/* Embedded NPC Panel overrides inside #gchat-wrapper */
#gchat-npc-panel .char-chat-header {
    padding: 4px 8px !important;
    min-height: 0 !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
}

#gchat-npc-panel .char-chat-header.is-compact {
    padding: 2px 8px !important;
    min-height: 28px !important;
}

#gchat-npc-panel .char-chat-body {
    flex: 1 1 auto;
    min-height: 0;
}

#gchat-npc-panel .char-chat-wiki-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

#gchat-npc-panel .char-chat-wiki-link:hover {
    color: var(--cc-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: none;
}

.gchat-close {
    background: transparent;
    border: 0;
    color: var(--gchat-text-muted);
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.18s ease, color 0.18s ease;
}

.gchat-close:hover {
    background: rgba(242, 180, 0, 0.14);
    border-color: transparent;
    color: var(--gchat-primary);
}

#gchat-body-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--gchat-bg);
}

#gchat-body {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 8px 18px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overscroll-behavior: contain;
    min-width: 0;
    scrollbar-width: thin;
    scroll-behavior: auto !important;
    contain: content;
    will-change: scroll-position;
    transform: translateZ(0);
    -webkit-overflow-scrolling: touch;
}

#gchat-loadmore {
    padding: 4px 8px;
    text-align: center;
}

#gchat-loadmore button {
    background: transparent;
    border: none;
    color: var(--gchat-primary);
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
    opacity: 0.85;
    min-height: 0;
    padding: 2px 0;
}

#gchat-loadmore.is-loading button,
#gchat-loadmore button:disabled {
    opacity: 0.55;
    cursor: wait;
}

#gchat-footer {
    flex-shrink: 0;
    padding: 6px 8px max(6px, env(safe-area-inset-bottom, 0px));
    background: var(--gchat-bg);
    border-top: 1px solid var(--gchat-border);
    position: relative;
    z-index: 2;
}

#gchat-form {
    position: relative;
    z-index: 1;
}

.gchat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--gchat-bubble-bg);
    padding: 2px 2px 2px 10px;
    border-radius: 999px;
    border: 1px solid var(--gchat-border);
    box-shadow: none;
    transition: border-color 0.18s ease, background 0.18s ease;
}

body.dark .gchat-input-wrapper {
    border: 1px solid rgba(242, 180, 0, 0.25);
    background: rgba(15, 23, 42, 0.6);
}

.gchat-input-wrapper:focus-within {
    background: var(--gchat-bubble-bg);
    border-color: var(--gchat-primary);
    outline: none;
    box-shadow: none;
}

body.dark .gchat-input-wrapper:focus-within {
    background: #0f172a;
    border-color: var(--gchat-primary);
    outline: none;
    box-shadow: none;
}

#gchat-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    color: var(--gchat-text);
    font-size: 14px;
    outline: none !important;
    box-shadow: none !important;
    line-height: 1.6 !important;
    font-family: inherit !important;
    height: auto !important;
    padding: 5px 0 !important;
    min-height: 32px;
}

#gchat-send {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: var(--gchat-primary);
    color: var(--gchat-bubble-self-text);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.18s ease;
}

#gchat-send:hover:not(:disabled) {
    background: var(--gchat-primary-dark);
    transform: none;
    box-shadow: none;
}

#gchat-send:disabled {
    opacity: 0.8;
    cursor: not-allowed;
    font-size: 11.5px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.2px;
}

#gchat-send[data-locked="true"] {
    background: var(--gchat-border);
    color: var(--gchat-text-muted);
}

/* Shimmer Loading Skeleton */
.gchat-loading-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 16px;
}

.gchat-loading-row {
    height: 54px;
    background: var(--gchat-bubble-bg);
    border-radius: 12px;
    animation: gchat-pulse 1.2s ease-in-out infinite;
}

@keyframes gchat-pulse {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 0.4; }
}

/* Message Styles */
.gmsg {
    display: flex !important;
    flex-direction: row !important;
    align-self: flex-start !important;
    align-items: flex-start !important;
    gap: 8px;
    max-width: 85%;
    min-width: 0;
    margin: 0;
    position: relative;
    flex-shrink: 0;
}

.gmsg-self {
    flex-direction: row-reverse !important;
    align-self: flex-end !important;
}

.gmsg-avatar-col {
    flex-shrink: 0;
    width: 32px;
    overflow: visible;
}

.gmsg-avatar-col a,
.gmsg-avatar-col .avatar-frame-wrap {
    display: block;
    width: 32px;
    height: 32px;
    box-sizing: border-box;
    border-radius: 50%;
    overflow: visible;
}

.gmsg-avatar-col img {
    width: 100% !important;
    height: 100% !important;
    max-width: 32px;
    object-fit: cover;
}

.gmsg-body-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.gmsg-self .gmsg-body-col {
    align-items: flex-end;
}

.gmsg-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-width: 0;
    font-size: 11px;
    color: var(--gchat-text-muted);
}

.gmsg-self .gmsg-meta {
    flex-direction: row-reverse;
}

.gmsg-time {
    font-size: 10px;
    opacity: 0.8;
}

.gmsg-other .gmsg-time {
    margin-left: 4px;
}

.gmsg-self .gmsg-time {
    margin-right: 4px;
}

.gmsg-compact {
    margin-top: -2px;
}

.gmsg-compact .gmsg-avatar-col,
.gmsg-compact .gmsg-meta {
    display: none !important;
}

.gmsg-compact .gmsg-body-col {
    margin-left: 40px;
}

.gmsg-compact.gmsg-self .gmsg-body-col {
    margin-left: 0;
    margin-right: 40px;
}

.gmsg-content {
    display: inline-block;
    width: auto !important;
    padding: 7px 11px;
    border-radius: 14px;
    background: var(--gchat-bubble-bg);
    color: var(--gchat-text);
    font-size: 13.5px;
    line-height: 1.45;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    white-space: pre-wrap;
}

.gmsg-self .gmsg-content {
    background: var(--gchat-bubble-self);
    color: var(--gchat-bubble-self-text);
    border-top-right-radius: 4px;
    box-shadow: 0 2px 6px rgba(242, 180, 0, 0.15);
}

.gmsg-other .gmsg-content {
    border-top-left-radius: 4px;
    border: 1px solid var(--gchat-border);
}

.gmsg-compact.gmsg-self .gmsg-content {
    border-top-right-radius: 14px;
}

.gmsg-compact.gmsg-other .gmsg-content {
    border-top-left-radius: 14px;
}

/* =========================================================================
   Blockquote / Reply Quote Styling in Chat Messages
   ========================================================================= */
.gmsg-content.gmsg-has-quote,
.gmsg-content:has(> .gmsg-quote) {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    border-radius: 10px;
}

.gmsg-quote {
    margin: 0;
    padding: 7px 10px 8px 10px;
    background: linear-gradient(135deg, rgba(46, 29, 77, 0.92) 0%, rgba(25, 28, 48, 0.96) 100%);
    border: 1px solid rgba(168, 85, 247, 0.24);
    border-left: 3px solid #a855f7;
    border-radius: 10px;
    font-size: 12.5px;
    line-height: 1.5;
    text-align: left;
    display: block;
    box-sizing: border-box;
    white-space: normal;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.gmsg-has-user-text .gmsg-quote,
.gmsg-quote:has(+ .gmsg-user-text) {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
.gmsg-quote-header {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
    font-size: 11.5px;
    line-height: 1.25;
}
.gmsg-quote-author {
    font-weight: 700;
    color: #c084fc;
    letter-spacing: 0.1px;
}
.gmsg-quote-title {
    font-weight: 600;
    color: #c084fc;
}
.gmsg-reply-quote {
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.gmsg-reply-quote:hover {
    background: linear-gradient(135deg, rgba(58, 36, 96, 0.95) 0%, rgba(32, 34, 60, 0.98) 100%);
    border-color: rgba(168, 85, 247, 0.4);
    border-left-color: #c084fc;
}
.gmsg-reply-quote:active {
    transform: scale(0.995);
}
.gmsg-quote-body {
    font-style: italic;
    color: var(--gchat-text, #e2e8f0);
    opacity: 0.95;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
}
.gmsg-reply-quote .gmsg-quote-body {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
}
.gmsg-quote-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    vertical-align: middle;
    flex-shrink: 0;
    color: #c084fc;
}
.gmsg-self .gmsg-quote {
    background: linear-gradient(135deg, #fef9c3 0%, #fde68a 100%);
    border: 1px solid rgba(180, 83, 9, 0.24);
    border-left: 3px solid #b45309;
}
.gmsg-self .gmsg-quote-author,
.gmsg-self .gmsg-quote-title {
    color: #78350f;
}
.gmsg-self .gmsg-quote-body {
    color: var(--gchat-bubble-self-text, #070a13);
    opacity: 0.92;
}
.gmsg-self .gmsg-quote-icon {
    color: #78350f;
}
.gmsg-self .gmsg-reply-quote:hover {
    background: linear-gradient(135deg, #fef08a 0%, #fcd34d 100%);
    border-color: rgba(180, 83, 9, 0.36);
    border-left-color: #78350f;
}
html:not(.dark) .gmsg-other .gmsg-quote {
    background: linear-gradient(135deg, #f5f3ff 0%, #faf5ff 100%);
    border: 1px solid rgba(139, 92, 246, 0.22);
    border-left: 3px solid #7c3aed;
    box-shadow: 0 1px 2px rgba(139, 92, 246, 0.05);
}
html:not(.dark) .gmsg-other .gmsg-quote-header {
    color: #7c3aed;
}
html:not(.dark) .gmsg-other .gmsg-quote-author,
html:not(.dark) .gmsg-other .gmsg-quote-title {
    color: #7c3aed;
}
html:not(.dark) .gmsg-other .gmsg-quote-body {
    color: #334155;
}
html:not(.dark) .gmsg-other .gmsg-quote-icon {
    color: #7c3aed;
}
html:not(.dark) .gmsg-other .gmsg-reply-quote:hover {
    background: linear-gradient(135deg, #ede9fe 0%, #f5f3ff 100%);
    border-color: rgba(124, 58, 237, 0.35);
    border-left-color: #6d28d9;
}

/* Bia Nhân Sinh (Stele Card) in Global Chat */
.gmsg-retrospect-quote {
    padding: 9px 11px 10px;
    background: linear-gradient(155deg, rgba(28, 25, 23, 0.94) 0%, rgba(19, 17, 15, 0.97) 100%);
    border: 1px solid rgba(245, 158, 11, 0.36);
    border-left: 3.5px solid #f59e0b;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(254, 243, 199, 0.08);
    position: relative;
    overflow: hidden;
}
.gmsg-retrospect-quote.is-lifetime-card {
    background: linear-gradient(155deg, rgba(31, 26, 20, 0.96) 0%, rgba(20, 17, 14, 0.98) 100%);
    border-color: rgba(251, 191, 36, 0.42);
    border-left-color: #fbbf24;
}
.gmsg-retrospect-quote.is-death-card {
    background: linear-gradient(155deg, rgba(40, 18, 18, 0.95) 0%, rgba(24, 15, 14, 0.98) 100%);
    border-color: rgba(248, 113, 113, 0.40);
    border-left-color: #f87171;
}
.gmsg-retrospect-quote .gmsg-retro-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: 7px;
    margin-bottom: 8px;
    border-bottom: 1px dashed rgba(245, 158, 11, 0.26);
}
.gmsg-retro-header-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.gmsg-retrospect-quote .gmsg-quote-title {
    color: #fde68a;
    font-weight: 800;
    font-size: 12.6px;
    letter-spacing: 0.2px;
}
.gmsg-retrospect-quote .gmsg-stele-badge {
    width: 22px;
    height: 22px;
    color: #fde68a;
    background:
        radial-gradient(circle at 50% 25%, rgba(253, 224, 71, 0.22) 0%, transparent 75%),
        linear-gradient(180deg, rgba(245, 158, 11, 0.20) 0%, rgba(120, 53, 15, 0.36) 100%);
    border: 1px solid rgba(251, 191, 36, 0.58);
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow:
        inset 0 0 0 1px rgba(15, 12, 8, 0.65),
        inset 0 1px 0 rgba(254, 240, 138, 0.35),
        0 0 8px rgba(245, 158, 11, 0.16);
}
.gmsg-retrospect-quote .gmsg-quote-icon {
    width: 14px;
    height: 14px;
    color: #fde68a;
    filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.42));
}
.gmsg-retro-range {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 400;
    letter-spacing: 0.25px;
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(251, 191, 36, 0.34);
    color: #fcd34d;
    white-space: nowrap;
}
.gmsg-retro-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0 0 8px;
    padding: 0;
    background: transparent;
    border: none;
    font-style: normal;
}
.gmsg-retro-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8.5px;
    border-radius: 6px;
    font-size: 11.1px;
    line-height: 1.35;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: #fef3c7;
}
.gmsg-retro-chip-k {
    color: rgba(253, 230, 138, 0.78);
    font-weight: 600;
}
.gmsg-retro-chip-v {
    color: #fde047;
    font-weight: 800;
}
.gmsg-retrospect-quote .gmsg-retro-body {
    font-style: normal;
    font-size: 12.4px;
    line-height: 1.58;
    color: #e7e5e4;
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.gmsg-retrospect-quote.is-collapsible:not(.is-expanded) .gmsg-retro-body {
    max-height: 175px;
    overflow: hidden;
    position: relative;
    -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 72%, transparent 100%);
}
.gmsg-retro-sec {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 800;
    color: #fbbf24;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(245, 158, 11, 0.15);
    font-size: 12.4px;
    letter-spacing: 0.12px;
}
.gmsg-retro-sec:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.gmsg-retro-sec-mark {
    font-size: 11px;
    color: #f59e0b;
    flex-shrink: 0;
}
.gmsg-retro-item {
    position: relative;
    padding-left: 13px;
    color: #e7e5e4;
    opacity: 0.96;
}
.gmsg-retro-item::before {
    content: "◆";
    position: absolute;
    left: 1px;
    top: 4.5px;
    font-size: 7px;
    line-height: 1;
    color: #f59e0b;
    opacity: 0.85;
}
.gmsg-retro-line {
    color: #e7e5e4;
}
.gmsg-retro-time {
    display: inline;
    padding: 0;
    margin: 0;
    font-size: 11.5px;
    font-weight: 400 !important;
    background: transparent;
    border: none;
    color: #fcd34d;
    white-space: nowrap;
}
.gmsg-retro-toggle {
    margin-top: 8px;
    width: 100%;
    justify-content: center;
    padding: 5px 11px;
    border-radius: 8px;
    border: 1px solid rgba(245, 158, 11, 0.32);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.16), rgba(217, 119, 6, 0.10));
    color: #fde68a;
    font-size: 11.2px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: all 0.15s ease;
}
.gmsg-retro-toggle:hover {
    background: rgba(245, 158, 11, 0.25);
}

/* Light Reader Themes & Explicit Light Mode — Warm Ivory-Parchment Stele Theme */
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote {
    background: linear-gradient(155deg, #fffdf9 0%, #fef8ec 55%, #fdf2dc 100%) !important;
    border: 1px solid rgba(180, 83, 9, 0.26) !important;
    border-left: 3.5px solid #d97706 !important;
    box-shadow: 0 3px 12px rgba(180, 83, 9, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote.is-lifetime-card {
    background: linear-gradient(155deg, #fffdf8 0%, #fef5e7 55%, #fcedd0 100%) !important;
    border: 1px solid rgba(217, 119, 6, 0.32) !important;
    border-left: 3.5px solid #d97706 !important;
    box-shadow: 0 3px 12px rgba(180, 83, 9, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote.is-death-card {
    background: linear-gradient(155deg, #fffafa 0%, #fef2f2 60%, #fee2e2 100%) !important;
    border-color: rgba(185, 28, 28, 0.26) !important;
    border-left-color: #dc2626 !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-retro-header {
    border-bottom: 1px dashed rgba(180, 83, 9, 0.20) !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-quote-title {
    color: #9a3412 !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-stele-badge {
    color: #b45309 !important;
    background:
        radial-gradient(circle at 50% 25%, rgba(251, 191, 36, 0.25) 0%, transparent 75%),
        linear-gradient(180deg, rgba(245, 158, 11, 0.18) 0%, rgba(180, 83, 9, 0.14) 100%) !important;
    border-color: rgba(180, 83, 9, 0.45) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.65),
        0 1px 4px rgba(180, 83, 9, 0.12) !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-quote-icon {
    color: #b45309 !important;
    filter: none !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-retro-range {
    background: rgba(217, 119, 6, 0.12) !important;
    border-color: rgba(180, 83, 9, 0.26) !important;
    color: #92400e !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-retro-chip {
    background: rgba(255, 255, 255, 0.88) !important;
    border-color: rgba(217, 119, 6, 0.28) !important;
    color: #44403c !important;
    box-shadow: 0 1px 2px rgba(180, 83, 9, 0.05) !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-retro-chip-k {
    color: #78716c !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-retro-chip-v {
    color: #9a3412 !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote :is(.gmsg-retro-body, .gmsg-retro-item, .gmsg-retro-line) {
    color: #292524 !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-retro-item::before {
    color: #d97706 !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-retro-sec {
    color: #9a3412 !important;
    border-top-color: rgba(180, 83, 9, 0.15) !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-retro-sec-mark {
    color: #d97706 !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-retro-time {
    background: transparent !important;
    border: none !important;
    color: #92400e !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote .gmsg-retro-toggle {
    border-color: rgba(180, 83, 9, 0.28) !important;
    background: linear-gradient(180deg, rgba(217, 119, 6, 0.12), rgba(180, 83, 9, 0.07)) !important;
    color: #92400e !important;
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retro-toggle:hover {
    background: rgba(217, 119, 6, 0.20) !important;
}

/* Dark Themes — Obsidian & Amber Stele Theme (Bia Nhân Sinh) */
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote {
    background: linear-gradient(155deg, rgba(28, 25, 23, 0.94) 0%, rgba(19, 17, 15, 0.97) 100%) !important;
    border: 1px solid rgba(245, 158, 11, 0.36) !important;
    border-left: 3.5px solid #f59e0b !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(254, 243, 199, 0.08) !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote.is-lifetime-card {
    background: linear-gradient(155deg, rgba(31, 26, 20, 0.96) 0%, rgba(20, 17, 14, 0.98) 100%) !important;
    border-color: rgba(251, 191, 36, 0.42) !important;
    border-left-color: #fbbf24 !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote.is-death-card {
    background: linear-gradient(155deg, rgba(40, 18, 18, 0.95) 0%, rgba(24, 15, 14, 0.98) 100%) !important;
    border-color: rgba(248, 113, 113, 0.40) !important;
    border-left-color: #f87171 !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-retro-header {
    border-bottom: 1px dashed rgba(245, 158, 11, 0.26) !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-quote-title {
    color: #fde68a !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-stele-badge {
    color: #fde68a !important;
    background:
        radial-gradient(circle at 50% 25%, rgba(253, 224, 71, 0.22) 0%, transparent 75%),
        linear-gradient(180deg, rgba(245, 158, 11, 0.20) 0%, rgba(120, 53, 15, 0.36) 100%) !important;
    border: 1px solid rgba(251, 191, 36, 0.58) !important;
    box-shadow:
        inset 0 0 0 1px rgba(15, 12, 8, 0.65),
        inset 0 1px 0 rgba(254, 240, 138, 0.35),
        0 0 8px rgba(245, 158, 11, 0.16) !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-quote-icon {
    color: #fde68a !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-retro-range {
    background: rgba(245, 158, 11, 0.20) !important;
    border-color: rgba(251, 191, 36, 0.38) !important;
    color: #fcd34d !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-retro-chip {
    background: rgba(245, 158, 11, 0.14) !important;
    border: 1px solid rgba(251, 191, 36, 0.28) !important;
    color: #fef3c7 !important;
    box-shadow: none !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-retro-chip-k {
    color: rgba(253, 230, 138, 0.82) !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-retro-chip-v {
    color: #fde047 !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark,
    body.dark,
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote :is(.gmsg-retro-body, .gmsg-retro-item, .gmsg-retro-line) {
    color: #e2e8f0 !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-retro-item::before {
    color: #f59e0b !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-retro-sec {
    color: #fbbf24 !important;
    border-top-color: rgba(245, 158, 11, 0.18) !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-retro-sec-mark {
    color: #f59e0b !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-retro-time {
    background: transparent !important;
    border: none !important;
    color: #fcd34d !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retrospect-quote .gmsg-retro-toggle {
    border-color: rgba(245, 158, 11, 0.32) !important;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.16), rgba(217, 119, 6, 0.10)) !important;
    color: #fde68a !important;
}
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html[data-theme="dark"],
    body[data-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    body.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) .gmsg-retro-toggle:hover {
    background: rgba(245, 158, 11, 0.25) !important;
}


/* User's comment text when accompanied by a quote */
.gmsg-user-text {
    margin: 0;
    padding: 6px 10px 7px 10px;
    font-size: 13.5px;
    line-height: 1.45;
    display: block;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
    background: var(--gchat-bubble-bg);
    color: var(--gchat-text);
    border: 1px solid rgba(168, 85, 247, 0.24);
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
html:not(.dark) .gmsg-other .gmsg-user-text {
    background: #ffffff;
    border-color: rgba(139, 92, 246, 0.22);
}
.gmsg-self .gmsg-user-text {
    background: var(--gchat-bubble-self);
    color: var(--gchat-bubble-self-text, #070a13);
    border-color: rgba(180, 83, 9, 0.24);
}
.gmsg-retrospect-quote + .gmsg-user-text {
    border-color: rgba(245, 158, 11, 0.36);
}
.gmsg-retrospect-quote.is-death-card + .gmsg-user-text {
    border-color: rgba(248, 113, 113, 0.40);
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote + .gmsg-user-text {
    border-color: rgba(180, 83, 9, 0.26);
}
:is(
    html[data-reader-theme="white"],
    html[data-reader-theme="paper"],
    html[data-reader-theme="sepia"],
    html[data-reader-theme="ghi"],
    html[data-reader-theme="green"],
    html[data-reader-theme="gray"],
    body[data-reader-theme="white"],
    body[data-reader-theme="paper"],
    body[data-reader-theme="sepia"],
    body[data-reader-theme="ghi"],
    body[data-reader-theme="green"],
    body[data-reader-theme="gray"],
    html:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"]) body:not(.dark):not([data-theme="dark"]):not([data-reader-theme="night"]):not([data-reader-theme="storyforge-dark"]):not([data-reader-theme="dark"])
) .gmsg-retrospect-quote.is-death-card + .gmsg-user-text {
    border-color: rgba(185, 28, 28, 0.26);
}

/* Highlight pulse when jumping to original message */
@keyframes gmsgPulse {
    0% { background-color: rgba(168, 85, 247, 0.38); }
    50% { background-color: rgba(168, 85, 247, 0.16); }
    100% { background-color: transparent; }
}
.gmsg.gmsg-highlight .gmsg-bubble-wrap {
    animation: gmsgPulse 1.6s ease-out;
    border-radius: 12px;
}

/* =========================================================================
   Quote & Reply Preview Banner (Outside & Above Chat Input)
   ========================================================================= */
.gchat-quote-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    margin-bottom: 8px;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-left: 3px solid #a855f7;
    border-radius: 8px;
    box-sizing: border-box;
    animation: gchatQpSlide 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes gchatQpSlide {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.gchat-qp-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}
.gchat-qp-icon {
    flex-shrink: 0;
    color: #c084fc;
}
.gchat-qp-content {
    min-width: 0;
    flex: 1;
}
.gchat-qp-title {
    font-size: 11px;
    font-weight: 600;
    color: #c084fc;
    letter-spacing: 0.2px;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 4px;
}
.gchat-qp-reply-label {
    font-weight: 500;
    color: var(--gchat-muted, #94a3b8);
}
.gchat-qp-reply-target {
    color: #c084fc;
    font-weight: 700;
}
.gchat-qp-body {
    font-size: 12px;
    font-style: italic;
    color: var(--gchat-text, #e2e8f0);
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
    margin-top: 2px;
}
.gchat-qp-cancel {
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--gchat-muted, #94a3b8);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.gchat-qp-cancel:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    transform: scale(1.08);
}
html:not(.dark) .gchat-quote-preview {
    background: #f5f3ff;
    border-color: rgba(124, 58, 237, 0.25);
    border-left-color: #7c3aed;
}
html:not(.dark) .gchat-qp-title,
html:not(.dark) .gchat-qp-icon,
html:not(.dark) .gchat-qp-reply-target {
    color: #7c3aed;
}
html:not(.dark) .gchat-qp-reply-label {
    color: #64748b;
}
html:not(.dark) .gchat-qp-body {
    color: #334155;
}

.gmsg-system-msg {
    display: block !important;
    text-align: left;
    box-sizing: border-box;
    padding: 8px 10px;
    background: rgba(242, 180, 0, 0.08);
    border-radius: 12px;
    border: 0;
    box-shadow: none;
    width: fit-content !important;
    max-width: 86%;
    margin: 0;
    overflow-wrap: break-word;
    flex-shrink: 0;
}

.gmsg.gmsg-recommend {
    display: flex !important;
    flex-direction: column;
    gap: 2px;
    align-self: flex-start !important;
    width: fit-content !important;
    max-width: 86% !important;
    margin: 0;
    min-width: 0;
}

body.dark .gmsg-system-msg {
    background: rgba(242, 180, 0, 0.05);
    border: 0;
}

.gchat-system-body {
    display: block;
    font-size: 13px;
    line-height: 1.4;
    color: var(--gchat-text-muted);
    font-style: normal;
    overflow-wrap: break-word;
}

.gchat-system-time {
    display: block;
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--gchat-text-muted);
    font-style: normal;
    white-space: nowrap;
}

.gchat-system-link {
    color: var(--gchat-link, var(--qk-link, #44619d));
    font-weight: 700;
    font-style: normal;
    text-decoration: none;
}

.gchat-system-body .gmsg-name,
.gchat-rec-name {
    display: inline;
    font-size: inherit;
    font-weight: 700;
    line-height: inherit;
    overflow: visible;
    text-overflow: unset;
    white-space: nowrap;
}

.gchat-rec-title {
    display: inline;
    font-size: inherit;
    font-weight: 700;
    line-height: inherit;
    color: var(--gchat-link, var(--qk-link, #44619d));
    text-decoration: none;
}

.gchat-rec-title:hover {
    color: var(--gchat-link, var(--qk-link, #44619d));
    text-decoration: underline;
    text-underline-offset: 2px;
}

.gmsg-avatar {
    object-fit: cover;
}

.gmsg-avatar-col .avatar-frame-wrap img,
.gmsg-avatar-col img.gmsg-avatar {
    border-radius: 50% !important;
}

#global-chat-modal .avatar-frame-ring,
#global-chat-modal .avatar-frame-wrap > .avatar-frame-ring,
#global-chat-modal .has-frame > .avatar-frame-ring,
#global-chat-modal [class*="frame-"] > .avatar-frame-ring,
.gmsg-avatar-col .avatar-frame-ring {
    border-radius: 50% !important;
    transform: none !important;
    rotate: none !important;
}

#global-chat-modal .has-frame,
.gmsg-avatar-col .has-frame {
    box-shadow: none !important;
}

#global-chat-modal .has-frame::before,
#global-chat-modal .has-frame::after,
.gmsg-avatar-col .has-frame::before {
    display: none !important;
    content: none !important;
}

.gmsg-name {
    font-weight: 700;
    text-decoration: none;
    font-size: 12px;
    transition: opacity 0.2s ease;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gmsg-name:hover {
    opacity: 0.8;
}

.gmsg-name.text-gray-600,
.gmsg-name.text-slate-600 { color: #334155 !important; }
.gmsg-name.text-emerald-600,
.gmsg-name.text-teal-600 { color: #059669 !important; }
.gmsg-name.text-amber-600,
.gmsg-name.text-yellow-600 { color: #b45309 !important; }
.gmsg-name.text-pink-600,
.gmsg-name.text-rose-600 { color: #db2777 !important; }
.gmsg-name.text-indigo-600 { color: #4f46e5 !important; }
.gmsg-name.text-red-600 { color: #dc2626 !important; }

:is(html.dark, body.dark) .gmsg-name.text-gray-600,
:is(html.dark, body.dark) .gmsg-name.text-slate-600 { color: #cbd5e1 !important; }
:is(html.dark, body.dark) .gmsg-name.text-emerald-600,
:is(html.dark, body.dark) .gmsg-name.text-teal-600 { color: #34d399 !important; }
:is(html.dark, body.dark) .gmsg-name.text-amber-600,
:is(html.dark, body.dark) .gmsg-name.text-yellow-600 { color: #fbbf24 !important; }
:is(html.dark, body.dark) .gmsg-name.text-pink-600,
:is(html.dark, body.dark) .gmsg-name.text-rose-600 { color: #f472b6 !important; }
:is(html.dark, body.dark) .gmsg-name.text-indigo-600 { color: #818cf8 !important; }
:is(html.dark, body.dark) .gmsg-name.text-red-600 { color: #f87171 !important; }

.gmsg-meta span[title="Tài khoản VIP"] {
    color: var(--gchat-primary) !important;
}

.gmsg-identity {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3px;
    min-width: 0;
    min-height: 32px;
    flex: 1 1 auto;
}

.gmsg-identity-top,
.gmsg-identity-bottom {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    line-height: 1.35;
}

.gmsg-self .gmsg-identity {
    align-items: flex-end;
}

.gmsg-self .gmsg-identity-top,
.gmsg-self .gmsg-identity-bottom {
    justify-content: flex-end;
}

.gmsg-vip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    color: var(--gchat-primary);
    line-height: 1;
}

.gmsg-vip svg {
    display: block;
}

.gmsg-cult {
    font-size: 10px;
    line-height: 1.35;
    opacity: 0.8;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gmsg-time {
    flex: 0 0 auto;
    white-space: nowrap;
    line-height: 1.35;
}

.gmsg.is-fresh .gmsg-content {
    animation: gchat-fresh 0.8s ease;
}

@keyframes gchat-fresh {
    from { box-shadow: inset 0 0 0 1px rgba(242, 180, 0, 0.45); }
    to { box-shadow: none; }
}

/* =========================================================================
   Message Bubble Wrap & Glassmorphic Action Pill
   ========================================================================= */

.gmsg-bubble-wrap {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    max-width: 100%;
}

.gmsg-self .gmsg-bubble-wrap {
    align-items: flex-end;
}

.gmsg-other .gmsg-bubble-wrap {
    align-items: flex-start;
}

.gmsg-actions {
    position: absolute;
    bottom: -11px;
    display: inline-flex;
    align-items: center;
    padding: 2.5px 3px;
    gap: 2px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 9999px;
    box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.14),
                0 2px 4px -1px rgba(15, 23, 42, 0.08);
    opacity: 0;
    pointer-events: none;
    transform: translateY(3px) scale(0.94);
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    white-space: nowrap;
    user-select: none;
}

body.dark .gmsg-actions,
html.dark .gmsg-actions {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.5),
                0 2px 6px -1px rgba(0, 0, 0, 0.35);
}

.gmsg-other .gmsg-actions {
    left: 8px;
    right: auto;
    transform-origin: bottom left;
}

.gmsg-self .gmsg-actions {
    right: 8px;
    left: auto;
    transform-origin: bottom right;
}

/* Hover & Focus state on desktop */
@media (hover: hover) {
    .gmsg:hover .gmsg-actions,
    .gmsg:focus-within .gmsg-actions {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }
}

/* Active state for mobile touch & tapped message */
.gmsg.is-active {
    z-index: 15;
}

.gmsg.is-active .gmsg-actions {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) scale(1) !important;
}

.gmsg.is-active .gmsg-content {
    box-shadow: 0 0 0 1.5px var(--gchat-primary), 0 3px 10px rgba(242, 180, 0, 0.18) !important;
}

.gmsg-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3.5px;
    font-size: 10.5px;
    line-height: 1;
    font-weight: 550;
    letter-spacing: 0.15px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2.5px 7px;
    border-radius: 9999px;
    transition: color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

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

.gmsg-reply {
    color: #334155;
}

body.dark .gmsg-reply,
html.dark .gmsg-reply {
    color: #e2e8f0;
}

.gmsg-reply svg {
    width: 10.5px;
    height: 10.5px;
    display: inline-block;
    flex-shrink: 0;
    color: var(--gchat-primary, #f59e0b);
    transition: transform 0.15s ease;
}

.gmsg-reply:hover svg {
    transform: translateX(-1px);
}

.gmsg-reply:hover,
.gmsg-reply:focus-visible {
    color: #b45309;
    background-color: rgba(245, 158, 11, 0.12);
}

body.dark .gmsg-reply:hover,
body.dark .gmsg-reply:focus-visible {
    color: #fbbf24;
    background-color: rgba(245, 158, 11, 0.2);
}

.gmsg-delete {
    color: #e11d48;
}

body.dark .gmsg-delete,
html.dark .gmsg-delete {
    color: #fb7185;
}

.gmsg-delete svg {
    width: 10.5px;
    height: 10.5px;
    display: inline-block;
    flex-shrink: 0;
    color: inherit;
    transition: transform 0.15s ease;
}

.gmsg-delete:hover svg {
    transform: rotate(-8deg);
}

.gmsg-delete:hover,
.gmsg-delete:focus-visible {
    background-color: rgba(225, 29, 72, 0.12);
    color: #be123c;
}

body.dark .gmsg-delete:hover,
body.dark .gmsg-delete:focus-visible {
    background-color: rgba(225, 29, 72, 0.22);
    color: #fda4af;
}

/* Touch optimization for mobile */
@media (pointer: coarse), (max-width: 640px) {
    .gmsg-actions {
        bottom: -11px;
        padding: 2.5px 3px;
        gap: 2px;
    }
    .gmsg-action-btn {
        padding: 3.5px 7.5px;
        font-size: 11px;
    }
}

.gmsg-mention {
    font-weight: 700;
    color: inherit;
}

.gmsg-self .gmsg-mention {
    color: inherit;
    font-weight: 700;
}

.gchat-close:focus-visible,
#gchat-loadmore button:focus-visible,
#gchat-send:focus-visible,
.gmsg-action-btn:focus-visible,
.gmsg-delete:focus-visible,
#gchat-body:focus-visible {
    outline: 2px solid var(--gchat-primary);
    outline-offset: 2px;
}

.gchat-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.gchat-error {
    margin: auto;
    padding: 30px 16px;
    color: var(--gchat-text-muted);
    text-align: center;
}

@media (max-width: 768px) {
    #global-chat-modal {
        /* visualViewport JS keeps this glued above the soft keyboard */
        width: 100%;
        max-width: 100vw;
    }

    #gchat-wrapper,
    #gchat-wrapper.is-wide {
        width: 100% !important;
        max-width: 100% !important;
        height: 100%;
        left: 0;
        right: 0;
        border-left: none;
        box-shadow: none !important;
    }

    #gchat-header {
        flex-shrink: 0;
    }

    #gchat-body {
        padding: 6px 6px 16px 6px;
    }

    .gmsg {
        max-width: 96%;
        gap: 6px;
    }

    .gmsg-compact .gmsg-body-col {
        margin-left: 38px;
    }

    .gmsg-compact.gmsg-self .gmsg-body-col {
        margin-left: 0;
        margin-right: 38px;
    }

    .gmsg-content {
        padding: 6px 10px;
    }

    .gmsg-quote {
        padding: 6px 9px 7px 9px;
    }

    .gmsg-retrospect-quote {
        padding: 8px 10px 9px;
    }

    .gmsg-user-text {
        padding: 6px 9px 7px 9px;
    }

    .gmsg-system-msg,
    .gmsg.gmsg-recommend {
        max-width: 96% !important;
    }

    #gchat-footer {
        padding: 6px 8px max(6px, env(safe-area-inset-bottom, 0px));
    }

    .gchat-input-wrapper {
        gap: 6px;
        touch-action: manipulation;
    }

    #gchat-input {
        font-size: 16px; /* prevent iOS focus zoom */
        min-height: 32px;
        touch-action: manipulation;
    }

    #global-chat-modal.has-keyboard-open #gchat-footer,
    #global-chat-modal.has-keyboard-open .char-chat-composer {
        padding-bottom: 6px !important;
    }

    #gchat-send {
        width: 32px;
        height: 32px;
        min-width: 32px;
        flex-shrink: 0;
    }
}

/* iOS Safari WebKit: ensure all chat inputs stay >= 16px to prevent auto-zoom viewport jumping */
@supports (-webkit-touch-callout: none) {
    #gchat-input,
    .char-chat-textarea,
    .char-chat-selfkey-input,
    .char-chat-field input,
    .char-chat-field textarea {
        font-size: 16px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    #gchat-wrapper,
    .status-dot,
    .gchat-loading-row {
        animation: none !important;
    }

    #gchat-body {
        scroll-behavior: auto;
    }

    .gchat-close,
    .gchat-input-wrapper,
    #gchat-send,
    .gmsg-name,
    .gmsg-action-btn,
    .gmsg-reply,
    .gmsg-actions,
    .gmsg-delete {
        transition: none !important;
    }
}


/* =========================================================================
   Unified Theme-Adaptive Quotes, Replies & Single-Bar Header Overrides
   ========================================================================= */
.gchat-world-subbar {
    display: none !important;
}

.gchat-npc-dir-dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    font-size: 10px;
    color: var(--gchat-text-muted);
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.14s ease, background 0.14s ease, color 0.14s ease;
}
.gchat-npc-dir-item:hover .gchat-npc-dir-dismiss {
    opacity: 0.75;
}
.gchat-npc-dir-dismiss:hover {
    opacity: 1 !important;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.gchat-npc-dir-footer {
    padding: 5px 8px;
    font-size: 10.5px;
    color: var(--gchat-text-muted);
    text-align: center;
    border-top: 1px dashed var(--gchat-border);
}

#gchat-header #gchat-loadmore {
    display: inline-flex;
    align-items: center;
    padding: 0;
    margin-right: 2px;
}
#gchat-header #gchat-loadmore[hidden] {
    display: none !important;
}
#gchat-header #gchat-loadmore button {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--gchat-primary) 10%, var(--gchat-surface-soft));
    border: 1px solid color-mix(in srgb, var(--gchat-primary) 28%, var(--gchat-border));
    color: var(--gchat-primary);
    font-size: 10.8px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

#global-chat-modal .gmsg-quote:not(.gmsg-retrospect-quote),
html:not(.dark) #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) {
    background: color-mix(in srgb, var(--gchat-primary) 9%, var(--gchat-bubble-bg)) !important;
    border: 1px solid color-mix(in srgb, var(--gchat-primary) 26%, var(--gchat-border)) !important;
    border-left: 3px solid var(--gchat-primary) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}
#global-chat-modal .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-header,
#global-chat-modal .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-author,
#global-chat-modal .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-title,
#global-chat-modal .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-icon,
html:not(.dark) #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-header,
html:not(.dark) #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-author,
html:not(.dark) #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-title,
html:not(.dark) #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-icon {
    color: var(--gchat-primary-dark) !important;
}
html[data-reader-theme="night"] #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-header,
html[data-reader-theme="night"] #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-author,
html[data-reader-theme="night"] #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-title,
html[data-reader-theme="night"] #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-icon,
html.dark #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-header,
html.dark #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-author,
html.dark #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-title,
html.dark #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-icon,
body.dark #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-header,
body.dark #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-author,
body.dark #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-title,
body.dark #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-icon {
    color: var(--gchat-accent) !important;
}
#global-chat-modal .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-body,
html:not(.dark) #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) .gmsg-quote-body {
    color: color-mix(in srgb, var(--gchat-text) 90%, var(--gchat-text-muted)) !important;
}
#global-chat-modal .gmsg-self .gmsg-quote:not(.gmsg-retrospect-quote) {
    background: color-mix(in srgb, var(--gchat-primary) 26%, var(--gchat-bubble-self)) !important;
    border: 1px solid color-mix(in srgb, var(--gchat-primary-dark) 30%, var(--gchat-border)) !important;
    border-left: 3px solid var(--gchat-primary-dark) !important;
}
#global-chat-modal .gmsg-user-text,
html:not(.dark) #global-chat-modal .gmsg-other .gmsg-user-text {
    background: var(--gchat-bubble-bg) !important;
    color: var(--gchat-text) !important;
    border: 1px solid color-mix(in srgb, var(--gchat-primary) 24%, var(--gchat-border)) !important;
    border-top: none !important;
}
#global-chat-modal .gmsg-self .gmsg-user-text {
    background: var(--gchat-bubble-self) !important;
    color: var(--gchat-bubble-self-text, #070a13) !important;
    border-color: color-mix(in srgb, var(--gchat-primary-dark) 28%, var(--gchat-border)) !important;
}
#global-chat-modal .gmsg-actions {
    background: var(--gchat-surface) !important;
    border: 1px solid var(--gchat-border) !important;
}
#global-chat-modal .gmsg-reply {
    color: var(--gchat-text) !important;
}
#global-chat-modal .gchat-quote-preview,
html:not(.dark) #global-chat-modal .gchat-quote-preview {
    background: color-mix(in srgb, var(--gchat-primary) 10%, var(--gchat-surface)) !important;
    border-color: color-mix(in srgb, var(--gchat-primary) 30%, var(--gchat-border)) !important;
    border-left: 3px solid var(--gchat-primary) !important;
}
#global-chat-modal .gchat-qp-title,
#global-chat-modal .gchat-qp-icon,
#global-chat-modal .gchat-qp-reply-target,
html:not(.dark) #global-chat-modal .gchat-qp-title,
html:not(.dark) #global-chat-modal .gchat-qp-icon,
html:not(.dark) #global-chat-modal .gchat-qp-reply-target {
    color: var(--gchat-primary-dark) !important;
}
#global-chat-modal .gchat-qp-body,
html:not(.dark) #global-chat-modal .gchat-qp-body {
    color: var(--gchat-text) !important;
}


/* =========================================================================
   Compact NPC Header Controls (Model Trigger, Gear Icon & Subtitle)
   ========================================================================= */
#global-chat-modal .char-chat-model-trigger-badge,
#global-chat-modal [data-char-chat-quota-text],
#global-chat-modal .char-chat-sub-sep,
#global-chat-modal [data-char-chat-pronoun-label],
#global-chat-modal .char-chat-memory-btn span {
    display: none !important;
}

#global-chat-modal .char-chat-controls {
    gap: 5px !important;
}

#global-chat-modal .char-chat-model-trigger {
    height: 27px !important;
    padding: 0 8px 0 10px !important;
    gap: 4px !important;
    font-size: 11px !important;
}

#global-chat-modal .char-chat-icon-btn,
#global-chat-modal .char-chat-memory-btn {
    width: 27px !important;
    height: 27px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    gap: 0 !important;
    flex-shrink: 0 !important;
}

#global-chat-modal .char-chat-header.is-compact .char-chat-icon-btn,
#global-chat-modal .char-chat-header.is-compact .char-chat-memory-btn {
    width: 22px !important;
    height: 22px !important;
}

#global-chat-modal .char-chat-header.is-compact .char-chat-model-trigger {
    height: 22px !important;
    padding: 0 6px !important;
    font-size: 10px !important;
    max-width: 85px !important;
}

/* =========================================================================
   Custom Confirmation Modal (Replaces Native Browser confirm/alert)
   ========================================================================= */
.gchat-confirm-overlay {
    position: absolute;
    inset: 0;
    z-index: 95;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(9, 13, 24, 0.44);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: gchat-confirm-fade 0.16s ease-out;
}

.gchat-confirm-overlay[hidden] {
    display: none !important;
}

@keyframes gchat-confirm-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes gchat-confirm-pop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(4px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.gchat-confirm-dialog {
    width: 100%;
    max-width: 345px;
    padding: 18px 18px 16px;
    border-radius: 16px;
    background: var(--gchat-surface);
    color: var(--gchat-text);
    border: 1px solid var(--gchat-border);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24), 0 4px 12px rgba(0, 0, 0, 0.08);
    animation: gchat-confirm-pop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.gchat-confirm-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 9px;
}

.gchat-confirm-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--gchat-primary) 15%, var(--gchat-surface-soft));
    color: var(--gchat-primary-dark);
    border: 1px solid color-mix(in srgb, var(--gchat-primary) 26%, transparent);
}

.gchat-confirm-dialog[data-tone="danger"] .gchat-confirm-icon {
    background: color-mix(in srgb, #ef4444 14%, var(--gchat-surface-soft));
    color: #dc2626;
    border-color: color-mix(in srgb, #ef4444 26%, transparent);
}

html[data-reader-theme="night"] .gchat-confirm-dialog[data-tone="danger"] .gchat-confirm-icon,
html.dark .gchat-confirm-dialog[data-tone="danger"] .gchat-confirm-icon,
body.dark .gchat-confirm-dialog[data-tone="danger"] .gchat-confirm-icon {
    color: #f87171;
}

.gchat-confirm-title {
    margin: 0;
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--gchat-text);
}

.gchat-confirm-desc {
    margin: 0 0 16px;
    font-size: 12.5px;
    line-height: 1.52;
    color: var(--gchat-text-muted);
}

.gchat-confirm-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.gchat-confirm-btn {
    height: 33px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.16s ease;
    border: 1px solid transparent;
}

.gchat-confirm-btn--cancel {
    background: var(--gchat-surface-soft);
    color: var(--gchat-text-muted);
    border-color: var(--gchat-border);
}

.gchat-confirm-btn--cancel:hover {
    color: var(--gchat-text);
    border-color: color-mix(in srgb, var(--gchat-text-muted) 40%, var(--gchat-border));
}

.gchat-confirm-btn--ok {
    background: linear-gradient(135deg, var(--gchat-primary), var(--gchat-primary-dark));
    color: #ffffff;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--gchat-primary) 32%, transparent);
}

.gchat-confirm-btn--ok:hover {
    filter: brightness(1.06);
    transform: translateY(-0.5px);
}

.gchat-confirm-dialog[data-tone="danger"] .gchat-confirm-btn--ok {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.gchat-confirm-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

/* =========================================================================
   Refined Dark Mode Palette (Night / StoryForge Dark / Site Dark)
   ========================================================================= */
#gchat-send {
    color: var(--gchat-send-text, #ffffff);
}

.gmsg-self .gmsg-content {
    border: 1px solid var(--gchat-bubble-self-border, rgba(217, 119, 6, 0.26));
}

.gmsg-other .gmsg-content {
    border: 1px solid var(--gchat-bubble-border, var(--gchat-border));
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal {
    --gchat-primary: #f59e0b;
    --gchat-primary-dark: #d97706;
    --gchat-accent: #fbbf24;
    --gchat-bg: #0c111d;
    --gchat-surface: #121929;
    --gchat-surface-soft: #182236;
    --gchat-text: #f1f5f9;
    --gchat-text-muted: #94a3b8;
    --gchat-border: rgba(148, 163, 184, 0.15);
    --gchat-bubble-bg: #172033;
    --gchat-bubble-border: rgba(148, 163, 184, 0.17);
    --gchat-bubble-self: linear-gradient(135deg, rgba(217, 119, 6, 0.25) 0%, rgba(146, 64, 14, 0.20) 100%);
    --gchat-bubble-self-solid: #2b2015;
    --gchat-bubble-self-border: rgba(251, 191, 36, 0.36);
    --gchat-bubble-self-text: #fef3c7;
    --gchat-send-text: #18130a;
    --gchat-link: #60a5fa;
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal #gchat-header.gchat-channel-bar {
    background: linear-gradient(180deg, #151d30 0%, #111827 100%);
    border-bottom-color: rgba(148, 163, 184, 0.15);
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gchat-tab-world.is-active,
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gchat-npc-tab.is-active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.20) 0%, rgba(180, 83, 9, 0.14) 100%);
    border-color: rgba(251, 191, 36, 0.45);
    color: #fef3c7;
    box-shadow: 0 2px 8px -2px rgba(245, 158, 11, 0.25);
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-other .gmsg-content {
    background: linear-gradient(180deg, #182236 0%, #141c2e 100%);
    border: 1px solid rgba(148, 163, 184, 0.17);
    color: #f1f5f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-self .gmsg-content {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.25) 0%, rgba(146, 64, 14, 0.20) 100%);
    border: 1px solid rgba(251, 191, 36, 0.36);
    color: #fef3c7;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(254, 243, 199, 0.08);
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-other .gmsg-quote:not(.gmsg-retrospect-quote) {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.11) 0%, rgba(24, 34, 54, 0.96) 100%) !important;
    border: 1px solid rgba(245, 158, 11, 0.28) !important;
    border-left: 3px solid #f59e0b !important;
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-other .gmsg-quote-header,
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-other .gmsg-quote-author,
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-other .gmsg-quote-title,
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-other .gmsg-quote-icon {
    color: #fbbf24 !important;
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-other .gmsg-quote-body {
    color: #cbd5e1 !important;
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-other .gmsg-user-text {
    background: linear-gradient(180deg, #182236 0%, #141c2e 100%) !important;
    color: #f1f5f9 !important;
    border: 1px solid rgba(245, 158, 11, 0.24) !important;
    border-top: none !important;
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-self .gmsg-quote:not(.gmsg-retrospect-quote) {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.32) 0%, rgba(180, 83, 9, 0.24) 100%) !important;
    border: 1px solid rgba(251, 191, 36, 0.42) !important;
    border-left: 3px solid #fbbf24 !important;
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-self .gmsg-quote-header,
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-self .gmsg-quote-author,
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-self .gmsg-quote-title,
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-self .gmsg-quote-icon {
    color: #fde68a !important;
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-self .gmsg-quote-body {
    color: #fef3c7 !important;
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gmsg-self .gmsg-user-text {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.25) 0%, rgba(146, 64, 14, 0.20) 100%) !important;
    color: #fef3c7 !important;
    border: 1px solid rgba(251, 191, 36, 0.36) !important;
    border-top: none !important;
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal #gchat-footer,
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal #gchat-story-footer {
    background: #111827;
    border-top-color: rgba(148, 163, 184, 0.15);
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gchat-input-wrapper {
    background: #161f33;
    border: 1px solid rgba(148, 163, 184, 0.20);
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gchat-input-wrapper:focus-within {
    background: #19243b;
    border-color: rgba(245, 158, 11, 0.55);
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal #gchat-send {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    color: #18130a;
}

:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gchat-qp-title,
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gchat-qp-icon,
:is(
    html[data-reader-theme="night"],
    html[data-reader-theme="storyforge-dark"],
    html[data-reader-theme="dark"],
    html.dark:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]),
    html:not([data-reader-theme="white"]):not([data-reader-theme="paper"]):not([data-reader-theme="sepia"]):not([data-reader-theme="ghi"]):not([data-reader-theme="green"]):not([data-reader-theme="gray"]) body.dark
) #global-chat-modal .gchat-qp-reply-target {
    color: #fbbf24 !important;
}

#gchat-story-body-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--gchat-bg);
    min-height: 0;
}

#gchat-story-older {
    padding: 4px 8px;
    text-align: center;
    flex-shrink: 0;
}

#gchat-story-older button {
    background: transparent;
    border: none;
    color: var(--gchat-primary);
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
}

#gchat-story-body {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 8px 18px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overscroll-behavior: contain;
    min-width: 0;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

#gchat-story-footer {
    flex-shrink: 0;
    padding: 6px 8px max(6px, env(safe-area-inset-bottom, 0px));
    background: var(--gchat-bg);
    border-top: 1px solid var(--gchat-border);
}

#gchat-story-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    color: var(--gchat-text);
    font-size: 14px;
    outline: none !important;
    box-shadow: none !important;
    line-height: 1.6 !important;
    font-family: inherit !important;
    height: auto !important;
    padding: 5px 0 !important;
    min-height: 32px;
}

#gchat-story-send {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: var(--gchat-primary);
    color: var(--gchat-bubble-self-text);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

#gchat-story-send:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

.gchat-story-empty {
    margin: auto;
    padding: 28px 16px;
    color: var(--gchat-text-muted);
    text-align: center;
}

@media (max-width: 768px) {
    #gchat-story-input {
        font-size: 16px;
        min-height: 32px;
    }
}
