:root {
    --bubble-width-adjustment: 18px;
    --bubble-vertical-padding: 8px;
    --header-title-weight: 600;
    --moment-poster-weight: 600;
    --moment-likes-weight: 600;
    --commenter-name-weight: 600;
    --storage-ai-bubble-bg-light: #FFFFFF;
    --storage-ai-bubble-bg-dark: #2C2C2C;
    --storage-user-bubble-bg-light: #007AFF;
    --storage-user-bubble-bg-dark: #007AFF;
    --storage-ai-text-color-light: #1a1a1a;
    --storage-ai-text-color-dark: #e0e0e0;
    --storage-user-text-color-light: #ffffff;
    --storage-user-text-color-dark: #ffffff;
    --storage-bubble-corner-radius: 19px;
    --storage-bg-color-light: #f7f7f7;
    --storage-bg-color-dark: #111111;
    --bg-color-light: var(--storage-bg-color-light);
    --bg-color-dark: var(--storage-bg-color-dark);
    --text-color-light: #1a1a1a;
    --text-color-dark: #e0e0e0;
    --assistant-msg-bg-light: var(--storage-ai-bubble-bg-light);
    --assistant-msg-bg-dark: var(--storage-ai-bubble-bg-dark);
    --border-color-light: #dcdcdc;
    --border-color-dark: #444;
    --input-action-color-light: #C2C2C2;
    --input-action-color-dark: #5C5C5C;
    --button-bg: #007AFF;
    --button-text: #ffffff;
    --time-divider-color: #8e8e8e;
    --dialog-bg-light: rgba(0, 0, 0, 0.5);
    --dialog-bg-dark: rgba(0, 0, 0, 0.7);
    --header-bg-light: rgba(247, 247, 247, 0.85);
    --header-bg-dark: rgba(17, 17, 17, 0.85);
    --input-bg-light: rgba(255, 255, 255, 0.5);
    --input-bg-dark: rgba(255, 255, 255, 0.05);
    --input-border-color-light: rgba(255, 255, 255, 0.5);
    --input-border-color-dark: rgba(255, 255, 255, 0.05);
    --chat-input-bg-light: var(--input-bg-light);
    --chat-input-bg-dark: var(--input-bg-dark);
    --chat-input-border-color-light: var(--input-border-color-light);
    --chat-input-border-color-dark: var(--input-border-color-dark);
    --settings-item-hover-bg-light: rgba(0, 0, 0, 0.05);
    --settings-item-hover-bg-dark: rgba(255, 255, 255, 0.1);
    --user-msg-bg: var(--storage-user-bubble-bg-light);
    --user-msg-text: var(--storage-user-text-color-light);
    --backdrop-blur-amount: 20px;
    --ai-msg-text: var(--storage-ai-text-color-light);
    --bubble-corner-radius: var(--storage-bubble-corner-radius);
    --bg-color: var(--bg-color-light);
    --header-bg: var(--header-bg-light);
    --text-color: var(--text-color-light);
    --assistant-msg-bg: var(--assistant-msg-bg-light);
    --border-color: var(--border-color-light);
    --input-bg: var(--input-bg-light);
    --input-border-color: var(--input-border-color-light);
    --chat-input-bg: var(--chat-input-bg-light);
    --chat-input-border-color: var(--chat-input-border-color-light);
    --dialog-bg: var(--dialog-bg-light);
    --dialog-content-bg: var(--dialog-content-bg-light);
    --icon-fill-color: var(--text-color-light);
    --settings-item-hover-bg: var(--settings-item-hover-bg-light);
    --input-action-color: var(--input-action-color-light);
    --custom-icon-stroke-color: var(--border-color);
    --dynamic-avatar-size: 38px;
    --chat-scrollbar-size: 10px;
    --chat-scrollbar-thumb-color-light: rgba(60, 60, 67, 0.38);
    --chat-scrollbar-thumb-color-dark: rgba(235, 235, 245, 0.34);
    --chat-scrollbar-thumb-color: var(--chat-scrollbar-thumb-color-light);
    --max-container-width: 100vw;
    --chat-main-input-height: 36px;
    --chat-input-bottom-padding: 7px;
}

@supports (-webkit-touch-callout: none) {
    @media screen and (prefers-contrast: more) {
        :root {
            --header-title-weight: 700;
            --moment-poster-weight: 800;
            --moment-likes-weight: 700;
            --commenter-name-weight: 700;
        }
    }
}

@media screen and (-webkit-min-device-pixel-ratio: 2) and (min-resolution: 192dpi) {
    @supports (font: -apple-system-body) {
        * {
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }
    }
}

html[data-theme="dark"] {
    --bg-color: var(--bg-color-dark);
    --header-bg: var(--header-bg-dark);
    --text-color: var(--text-color-dark);
    --assistant-msg-bg: var(--assistant-msg-bg-dark);
    --border-color: var(--border-color-dark);
    --input-bg: var(--input-bg-dark);
    --input-border-color: var(--input-border-color-dark);
    --chat-input-bg: var(--chat-input-bg-dark);
    --chat-input-border-color: var(--chat-input-border-color-dark);
    --dialog-bg: var(--dialog-bg-dark);
    --dialog-content-bg: var(--dialog-content-bg-dark);
    --icon-fill-color: var(--text-color-dark);
    --settings-item-hover-bg: var(--settings-item-hover-bg-dark);
    --input-action-color: var(--input-action-color-dark);
    --user-msg-bg: var(--storage-user-bubble-bg-dark);
    --user-msg-text: var(--storage-user-text-color-dark);
    --ai-msg-text: var(--storage-ai-text-color-dark);
    --chat-scrollbar-thumb-color: var(--chat-scrollbar-thumb-color-dark);
}

*,
*::before,
*::after {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
    tap-highlight-color: rgba(0, 0, 0, 0) !important;
    -webkit-focus-ring-color: rgba(0, 0, 0, 0);
}

*:focus {
    outline: none !important;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    max-width: var(--max-container-width);
    margin: 0 auto;
    background-color: transparent;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    visibility: hidden;
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(3px + env(safe-area-inset-top)) 15px 0px 15px;
    background-color: transparent;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    box-sizing: border-box;
    overflow: visible;
}

#header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--header-bg);
    backdrop-filter: blur(var(--backdrop-blur-amount));
    -webkit-backdrop-filter: blur(var(--backdrop-blur-amount));
    pointer-events: none;
    z-index: -1;
}

#header h1 {
    font-size: 17px;
    margin: 0;
    color: var(--text-color);
    font-weight: var(--header-title-weight);
}

.header-buttons-left,
.header-buttons-right {
    display: flex;
    align-items: center;
    flex: 1;
}

.header-buttons-left {
    justify-content: flex-start;
}

.header-buttons-right {
    justify-content: flex-end;
    gap: 5px;
}

#notification-badge {
    display: none;
    width: 22px;
    height: 22px;
    background-color: #FF3B30;
    color: white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
    flex-shrink: 0;
    cursor: pointer;
    transform-origin: center;
    animation: badgePop 0.2s ease-out;
}

@keyframes badgePop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#theme-toggle-btn {
    padding-left: 0;
    padding-right: 0;
    margin-left: 5px;
}

#ai-name-display-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#ai-name-display-wrapper h1 {
    pointer-events: auto;
}

#sync-status-btn {
    padding: 5px;
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 5px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#settings-btn {
    position: relative;
    right: 3px;
}

.back-arrow-icon {
    width: 24px;
    height: 24px;
    stroke: var(--icon-fill-color);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

#back-arrow-menu {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95) translateY(-5px);
    transform-origin: top left;
    transition: transform 0.15s ease-out, opacity 0.15s ease-out;
    position: absolute;
    top: calc(100% + 5px);
    left: 15px;
    background-color: var(--header-bg);
    backdrop-filter: blur(var(--backdrop-blur-amount));
    -webkit-backdrop-filter: blur(var(--backdrop-blur-amount));
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 20;
    overflow: hidden;
    min-width: 120px;
    will-change: backdrop-filter;
}

#back-arrow-menu.visible {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}

.back-arrow-menu-item {
    background: none;
    border: none;
    color: var(--text-color);
    padding: 10px 15px;
    width: 100%;
    text-align: left;
    font-size: 16px;
    cursor: pointer;
    display: block;
}

.back-arrow-menu-item:hover {
    background-color: var(--settings-item-hover-bg);
}

.back-arrow-menu-item:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

#chat-window {
    height: 100%;
    width: 100%;
    overflow-y: auto;
    padding: 70px 15px 80px 15px;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    -webkit-overflow-scrolling: touch;
    will-change: scroll-position;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

#chat-window:hover,
#chat-window:focus-within,
#chat-window:active {
    scrollbar-color: var(--chat-scrollbar-thumb-color) transparent;
}

#chat-window::-webkit-scrollbar {
    width: var(--chat-scrollbar-size);
}

#chat-window::-webkit-scrollbar-track {
    background: transparent;
}

#chat-window::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background-color 0.15s ease;
}

#chat-window:hover::-webkit-scrollbar-thumb,
#chat-window:focus-within::-webkit-scrollbar-thumb,
#chat-window:active::-webkit-scrollbar-thumb {
    background-color: var(--chat-scrollbar-thumb-color);
}

#chat-window::-webkit-scrollbar-corner {
    background: transparent;
}

.time-divider {
    text-align: center;
    font-size: 14px;
    color: var(--time-divider-color);
    margin: 0;
    background-color: transparent;
    padding: 2px 8px;
    border-radius: 50px;
    display: inline-block;
    align-self: center;
    margin-top: 4px;
    margin-bottom: 15px;
}

body.show-timestamp-background .time-divider {
    background-color: var(--header-bg);
    backdrop-filter: blur(var(--backdrop-blur-amount));
    -webkit-backdrop-filter: blur(var(--backdrop-blur-amount));
}

.message-wrapper {
    display: flex;
    gap: 5px;
    max-width: calc(83% + var(--bubble-width-adjustment));
    align-items: flex-end;
    margin-bottom: 18px;
}

body.hide-ai-avatar .assistant-wrapper .avatar,
body.hide-user-avatar .user-wrapper .avatar {
    display: none;
}

body.hide-ai-avatar .assistant-wrapper,
body.hide-user-avatar .user-wrapper {
    max-width: calc(83% + var(--bubble-width-adjustment) - 6px);
}

#chat-window>.message-wrapper:last-child {
    margin-bottom: 0;
}

#chat-window>*:first-child {
    margin-top: 0;
}

.avatar {
    width: var(--dynamic-avatar-size);
    height: var(--dynamic-avatar-size);
    border-radius: var(--avatar-corner-radius, 50%);
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
}

.message-content {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    position: relative;
    bottom: 0px;
}

.message-bubble {
    padding: var(--bubble-vertical-padding) 12px;
    width: fit-content;
    max-width: 100%;
    line-height: 1.3;
    word-wrap: break-word;
    white-space: pre-wrap;
    position: relative;
    z-index: 1;
    font-size: var(--chat-font-size, 17px);
    cursor: pointer;
    border-radius: var(--bubble-corner-radius);
    transform: translateZ(0);
    hanging-punctuation: allow-end last;
    -webkit-hanging-punctuation: allow-end last;
    line-break: strict;
}

.sticker-container {
    display: flex;
    align-items: center;
    background-color: transparent;
}

.assistant-wrapper .sticker-container {
    justify-content: flex-start;
    margin-left: 8px;
}

.user-wrapper .sticker-container {
    justify-content: flex-end;
    margin-right: 8px;
}

.sticker-image {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 0;
    background-color: transparent;
    cursor: pointer;
}

.user-sent-image {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    cursor: pointer;
    object-fit: cover;
}

.user-wrapper .message-content {
    align-items: flex-end;
}

.user-wrapper .user-sent-image {
    margin-right: 8px;
}

.user-wrapper {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.user-wrapper .avatar {
    right: -1px;
}

.user-wrapper .message-bubble {
    background-color: var(--user-msg-bg);
    color: var(--user-msg-text);
    margin-right: 7px;
}

body:not(.avatars-at-top) .user-wrapper .message-bubble::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: -10px;
    width: 10px;
    height: 20px;
    background-color: var(--bg-color);
    border-bottom-left-radius: 10px;
    z-index: -1;
}

body:not(.avatars-at-top) .user-wrapper .message-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -7px;
    width: 18px;
    height: 19px;
    background-color: var(--user-msg-bg);
    border-bottom-left-radius: 15px;
    z-index: -2;
}

body.avatars-at-top .user-wrapper .message-bubble::before {
    content: '';
    position: absolute;
    top: calc(var(--bubble-vertical-padding) + (var(--chat-font-size, 17px) * 1.3 / 2) - 6px);
    right: -3px;
    width: 12px;
    height: 12px;
    background-color: var(--user-msg-bg);
    transform: rotate(45deg) skew(-5deg, -5deg);
    border-top-right-radius: 1.5px;
    border: none;
    z-index: -1;
}

body.avatars-at-top .user-wrapper .message-bubble::after {
    display: none;
}

.assistant-wrapper {
    align-self: flex-start;
}

.assistant-wrapper .avatar {
    left: -1px;
}

.assistant-wrapper .message-bubble {
    background-color: var(--assistant-msg-bg);
    color: var(--ai-msg-text);
    margin-left: 7px;
}

body:not(.avatars-at-top) .assistant-wrapper .message-bubble::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -10px;
    width: 10px;
    height: 20px;
    background-color: var(--bg-color);
    border-bottom-right-radius: 10px;
    z-index: -1;
}

body:not(.avatars-at-top) .assistant-wrapper .message-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -7px;
    width: 18px;
    height: 19px;
    background-color: var(--assistant-msg-bg);
    border-bottom-right-radius: 15px;
    z-index: -2;
}

body.avatars-at-top .assistant-wrapper .message-bubble::before {
    content: '';
    position: absolute;
    top: calc(var(--bubble-vertical-padding) + (var(--chat-font-size, 17px) * 1.3 / 2) - 6px);
    left: -3px;
    width: 12px;
    height: 12px;
    background-color: var(--assistant-msg-bg);
    transform: rotate(45deg) skew(-5deg, -5deg);
    border-bottom-left-radius: 1.5px;
    border: none;
    z-index: -1;
}

body.avatars-at-top .assistant-wrapper .message-bubble::after {
    display: none;
}

.assistant-wrapper .message-bubble.error {
    background-color: #5a1d1d;
    color: #ffacac;
}

body:not(.avatars-at-top) .assistant-wrapper .message-bubble.error::after {
    background-color: #5a1d1d;
}

body.avatars-at-top .assistant-wrapper .message-bubble.error::before {
    background-color: #5a1d1d;
}

body.hide-bubble-tails .message-bubble::before,
body.hide-bubble-tails .message-bubble::after {
    display: none;
}

body.avatars-at-top .message-wrapper {
    align-items: flex-start;
}

#input-area {
    display: flex;
    flex-direction: column;
    padding: 7px 15px;
    padding-bottom: calc(var(--chat-input-bottom-padding) + env(safe-area-inset-bottom));
    background-color: transparent;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    box-sizing: border-box;
    overflow: visible;
}

#input-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--header-bg);
    backdrop-filter: blur(var(--backdrop-blur-amount));
    -webkit-backdrop-filter: blur(var(--backdrop-blur-amount));
    pointer-events: none;
    z-index: -1;
}

#chat-form {
    display: flex;
    gap: 5px;
    align-items: center;
    width: 100%;
}

#user-input {
    flex-grow: 1;
    background-color: var(--chat-input-bg);
    color: var(--text-color);
    border: 1px solid var(--chat-input-border-color);
    border-radius: var(--bubble-corner-radius);
    padding: max(0px, calc((var(--chat-main-input-height) - (var(--chat-font-size, 17px) * 1.3) - 2px) / 2)) 9px;
    font-size: var(--chat-font-size, 17px);
    outline: none;
    resize: none;
    line-height: 1.3;
    height: var(--chat-main-input-height);
    min-height: var(--chat-main-input-height);
    max-height: none;
    box-sizing: border-box;
    transition: height 0.2s ease-out;
    will-change: height, scroll-position;
}

#send-btn {
    background-color: var(--user-msg-bg);
    color: var(--user-msg-text);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: var(--input-vertical-padding) 0;
    height: 32px;
    aspect-ratio: 3 / 2;
    margin-left: 4px;
    font-size: var(--chat-font-size, 17px);
    line-height: 1.3;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s linear, color 0.1s linear;
}

#send-btn.inactive {
    background-color: transparent;
    color: var(--input-action-color);
    cursor: default;
}

#send-btn.pending-ready {
    background-color: transparent;
    color: var(--input-action-color);
    cursor: pointer;
}

#send-btn:disabled {
    background-color: transparent !important;
    color: var(--input-action-color) !important;
    cursor: not-allowed;
}

#user-input.processing::placeholder {
    color: var(--border-color);
}

#sticker-toggle-btn,
#image-select-btn {
    flex-shrink: 0;
    padding: 5px;
    height: 38px;
    width: 38px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#sticker-toggle-btn,
#image-select-btn {
    --custom-icon-stroke-color: var(--input-action-color);
}

#image-select-btn .gallery-icon {
    transform: translateX(-3.5px);
}

.custom-icon {
    position: relative;
    box-sizing: border-box;
    width: 24px;
    height: 24px;
}

.smiley-icon {
    border: 1.5px solid var(--custom-icon-stroke-color);
    border-radius: 50%;
}

.smiley-icon .eye {
    position: absolute;
    width: 2.4px;
    height: 2.4px;
    background-color: var(--custom-icon-stroke-color);
    border-radius: 50%;
    top: 7.5px;
}

.smiley-icon .eye.left {
    left: 6.5px;
}

.smiley-icon .eye.right {
    right: 6.5px;
}

.smiley-icon .mouth {
    position: absolute;
    width: 12.8px;
    height: 11px;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    border: 1.5px solid transparent;
    border-bottom-color: var(--custom-icon-stroke-color);
    border-radius: 0 0 12.8px 12.8px;
}

.gallery-icon {
    border: 1.5px solid var(--custom-icon-stroke-color);
    border-radius: 4.7px;
    overflow: hidden;
}

.gallery-icon .sun {
    position: absolute;
    width: 5.1px;
    height: 5.1px;
    border: 1.5px solid var(--custom-icon-stroke-color);
    border-radius: 50%;
    top: 2.8px;
    left: 2.8px;
}

.gallery-icon .mountain-svg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.gallery-icon .mountain-svg svg path {
    stroke: var(--custom-icon-stroke-color);
    stroke-width: 5.2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#sticker-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 15px;
    max-height: 330px;
    overflow-y: auto;
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    background-color: var(--header-bg);
    backdrop-filter: blur(var(--backdrop-blur-amount));
    -webkit-backdrop-filter: blur(var(--backdrop-blur-amount));
    box-sizing: border-box;
    border-top: none;
    z-index: 2;
    will-change: backdrop-filter;
}

.sticker-preview-item {
    width: calc(20% - 8px);
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background-color: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    padding: 5px;
    box-sizing: border-box;
}

#image-preview-container {
    display: none;
    position: absolute;
    top: -65px;
    left: 15px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 5;
}

#image-preview-thumb {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
}

#remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background-color: #888;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid var(--bg-color);
}

.dialog-overlay,
.full-page-view {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--dialog-bg);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.full-page-view {
    background-color: var(--bg-color);
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    z-index: 1010;
    max-width: var(--max-container-width);
    left: 0;
    right: 0;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(8px + env(safe-area-inset-top)) 15px 8px 15px;
    background-color: var(--header-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-shrink: 0;
    height: 30px;
}

html[data-theme="dark"] .page-header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.page-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    flex-grow: 1;
    text-align: center;
    cursor: default;
}

#memory-settings-page .page-header h2 {
    flex-grow: 1;
    text-align: center;
}

.page-header .header-actions {
    display: flex;
    gap: 10px;
}

.page-header .close-btn,
.page-header .save-btn,
.page-header .action-btn,
.sticker-mapping-header .save-btn,
.settings-section-header .save-btn {
    font-size: 16px;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--button-bg);
    padding: 5px 10px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.page-header .close-btn {
    font-size: 24px;
    font-weight: 400;
    padding: 5px;
}

.page-content {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#settings-panel .page-content,
#appearance-settings-page .page-content,
#schedule-page .page-content,
#model-management-page .page-content,
#memory-settings-page .page-content,
#user-info-summary-page .page-content,
#sticker-settings-page .page-content,
#sticker-ratio-settings-page .page-content,
#more-settings-page .page-content,
#vision-model-editor-page .page-content,
#aux-model-editor-page .page-content,
#signature-settings-page .page-content,
#default-model-editor-page .page-content,
#web-search-model-editor-page .page-content,
#moments-settings-page .page-content,
#moments-interaction-settings-page .page-content,
#console-log-page .page-content {
    padding-left: 20px;
    padding-right: 20px;
}

#sticker-settings-page .page-content {
    overflow-x: hidden;
}

.dialog-box {
    background-color: var(--bg-color);
    padding: 25px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.dialog-box h2 {
    margin: 0 0 10px 0;
    text-align: center;
}

.dialog-box label {
    font-size: 14px;
    margin-bottom: -10px;
}

.dialog-box input,
.dialog-box textarea,
.dialog-box select,
.dialog-box-input,
.dialog-box-textarea,
.dialog-box-select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 17px;
    box-sizing: border-box;
}

.dialog-box textarea,
.dialog-box-textarea {
    resize: vertical;
    min-height: 120px;
}

.dialog-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.dialog-buttons button,
.settings-action-btn {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    cursor: pointer;
}

.settings-action-btn {
    background-color: #555;
    color: white;
    text-align: left;
}

.font-size-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

#font-size-slider {
    flex-grow: 1;
}

#font-size-value {
    font-size: 14px;
    min-width: 35px;
    text-align: right;
}

.confirm-box,
.edit-box,
#format-confirm-dialog .dialog-box,
#add-memory-dialog .dialog-box,
#text-edit-dialog .dialog-box {
    padding: 20px;
    max-width: 300px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#confirm-dialog {
    z-index: 1090;
}

#text-edit-dialog {
    z-index: 1080;
}

#format-confirm-dialog {
    z-index: 1090;
}

#action-dialog .dialog-box {
    background-color: var(--bg-color);
    padding: 0;
    gap: 0;
    max-width: 250px;
}

#action-buttons-container button {
    background-color: var(--dialog-content-bg);
}

.dialog-buttons-row {
    display: flex;
    gap: 10px;
    flex-direction: row;
}

.dialog-buttons-row button {
    flex-grow: 1;
    padding: 10px;
}

#add-memory-textarea {
    min-height: 180px;
}

#system-prompt-page textarea,
#import-settings-page textarea,
#import-sticker-config-page textarea,
#summary-prompt-page textarea,
#proactive-prompt-page textarea,
#schedule-prompt-page-textarea,
#todays-schedule-page-textarea,
#user-basic-info-page textarea,
#user-info-prompt-page textarea,
#web-search-prompt-page-textarea,
#web-search-result-page-textarea,
#pending-summary-page textarea,
#user-info-pending-summary-page textarea,
#moments-prompt-page textarea,
#moments-reply-prompt-page textarea,
#auto-moments-prompt-page textarea,
#npc-relationships-page textarea,
#signature-prompt-page textarea,
#implicit-prompt-page textarea,
#sticker-prompt-page-textarea {
    width: 100%;
    flex-grow: 1;
    box-sizing: border-box;
    resize: none;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-color);
    font-size: 17px;
    margin-top: -10px;
    padding-top: 0;
}

#memory-items-container,
#user-info-items-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#theme-presets-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.memory-item {
    background-color: var(--bg-color);
    padding: 12px 15px;
    border-radius: 10px;
    border: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 1.6;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.memory-item-content {
    flex-grow: 1;
}

.memory-delete-checkbox {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.sticker-delete-btn {
    background: none;
    border: none;
    color: var(--button-bg);
    font-size: 20px;
    font-weight: 400;
    padding: 0 0 0 10px;
    margin: 0;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#api-configs-list,
#model-profiles-list,
#aux-model-profiles-list,
#vision-model-profiles-list,
#web-search-model-profiles-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.model-profile-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
}

.model-profile-item.active {
    border-color: var(--button-bg);
    background-color: rgba(0, 122, 255, 0.1);
}

.model-profile-item span {
    flex-grow: 1;
}

.model-profile-item button {
    padding: 5px 10px;
    font-size: 14px;
    flex-shrink: 0;
}

.model-profile-item .edit-model-btn,
.model-profile-item .delete-model-btn,
.model-profile-item .edit-theme-btn,
.model-profile-item .delete-theme-btn {
    background: none;
    border: none;
    color: var(--button-bg);
    font-weight: normal;
    font-size: 16px;
}

.settings-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    margin-bottom: 5px;
}

.settings-section-header:first-of-type {
    margin-top: 0;
}

.settings-section-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

#action-dialog {
    z-index: 1040;
}

#action-buttons-container button {
    color: var(--button-bg);
    border: none;
    padding: 15px;
    width: 100%;
    text-align: center;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    border-top: 1px solid var(--border-color);
}

#action-buttons-container button:first-child {
    border-top: none;
}

#action-buttons-container button:hover {
    background-color: var(--bg-color);
}

.profile-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--avatar-corner-radius, 50%);
    cursor: pointer;
    flex-shrink: 0;
    object-fit: cover;
}

.setting-group {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-group-header label {
    font-weight: 500;
    margin-bottom: 0;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 38px;
}

.setting-row label {
    margin-bottom: 0;
}

/* .setting-row input[type="number"] 样式已统一到 .sys-number-input */

#settings-panel .setting-row label {
    font-size: 16px;
}

.settings-menu-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 16px;
}

.settings-menu-item:hover {
    background-color: var(--settings-item-hover-bg);
}

.settings-menu-item .profile-avatar {
    width: 40px;
    height: 40px;
}

.settings-menu-item>span {
    flex-grow: 1;
    margin-left: 15px;
}

#user-profile-setting,
#ai-profile-setting {
    border: none;
    cursor: default;
}

#user-profile-setting:hover,
#ai-profile-setting:hover {
    background-color: transparent;
}

#user-profile-setting .profile-avatar,
#user-profile-setting span,
#ai-profile-setting .profile-avatar,
#ai-profile-setting span {
    cursor: pointer;
}

.proactive-time-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* .proactive-time-inputs input 的 width: 100% 已移除，由 .sys-number-input 统一控制 */

.memory-stats-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.memory-stats {
    font-size: 14px;
    color: var(--time-divider-color);
    line-height: 1.5;
}

.switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 23px;
    width: 23px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #4CAF50;
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toast-notification.show {
    opacity: 1;
}

/* .memory-setting-number-input 和 .appearance-setting-number-input 已统一为 .sys-number-input */

#view-pending-summary-btn,
#view-user-info-pending-summary-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#pending-summary-stats,
#user-info-pending-summary-stats {
    font-size: 16px;
    color: var(--text-color);
    pointer-events: none;
}

#batch-delete-actions {
    display: none;
    flex-direction: row;
    gap: 10px;
}

.schedule-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 15px;
    background-color: var(--assistant-msg-bg);
}

.schedule-item h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 500;
}

.schedule-item textarea {
    width: 100%;
    min-height: 100px;
    box-sizing: border-box;
    resize: vertical;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-color);
    font-size: 15px;
    line-height: 1.5;
}

.color-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
}

.capacity-label {
    font-size: 14px;
    color: var(--time-divider-color);
}

.dialog-box .setting-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.dialog-box .setting-row:last-of-type {
    border-bottom: none;
}

.sticker-mapping-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.sticker-mapping-header h3 {
    margin: 0;
}

.sticker-grid-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 10px;
}

.sticker-grid-item {
    width: calc((100% - 40px) / 5);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.sticker-grid-item.dragging {
    opacity: 0.5;
}

.sticker-grid-item.drag-over {
    transform: scale(1.05);
}

.sticker-grid-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background-color: transparent;
    border: none;
    border-radius: 0;
    box-sizing: border-box;
}

.sticker-grid-name {
    width: 100%;
    padding: 4px 2px;
    font-size: 13px;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--text-color);
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    pointer-events: none;
}

.sticker-delete-overlay {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid white;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: transparent;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.sticker-delete-overlay.selected {
    background-color: #34C759;
    border-color: #34C759;
    color: white;
}

#sticker-ratio-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sticker-ratio-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sticker-ratio-preview {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--input-bg);
    flex-shrink: 0;
}

.sticker-ratio-name {
    flex-grow: 1;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticker-ratio-inputs {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.sticker-ratio-inputs input {
    width: 60px;
    padding: 8px 10px;
    font-size: 14px;
    text-align: center;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    box-sizing: border-box;
}

#moments-page {
    background-color: transparent;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    z-index: 1050;
}

#moments-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    max-width: var(--max-container-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 15px 0px 15px;
    padding-top: calc(3px + env(safe-area-inset-top));
    z-index: 1052;
    color: white;
    height: 44px;
    box-sizing: content-box;
    background-color: transparent;
}

#moments-top-bar .icon-btn .back-arrow-icon {
    stroke: #ffffff;
}

#moments-content {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
    background-color: var(--bg-color);
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

#moments-content:hover,
#moments-content:focus-within,
#moments-content:active {
    scrollbar-color: var(--chat-scrollbar-thumb-color) transparent;
}

#moments-content::-webkit-scrollbar {
    width: var(--chat-scrollbar-size);
}

#moments-content::-webkit-scrollbar-track {
    background: transparent;
}

#moments-content::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background-color 0.15s ease;
}

#moments-content:hover::-webkit-scrollbar-thumb,
#moments-content:focus-within::-webkit-scrollbar-thumb,
#moments-content:active::-webkit-scrollbar-thumb {
    background-color: var(--chat-scrollbar-thumb-color);
}

#moments-content::-webkit-scrollbar-corner {
    background: transparent;
}

#moments-header {
    position: relative;
    width: 100%;
    height: 300px;
    margin-bottom: 45px;
}

#moments-header-bg {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #444444;
}

#moments-header-info {
    position: absolute;
    bottom: -20px;
    right: 25px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.moments-header-main {
    display: flex;
    align-items: flex-end;
    gap: 15px;
}

#moments-ai-name {
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    margin-bottom: 5px;
    transform: translateY(2px);
}

.avatar-signature-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#moments-ai-avatar {
    width: 70px;
    height: 70px;
    border-radius: var(--moments-avatar-corner-radius, var(--avatar-corner-radius, 50%));
    border: none;
    object-fit: cover;
    transform: translateX(0) translateY(24px);
    cursor: pointer;
}

#moments-ai-signature {
    color: #6F6E6A;
    font-size: 14px;
    text-align: right;
    margin-top: 8px;
    transform: translateY(24px);
}

#moments-feed {
    padding: 23px 25px 15px 25px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    background-color: var(--bg-color);
}

.moment-item {
    display: flex;
    gap: 10px;
    padding-bottom: 20px;
    border-bottom: none;
    position: relative;
}

#moments-posts-list .moment-item:last-child {
    border-bottom: none;
}

.moment-avatar {
    width: var(--dynamic-avatar-size);
    height: var(--dynamic-avatar-size);
    border-radius: var(--avatar-corner-radius, 50%);
    flex-shrink: 0;
    object-fit: cover;
    cursor: pointer;
}

.moment-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.moment-poster-name {
    font-size: 17px;
    font-weight: var(--moment-poster-weight);
    color: #576B95;
    cursor: pointer;
}

.moment-text {
    font-size: 17px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    position: relative;
    bottom: 3px;
    color: #1A1A1A;
}

.moment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0;
    transform: translateY(-8px);
    margin-bottom: -5px;
}

.moment-timestamp {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--time-divider-color);
}

.moment-lock-indicator {
    position: relative;
    display: inline-block;
    width: 10px;
    height: 11px;
    color: var(--time-divider-color);
    flex-shrink: 0;
    vertical-align: middle;
}

.moment-lock-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 6.2px;
    height: 4.3px;
    border: 1.6px solid currentColor;
    border-bottom: none;
    border-radius: 3px 3px 0 0;
    box-sizing: border-box;
    transform: translateX(-50%);
}

.moment-lock-indicator::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 7.2px;
    height: 7.2px;
    border-radius: 2px;
    background:
        radial-gradient(circle at 50% 50%, var(--bg-color) 0 1px, transparent 1.12px),
        currentColor;
    transform: translateX(-50%);
}

.moment-actions-btn {
    background-color: var(--settings-item-hover-bg);
    border: none;
    border-radius: 4px;
    padding: 0 8px 1px;
    font-size: 16px;
    font-weight: bold;
    color: var(--time-divider-color);
    cursor: pointer;
}

.moment-likes-comments {
    background-color: var(--settings-item-hover-bg);
    border-radius: 4px;
    margin-top: 3px;
    font-size: 14px;
    overflow: hidden;
}

.moment-likes-comments>div {
    padding: 8px 10px;
}

.moment-likes {
    color: #576B95;
    font-weight: var(--moment-likes-weight);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    line-height: 1.4;
}

.moment-likes-comments>div:last-child {
    border-bottom: none;
}

.comment-item {
    margin-bottom: 7px;
    font-size: 15px;
    cursor: pointer;
    line-height: 1.4;
    color: #191919;
}

.comment-item:last-child {
    margin-bottom: 0;
}

.commenter-name {
    font-weight: var(--commenter-name-weight);
    color: #576B95;
}

html[data-theme="dark"] .moment-text {
    color: #D1D1D1;
}

html[data-theme="dark"] .comment-item {
    color: #A6A6A6;
}

html[data-theme="dark"] .moment-poster-name,
html[data-theme="dark"] .moment-likes,
html[data-theme="dark"] .commenter-name {
    color: #7991AB;
}

#moment-action-menu.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-100%) scale(1);
}

#moments-settings-page {
    z-index: 1060;
}

#moment-action-menu {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-100%) scale(0.95);
    transform-origin: top right;
    transition: transform 0.15s ease-out, opacity 0.15s ease-out;
    position: absolute;
    background-color: #4c4c4c;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1055;
    overflow: hidden;
    padding: 0 5px;
    display: flex;
}

#moment-action-menu button {
    background: none;
    border: none;
    color: white;
    padding: 8px 10px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
}

#moment-action-menu button:hover {
    background-color: #333;
}

#moment-action-menu button:not(:last-child) {
    border-right: 1px solid #666;
}

.moment-comment-input {
    flex-grow: 1;
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 15px;
    font-size: 15px;
    outline: none;
    resize: none;
    line-height: 1.3;
    max-height: 80px;
    box-sizing: border-box;
    min-height: 32px;
}

.moment-comment-send-btn {
    background-color: var(--user-msg-bg);
    color: var(--user-msg-text);
    border: none;
    border-radius: 8px;
    padding: 0 12px;
    height: 32px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
}

#global-comment-input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: var(--max-container-width);
    margin: 0 auto;
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 10px 15px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    background-color: var(--header-bg);
    backdrop-filter: blur(var(--backdrop-blur-amount));
    -webkit-backdrop-filter: blur(var(--backdrop-blur-amount));
    z-index: 1100;
    box-sizing: border-box;
    border-top: none;
}

#global-comment-input {
    flex-grow: 1;
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: var(--input-vertical-padding) 15px;
    font-size: 15px;
    outline: none;
    resize: none;
    line-height: 1.3;
    max-height: none;
    box-sizing: border-box;
    min-height: 32px;
    height: 32px;
    transition: height 0.2s ease-out;
    will-change: height, scroll-position;
}

#global-comment-send-btn {
    background-color: var(--user-msg-bg);
    color: var(--user-msg-text);
    border: none;
    border-radius: 8px;
    padding: 0 12px;
    height: 32px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
}

#moments-display-pics-container-wrapper {
    margin-bottom: 0px;
    padding-left: 48px;
    box-sizing: border-box;
}

#moments-display-pics-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#moments-display-pics-container::-webkit-scrollbar {
    display: none;
}

.moments-display-pic {
    width: calc((100% - 16px) / 3);
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    cursor: pointer;
}

.moments-display-pic[data-loading="true"] {
    background-color: var(--settings-item-hover-bg);
}

#moments-display-pics-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.display-pic-thumbnail-wrapper {
    position: relative;
    width: calc(33.333% - 7px);
    aspect-ratio: 1 / 1;
}

.display-pic-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.delete-display-pic-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid var(--bg-color);
}

.display-pic-thumbnail-wrapper.dragging {
    opacity: 0.5;
}

.model-name-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.model-name-container input {
    flex-grow: 1;
    min-width: 0;
}

.model-name-container .fetch-models-btn {
    background: none;
    border: none;
    color: var(--button-bg);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    padding: 5px;
    flex-shrink: 0;
}

#model-selection-page .page-content {
    padding: 15px 0;
}

#model-search-input {
    width: calc(100% - 40px);
    margin: 0 20px 15px 20px;
    padding: 10px 15px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    box-sizing: border-box;
}

.model-select-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.model-select-item:hover {
    background-color: var(--settings-item-hover-bg);
}

.model-select-item span {
    flex-grow: 1;
    pointer-events: none;
}

.add-favorite-btn,
.favorite-icon {
    background: none;
    border: none;
    color: var(--button-bg);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 15px;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    padding: 0;
}

.favorite-icon.saved {
    color: #34C759;
    font-size: 20px;
}

#image-lightbox-view {
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
}

#image-lightbox-img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
}

#image-lightbox-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.sys-dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.sys-dialog-box {
    background-color: var(--bg-color);
    border-radius: 15px;
    width: 80%;
    max-width: 400px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
}

.sys-dialog-title {
    margin: 0;
    text-align: center;
    font-size: 23px;
    font-weight: 500;
    color: var(--text-color);
}

.sys-dialog-label {
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: -10px;
}

.sys-dialog-input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: var(--chat-font-size, 17px);
    box-sizing: border-box;
    outline: none;
}

.sys-dialog-input:focus {
    border-color: var(--border-color);
}

.sys-dialog-textarea {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: var(--chat-font-size, 17px);
    box-sizing: border-box;
    outline: none;
    resize: vertical;
    min-height: calc(var(--chat-font-size, 17px) * 1.5 * 10 + 24px);
    line-height: 1.5;
}

.sys-dialog-textarea:focus {
    border-color: var(--border-color);
}

.sys-dialog-input-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.sys-dialog-input-row .sys-dialog-inputs-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
}

.sys-dialog-preview {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

#sticker-edit-dialog .sys-dialog-preview {
    width: 107px;
    height: 107px;
}

.sys-dialog-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sys-dialog-buttons {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-top: 5px;
    justify-content: center;
    align-items: center;
}

.sys-dialog-btn {
    background: transparent;
    border: none;
    font-size: var(--chat-font-size, 17px);
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    transition: opacity 0.15s ease;
    flex: 1;
    text-align: center;
}

.sys-dialog-btn:active {
    opacity: 0.6;
}

.sys-btn-cancel {
    color: var(--text-color);
}

.sys-btn-save {
    color: #007AFF;
}

.sys-btn-save-send {
    color: #007AFF;
}

.sys-btn-delete {
    color: #c93c3c;
}

.sys-btn-confirm-delete {
    color: #c93c3c;
}

.moment-delete-lock-warning {
    display: block;
    color: #c93c3c;
    font-weight: 600;
    margin-bottom: 6px;
}

.sys-dialog-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border-color);
    border-top-color: var(--button-bg);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============ 转账气泡样式 ============ */

.transfer-bubble {
    position: relative;
    background-color: #FA9D3B;
    border-radius: var(--bubble-corner-radius);
    color: #FFFFFF;
    cursor: pointer;
    margin-right: 7px;
    z-index: 1;
}

/* 深色模式下的转账气泡背景 */
html[data-theme="dark"] .transfer-bubble {
    background-color: #E18D35;
}

/* 转账气泡的小尾巴 - iMessage样式（头像在底部） */
body:not(.avatars-at-top) .user-wrapper .transfer-bubble::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: -10px;
    width: 10px;
    height: 20px;
    background-color: var(--bg-color);
    border-bottom-left-radius: 10px;
    z-index: 1;
}

body:not(.avatars-at-top) .user-wrapper .transfer-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -7px;
    width: 18px;
    height: 19px;
    background-color: #FA9D3B;
    border-bottom-left-radius: 15px;
    z-index: 0;
}

html[data-theme="dark"] body:not(.avatars-at-top) .user-wrapper .transfer-bubble::after {
    background-color: #E18D35;
}

body:not(.avatars-at-top) .assistant-wrapper .transfer-bubble::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -10px;
    width: 10px;
    height: 20px;
    background-color: var(--bg-color);
    border-bottom-right-radius: 10px;
    z-index: 1;
}

body:not(.avatars-at-top) .assistant-wrapper .transfer-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -7px;
    width: 18px;
    height: 19px;
    background-color: #FA9D3B;
    border-bottom-right-radius: 15px;
    z-index: 0;
}

html[data-theme="dark"] body:not(.avatars-at-top) .assistant-wrapper .transfer-bubble::after {
    background-color: #E18D35;
}

/* 转账气泡的小尾巴 - 微信样式（头像在顶部）- 沿用现有message-bubble样式 */
body.avatars-at-top .user-wrapper .transfer-bubble::before {
    content: '';
    position: absolute;
    top: calc(var(--bubble-vertical-padding) + (var(--chat-font-size, 17px) * 1.3 / 2) - 6px);
    right: -3px;
    width: 12px;
    height: 12px;
    background-color: #FA9D3B;
    transform: rotate(45deg) skew(-5deg, -5deg);
    border-top-right-radius: 1.5px;
    border: none;
    z-index: -1;
}

html[data-theme="dark"] body.avatars-at-top .user-wrapper .transfer-bubble::before {
    background-color: #E18D35;
}

body.avatars-at-top .user-wrapper .transfer-bubble::after {
    display: none;
}

body.avatars-at-top .assistant-wrapper .transfer-bubble::before {
    content: '';
    position: absolute;
    top: calc(var(--bubble-vertical-padding) + (var(--chat-font-size, 17px) * 1.3 / 2) - 6px);
    left: -3px;
    width: 12px;
    height: 12px;
    background-color: #FA9D3B;
    transform: rotate(45deg) skew(-5deg, -5deg);
    border-bottom-left-radius: 1.5px;
    border: none;
    z-index: -1;
}

html[data-theme="dark"] body.avatars-at-top .assistant-wrapper .transfer-bubble::before {
    background-color: #E18D35;
}

body.avatars-at-top .assistant-wrapper .transfer-bubble::after {
    display: none;
}

/* 隐藏小尾巴时 */
body.hide-bubble-tails .transfer-bubble::before,
body.hide-bubble-tails .transfer-bubble::after {
    display: none;
}

/* AI发送的转账气泡位置调整 */
.assistant-wrapper .transfer-bubble {
    margin-left: 7px;
    margin-right: 0;
}

/* 转账图标 - 圆形容器 */
.transfer-icon {
    position: absolute;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.transfer-icon svg {
    width: 75%;
    height: 75%;
}

/* 转账金额 */
.transfer-amount {
    position: absolute;
    color: #FFFFFF;
    font-weight: bold;
    line-height: 1.3;
    white-space: nowrap;
}

/* 转账备注 */
.transfer-remark {
    position: absolute;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

/* 分割线 */
.transfer-divider {
    position: absolute;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.3);
}

/* 底部"转账"文字 */
.transfer-footer {
    position: absolute;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.3;
    white-space: nowrap;
}

/* ============ 已接收状态的转账气泡样式 ============ */

/* 浅色模式下已接收的转账气泡 */
.transfer-bubble.transfer-received {
    background-color: #FDE1C3;
}

/* 深色模式下已接收的转账气泡 */
html[data-theme="dark"] .transfer-bubble.transfer-received {
    background-color: #AF6E29;
}

/* 已接收状态的小尾巴颜色 - iMessage样式 */
body:not(.avatars-at-top) .user-wrapper .transfer-bubble.transfer-received::after {
    background-color: #FDE1C3;
}

html[data-theme="dark"] body:not(.avatars-at-top) .user-wrapper .transfer-bubble.transfer-received::after {
    background-color: #AF6E29;
}

body:not(.avatars-at-top) .assistant-wrapper .transfer-bubble.transfer-received::after {
    background-color: #FDE1C3;
}

html[data-theme="dark"] body:not(.avatars-at-top) .assistant-wrapper .transfer-bubble.transfer-received::after {
    background-color: #AF6E29;
}

/* 已接收状态的小尾巴颜色 - 微信样式 */
body.avatars-at-top .user-wrapper .transfer-bubble.transfer-received::before {
    background-color: #FDE1C3;
}

html[data-theme="dark"] body.avatars-at-top .user-wrapper .transfer-bubble.transfer-received::before {
    background-color: #AF6E29;
}

body.avatars-at-top .assistant-wrapper .transfer-bubble.transfer-received::before {
    background-color: #FDE1C3;
}

html[data-theme="dark"] body.avatars-at-top .assistant-wrapper .transfer-bubble.transfer-received::before {
    background-color: #AF6E29;
}

/* ============ 转账气泡样式结束 ============ */

/* ============ 系统级别无边框按钮样式 ============ */

/*
 * 第一种：sys-btn-simple（简单按钮）
 * 适用于：无边框、无内部子按钮的简单按钮
 * 使用场景：设置界面的10个按钮、主题设置的14个按钮
 * 使用方法：在HTML中添加 class="settings-menu-item sys-btn-simple"
 */
.sys-btn-simple {
    border: none;
}

.sys-btn-simple > span {
    margin-left: 0;
}

/*
 * 第二种：sys-btn-compound（复合按钮）
 * 适用于：无边框、内部有编辑/删除等子按钮的复合按钮
 * 使用场景：主题预设列表、模型配置列表、已保存模型列表
 * 使用方法：在JS中生成按钮时添加 class="model-profile-item sys-btn-compound"
 */
.sys-btn-compound {
    border: none;
    padding: 8px 15px;  /* 减少上下padding以补偿内部按钮高度 */
}

/* ============ 系统级别无边框按钮样式结束 ============ */

/* ============ 系统级别数值输入框样式 ============ */

/*
 * .sys-number-input（系统级别数值输入框）
 * 适用于：所有需要填写纯数值的输入框
 * 规格：38x38px正方形，15px圆角
 * 使用方法：在HTML中添加 class="sys-number-input"
 */
.sys-number-input {
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 15px;
    text-align: center;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--text-color);
    box-sizing: border-box;
    -moz-appearance: textfield;
    appearance: textfield;
}

.sys-number-input::-webkit-outer-spin-button,
.sys-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* ============ 系统级别数值输入框样式结束 ============ */

/* ============ 表情包本地导入按钮样式 ============ */

.sticker-url-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.sticker-url-input-wrapper .sys-dialog-input {
    flex: 1;
    min-width: 0;
}

.sticker-local-import-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: var(--chat-font-size, 17px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    outline: none;
}

.sticker-local-import-btn:focus {
    border-color: var(--border-color);
}

/* ============ 表情包本地导入按钮样式结束 ============ */

/* ============ 朋友圈背景图上传按钮样式 ============ */

.moments-bg-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.moments-bg-input-wrapper .sys-dialog-input {
    flex: 1;
    min-width: 0;
}

.moments-bg-upload-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: var(--chat-font-size, 17px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    outline: none;
}

.moments-bg-upload-btn:focus {
    border-color: var(--border-color);
}

/* ============ 朋友圈背景图上传按钮样式结束 ============ */

/* ============ 控制台日志界面样式 ============ */

#console-log-page {
    z-index: 1020;
}

#console-log-page .page-header h2 {
    flex-grow: 0;
}

.console-log-content {
    padding: 0 !important;
    gap: 0 !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
}

.console-log-item {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 4px 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-all;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.console-log-time {
    color: var(--time-divider-color);
    font-size: 12px;
    margin-right: 8px;
    flex-shrink: 0;
    line-height: 1.5;
    padding-top: 2px;
}

.console-log-level {
    font-size: 12px;
    margin-right: 8px;
    flex-shrink: 0;
    font-weight: 600;
    line-height: 1.5;
    padding-top: 2px;
}

.console-log-message {
    flex: 1;
    min-width: 0;
    word-break: break-all;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

/* ============ 控制台日志界面样式结束 ============ */
